Skip to content

Commit be70b39

Browse files
committed
fix: crash during getting info about replication
1 parent 0fe5e86 commit be70b39

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
@@ -1333,6 +1333,10 @@ size_t RdbSaver::Impl::GetTotalBuffersSize() const {
13331333

13341334
auto cb = [this, &channel_bytes, &serializer_bytes](ShardId sid) {
13351335
auto& snapshot = shard_snapshots_[sid];
1336+
// before create a snapshot we save header so shard_snapshots_ are vector of nullptr until we
1337+
// start snapshots saving
1338+
if (!snapshot)
1339+
return;
13361340
if (channel_.has_value())
13371341
channel_bytes.fetch_add(channel_->GetSize(), memory_order_relaxed);
13381342
serializer_bytes.store(snapshot->GetBufferCapacity() + snapshot->GetTempBuffersSize(),
@@ -1355,6 +1359,10 @@ RdbSaver::SnapshotStats RdbSaver::Impl::GetCurrentSnapshotProgress() const {
13551359

13561360
auto cb = [this, &results](ShardId sid) {
13571361
auto& snapshot = shard_snapshots_[sid];
1362+
// before create a snapshot we save header so shard_snapshots_ are vector of nullptr until we
1363+
// start snapshots saving
1364+
if (!snapshot)
1365+
return;
13581366
results[sid] = snapshot->GetCurrentSnapshotProgress();
13591367
};
13601368

0 commit comments

Comments
 (0)