Skip to content

Commit

Permalink
Remove LogReaderContainer's status
Browse files Browse the repository at this point in the history
  • Loading branch information
jaykorean committed Mar 19, 2024
1 parent b4e9f5a commit f8c8adf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
8 changes: 1 addition & 7 deletions db/db_impl/db_impl_secondary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,6 @@ Status DBImplSecondary::RecoverLogFiles(
auto it = log_readers_.find(log_number);
assert(it != log_readers_.end());
log::FragmentBufferedReader* reader = it->second->reader_;
Status* wal_read_status = it->second->status_;
assert(wal_read_status);
// Manually update the file number allocation counter in VersionSet.
versions_->MarkFileNumberUsed(log_number);

Expand All @@ -217,8 +215,7 @@ Status DBImplSecondary::RecoverLogFiles(
WriteBatch batch;

while (reader->ReadRecord(&record, &scratch,
immutable_db_options_.wal_recovery_mode) &&
wal_read_status->ok() && status.ok()) {
immutable_db_options_.wal_recovery_mode) && status.ok()) {
if (record.size() < WriteBatchInternal::kHeader) {
reader->GetReporter()->Corruption(
record.size(), Status::Corruption("log record too small"));
Expand Down Expand Up @@ -323,9 +320,6 @@ Status DBImplSecondary::RecoverLogFiles(
reader->GetReporter()->Corruption(record.size(), status);
}
}
if (status.ok() && !wal_read_status->ok()) {
status = *wal_read_status;
}
if (!status.ok()) {
return status;
}
Expand Down
6 changes: 1 addition & 5 deletions db/db_impl/db_impl_secondary.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@ namespace ROCKSDB_NAMESPACE {
class LogReaderContainer {
public:
LogReaderContainer()
: reader_(nullptr), reporter_(nullptr), status_(nullptr) {}
: reader_(nullptr), reporter_(nullptr) {}
LogReaderContainer(Env* env, std::shared_ptr<Logger> info_log,
std::string fname,
std::unique_ptr<SequentialFileReader>&& file_reader,
uint64_t log_number) {
LogReporter* reporter = new LogReporter();
status_ = new Status();
reporter->env = env;
reporter->info_log = info_log.get();
reporter->fname = std::move(fname);
reporter->status = status_;
reporter_ = reporter;
// We intentially make log::Reader do checksumming even if
// paranoid_checks==false so that corruptions cause entire commits
Expand All @@ -40,11 +38,9 @@ class LogReaderContainer {
}
log::FragmentBufferedReader* reader_;
log::Reader::Reporter* reporter_;
Status* status_;
~LogReaderContainer() {
delete reader_;
delete reporter_;
delete status_;
}

private:
Expand Down

0 comments on commit f8c8adf

Please sign in to comment.