[PATCH] raft: drop local snapshot if it cannot be installed

0 views
Skip to first unread message

Gleb Natapov

unread,
Sep 22, 2021, 3:08:19 AMSep 22
to scylla...@googlegroups.com
If a locally taken snapshot cannot be installed because newer one was
received meanwhile it should be dropped, otherwise it will take space
needlessly.

diff --git a/raft/server.cc b/raft/server.cc
index ff6a4a1aab..2ca4e26c3d 100644
--- a/raft/server.cc
+++ b/raft/server.cc
@@ -829,6 +829,7 @@ future<> server_impl::applier_fiber() {
if (!_fsm->apply_snapshot(snp, _config.snapshot_trailing, true)) {
logger.trace("[{}] applier fiber: while taking snapshot term={} idx={} id={},"
" fsm received a later snapshot at idx={}", _id, snp.term, snp.idx, snp.id, _fsm->log_last_snapshot_idx());
+ _state_machine->drop_snapshot(snp.id);
}
_stats.snapshots_taken++;
}
--
Gleb.

Konstantin Osipov

unread,
Sep 24, 2021, 12:21:38 PMSep 24
to Gleb Natapov, scylla...@googlegroups.com
* Gleb Natapov <gl...@scylladb.com> [21/09/22 10:09]:
> If a locally taken snapshot cannot be installed because newer one was
> received meanwhile it should be dropped, otherwise it will take space
> needlessly.

Reviewed-by: Konstantin Osipov <kos...@scylladb.com>

> diff --git a/raft/server.cc b/raft/server.cc
> index ff6a4a1aab..2ca4e26c3d 100644
> --- a/raft/server.cc
> +++ b/raft/server.cc
> @@ -829,6 +829,7 @@ future<> server_impl::applier_fiber() {
> if (!_fsm->apply_snapshot(snp, _config.snapshot_trailing, true)) {
> logger.trace("[{}] applier fiber: while taking snapshot term={} idx={} id={},"
> " fsm received a later snapshot at idx={}", _id, snp.term, snp.idx, snp.id, _fsm->log_last_snapshot_idx());
> + _state_machine->drop_snapshot(snp.id);
> }
> _stats.snapshots_taken++;
> }

--
Konstantin Osipov, Moscow, Russia

Gleb Natapov

unread,
Sep 27, 2021, 4:30:46 AMSep 27
to scylla...@googlegroups.com
Ping.
--
Gleb.

Commit Bot

unread,
Sep 27, 2021, 7:03:57 AMSep 27
to scylla...@googlegroups.com, Gleb Natapov
From: Gleb Natapov <gl...@scylladb.com>
Committer: Tomasz Grabiec <tgra...@scylladb.com>
Branch: next

raft: drop local snapshot if it cannot be installed

If a locally taken snapshot cannot be installed because newer one was
received meanwhile it should be dropped, otherwise it will take space
needlessly.

Message-Id: <YUrWXxVf...@scylladb.com>

---
diff --git a/raft/server.cc b/raft/server.cc
--- a/raft/server.cc
+++ b/raft/server.cc
@@ -751,6 +751,7 @@ future<> server_impl::applier_fiber() {

Commit Bot

unread,
Sep 28, 2021, 10:00:12 AMSep 28
to scylla...@googlegroups.com, Gleb Natapov
From: Gleb Natapov <gl...@scylladb.com>
Committer: Tomasz Grabiec <tgra...@scylladb.com>
Branch: master

raft: drop local snapshot if it cannot be installed

If a locally taken snapshot cannot be installed because newer one was
received meanwhile it should be dropped, otherwise it will take space
needlessly.

Message-Id: <YUrWXxVf...@scylladb.com>

---
diff --git a/raft/server.cc b/raft/server.cc
--- a/raft/server.cc
+++ b/raft/server.cc
@@ -751,6 +751,7 @@ future<> server_impl::applier_fiber() {
Reply all
Reply to author
Forward
0 new messages