Skip to content

Commit 3956137

Browse files
committed
dcompact_worker: ROCKS_LOG_DEBUG for top stages
1 parent f6bbde8 commit 3956137

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

tools/dcompact/dcompact_worker.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,6 +1091,7 @@ int RunCompact(FILE* in) const {
10911091
WARN("env TOPLINGDB_CACHE_SST_FILE_ITER is true, sst would not be closed asap!");
10921092
}
10931093
mut_dbo.max_open_files = 1; // capacity is not strict
1094+
ROCKS_LOG_DEBUG(info_log, "Initialize workspace VersionSet");
10941095
shared_ptr<Cache> table_cache = NewLRUCache(mut_dbo.max_open_files);
10951096
BlockCacheTracer* block_cache_tracer = nullptr;
10961097
const std::shared_ptr<IOTracer> io_tracer(nullptr);
@@ -1156,6 +1157,7 @@ int RunCompact(FILE* in) const {
11561157
&edit, &mutex, null_dbdir, new_descriptor_log, &cfo);
11571158
VERIFY_STATUS_OK(s);
11581159
}
1160+
ROCKS_LOG_DEBUG(info_log, "Add compaction input SSTs to VersionSet");
11591161
auto cfd = versions->GetColumnFamilySet()->GetColumnFamily(params.cf_id);
11601162
VERIFY_S(nullptr != cfd, "cf: id = %d name = %s", params.cf_id, params.cf_name);
11611163
VERIFY_S_EQ(params.cf_name, cfd->GetName());
@@ -1194,6 +1196,7 @@ int RunCompact(FILE* in) const {
11941196
onelevel.level, attempt_dbname, params.DebugString());
11951197
onelevel.files = std::move(populated_files);
11961198
}
1199+
ROCKS_LOG_DEBUG(info_log, "Construct Compaction object");
11971200
std::string trim_ts = "";
11981201
Compaction compaction(storage_info,
11991202
*cfd->ioptions(), *cfd->GetLatestMutableCFOptions(), mut_dbo, inputs,
@@ -1231,6 +1234,7 @@ int RunCompact(FILE* in) const {
12311234
std::atomic<bool> manual_compaction_canceled{false};
12321235
#endif
12331236
BlobFileCompletionCallback* blob_callback = nullptr;
1237+
ROCKS_LOG_DEBUG(info_log, "Construct CompactionJob object");
12341238
CompactionJob compaction_job(
12351239
params.job_id, &compaction, imm_dbo, mut_dbo, file_options,
12361240
versions.get(),
@@ -1260,6 +1264,7 @@ int RunCompact(FILE* in) const {
12601264
#endif
12611265
blob_callback);
12621266

1267+
ROCKS_LOG_DEBUG(info_log, "Calling compaction_job.Prepare()");
12631268
compaction_job.Prepare();
12641269
MutexUnlock();
12651270
VERIFY_S_EQ(compaction.GetSmallestUserKey(), params.smallest_user_key);
@@ -1273,8 +1278,10 @@ int RunCompact(FILE* in) const {
12731278
input_version->props_of_all_tables_[std::move(fpath)] = props;
12741279
}
12751280
}
1281+
ROCKS_LOG_DEBUG(info_log, "Calling ShowCompactionParams() for start");
12761282
const std::string start_time = StrDateTimeNow();
12771283
ShowCompactionParams(params, cfd->current(), cfd, &start_time);
1284+
ROCKS_LOG_DEBUG(info_log, "Calling compaction_job.Run()");
12781285
{
12791286
Status s1 = compaction_job.Run();
12801287
IOStatus s2 = compaction_job.io_status();
@@ -1313,6 +1320,7 @@ auto writeObjResult = [&]{
13131320
SetResultSerDe1(cfo, table_properties_collector_factories[i]);
13141321
}
13151322
};
1323+
ROCKS_LOG_DEBUG(info_log, "Collecting compaction result");
13161324
vector<vector<const FileMetaData*> > output_files;
13171325
compaction_job.GetSubCompactOutputs(&output_files);
13181326
results->output_files.resize(output_files.size());
@@ -1342,6 +1350,7 @@ auto writeObjResult = [&]{
13421350
imm_dbo.statistics->GetAggregated(results->statistics.tickers,
13431351
results->statistics.histograms);
13441352
auto t1 = pf.now();
1353+
ROCKS_LOG_DEBUG(info_log, "Writing rpc.result");
13451354
results->work_time_usec = pf.us(t0, t1);
13461355
try {
13471356
string outFname = MakePath(attempt_dir, "rpc.results");
@@ -1365,6 +1374,7 @@ auto writeObjResult = [&]{
13651374
fclose(out); // must close before write compact_done_file
13661375
//INFO("after fclose(out)");
13671376
auto t2 = pf.now();
1377+
ROCKS_LOG_DEBUG(info_log, "Calling compaction_job.Install()");
13681378
{
13691379
MutexLock();
13701380
Status s = compaction_job.Install(*cfd->GetLatestMutableCFOptions());
@@ -1384,8 +1394,10 @@ auto writeObjResult = [&]{
13841394
// compact end time
13851395
auto t3 = pf.now();
13861396
const std::string end_time = StrDateTimeNow();
1397+
ROCKS_LOG_DEBUG(info_log, "Calling ShowCompactionParams() for end");
13871398
ShowCompactionParams(params, cfd->current(), cfd, &start_time, &end_time, pf.sf(t0, t3));
13881399
if (!shutting_down.load(std::memory_order_acquire)) {
1400+
ROCKS_LOG_DEBUG(info_log, "Write compact.done");
13891401
std::string compact_done_file = attempt_dir + "/compact.done";
13901402
int fd = ::creat(compact_done_file.c_str(), 0644);
13911403
if (fd < 0) {
@@ -1408,6 +1420,7 @@ auto writeObjResult = [&]{
14081420
}
14091421
//INFO("after close(compact.done)");
14101422
if (!FEE_URL.empty()) {
1423+
ROCKS_LOG_DEBUG(info_log, "Report fee");
14111424
DcompactFeeReport fee;
14121425
fee.provider = CLOUD_PROVIDER;
14131426
fee.dbId = params.db_id;
@@ -1429,6 +1442,7 @@ auto writeObjResult = [&]{
14291442
}
14301443
}
14311444
if (terark::getEnvBool("DEL_WORKER_TEMP_DB", false)) {
1445+
ROCKS_LOG_DEBUG(info_log, "Deleting %s", attempt_dbname.c_str());
14321446
std::error_code ec;
14331447
std::filesystem::remove_all(attempt_dbname, ec);
14341448
// if cur attempt is last attempt, DeleteDir will success
@@ -1443,6 +1457,8 @@ auto writeObjResult = [&]{
14431457
attempt_dbname, params.output_level, pf.sf(t0,t1), pf.mf(t1,t2), pf.mf(t2,t3),
14441458
SizeToString(inputBytes[0]), SizeToString(inputBytes[1]));
14451459
}
1460+
ROCKS_LOG_DEBUG(info_log, "Compaction done");
1461+
log_buffer.FlushBufferToLog();
14461462

14471463
return 0;
14481464
}

0 commit comments

Comments
 (0)