Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corruption error when calling GetUpdatesSince() #5455

Closed
graetzer opened this issue Jun 14, 2019 · 2 comments
Closed

Corruption error when calling GetUpdatesSince() #5455

graetzer opened this issue Jun 14, 2019 · 2 comments

Comments

@graetzer
Copy link
Contributor

graetzer commented Jun 14, 2019

When using the GetUpdatesSince(..) method we regulary see a corruption error with the message "NO MORE DATA LEFT".

It seems to me like there is a condition in the TransactionLogIteratorImpl::NextImpl() method, that would always lead to this error when a new WAL file is openened (while concurrently scanning the WAL). The code in question is this piece:

is_valid_ = false;
if (current_last_seq_ == versions_->LastSequence()) {
  current_status_ = Status::OK();
} else {
  current_status_ = Status::Corruption("NO MORE DATA LEFT");
}

Seems like the sequence number returned by versions_->LastSequence() would be higher in that case ? Would it be more correct to return a "try again" type error ?

Expected behavior

No corruption error on scanning the WAL when executing basically this code:

std::unique_ptr<rocksdb::TransactionLogIterator> it; 
rocksdb::TransactionLogIterator::ReadOptions ro(false);
rocksdb::Status s = db->GetUpdatesSince(startingFrom, &it, ro);
for (; it->Valid(); it->Next()) {
   // ..
}
if (!it->status().ok())
   std::cout << it->status().ToString();

Actual behavior

We regulary see a corruption error.

Steps to reproduce the behavior

Scan the WAL via GetUpdatesSince and run parallel threads writing into the database instance.

@graetzer graetzer changed the title Corruption on WAL scan via GetUpdatesSince Corruption when calling GetUpdatesSince() Jun 14, 2019
@graetzer graetzer changed the title Corruption when calling GetUpdatesSince() Corruption error when calling GetUpdatesSince() Jun 14, 2019
@maysamyabandeh
Copy link
Contributor

Thanks @graetzer. Changing it to ::TryAgain makes sense to me. Are you interested in submitting a PR?

@graetzer
Copy link
Contributor Author

Sure thing #5474

merryChris pushed a commit to merryChris/rocksdb that referenced this issue Nov 18, 2019
…to TransactionLogIterator (facebook#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 facebook#5455
Pull Request resolved: facebook#5474

Differential Revision: D15898953

Pulled By: maysamyabandeh

fbshipit-source-id: 40966f6457cb539e1aeb104daeada6b0e46059fc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants