forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit6c06fdd
Make the tablesync worker's replication origin drop logic robust.
In commitf6c5edb, we started to drop the replication origin slotsbefore tablesync worker exits to avoid consuming more slots than required.We were dropping the replication origin in the same transaction where wewere marking the tablesync state as SYNCDONE. Now, if there is any errorafter we have dropped the origin but before we commit the containingtransaction, the in-memory state of replication progress won't be rolledback. Due to this, after the restart, tablesync worker can start streamingfrom the wrong location and can apply the already processed transaction.To fix this, we need to opportunistically drop the origin after markingthe tablesync state as SYNCDONE. Even, if the tablesync worker fails toremove the replication origin before exit, the apply worker ensures toclean it up afterward.Reported by Tom Lane as per buildfarm.Diagnosed-by: Masahiko SawadaAuthor: Hou ZhijieReviewed-By: Masahiko Sawada, Amit KapilaDiscussion:https://postgr.es/m/20220714115155.GA5439@depesz.comDiscussion:https://postgr.es/m/CAD21AoAw0Oofi4kiDpJBOwpYyBBBkJj=sLUOn4Gd2GjUAKG-fw@mail.gmail.com1 parentca62947 commit6c06fdd
File tree
2 files changed
+75
-41
lines changed- src/backend
- commands
- replication/logical
2 files changed
+75
-41
lines changedLines changed: 11 additions & 14 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
931 | 931 |
| |
932 | 932 |
| |
933 | 933 |
| |
934 |
| - | |
935 |
| - | |
| 934 | + | |
| 935 | + | |
936 | 936 |
| |
937 |
| - | |
| 937 | + | |
938 | 938 |
| |
939 | 939 |
| |
940 | 940 |
| |
941 | 941 |
| |
942 | 942 |
| |
943 | 943 |
| |
944 | 944 |
| |
945 |
| - | |
946 |
| - | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
947 | 950 |
| |
948 | 951 |
| |
949 | 952 |
| |
| |||
1516 | 1519 |
| |
1517 | 1520 |
| |
1518 | 1521 |
| |
1519 |
| - | |
1520 |
| - | |
1521 |
| - | |
1522 | 1522 |
| |
1523 | 1523 |
| |
1524 | 1524 |
| |
1525 | 1525 |
| |
1526 |
| - | |
1527 |
| - | |
1528 |
| - | |
1529 |
| - | |
1530 |
| - | |
1531 |
| - | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
1532 | 1529 |
| |
1533 | 1530 |
| |
1534 | 1531 |
| |
|
Lines changed: 64 additions & 27 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
300 | 300 |
| |
301 | 301 |
| |
302 | 302 |
| |
303 |
| - | |
304 | 303 |
| |
305 | 304 |
| |
306 | 305 |
| |
| |||
310 | 309 |
| |
311 | 310 |
| |
312 | 311 |
| |
313 |
| - | |
314 |
| - | |
315 |
| - | |
316 |
| - | |
317 |
| - | |
318 |
| - | |
319 |
| - | |
320 |
| - | |
321 |
| - | |
322 |
| - | |
323 |
| - | |
324 |
| - | |
325 |
| - | |
326 |
| - | |
327 |
| - | |
328 |
| - | |
329 |
| - | |
330 |
| - | |
331 |
| - | |
332 |
| - | |
333 |
| - | |
334 |
| - | |
335 |
| - | |
336 |
| - | |
337 | 312 |
| |
338 | 313 |
| |
339 | 314 |
| |
| |||
343 | 318 |
| |
344 | 319 |
| |
345 | 320 |
| |
346 |
| - | |
| 321 | + | |
347 | 322 |
| |
348 | 323 |
| |
349 | 324 |
| |
| |||
359 | 334 |
| |
360 | 335 |
| |
361 | 336 |
| |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
362 | 380 |
| |
363 | 381 |
| |
364 | 382 |
| |
| |||
466 | 484 |
| |
467 | 485 |
| |
468 | 486 |
| |
| 487 | + | |
| 488 | + | |
469 | 489 |
| |
470 | 490 |
| |
471 | 491 |
| |
| |||
475 | 495 |
| |
476 | 496 |
| |
477 | 497 |
| |
478 |
| - | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
479 | 516 |
| |
480 | 517 |
| |
481 | 518 |
| |
|
0 commit comments
Comments
(0)