mirror of
https://github.com/facebook/rocksdb.git
synced 2024-11-26 07:30:54 +00:00
Replace Corruption with TryAgain status when new tail is not visible to TransactionLogIterator (#5474)
Summary: When tailing the WAL with TransactionLogIterator, it used to return Corruption status to indicate that the WAL has new tail that is not visible to the iterator, which is a misleading status. The patch replaces it with TryAgain which is more descriptive of a status, indicating that the user needs to create a new iterator to fetch the recent tail. Fixes https://github.com/facebook/rocksdb/issues/5455 Pull Request resolved: https://github.com/facebook/rocksdb/pull/5474 Differential Revision: D15898953 Pulled By: maysamyabandeh fbshipit-source-id: 40966f6457cb539e1aeb104daeada6b0e46059fc
This commit is contained in:
parent
5355e527d9
commit
fe90ed7a70
|
@ -29,6 +29,7 @@
|
||||||
* Fix a bug in WAL replay of secondary instance by skipping write batches with older sequence numbers than the current last sequence number.
|
* Fix a bug in WAL replay of secondary instance by skipping write batches with older sequence numbers than the current last sequence number.
|
||||||
* Fix flush's/compaction's merge processing logic which allowed `Put`s covered by range tombstones to reappear. Note `Put`s may exist even if the user only ever called `Merge()` due to an internal conversion during compaction to the bottommost level.
|
* Fix flush's/compaction's merge processing logic which allowed `Put`s covered by range tombstones to reappear. Note `Put`s may exist even if the user only ever called `Merge()` due to an internal conversion during compaction to the bottommost level.
|
||||||
* Fix/improve memtable earliest sequence assignment and WAL replay so that WAL entries of unflushed column families will not be skipped after replaying the MANIFEST and increasing db sequence due to another flushed/compacted column family.
|
* Fix/improve memtable earliest sequence assignment and WAL replay so that WAL entries of unflushed column families will not be skipped after replaying the MANIFEST and increasing db sequence due to another flushed/compacted column family.
|
||||||
|
* Return TryAgain status in place of Corruption when new tail is not visible to TransactionLogIterator.
|
||||||
* Fix a bug caused by secondary not skipping the beginning of new MANIFEST.
|
* Fix a bug caused by secondary not skipping the beginning of new MANIFEST.
|
||||||
|
|
||||||
## 6.2.0 (4/30/2019)
|
## 6.2.0 (4/30/2019)
|
||||||
|
|
|
@ -199,7 +199,8 @@ void TransactionLogIteratorImpl::NextImpl(bool internal) {
|
||||||
if (current_last_seq_ == versions_->LastSequence()) {
|
if (current_last_seq_ == versions_->LastSequence()) {
|
||||||
current_status_ = Status::OK();
|
current_status_ = Status::OK();
|
||||||
} else {
|
} else {
|
||||||
current_status_ = Status::Corruption("NO MORE DATA LEFT");
|
const char* msg = "Create a new iterator to fetch the new tail.";
|
||||||
|
current_status_ = Status::TryAgain(msg);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -294,6 +294,29 @@ TEST_F(WalManagerTest, TransactionLogIteratorJustEmptyFile) {
|
||||||
ASSERT_TRUE(!iter->Valid());
|
ASSERT_TRUE(!iter->Valid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(WalManagerTest, TransactionLogIteratorNewFileWhileScanning) {
|
||||||
|
Init();
|
||||||
|
CreateArchiveLogs(2, 100);
|
||||||
|
auto iter = OpenTransactionLogIter(0);
|
||||||
|
CreateArchiveLogs(1, 100);
|
||||||
|
int i = 0;
|
||||||
|
for (; iter->Valid(); iter->Next()) {
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
ASSERT_EQ(i, 200);
|
||||||
|
// A new log file was added after the iterator was created.
|
||||||
|
// TryAgain indicates a new iterator is needed to fetch the new data
|
||||||
|
ASSERT_TRUE(iter->status().IsTryAgain());
|
||||||
|
|
||||||
|
iter = OpenTransactionLogIter(0);
|
||||||
|
i = 0;
|
||||||
|
for (; iter->Valid(); iter->Next()) {
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
ASSERT_EQ(i, 300);
|
||||||
|
ASSERT_TRUE(iter->status().ok());
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace rocksdb
|
} // namespace rocksdb
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
|
|
Loading…
Reference in a new issue