Skip to content

Commit

Permalink
Add more logs (#195)
Browse files Browse the repository at this point in the history
  • Loading branch information
greensky00 authored Feb 5, 2025
1 parent 4eea0a0 commit 59650dc
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/cmd_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ std::string CmdHandler::hTableInfo(DBWrap* target_dbw,
ss << " space by index: " << t_stats.numIndexNodes << " nodes, "
<< t_stats.numIndexNodes * 4096 << " / " << t_stats.workingSetSizeByte
<< ", " << std::fixed << std::setprecision(1) << space_perc
<< "%%\n";
<< "%\n";

ss << " block reuse cycle: " << t_stats.blockReuseCycle << "\n";
ss << " status: " << t_info->status.load() << "\n";
Expand Down
31 changes: 31 additions & 0 deletions src/db_mgr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,40 @@ void DBMgr::printGlobalConfig() {
_log_info(myLog, "idle time compaction disabled");
}

if (gConfig.ltOpt.maxSleepTimeMs) {
_log_info(myLog, "global log throttling enabled, "
"start and limit: %u, %u, "
"max sleep time %u ms",
gConfig.ltOpt.startNumLogs,
gConfig.ltOpt.limitNumLogs,
gConfig.ltOpt.maxSleepTimeMs);
} else {
_log_info(myLog, "global log throttling disabled");
}

_log_info(myLog, "compaction throttling resolution %zu ms factor %zu",
gConfig.ctOpt.resolution_ms,
gConfig.ctOpt.throttlingFactor);

_log_info(myLog, "num flusher threads %zu, sleep time %zu ms, "
"dedicated flusher for async reqs %zu, "
"min records to flush %zu, min log files to flush %zu",
gConfig.numFlusherThreads,
gConfig.flusherSleepDuration_ms,
gConfig.numDedicatedFlusherForAsyncReqs,
gConfig.flusherMinRecordsToTrigger,
gConfig.flusherMinLogFilesToTrigger);

_log_info(myLog, "num compactor threads %zu, "
"num table writers %zu, "
"sleep time %zu ms",
gConfig.numCompactorThreads,
gConfig.numTableWriters,
gConfig.compactorSleepDuration_ms);

_log_info(myLog, "fdb cache size %zu, memtable flush buffer size %zu",
gConfig.fdbCacheSize,
gConfig.memTableFlushBufferSize);
}

void DBMgr::initInternal(const GlobalConfig& config) {
Expand Down
11 changes: 11 additions & 0 deletions src/worker_mgr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ limitations under the License.

#include "worker_mgr.h"

#include "db_mgr.h"

#include _MACRO_TO_STR(LOGGER_H)

namespace jungle {

WorkerBase::WorkerBase()
Expand All @@ -37,6 +41,11 @@ void WorkerBase::loop(WorkerOptions* opt) {
pthread_setname_np(pthread_self(), thread_name.c_str());
#endif

DBMgr* dbm = DBMgr::getWithoutInit();
SimpleLogger* my_log = dbm->getLogger();

_log_info(my_log, "worker %s initiated", worker->workerName.c_str());

for (;;) {
// Sleep if IDLE or STOP.
if ( (worker->status == IDLE || worker->status == STOP) &&
Expand Down Expand Up @@ -64,6 +73,8 @@ void WorkerBase::loop(WorkerOptions* opt) {
}
}
worker->status = NO_INSTANCE;

_log_info(my_log, "worker %s terminated", worker->workerName.c_str());
}

void WorkerBase::run() {
Expand Down

0 comments on commit 59650dc

Please sign in to comment.