box: introduce `box.ctl.demote`
Introduce a new journal entry, DEMOTE. The entry has the same meaning as PROMOTE, with the only difference that it clears limbo ownership instead of transferring it to the issuer. Introduce `box.ctl.demote`, a counterpart to `box.ctl.promote`, which clears the limbo ownership (when elections are off) via writing the DEMOTE, or simply makes this instance step down from the leader's role (when elections are enabled in any mode). A new request was necessary instead of simply writing PROMOTE(origin_id = 0), because origin_id is deduced from row.replica_id, which cannot be 0 for replicated rows (it's always equal to instance_id of the row originator). Closes #6034 @TarantoolBot document Title: box.ctl.demote `box.ctl.demote()` is a counterpart to `box.ctl.promote()` which works as follows: - when `box.cfg.election_mode` is not 'off': make the instance give up leadership. - when `box.cfg.election_mode` is 'off': write a DEMOTE entry to WAL. `box.ctl.demote()` may only be issued on the synchronous transaction queue owner (i.e. leader when elections are enabled). A DEMOTE request (DEMOTE = 32) copies PROMOTE behaviour (it clears the limbo as well), but clears the synchronous transaction queue ownership instead of assigning it to a new instance.
Showing
- src/box/box.cc 68 additions, 7 deletionssrc/box/box.cc
- src/box/box.h 3 additions, 0 deletionssrc/box/box.h
- src/box/iproto_constants.h 7 additions, 3 deletionssrc/box/iproto_constants.h
- src/box/lua/ctl.c 9 additions, 0 deletionssrc/box/lua/ctl.c
- src/box/txn_limbo.c 32 additions, 5 deletionssrc/box/txn_limbo.c
- src/box/txn_limbo.h 7 additions, 0 deletionssrc/box/txn_limbo.h
- test/replication/election_basic.result 3 additions, 0 deletionstest/replication/election_basic.result
- test/replication/election_basic.test.lua 1 addition, 0 deletionstest/replication/election_basic.test.lua
- test/replication/election_qsync.result 3 additions, 0 deletionstest/replication/election_qsync.result
- test/replication/election_qsync.test.lua 1 addition, 0 deletionstest/replication/election_qsync.test.lua
- test/replication/gh-5140-qsync-casc-rollback.result 6 additions, 0 deletionstest/replication/gh-5140-qsync-casc-rollback.result
- test/replication/gh-5140-qsync-casc-rollback.test.lua 2 additions, 0 deletionstest/replication/gh-5140-qsync-casc-rollback.test.lua
- test/replication/gh-5144-qsync-dup-confirm.result 6 additions, 0 deletionstest/replication/gh-5144-qsync-dup-confirm.result
- test/replication/gh-5144-qsync-dup-confirm.test.lua 2 additions, 0 deletionstest/replication/gh-5144-qsync-dup-confirm.test.lua
- test/replication/gh-5163-qsync-restart-crash.result 6 additions, 0 deletionstest/replication/gh-5163-qsync-restart-crash.result
- test/replication/gh-5163-qsync-restart-crash.test.lua 2 additions, 0 deletionstest/replication/gh-5163-qsync-restart-crash.test.lua
- test/replication/gh-5167-qsync-rollback-snap.result 6 additions, 0 deletionstest/replication/gh-5167-qsync-rollback-snap.result
- test/replication/gh-5167-qsync-rollback-snap.test.lua 2 additions, 0 deletionstest/replication/gh-5167-qsync-rollback-snap.test.lua
- test/replication/gh-5195-qsync-replica-write.result 8 additions, 2 deletionstest/replication/gh-5195-qsync-replica-write.result
- test/replication/gh-5195-qsync-replica-write.test.lua 4 additions, 2 deletionstest/replication/gh-5195-qsync-replica-write.test.lua
Loading
Please register or sign in to comment