core: fix wal saving an empty xlog during startup failure
After the commit a392eb76 ("box: destroy its modules even if box.cfg not done") wal_free() on exit is called even if box.cfg() isn't finished yet, and thus wal isn't yet enabled. This leads to a bug when wal would unconditionally write a 00...0.xlog regardless of the actual xlog directory contents or the actual vclock. Let's fix this by not writing an empty xlog on exit if wal writer's vclock is zero. It means the writer either wasn't enabled yet, or was enabled, but hasn't written anything. In both cases writing the empty xlog is extraneous. Closes #8704 NO_DOC=bugfix (cherry picked from commit f78908c9)
Showing
- changelogs/unreleased/gh-8704-wal-exit-empty-xlog.md 5 additions, 0 deletionschangelogs/unreleased/gh-8704-wal-exit-empty-xlog.md
- src/box/wal.c 1 addition, 1 deletionsrc/box/wal.c
- test/box-luatest/gh_8704_extra_empty_xlog_on_exit_test.lua 38 additions, 0 deletionstest/box-luatest/gh_8704_extra_empty_xlog_on_exit_test.lua
Please register or sign in to comment