feat(server): add prints on takeover timeout (#2856)

feat server: add prints on takeover timeout

Signed-off-by: adi_holden <adi@dragonflydb.io>
This commit is contained in:
adiholden 2024-04-08 08:52:36 +03:00 committed by GitHub
parent a5ea47f2d9
commit 700fae6a58
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 3 deletions

View file

@ -302,6 +302,9 @@ class Connection : public util::Connection {
// Stops traffic logging in this thread. A noop if the thread is not logging.
static void StopTrafficLogging();
// Get quick debug info for logs
std::string DebugInfo() const;
protected:
void OnShutdown() override;
void OnPreMigrateThread() override;
@ -381,9 +384,6 @@ class Connection : public util::Connection {
// Clear pipelined messages, disaptching only intrusive ones.
void ClearPipelinedMessages();
// Get quick debug info for logs
std::string DebugInfo() const;
std::pair<std::string, std::string> GetClientInfoBeforeAfterTid() const;
protected:

View file

@ -370,7 +370,17 @@ void DflyCmd::TakeOver(CmdArgList args, ConnectionContext* cntx) {
if (!tracker.Wait(timeout_dur)) {
LOG(WARNING) << "Couldn't wait for commands to finish dispatching. " << timeout_dur;
status = OpStatus::TIMED_OUT;
auto cb = [&](unsigned thread_index, util::Connection* conn) {
facade::Connection* dcon = static_cast<facade::Connection*>(conn);
LOG(INFO) << dcon->DebugInfo();
};
for (auto* listener : sf_->GetListeners()) {
listener->TraverseConnections(cb);
}
}
VLOG(1) << "AwaitCurrentDispatches done";
// We have this guard to disable expirations: We don't want any writes to the journal after