]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Refactor slot synchronization logic in slotsync.c.
authorAmit Kapila <akapila@postgresql.org>
Thu, 12 Feb 2026 09:08:31 +0000 (14:38 +0530)
committerAmit Kapila <akapila@postgresql.org>
Thu, 12 Feb 2026 09:08:31 +0000 (14:38 +0530)
commit788ec96d591d0a7c916f2f4332765f46410d73b5
treea17e0c33d8e8ebe7ed4d0fad4948cc04f6a1df76
parent706cadde3239842a41a3375d50dda8b33325c008
Refactor slot synchronization logic in slotsync.c.

Following e68b6adad9, the reason for skipping slot synchronization is
stored as a slot property. This commit removes redundant function
parameters that previously tracked this state, instead relying directly on
the slot property.

Additionally, this change centralizes the logic for skipping
synchronization when required WAL has not yet been received or flushed. By
consolidating this check, we reduce code duplication and the risk of
inconsistent state updates across different code paths.

In passing, add an assertion to ensure a slot is marked as temporary if a
consistent point has not been reached during synchronization.

Author: Zhijie Hou <houzj.fnst@fujitsu.com>
Reviewed-by: Shveta Malik <shveta.malik@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/TY4PR01MB16907DD16098BE3B20486D4569463A@TY4PR01MB16907.jpnprd01.prod.outlook.com
Discussion: https://postgr.es/m/CAFPTHDZAA+gWDntpa5ucqKKba41=tXmoXqN3q4rpjO9cdxgQrw@mail.gmail.com
src/backend/replication/logical/slotsync.c