Skip to content

Commit abf6d93

Browse files
BorysTheDevromange
authored andcommitted
fix: crash during getting info about replication (#4328)
1 parent f4d3faa commit abf6d93

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/server/rdb_save.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,6 +1371,10 @@ size_t RdbSaver::Impl::GetTotalBuffersSize() const {
13711371

13721372
auto cb = [this, &channel_bytes, &serializer_bytes](ShardId sid) {
13731373
auto& snapshot = shard_snapshots_[sid];
1374+
// before create a snapshot we save header so shard_snapshots_ are vector of nullptr until we
1375+
// start snapshots saving
1376+
if (!snapshot)
1377+
return;
13741378
if (channel_.has_value())
13751379
channel_bytes.fetch_add(channel_->GetSize(), memory_order_relaxed);
13761380
serializer_bytes.store(snapshot->GetBufferCapacity() + snapshot->GetTempBuffersSize(),
@@ -1393,6 +1397,10 @@ RdbSaver::SnapshotStats RdbSaver::Impl::GetCurrentSnapshotProgress() const {
13931397

13941398
auto cb = [this, &results](ShardId sid) {
13951399
auto& snapshot = shard_snapshots_[sid];
1400+
// before create a snapshot we save header so shard_snapshots_ are vector of nullptr until we
1401+
// start snapshots saving
1402+
if (!snapshot)
1403+
return;
13961404
results[sid] = snapshot->GetCurrentSnapshotProgress();
13971405
};
13981406

0 commit comments

Comments
 (0)