mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 10:25:47 +02:00
feat: Use journal LSNs for absolute replication offsets (#1242)
* feat: Use journal LSNs for absolute replication offsets * 1 - Address small CR comments 2 - Simplify the offset accounting so that we send the correct offset in `SliceSnapshot::Stop` instead of counting in RdbLoader. This allows us to revert the changes to slice journaling of EXEC commands, for example. * Store int with absl::little_endian * Document the offset management
This commit is contained in:
parent
6962771c21
commit
cbb2afc792
17 changed files with 90 additions and 43 deletions
|
@ -1826,6 +1826,15 @@ error_code RdbLoader::Load(io::Source* src) {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (type == RDB_OPCODE_JOURNAL_OFFSET) {
|
||||
VLOG(1) << "Read RDB_OPCODE_JOURNAL_OFFSET";
|
||||
uint64_t journal_offset;
|
||||
SET_OR_RETURN(FetchInt<uint64_t>(), journal_offset);
|
||||
VLOG(1) << "Got offset " << journal_offset;
|
||||
journal_offset_ = journal_offset;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (type == RDB_OPCODE_SELECTDB) {
|
||||
unsigned dbid = 0;
|
||||
|
||||
|
@ -1838,7 +1847,7 @@ error_code RdbLoader::Load(io::Source* src) {
|
|||
return RdbError(errc::bad_db_index);
|
||||
}
|
||||
|
||||
VLOG(1) << "Select DB: " << dbid;
|
||||
VLOG(2) << "Select DB: " << dbid;
|
||||
for (unsigned i = 0; i < shard_set->size(); ++i) {
|
||||
// we should flush pending items before switching dbid.
|
||||
FlushShardAsync(i);
|
||||
|
@ -2050,6 +2059,7 @@ error_code RdbLoaderBase::HandleJournalBlob(Service* service) {
|
|||
journal::ParsedEntry entry{};
|
||||
SET_OR_RETURN(journal_reader_.ReadEntry(), entry);
|
||||
ex.Execute(entry.dbid, entry.cmd);
|
||||
VLOG(1) << "Reading item: " << entry.ToString();
|
||||
done++;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue