This is an automated email from the ASF dual-hosted git repository.

git-hulk pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/kvrocks.git


The following commit(s) were added to refs/heads/unstable by this push:
     new 71f3810d1 fix(server): report replication status in INFO during 
loading (#3720)
71f3810d1 is described below

commit 71f3810d1b8cfd4a8ca867b0fca6659e3d863ad2
Author: hulk <[email protected]>
AuthorDate: Thu Oct 29 11:37:24 2026 +0800

    fix(server): report replication status in INFO during loading (#3720)
    
    INFO omits the entire replication section while a replica is loading
    its database during full synchronization. This hides its role, master
    address, and replication state even though ROLE can still report them.
    
    When INFO runs after SLAVEOF but before loading finishes, the role is
    missing despite the server already being a replica.
    
    Keep the role, master host and port, and replication status available
    during loading, while continuing to omit fields that require the
    database.
    
    Reference: [CI
    
failure](https://github.com/apache/kvrocks/actions/runs/39933290371/job/120353734258)
    
    Assistant-By GPT-6
---
 src/server/server.cc | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/server/server.cc b/src/server/server.cc
index 7842c5a81..ff898a99e 100644
--- a/src/server/server.cc
+++ b/src/server/server.cc
@@ -1281,9 +1281,8 @@ Server::InfoEntries Server::GetMemoryInfo() {
 
 Server::InfoEntries Server::GetReplicationInfo() {
   InfoEntries entries;
-  if (is_loading_) return entries;
-
   entries.emplace_back("role", (IsSlave() ? "slave" : "master"));
+
   if (IsSlave()) {
     int64_t now_secs = util::GetTimeStamp<std::chrono::seconds>();
     entries.emplace_back("master_host", master_host_);
@@ -1292,11 +1291,15 @@ Server::InfoEntries Server::GetReplicationInfo() {
     entries.emplace_back("master_link_status", (state == kReplConnected ? "up" 
: "down"));
     entries.emplace_back("master_sync_unrecoverable_error", (state == 
kReplError ? "yes" : "no"));
     entries.emplace_back("master_sync_in_progress", (state == kReplFetchMeta 
|| state == kReplFetchSST));
+    if (is_loading_) return entries;
+
     entries.emplace_back("master_last_io_seconds_ago", now_secs - 
replication_thread_->LastIOTimeSecs());
     entries.emplace_back("slave_repl_offset", storage->LatestSeqNumber());
     entries.emplace_back("slave_priority", config_->slave_priority);
   }
 
+  if (is_loading_) return entries;
+
   int idx = 0;
 
   {

Reply via email to