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

@ -1279,12 +1279,11 @@ void DbSlice::FreeMemWithEvictionStep(DbIndex db_ind, size_t increase_goal_bytes
finish:
// send the deletion to the replicas.
// fiber preemption could happen in this phase.
vector<string_view> args(keys_to_journal.begin(), keys_to_journal.end());
if (!args.empty()) {
ArgSlice delete_args(&args[0], args.size());
if (auto journal = owner_->journal(); journal) {
journal->RecordEntry(0, journal::Op::EXPIRED, db_ind, 1, make_pair("DEL", delete_args),
false);
if (auto journal = owner_->journal(); journal) {
for (string_view key : keys_to_journal) {
ArgSlice delete_args(&key, 1);
journal->RecordEntry(0, journal::Op::EXPIRED, db_ind, 1, ClusterConfig::KeySlot(key),
make_pair("DEL", delete_args), false);
}
}