|
|
|
@ -1067,16 +1067,18 @@ Status CompactionJob::FinishCompactionOutputFile( |
|
|
|
|
range_del_agg->AddToBuilder(sub_compact->builder.get(), lower_bound, |
|
|
|
|
upper_bound, meta, range_del_out_stats, |
|
|
|
|
bottommost_level_); |
|
|
|
|
meta->marked_for_compaction = sub_compact->builder->NeedCompact(); |
|
|
|
|
} |
|
|
|
|
const uint64_t current_entries = sub_compact->builder->NumEntries(); |
|
|
|
|
meta->marked_for_compaction = sub_compact->builder->NeedCompact(); |
|
|
|
|
if (s.ok()) { |
|
|
|
|
s = sub_compact->builder->Finish(); |
|
|
|
|
} else { |
|
|
|
|
sub_compact->builder->Abandon(); |
|
|
|
|
} |
|
|
|
|
const uint64_t current_bytes = sub_compact->builder->FileSize(); |
|
|
|
|
if (s.ok()) { |
|
|
|
|
meta->fd.file_size = current_bytes; |
|
|
|
|
} |
|
|
|
|
sub_compact->current_output()->finished = true; |
|
|
|
|
sub_compact->total_bytes += current_bytes; |
|
|
|
|
|
|
|
|
@ -1144,17 +1146,24 @@ Status CompactionJob::FinishCompactionOutputFile( |
|
|
|
|
meta->marked_for_compaction ? " (need compaction)" : ""); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
std::string fname = TableFileName(db_options_.db_paths, meta->fd.GetNumber(), |
|
|
|
|
std::string fname; |
|
|
|
|
FileDescriptor output_fd; |
|
|
|
|
if (meta != nullptr) { |
|
|
|
|
fname = TableFileName(db_options_.db_paths, meta->fd.GetNumber(), |
|
|
|
|
meta->fd.GetPathId()); |
|
|
|
|
output_fd = meta->fd; |
|
|
|
|
} else { |
|
|
|
|
fname = "(nil)"; |
|
|
|
|
} |
|
|
|
|
EventHelpers::LogAndNotifyTableFileCreationFinished( |
|
|
|
|
event_logger_, cfd->ioptions()->listeners, dbname_, cfd->GetName(), fname, |
|
|
|
|
job_id_, meta->fd, tp, TableFileCreationReason::kCompaction, s); |
|
|
|
|
job_id_, output_fd, tp, TableFileCreationReason::kCompaction, s); |
|
|
|
|
|
|
|
|
|
#ifndef ROCKSDB_LITE |
|
|
|
|
// Report new file to SstFileManagerImpl
|
|
|
|
|
auto sfm = |
|
|
|
|
static_cast<SstFileManagerImpl*>(db_options_.sst_file_manager.get()); |
|
|
|
|
if (sfm && meta->fd.GetPathId() == 0) { |
|
|
|
|
if (sfm && meta != nullptr && meta->fd.GetPathId() == 0) { |
|
|
|
|
auto fn = TableFileName(cfd->ioptions()->db_paths, meta->fd.GetNumber(), |
|
|
|
|
meta->fd.GetPathId()); |
|
|
|
|
sfm->OnAddFile(fn); |
|
|
|
|