This is an automated email from the ASF dual-hosted git repository.
twice pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/kvrocks.git
The following commit(s) were added to refs/heads/unstable by this push:
new a44fcd3b7 chore(cluster): check and send the migration batches when
the buffer is full (#3227)
a44fcd3b7 is described below
commit a44fcd3b7992bdd2a7b1235403741d9c9cec7c51
Author: Lele Huang <[email protected]>
AuthorDate: Sat Oct 18 12:40:00 2025 +0800
chore(cluster): check and send the migration batches when the buffer is
full (#3227)
---
src/cluster/slot_migrate.cc | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/src/cluster/slot_migrate.cc b/src/cluster/slot_migrate.cc
index e69813876..684f7f6c4 100644
--- a/src/cluster/slot_migrate.cc
+++ b/src/cluster/slot_migrate.cc
@@ -1293,17 +1293,20 @@ Status SlotMigrator::sendSnapshotByRawKV() {
batch_sender.SetPrefixLogData(log_data);
GET_OR_RET(batch_sender.Put(storage_->GetCFHandle(ColumnFamilyID::Metadata),
iter.Key(), iter.Value()));
+ if (batch_sender.IsFull()) {
+ GET_OR_RET(sendMigrationBatch(&batch_sender));
+ }
auto subkey_iter = iter.GetSubKeyIterator();
if (!subkey_iter) {
- if (batch_sender.IsFull()) {
- GET_OR_RET(sendMigrationBatch(&batch_sender));
- }
continue;
}
for (subkey_iter->Seek(); subkey_iter->Valid(); subkey_iter->Next()) {
GET_OR_RET(batch_sender.Put(subkey_iter->ColumnFamilyHandle(),
subkey_iter->Key(), subkey_iter->Value()));
+ if (batch_sender.IsFull()) {
+ GET_OR_RET(sendMigrationBatch(&batch_sender));
+ }
if (redis_type == RedisType::kRedisZSet) {
InternalKey internal_key(subkey_iter->Key(),
storage_->IsSlotIdEncoded());
@@ -1318,10 +1321,6 @@ Status SlotMigrator::sendSnapshotByRawKV() {
GET_OR_RET(sendMigrationBatch(&batch_sender));
}
}
-
- if (batch_sender.IsFull()) {
- GET_OR_RET(sendMigrationBatch(&batch_sender));
- }
}
GET_OR_RET(sendMigrationBatch(&batch_sender));