forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitcd142e0

Amit Kapila
Make pg_replication_origin_drop safe against concurrent drops.
Currently, we get the origin id from the name and then drop the origin bytaking ExclusiveLock on ReplicationOriginRelationId. So, two concurrentsessions can get the id from the name at the same time and then when theytry to drop the origin, one of the sessions will get the either"tuple concurrently deleted" or "cache lookup failed for replicationorigin ..".To prevent this race condition we do the entire operation under lock. Thisobviates the need for replorigin_drop() API and we have removed it so ifany extension authors are using it they need to instead usereplorigin_drop_by_name. See it's usage in pg_replication_origin_drop().Author: Peter SmithReviewed-by: Amit Kapila, Euler Taveira, Petr Jelinek, and AlvaroHerreraDiscussion:https://www.postgresql.org/message-id/CAHut%2BPuW8DWV5fskkMWWMqzt-x7RPcNQOtJQBp6SdwyRghCk7A%40mail.gmail.com1 parent31c7fb4 commitcd142e0
File tree
3 files changed
+38
-28
lines changed- src
- backend
- commands
- replication/logical
- include/replication
3 files changed
+38
-28
lines changedLines changed: 1 addition & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
926 | 926 |
| |
927 | 927 |
| |
928 | 928 |
| |
929 |
| - | |
930 | 929 |
| |
931 | 930 |
| |
932 | 931 |
| |
| |||
1050 | 1049 |
| |
1051 | 1050 |
| |
1052 | 1051 |
| |
1053 |
| - | |
1054 |
| - | |
1055 |
| - | |
| 1052 | + | |
1056 | 1053 |
| |
1057 | 1054 |
| |
1058 | 1055 |
| |
|
Lines changed: 36 additions & 23 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
322 | 322 |
| |
323 | 323 |
| |
324 | 324 |
| |
325 |
| - | |
326 | 325 |
| |
327 |
| - | |
328 |
| - | |
329 |
| - | |
| 326 | + | |
330 | 327 |
| |
331 |
| - | |
332 |
| - | |
| 328 | + | |
| 329 | + | |
333 | 330 |
| |
334 | 331 |
| |
335 |
| - | |
336 | 332 |
| |
337 | 333 |
| |
338 |
| - | |
339 |
| - | |
340 |
| - | |
341 |
| - | |
342 |
| - | |
343 |
| - | |
344 |
| - | |
345 |
| - | |
346 | 334 |
| |
347 | 335 |
| |
348 | 336 |
| |
| |||
415 | 403 |
| |
416 | 404 |
| |
417 | 405 |
| |
418 |
| - | |
419 |
| - | |
420 |
| - | |
421 | 406 |
| |
422 | 407 |
| |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
423 | 440 |
| |
424 | 441 |
| |
425 | 442 |
| |
| |||
1256 | 1273 |
| |
1257 | 1274 |
| |
1258 | 1275 |
| |
1259 |
| - | |
1260 | 1276 |
| |
1261 | 1277 |
| |
1262 | 1278 |
| |
1263 | 1279 |
| |
1264 | 1280 |
| |
1265 |
| - | |
1266 |
| - | |
1267 |
| - | |
1268 |
| - | |
| 1281 | + | |
1269 | 1282 |
| |
1270 | 1283 |
| |
1271 | 1284 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
40 | 40 |
| |
41 | 41 |
| |
42 | 42 |
| |
43 |
| - | |
| 43 | + | |
44 | 44 |
| |
45 | 45 |
| |
46 | 46 |
| |
|
0 commit comments
Comments
(0)