mirror of
https://github.com/facebook/rocksdb.git
synced 2024-11-26 16:30:56 +00:00
[Rocksdb] Recover last updated sequence number from manifest also.
Summary: During recovery, last_updated_manifest number was not set if there were no records in the Write-ahead log. Now check for the recovered manifest also and set last_updated_manifest file to the max value. Test Plan: unit test Reviewers: heyongqiang Reviewed By: heyongqiang CC: leveldb Differential Revision: https://reviews.facebook.net/D9891
This commit is contained in:
parent
6763110867
commit
ca789a10cc
|
@ -549,13 +549,13 @@ Status DBImpl::Recover(VersionEdit* edit, MemTable* external_table,
|
|||
// update the file number allocation counter in VersionSet.
|
||||
versions_->MarkFileNumberUsed(logs[i]);
|
||||
}
|
||||
// This could be the last_flushed_sequence as the next sequences will be
|
||||
// greater than this.
|
||||
last_flushed_sequence_ = max_sequence;
|
||||
|
||||
if (s.ok()) {
|
||||
if (versions_->LastSequence() < max_sequence) {
|
||||
versions_->SetLastSequence(max_sequence);
|
||||
last_flushed_sequence_ = max_sequence;
|
||||
} else {
|
||||
last_flushed_sequence_ = versions_->LastSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2688,6 +2688,18 @@ TEST(DBTest, TransactionLogIteratorJustEmptyFile) {
|
|||
Status status = dbfull()->GetUpdatesSince(0, &iter);
|
||||
ASSERT_TRUE(!status.ok());
|
||||
}
|
||||
|
||||
TEST(DBTest, TransactionLogIteratorCheckAfterRestart) {
|
||||
Options options = OptionsForLogIterTest();
|
||||
DestroyAndReopen(&options);
|
||||
Put("key1", DummyString(1024));
|
||||
Put("key2", DummyString(1023));
|
||||
dbfull()->Flush(FlushOptions());
|
||||
Reopen(&options);
|
||||
auto iter = OpenTransactionLogIter(0);
|
||||
ExpectRecords(2, iter);
|
||||
}
|
||||
|
||||
TEST(DBTest, ReadCompaction) {
|
||||
std::string value(4096, '4'); // a string of size 4K
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue