[PATCH] Support automatic sequence replication
| От | Ajin Cherian |
|---|---|
| Тема | [PATCH] Support automatic sequence replication |
| Дата | |
| Msg-id | CAFPTHDZXX9WQ_X1ZfEvS248T+pKuk6SmCnXcvgPM059N1xPUfA@mail.gmail.com обсуждение исходный текст |
| Ответы |
Re: [PATCH] Support automatic sequence replication
|
| Список | pgsql-hackers |
Hello hackers, I'd like to propose an improvement to the sequence replication feature that was committed in [1]. The current implementation synchronizes sequences during initial subscription setup, but the sequence sync worker exits after this initial sync. This means that as sequences advance on the publisher, they drift from the subscriber values over time. Users must manually run ALTER SUBSCRIPTION ... REFRESH SEQUENCES to resynchronize, which requires monitoring and intervention. Proposed Enhancement: This patch changes the sequence sync worker to run continuously throughout the subscription lifetime, automatically detecting and correcting sequence drift. The key changes are: 1. The sequence sync worker remains running instead of exiting after initial sync, periodically checking for and synchronizing drifted sequences. 2. The worker uses an exponential backoff strategy - starting at 2 seconds, doubling up to a maximum of 30 seconds when sequences are in sync, and resetting to the minimum interval when drift is detected. 3. Since synchronization is now automatic, ALTER SUBSCRIPTION ... REFRESH SEQUENCES is no longer needed and has been removed. The patch modifies documentation to reflect the new behavior, removes the REFRESH SEQUENCES command from the grammar and subscription commands, and implements the continuous monitoring loop in sequencesync.c. Tap tests have been updated to verify automatic synchronization rather than manual refresh. The attached v2 patch is attached and ready for review. Thoughts and feedback are welcome! [1] - https://github.com/postgres/postgres/commit/5509055d6956745532e65ab218e15b99d87d66ce Best regards, Ajin Cherian Fujitsu Australia
Вложения
В списке pgsql-hackers по дате отправления: