Skip to content

Commit c9d40d4

Browse files
committed
server: avoid splitting stream after final listpack
Skip PushToConsumerIfNeeded after the last listpack in SaveStreamObject. The stream metadata tail (length, IDs, consumer groups) must stay bundled with the last listpack chunk so the loader can read it in the same chunk.
1 parent 469f1cf commit c9d40d4

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/server/rdb_save.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,11 @@ error_code RdbSerializer::SaveStreamObject(const PrimeValue& pv) {
572572
RETURN_ON_ERR(SaveString((uint8_t*)ri.key, ri.key_len));
573573
RETURN_ON_ERR(SaveString(lp, lp_bytes));
574574

575-
PushToConsumerIfNeeded(FlushState::kFlushMidEntry);
575+
// Do not split after the final listpack. The loader can resume between listpacks,
576+
// but the stream metadata tail is expected to stay bundled with the last listpack chunk, not
577+
// in its own separate chunk.
578+
if (i + 1 < rax_size)
579+
PushToConsumerIfNeeded(FlushState::kFlushMidEntry);
576580
}
577581

578582
std::move(stop_listpacks_rax).Invoke();

0 commit comments

Comments
 (0)