mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 10:25:47 +02:00
feat(server): check master journal lsn in replica (#2778)
Send journal lsn to replica and compare the lsn value against number of records received in replica side Signed-off-by: kostas <kostas@dragonflydb.io> Co-authored-by: adi_holden <adi@dragonflydb.io>
This commit is contained in:
parent
3ec43afd30
commit
b2e2ad6e04
17 changed files with 77 additions and 37 deletions
|
@ -75,6 +75,8 @@ void JournalWriter::Write(const journal::Entry& entry) {
|
|||
switch (entry.opcode) {
|
||||
case journal::Op::SELECT:
|
||||
return Write(entry.dbid);
|
||||
case journal::Op::LSN:
|
||||
return Write(entry.lsn);
|
||||
case journal::Op::PING:
|
||||
return;
|
||||
case journal::Op::COMMAND:
|
||||
|
@ -199,6 +201,11 @@ io::Result<journal::ParsedEntry> JournalReader::ReadEntry() {
|
|||
return entry;
|
||||
}
|
||||
|
||||
if (opcode == journal::Op::LSN) {
|
||||
SET_OR_UNEXPECT(ReadUInt<uint64_t>(), entry.lsn);
|
||||
return entry;
|
||||
}
|
||||
|
||||
SET_OR_UNEXPECT(ReadUInt<uint64_t>(), entry.txid);
|
||||
SET_OR_UNEXPECT(ReadUInt<uint32_t>(), entry.shard_cnt);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue