replication: fix downstream lag growing when there's no new transactions
downstream lag is the difference in time between the moment a transaction was written to master's WAL and the moment an ack for it arrived. Its calculation is supported by replicas sending the last applied row timestamp. When there is no replication, the last applied row timestamp stays the same, so in this case downstream lag grows as time passes. Once an old master is replaced by a new one, it notices changes in peer vclocks and tries to update downstream lag unconditionally. This makes the lag appear to be growing indefinitely, showing the time since the last transaction on the old master: ``` downstream: status: follow idle: 0.018218606001028 vclock: {1: 3, 2: 2} lag: 34.623061401367 ``` The commit 56571d83 ("raft: make followers notice leader hang") made relay exchange information with tx even when there are no new transactions, so the issue became even easier to reproduce. The issue itself was present since downstream lag introduction in commit 29025bce ("relay: provide information about downstream lag"). Closes #7581 NO_DOC=bugfix
Showing
- changelogs/unreleased/gh-7581-downstream-lag-calculation-fix.md 4 additions, 0 deletions...logs/unreleased/gh-7581-downstream-lag-calculation-fix.md
- src/box/relay.cc 7 additions, 2 deletionssrc/box/relay.cc
- test/replication-luatest/gh_7581_downstream_lag_test.lua 88 additions, 0 deletionstest/replication-luatest/gh_7581_downstream_lag_test.lua
Loading
Please register or sign in to comment