Skip to content

Commit

Permalink
slave push slowlog entry in memory if necessary (OpenAtomFoundation#522)
Browse files Browse the repository at this point in the history
  • Loading branch information
Axlgrep authored Mar 6, 2019
1 parent 751151a commit 1889fe6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/pika_binlog_bgworker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,13 @@ void BinlogBGWorker::DoBinlogBG(void* arg) {
g_pika_server->mutex_record_.Unlock(argv[1]);
}
if (g_pika_conf->slowlog_slower_than() >= 0) {
int32_t start_time = start_us / 1000000;
int64_t duration = slash::NowMicros() - start_us;
if (g_pika_conf->slowlog_write_errorlog()
&& duration > g_pika_conf->slowlog_slower_than()) {
LOG(ERROR) << "command: " << opt << ", start_time(s): " << start_us / 1000000 << ", duration(us): " << duration;
if (duration > g_pika_conf->slowlog_slower_than()) {
g_pika_server->SlowlogPushEntry(argv, start_time, duration);
if (g_pika_conf->slowlog_write_errorlog()) {
LOG(ERROR) << "command: " << opt << ", start_time(s): " << start_us / 1000000 << ", duration(us): " << duration;
}
}
}

Expand Down

0 comments on commit 1889fe6

Please sign in to comment.