From 85ef806a941c744c54602fe3539922088a0f1265 Mon Sep 17 00:00:00 2001 From: baixin01 <156997066+baixin01@users.noreply.github.com> Date: Sun, 3 Mar 2024 19:45:30 +0800 Subject: [PATCH] fix not syncing (#2430) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 白鑫 --- src/pika_repl_client_thread.cc | 3 ++- src/pika_server.cc | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pika_repl_client_thread.cc b/src/pika_repl_client_thread.cc index 355b373490..2a7c666d81 100644 --- a/src/pika_repl_client_thread.cc +++ b/src/pika_repl_client_thread.cc @@ -42,7 +42,8 @@ void PikaReplClientThread::ReplClientHandle::FdTimeoutHandle(int fd, const std:: } if (ip == g_pika_server->master_ip() && port == g_pika_server->master_port() + kPortShiftReplServer && PIKA_REPL_ERROR != g_pika_server->repl_state() && - PikaReplicaManager::CheckSlaveDBState(ip, port)) { // if state machine in error state, no retry + PikaReplicaManager::CheckSlaveDBState(ip, port)) { + // if state machine equal to kDBNoConnect(execute cmd 'dbslaveof db no one'), no retry LOG(WARNING) << "Master conn timeout : " << ip_port << " try reconnect"; g_pika_server->ResetMetaSyncStatus(); } diff --git a/src/pika_server.cc b/src/pika_server.cc index fc4944248a..36b47182e8 100644 --- a/src/pika_server.cc +++ b/src/pika_server.cc @@ -601,6 +601,8 @@ int32_t PikaServer::GetSlaveListString(std::string& slave_list_str) { master_boffset.offset - sent_slave_boffset.offset; tmp_stream << "(" << db->DBName() << ":" << lag << ")"; } + } else if (s.ok() && slave_state == SlaveState::kSlaveDbSync){ + tmp_stream << "(" << db->DBName() << ":full syncing)"; } else { tmp_stream << "(" << db->DBName() << ":not syncing)"; }