Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/kv/store.h
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,6 @@ namespace ccf::kv
// In practice rollback is only called at signature seqnos, so
// clamping here restores the latest committable entry
last_committable = std::min(last_committable, tx_id.seqno);
unset_flag_unsafe(StoreFlag::SNAPSHOT_AT_NEXT_SIGNATURE);
rollback_count++;
pending_txs.clear();
auto e = get_encryptor();
Expand Down
18 changes: 18 additions & 0 deletions src/kv/test/kv_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3512,6 +3512,24 @@ TEST_CASE("Ledger entry chunk request")
store.set_flag(
ccf::kv::AbstractStore::StoreFlag::SNAPSHOT_AT_NEXT_SIGNATURE);

INFO("Roll back a transaction without clearing the snapshot flag");
{
MapTypes::StringString map("public:map");
auto tx = store.create_tx();

auto h1 = tx.rw(map);
h1->put("key", "value");
REQUIRE(tx.commit() == ccf::kv::CommitResult::SUCCESS);

store.rollback(
{store.commit_view(), store.current_version() - 1},
store.commit_view());

REQUIRE(store.flag_enabled(
ccf::kv::AbstractStore::StoreFlag::SNAPSHOT_AT_NEXT_SIGNATURE));
REQUIRE(store.should_create_ledger_chunk(store.current_version()));
}

INFO("Add a signature that triggers a snapshot");
{
auto txid = store.next_txid();
Expand Down