feat(cluster): Add RestoreStreamer. (#2390)

* feat(cluster): Add `RestoreStreamer`.

`RestoreStreamer`, like `JournalStreamer`, streams journal changes to a
sink. However, in addition, it traverses the DB like `RdbSerializer` and
sends existing entries as `RESTORE` commands.

Adding it required a bit of plumbing to get all journal changes to be
slot-aware.

In a follow-up PR I will remove the now unneeded `SerializerBase`.

* Fix build

* Fix bug

* Remove unimplemented function

* Iterate DB, drop support for db1+

* Send FULL-SYNC-CUT
This commit is contained in:
Shahar Mike 2024-01-10 15:10:21 +02:00 committed by GitHub
parent f4ea42f2f6
commit 4874da8b5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 311 additions and 99 deletions

View file

@ -64,7 +64,7 @@ void JournalWriter::Write(std::monostate) {
void JournalWriter::Write(const journal::Entry& entry) {
// Check if entry has a new db index and we need to emit a SELECT entry.
if (entry.opcode != journal::Op::SELECT && (!cur_dbid_ || entry.dbid != *cur_dbid_)) {
Write(journal::Entry{journal::Op::SELECT, entry.dbid});
Write(journal::Entry{journal::Op::SELECT, entry.dbid, entry.slot});
cur_dbid_ = entry.dbid;
}