mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 18:35:46 +02:00
feat: add slave_repl_offset to the replication section. (#3596)
* feat: add slave_repl_offset to the replication section. In Valkey slave_repl_offset denotes the replication offset on replica site during stable sync phase. During fullsync phase it appears with 0 value. In Dragonfly this field appears only after full sync has completed, thus it allows to check whether Dragonfly reached stable sync phase. The value of this field describes the cumulative progress of all the replication flows and it does not directly correspond to master side metrics. In addition, this PR fixes the bug in wait_available_async() function in our replication tests. This function is intended to wait until a replica reaches stable state and it did by sending pings until they do not respond with LOADING error, hence the assumption is that the replica is in full sync state already. However it can happen that master_link_status is "up" but replica has not reached full sync state, and the PING will succeed just because wait_available_async() was called before full sync started. The whole approach of polling the state is fragile. Now we use `slave_repl_offset` explicitly to see if the replica reaches stable state. Signed-off-by: Roman Gershman <roman@dragonflydb.io> * chore: simplify wait_available_async * chore: comments --------- Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
parent
41f7b611d0
commit
dd0effac6f
6 changed files with 51 additions and 43 deletions
|
@ -2378,6 +2378,8 @@ void ServerFamily::Info(CmdArgList args, ConnectionContext* cntx) {
|
|||
append("master_last_io_seconds_ago", rinfo.master_last_io_sec);
|
||||
append("master_sync_in_progress", rinfo.full_sync_in_progress);
|
||||
append("master_replid", rinfo.master_id);
|
||||
if (rinfo.full_sync_done)
|
||||
append("slave_repl_offset", rinfo.repl_offset_sum);
|
||||
append("slave_priority", GetFlag(FLAGS_replica_priority));
|
||||
append("slave_read_only", 1);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue