From b7bc9cc0384209738066fa41d778228c3332510f Mon Sep 17 00:00:00 2001 From: Andrew Kryczka Date: Mon, 30 Oct 2017 00:47:15 -0700 Subject: [PATCH] fix tracking oldest snapshot for bottom-level compaction Summary: The assertion was caught by `MySQLStyleTransactionTest/MySQLStyleTransactionTest.TransactionStressTest/5` when run in a loop. The caller doesn't track whether the released snapshot is oldest, so let this function handle that case. Closes https://github.com/facebook/rocksdb/pull/3080 Differential Revision: D6185257 Pulled By: ajkr fbshipit-source-id: 4b3015c11db5d31e46521a00af568546ef4558cd --- db/db_impl.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/db/db_impl.cc b/db/db_impl.cc index cbb1cd53b..84cc7b9cf 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -1618,7 +1618,9 @@ void DBImpl::ReleaseSnapshot(const Snapshot* s) { snapshots_.Delete(casted_s); uint64_t oldest_snapshot; if (snapshots_.empty()) { - oldest_snapshot = versions_->LastSequence(); + oldest_snapshot = concurrent_prepare_ && seq_per_batch_ + ? versions_->LastToBeWrittenSequence() + : versions_->LastSequence(); } else { oldest_snapshot = snapshots_.oldest()->number_; } -- GitLab