- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit9a17be1

Amit Kapila
Allow upgrades to preserve the full subscription's state.
This feature will allow us to replicate the changes on subscriber nodesafter the upgrade.Previously, only the subscription metadata information was preserved.Without the list of relations and their state, it's not possible tore-enable the subscriptions without missing some records as the list ofrelations can only be refreshed after enabling the subscription (andtherefore starting the apply worker). Even if we added a way to refreshthe subscription while enabling a publication, we still wouldn't knowwhich relations are new on the publication side, and therefore should befully synced, and which shouldn't.To preserve the subscription relations, this patch teaches pg_dump torestore the content of pg_subscription_rel from the old cluster by usingbinary_upgrade_add_sub_rel_state SQL function. This is supported onlyin binary upgrade mode.The subscription's replication origin is needed to ensure that we don'treplicate anything twice.To preserve the replication origins, this patch teaches pg_dump to updatethe replication origin along with creating a subscription by usingbinary_upgrade_replorigin_advance SQL function to restore theunderlying replication origin remote LSN. This is supported only inbinary upgrade mode.pg_upgrade will check that all the subscription relations are in 'i'(init) or in 'r' (ready) state and will error out if that's not the case,logging the reason for the failure. This helps to avoid the risk of anydangling slot or origin after the upgrade.Author: Vignesh C, Julien Rouhaud, Shlok KyalReviewed-by: Peter Smith, Masahiko Sawada, Michael Paquier, Amit Kapila, Hayato KurodaDiscussion:https://postgr.es/m/20230217075433.u5mjly4d5cr4hcfe@jrouhaud1 parentcea89c9 commit9a17be1
File tree
17 files changed
+1032
-16
lines changed- doc/src/sgml/ref
- src
- backend
- catalog
- commands
- utils/adt
- bin
- pg_dump
- pg_upgrade
- t
- include/catalog
- tools/pgindent
17 files changed
+1032
-16
lines changedLines changed: 50 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
456 | 456 |
| |
457 | 457 |
| |
458 | 458 |
| |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
459 | 509 |
| |
460 | 510 |
| |
461 | 511 |
| |
|
Lines changed: 14 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
228 | 228 |
| |
229 | 229 |
| |
230 | 230 |
| |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
231 | 235 |
| |
232 | 236 |
| |
233 | 237 |
| |
234 |
| - | |
| 238 | + | |
235 | 239 |
| |
236 | 240 |
| |
237 | 241 |
| |
| |||
269 | 273 |
| |
270 | 274 |
| |
271 | 275 |
| |
272 |
| - | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
273 | 285 |
| |
274 | 286 |
| |
275 | 287 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
773 | 773 |
| |
774 | 774 |
| |
775 | 775 |
| |
776 |
| - | |
| 776 | + | |
777 | 777 |
| |
778 | 778 |
| |
779 | 779 |
| |
| |||
943 | 943 |
| |
944 | 944 |
| |
945 | 945 |
| |
946 |
| - | |
| 946 | + | |
947 | 947 |
| |
948 | 948 |
| |
949 | 949 |
| |
|
Lines changed: 106 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
11 | 11 |
| |
12 | 12 |
| |
13 | 13 |
| |
| 14 | + | |
| 15 | + | |
14 | 16 |
| |
15 | 17 |
| |
16 | 18 |
| |
| 19 | + | |
17 | 20 |
| |
18 | 21 |
| |
19 | 22 |
| |
20 | 23 |
| |
| 24 | + | |
| 25 | + | |
| 26 | + | |
21 | 27 |
| |
22 | 28 |
| |
| 29 | + | |
| 30 | + | |
| 31 | + | |
23 | 32 |
| |
24 | 33 |
| |
25 | 34 |
| |
| |||
305 | 314 |
| |
306 | 315 |
| |
307 | 316 |
| |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 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 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + |
Lines changed: 22 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
24 | 24 |
| |
25 | 25 |
| |
26 | 26 |
| |
| 27 | + | |
27 | 28 |
| |
28 | 29 |
| |
29 | 30 |
| |
| |||
265 | 266 |
| |
266 | 267 |
| |
267 | 268 |
| |
| 269 | + | |
| 270 | + | |
| 271 | + | |
268 | 272 |
| |
269 | 273 |
| |
270 | 274 |
| |
| |||
978 | 982 |
| |
979 | 983 |
| |
980 | 984 |
| |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
981 | 1003 |
| |
982 | 1004 |
| |
983 | 1005 |
| |
|
0 commit comments
Comments
(0)