gc: replace vclockset_psearch with _match in wal_collect_garbage_f
When using vclockset_psearch, the resulting vclock may be incomparable to the search key. For example, with a vclock set { } (empty vclock), {0: 1, 1: 10}, {0: 2, 1:11} vclockset_psearch(set, {0:2, 1: 9}) might return {0: 1, 1: 10}, and not { }. This is known and avoided in other places, for example recover_remaining_wals(), where vclockset_match() is used instead. vclockset_match() starts with the same result as vclockset_psearch() and then unwinds the result until the first vclock which is less or equal to the search key is found. Having vclockset_psearch in wal_collect_garbage_f could lead to issues even before local space changes became written to 0-th vclock component. Once replica subscribes, its' gc consumer is set to the vclock, which the replica sent in subscribe request. This vclock might be incomparable with xlog vclocks of the master, leading to the same issue of potentially deleting a needed xlog during gc. Closes #7584 NO_DOC=bugfix
Showing
- changelogs/unreleased/gh-7584-missing-xlog-fix.md 4 additions, 0 deletionschangelogs/unreleased/gh-7584-missing-xlog-fix.md
- src/box/wal.c 1 addition, 1 deletionsrc/box/wal.c
- src/lib/vclock/vclock.h 1 addition, 1 deletionsrc/lib/vclock/vclock.h
- test/replication-luatest/gh_7584_missing_xlog_test.lua 48 additions, 0 deletionstest/replication-luatest/gh_7584_missing_xlog_test.lua
Loading