forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitc91f71b
committed
Fix publish_as_relid with multiple publications
Commit83fd453 allowed publishing of changes via ancestors, forpublications defined with publish_via_partition_root. But the waythe ancestor was determined in get_rel_sync_entry() was incorrect,simply updating the same variable. So with multiple publications,replicating different ancestors, the outcome depended on the orderof publications in the list - the value from the last loop was used,even if it wasn't the top-most ancestor.This is a probably rare situation, as in most cases publications donot overlap, so each partition has exactly one candidate ancestorto replicate as and there's no ambiguity.Fixed by tracking the "ancestor level" for each publication, andpicking the top-most ancestor. Adds a test case, verifying thecorrect ancestor is used for publishing the changes and that thisdoes not depend on order of publications in the list.Older releases have another bug in this loop - once all actions arereplicated, the loop is terminated, on the assumption that inspectingadditional publications is unecessary. But that misses the fact thatthose additional applications may replicate different ancestors.Fixed by removal of this break condition. We might still terminate theloop in some cases (e.g. when replicating all actions and the ancestoris the partition root).Backpatch to 13, where publish_via_partition_root was introduced.Initial report and fix by me, test added by Hou zj. Reviews andimprovements by Amit Kapila.Author: Tomas Vondra, Hou zj, Amit KapilaReviewed-by: Amit Kapila, Hou zjDiscussion:https://postgr.es/m/d26d24dd-2fab-3c48-0162-2b7f84a9c893%40enterprisedb.com1 parentd0083c1 commitc91f71b
File tree
5 files changed
+133
-9
lines changed- src
- backend
- catalog
- commands
- replication/pgoutput
- include/catalog
- test/subscription/t
5 files changed
+133
-9
lines changedLines changed: 19 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
277 | 277 |
| |
278 | 278 |
| |
279 | 279 |
| |
280 |
| - | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
281 | 285 |
| |
282 | 286 |
| |
283 | 287 |
| |
284 | 288 |
| |
285 | 289 |
| |
286 |
| - | |
| 290 | + | |
287 | 291 |
| |
288 | 292 |
| |
289 | 293 |
| |
| 294 | + | |
290 | 295 |
| |
291 | 296 |
| |
292 | 297 |
| |
| |||
297 | 302 |
| |
298 | 303 |
| |
299 | 304 |
| |
| 305 | + | |
| 306 | + | |
300 | 307 |
| |
| 308 | + | |
301 | 309 |
| |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
302 | 314 |
| |
303 | 315 |
| |
304 | 316 |
| |
305 | 317 |
| |
| 318 | + | |
306 | 319 |
| |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
307 | 324 |
| |
308 | 325 |
| |
309 | 326 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
323 | 323 |
| |
324 | 324 |
| |
325 | 325 |
| |
326 |
| - | |
| 326 | + | |
| 327 | + | |
327 | 328 |
| |
328 | 329 |
| |
329 | 330 |
| |
|
Lines changed: 40 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1748 | 1748 |
| |
1749 | 1749 |
| |
1750 | 1750 |
| |
| 1751 | + | |
1751 | 1752 |
| |
1752 | 1753 |
| |
1753 | 1754 |
| |
| |||
1815 | 1816 |
| |
1816 | 1817 |
| |
1817 | 1818 |
| |
| 1819 | + | |
| 1820 | + | |
| 1821 | + | |
| 1822 | + | |
| 1823 | + | |
| 1824 | + | |
| 1825 | + | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
1818 | 1831 |
| |
1819 | 1832 |
| |
1820 | 1833 |
| |
1821 | 1834 |
| |
1822 |
| - | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
| 1840 | + | |
1823 | 1841 |
| |
1824 | 1842 |
| |
1825 | 1843 |
| |
| |||
1835 | 1853 |
| |
1836 | 1854 |
| |
1837 | 1855 |
| |
| 1856 | + | |
1838 | 1857 |
| |
1839 | 1858 |
| |
1840 | 1859 |
| |
1841 |
| - | |
| 1860 | + | |
| 1861 | + | |
1842 | 1862 |
| |
1843 | 1863 |
| |
1844 | 1864 |
| |
1845 | 1865 |
| |
1846 | 1866 |
| |
1847 |
| - | |
| 1867 | + | |
| 1868 | + | |
| 1869 | + | |
| 1870 | + | |
1848 | 1871 |
| |
1849 | 1872 |
| |
1850 | 1873 |
| |
| |||
1868 | 1891 |
| |
1869 | 1892 |
| |
1870 | 1893 |
| |
| 1894 | + | |
| 1895 | + | |
| 1896 | + | |
| 1897 | + | |
| 1898 | + | |
| 1899 | + | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
| 1903 | + | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
1871 | 1908 |
| |
1872 | 1909 |
| |
1873 | 1910 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
134 | 134 |
| |
135 | 135 |
| |
136 | 136 |
| |
137 |
| - | |
| 137 | + | |
| 138 | + | |
138 | 139 |
| |
139 | 140 |
| |
140 | 141 |
| |
|
Lines changed: 70 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
409 | 409 |
| |
410 | 410 |
| |
411 | 411 |
| |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
412 | 420 |
| |
413 | 421 |
| |
414 | 422 |
| |
| |||
419 | 427 |
| |
420 | 428 |
| |
421 | 429 |
| |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
422 | 435 |
| |
423 | 436 |
| |
424 | 437 |
| |
| |||
462 | 475 |
| |
463 | 476 |
| |
464 | 477 |
| |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
465 | 487 |
| |
466 |
| - | |
| 488 | + | |
| 489 | + | |
467 | 490 |
| |
468 |
| - | |
| 491 | + | |
469 | 492 |
| |
470 | 493 |
| |
471 | 494 |
| |
| |||
487 | 510 |
| |
488 | 511 |
| |
489 | 512 |
| |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
490 | 518 |
| |
491 | 519 |
| |
492 | 520 |
| |
| |||
525 | 553 |
| |
526 | 554 |
| |
527 | 555 |
| |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
528 | 596 |
| |
529 | 597 |
| |
530 | 598 |
| |
|
0 commit comments
Comments
(0)