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
This commit is contained in:
Andrew Kryczka 2017-10-30 00:47:15 -07:00 committed by Facebook Github Bot
parent 792ef10ca8
commit b7bc9cc038
1 changed files with 3 additions and 1 deletions

View File

@ -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_;
}