Sentinel is updated for every commit #774
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We used to track last sentinel sync time and update sentinel for every 1 sec. However, the change[1] which adopted sqlite to track sentinel removed the last updated time assignment[2] leading to sentinel write
for every commit message causes replay slowness by almost 6 times.
Solution: Track last sentinel update time
Without the fix, the following snippet will be always executed because
1 < (now - context->sentinelSyncTime)
will be always true!pgcopydb/src/bin/pgcopydb/ld_replay.c
Lines 170 to 179 in 812a108
[1] #601
[2] https://github.com/dimitri/pgcopydb/pull/601/files#diff-481cd5fcd15742c022e2a18916c7a508cc7c7d46c264084daab85200e1b10004L477
Before this PR,
After this PR,
Gain:
(2m, 30 sec - 21 sec) / 21 sec = ~6.1 times