Skip to content

Commit

Permalink
fix manifest too large
Browse files Browse the repository at this point in the history
  • Loading branch information
yapple committed Jun 30, 2022
1 parent b905041 commit e7ada91
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 13 deletions.
2 changes: 1 addition & 1 deletion db/version_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ bool VersionBuilder::CheckConsistencyForNumLevels() {

void VersionBuilder::Apply(VersionEdit* edit) {
// not change the current state
if(edit->check_point()) return;
// if(edit->check_point()) return;
rep_->Apply(edit);
}

Expand Down
32 changes: 26 additions & 6 deletions db/version_set.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3192,16 +3192,36 @@ Status VersionSet::ProcessManifestWrites(std::deque<ManifestWriter>& writers,
Status s;

assert(pending_manifest_file_number_ == 0);
if (!descriptor_log_ ||
manifest_file_size_ > db_options_->max_manifest_file_size ||
manifest_edit_count_ > db_options_->max_manifest_edit_count) {
pending_manifest_file_number_ = NewFileNumber();
batch_edits.back()->SetNextFile(next_file_number_.load());
new_descriptor_log = true;

bool cp = false;
for (auto e : batch_edits) {
if (e->check_point()) {
cp = true;
break;
}
}
if (!descriptor_log_) {
pending_manifest_file_number_ = NewFileNumber();
batch_edits.back()->SetNextFile(next_file_number_.load());
new_descriptor_log = true;
} else {
pending_manifest_file_number_ = manifest_file_number_;
}

// if (!descriptor_log_ ||
// manifest_file_size_ > db_options_->max_manifest_file_size ||
// manifest_edit_count_ > db_options_->max_manifest_edit_count) {
// if (!descriptor_log_ || !cp) {
// pending_manifest_file_number_ = NewFileNumber();
// batch_edits.back()->SetNextFile(next_file_number_.load());
// new_descriptor_log = true;
// }else {
// pending_manifest_file_number_ = manifest_file_number_;
// }
// } else {
// pending_manifest_file_number_ = manifest_file_number_;
// }

if (new_descriptor_log) {
// if we are writing out new snapshot make sure to persist max column
// family.
Expand Down
2 changes: 1 addition & 1 deletion include/rocksdb/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ struct DBOptions {
// transaction is encountered in the WAL
bool allow_2pc = false;

bool check_point_fake_flush = true;
bool check_point_fake_flush = false;

// A global cache for table-level rows.
// Default: nullptr (disabled)
Expand Down
14 changes: 9 additions & 5 deletions utilities/checkpoint/checkpoint_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,16 @@ Status CheckpointImpl::CreateCustomCheckpoint(
}

// this will return live_files prefixed with "/"
if(db_options.check_point_fake_flush){
if (db_options.check_point_fake_flush) {
s = db_->FakeFlush(fake_flush_files);
s = db_->GetLiveFiles(live_files, &manifest_file_size, false);
live_files.insert(live_files.end(), fake_flush_files.begin(),
fake_flush_files.end());
}else{
if (s.ok()) {
s = db_->GetLiveFiles(live_files, &manifest_file_size, false);
}
if (s.ok()) {
live_files.insert(live_files.end(), fake_flush_files.begin(),
fake_flush_files.end());
}
} else {
s = db_->GetLiveFiles(live_files, &manifest_file_size, flush_memtable);
}

Expand Down

0 comments on commit e7ada91

Please sign in to comment.