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

Amit Kapila
Invalidate inactive replication slots.
This commit introduces idle_replication_slot_timeout GUC that allowsinactive slots to be invalidated at the time of checkpoint. Becausecheckpoints happen checkpoint_timeout intervals, there can be some lagbetween when the idle_replication_slot_timeout was exceeded and when theslot invalidation is triggered at the next checkpoint. To avoid such lags,users can force a checkpoint to promptly invalidate inactive slots.Note that the idle timeout invalidation mechanism is not applicable forslots that do not reserve WAL or for slots on the standby server that aresynced from the primary server (i.e., standby slots having 'synced' field'true'). Synced slots are always considered to be inactive because theydon't perform logical decoding to produce changes.The slots can become inactive for a long period if a subscriber is downdue to a system error or inaccessible because of network issues. If such asituation persists, it might be more practical to recreate the subscriberrather than attempt to recover the node and wait for it to catch up whichcould be time-consuming.Then, external tools could create replication slots (e.g., for migrationsor upgrades) that may fail to remove them if an error occurs, leavingbehind unused slots that take up space and resources. Manually cleaningthem up can be tedious and error-prone, and without intervention, theselingering slots can cause unnecessary WAL retention and system bloat.As the duration of idle_replication_slot_timeout is in minutes, any testusing that would be time-consuming. We are planning to commit a follow uppatch for tests by using the injection point framework.Author: Nisha Moond <nisha.moond412@gmail.com>Author: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>Reviewed-by: Peter Smith <smithpb2250@gmail.com>Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>Reviewed-by: Vignesh C <vignesh21@gmail.com>Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>Reviewed-by: Hou Zhijie <houzj.fnst@fujitsu.com>Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>Discussion:https://postgr.es/m/CALj2ACW4aUe-_uFQOjdWCEN-xXoLGhmvRFnL8SNw_TZ5nJe+aw@mail.gmail.comDiscussion:https://postgr.es/m/OS0PR01MB5716C131A7D80DAE8CB9E88794FC2@OS0PR01MB5716.jpnprd01.prod.outlook.com1 parentb464e51 commitac0e331
File tree
15 files changed
+367
-86
lines changed- doc/src/sgml
- src
- backend
- access/transam
- replication
- utils
- adt
- misc
- bin
- pg_basebackup
- pg_upgrade
- include
- replication
- utils
- tools/pgindent
15 files changed
+367
-86
lines changedLines changed: 40 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4429 | 4429 |
| |
4430 | 4430 |
| |
4431 | 4431 |
| |
| 4432 | + | |
| 4433 | + | |
| 4434 | + | |
| 4435 | + | |
| 4436 | + | |
| 4437 | + | |
| 4438 | + | |
| 4439 | + | |
| 4440 | + | |
| 4441 | + | |
| 4442 | + | |
| 4443 | + | |
| 4444 | + | |
| 4445 | + | |
| 4446 | + | |
| 4447 | + | |
| 4448 | + | |
| 4449 | + | |
| 4450 | + | |
| 4451 | + | |
| 4452 | + | |
| 4453 | + | |
| 4454 | + | |
| 4455 | + | |
| 4456 | + | |
| 4457 | + | |
| 4458 | + | |
| 4459 | + | |
| 4460 | + | |
| 4461 | + | |
| 4462 | + | |
| 4463 | + | |
| 4464 | + | |
| 4465 | + | |
| 4466 | + | |
| 4467 | + | |
| 4468 | + | |
| 4469 | + | |
| 4470 | + | |
| 4471 | + | |
4432 | 4472 |
| |
4433 | 4473 |
| |
4434 | 4474 |
| |
|
Lines changed: 5 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2390 | 2390 |
| |
2391 | 2391 |
| |
2392 | 2392 |
| |
| 2393 | + | |
| 2394 | + | |
| 2395 | + | |
| 2396 | + | |
| 2397 | + | |
2393 | 2398 |
| |
2394 | 2399 |
| |
2395 | 2400 |
| |
|
Lines changed: 7 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2619 | 2619 |
| |
2620 | 2620 |
| |
2621 | 2621 |
| |
| 2622 | + | |
| 2623 | + | |
| 2624 | + | |
| 2625 | + | |
| 2626 | + | |
| 2627 | + | |
| 2628 | + | |
2622 | 2629 |
| |
2623 | 2630 |
| |
2624 | 2631 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7337 | 7337 |
| |
7338 | 7338 |
| |
7339 | 7339 |
| |
7340 |
| - | |
| 7340 | + | |
7341 | 7341 |
| |
7342 | 7342 |
| |
7343 | 7343 |
| |
| |||
7792 | 7792 |
| |
7793 | 7793 |
| |
7794 | 7794 |
| |
7795 |
| - | |
| 7795 | + | |
7796 | 7796 |
| |
7797 | 7797 |
| |
7798 | 7798 |
| |
|
0 commit comments
Comments
(0)