vinyl: implement rebootstrap support
If vy_log_bootstrap() finds a vylog file in the vinyl directory, it assumes it has to be rebootstrapped and calls vy_log_rebootstrap(). The latter scans the old vylog file to find the max vinyl object id, from which it will start numbering objects created during rebootstrap to avoid conflicts with old objects, then it writes VY_LOG_REBOOTSTRAP record to the old vylog to denote the beginning of a rebootstrap section. After that initial join proceeds as usual, writing information about new objects to the old vylog file after VY_LOG_REBOOTSTRAP marker. Upon successful rebootstrap completion, checkpoint, which is always called right after bootstrap, rotates the old vylog and marks all objects created before the VY_LOG_REBOOTSTRAP marker as dropped in the new vylog. The old objects will be purged by the garbage collector as usual. In case rebootstrap fails and checkpoint never happens, local recovery writes VY_LOG_ABORT_REBOOTSTRAP record to the vylog. This marker indicates that the rebootstrap attempt failed and all objects created during rebootstrap should be discarded. They will be purged by the garbage collector on checkpoint. Thus even if rebootstrap fails, it is possible to recover the database to the state that existed right before a failed rebootstrap attempt. Closes #461
Showing
- src/box/relay.cc 3 additions, 0 deletionssrc/box/relay.cc
- src/box/vy_log.c 125 additions, 8 deletionssrc/box/vy_log.c
- src/box/vy_log.h 34 additions, 0 deletionssrc/box/vy_log.h
- src/errinj.h 1 addition, 0 deletionssrc/errinj.h
- test/box/errinj.result 4 additions, 2 deletionstest/box/errinj.result
- test/replication/replica_rejoin.result 7 additions, 4 deletionstest/replication/replica_rejoin.result
- test/replication/replica_rejoin.test.lua 3 additions, 4 deletionstest/replication/replica_rejoin.test.lua
- test/replication/suite.cfg 0 additions, 1 deletiontest/replication/suite.cfg
- test/vinyl/replica_rejoin.lua 13 additions, 0 deletionstest/vinyl/replica_rejoin.lua
- test/vinyl/replica_rejoin.result 257 additions, 0 deletionstest/vinyl/replica_rejoin.result
- test/vinyl/replica_rejoin.test.lua 88 additions, 0 deletionstest/vinyl/replica_rejoin.test.lua
- test/vinyl/suite.ini 1 addition, 1 deletiontest/vinyl/suite.ini
Loading
Please register or sign in to comment