commitlog_replayer: Ensure applied frozen_mutation is safe during apply

Fixes #5211

In 79935df959 replay apply-call was
changed from one with no continuation to one with. But the frozen
mutation arg was still just lambda local.

Change to use do_with for this case as well.

Message-Id: <20191203162606.1664-1-calle@scylladb.com>
(cherry picked from commit 56a5e0a251)
This commit is contained in:
Calle Wilund
2019-12-03 16:26:06 +00:00
committed by Avi Kivity
parent 3980570520
commit 9dd714ae64

View File

@@ -276,7 +276,7 @@ future<> db::commitlog_replayer::impl::process(stats* s, commitlog::buffer_and_r
}
auto shard = _db.local().shard_of(fm);
return _db.invoke_on(shard, [this, cer = std::move(cer), &src_cm, rp, shard, s] (database& db) -> future<> {
return _db.invoke_on(shard, [this, cer = std::move(cer), &src_cm, rp, shard, s] (database& db) mutable -> future<> {
auto& fm = cer.mutation();
// TODO: might need better verification that the deserialized mutation
// is schema compatible. My guess is that just applying the mutation
@@ -306,7 +306,9 @@ future<> db::commitlog_replayer::impl::process(stats* s, commitlog::buffer_and_r
return db.apply_in_memory(m, cf, db::rp_handle(), db::no_timeout);
});
} else {
return db.apply_in_memory(fm, cf.schema(), db::rp_handle(), db::no_timeout);
return do_with(std::move(cer).mutation(), [&](const frozen_mutation& m) {
return db.apply_in_memory(m, cf.schema(), db::rp_handle(), db::no_timeout);
});
}
}).then_wrapped([s] (future<> f) {
try {