forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitb36fbd9
committed
Improve consistency of replication slot statistics
The replication slot stats stored in shared memory rely on an internalindex number. Both pgstat_reset_replslot() and pgstat_fetch_replslot()lacked some LWLock protections with ReplicationSlotControlLock whileoperating on these index numbers. This issue could cause these twofunctions to potentially operate on incorrect slots when taken inisolation in the event of slots dropped and/or re-created concurrently.Note that pg_stat_get_replication_slot() is called once per slot whenquerying pg_stat_replication_slots, meaning that the stats are retrievedacross multiple ReplicationSlotControlLock acquisitions. So, while thiscommit improves more consistency, it may still be possible thatstatistics are not completely consistent for a single scan ofpg_stat_replication_slots under concurrent replication slot drop orcreation activity.The issue should unlikely be a problem in practice, causing the reportof inconsistent stats or or the stats reset of an incorrect slot, so nobackpatch is done.Author: Bertrand DrouvotReviewed-by: Heikki Linnakangas, Shveta Malik, Michael PaquierDiscussion:https://postgr.es/m/ZeGq1HDWFfLkjh4o@ip-10-97-1-34.eu-west-3.compute.internal1 parentf500ba0 commitb36fbd9
1 file changed
+25
-17
lines changedLines changed: 25 additions & 17 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
29 | 29 |
| |
30 | 30 |
| |
31 | 31 |
| |
32 |
| - | |
| 32 | + | |
33 | 33 |
| |
34 | 34 |
| |
35 | 35 |
| |
| |||
45 | 45 |
| |
46 | 46 |
| |
47 | 47 |
| |
| 48 | + | |
| 49 | + | |
48 | 50 |
| |
49 |
| - | |
| 51 | + | |
50 | 52 |
| |
51 | 53 |
| |
52 | 54 |
| |
| |||
55 | 57 |
| |
56 | 58 |
| |
57 | 59 |
| |
58 |
| - | |
59 |
| - | |
| 60 | + | |
| 61 | + | |
60 | 62 |
| |
61 |
| - | |
62 |
| - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
63 | 66 |
| |
64 |
| - | |
65 |
| - | |
66 |
| - | |
| 67 | + | |
67 | 68 |
| |
68 | 69 |
| |
69 | 70 |
| |
| |||
163 | 164 |
| |
164 | 165 |
| |
165 | 166 |
| |
166 |
| - | |
| 167 | + | |
| 168 | + | |
167 | 169 |
| |
168 |
| - | |
169 |
| - | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
170 | 179 |
| |
171 |
| - | |
172 |
| - | |
| 180 | + | |
173 | 181 |
| |
174 | 182 |
| |
175 | 183 |
| |
| |||
188 | 196 |
| |
189 | 197 |
| |
190 | 198 |
| |
191 |
| - | |
| 199 | + | |
192 | 200 |
| |
193 | 201 |
| |
194 | 202 |
| |
| |||
208 | 216 |
| |
209 | 217 |
| |
210 | 218 |
| |
211 |
| - | |
| 219 | + | |
212 | 220 |
| |
213 | 221 |
| |
214 | 222 |
| |
215 | 223 |
| |
216 | 224 |
| |
217 |
| - | |
| 225 | + | |
218 | 226 |
| |
219 | 227 |
| |
220 | 228 |
| |
|
0 commit comments
Comments
(0)