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

FIFO Compaction with TTL #2480

Closed
wants to merge 11 commits into from
12 changes: 8 additions & 4 deletions db/compaction_picker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1450,10 +1450,6 @@ Compaction* FIFOCompactionPicker::PickTTLCompaction(
(current_time - ioptions_.compaction_options_fifo.ttl)) {
total_size -= f->compensated_file_size;
sagar0 marked this conversation as resolved.
Show resolved Hide resolved
inputs[0].files.push_back(f);
ROCKS_LOG_BUFFER(log_buffer,
"[%s] FIFO compaction: picking file %" PRIu64
" with creation time %" PRIu64 " for deletion",
cf_name.c_str(), f->fd.GetNumber(), creation_time);
}
}
}
Expand All @@ -1467,6 +1463,14 @@ Compaction* FIFOCompactionPicker::PickTTLCompaction(
return nullptr;
}

for (const auto& f : inputs[0].files) {
ROCKS_LOG_BUFFER(log_buffer,
"[%s] FIFO compaction: picking file %" PRIu64
" with creation time %" PRIu64 " for deletion",
cf_name.c_str(), f->fd.GetNumber(),
f->fd.table_reader->GetTableProperties()->creation_time);
}

Compaction* c = new Compaction(
vstorage, ioptions_, mutable_cf_options, std::move(inputs), 0, 0, 0, 0,
kNoCompression, {}, /* is manual */ false, vstorage->CompactionScore(0),
Expand Down
17 changes: 12 additions & 5 deletions db/db_impl_open.cc
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,18 @@ static Status ValidateOptions(
"universal and level compaction styles. ");
}
}
if (cfd.options.compaction_options_fifo.ttl > 0 &&
cfd.options.table_factory->Name() != BlockBasedTableFactory().Name()) {
return Status::NotSupported(
"FIFO Compaction with TTL is only supported in "
"Block-Based Table format. ");
if (cfd.options.compaction_options_fifo.ttl > 0) {
if (db_options.max_open_files != -1) {
return Status::NotSupported(
"FIFO Compaction with TTL is only supported when files are always "
"kept open (set max_open_files = -1). ");
}
if (cfd.options.table_factory->Name() !=
BlockBasedTableFactory().Name()) {
return Status::NotSupported(
"FIFO Compaction with TTL is only supported in "
"Block-Based Table format. ");
}
}
}

Expand Down