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

twice 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 aaf0faf0 Add INFO comment when DB not scaned (#1956)
aaf0faf0 is described below

commit aaf0faf092e9ea5d7519bfcefb71e4e260bcb826
Author: 纪华裕 <[email protected]>
AuthorDate: Wed Jan 3 08:36:44 2024 +0800

    Add INFO comment when DB not scaned (#1956)
    
    Co-authored-by: tison <[email protected]>
    Co-authored-by: Twice <[email protected]>
    Co-authored-by: hulk <[email protected]>
---
 src/server/server.cc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/server/server.cc b/src/server/server.cc
index 231d532d..f8f2fb94 100644
--- a/src/server/server.cc
+++ b/src/server/server.cc
@@ -1169,7 +1169,11 @@ void Server::GetInfo(const std::string &ns, const 
std::string &section, std::str
 
     if (section_cnt++) string_stream << "\r\n";
     string_stream << "# Keyspace\r\n";
-    string_stream << "# Last scan db time: " << std::put_time(&last_scan_tm, 
"%a %b %e %H:%M:%S %Y") << "\r\n";
+    if (last_scan_time == 0) {
+      string_stream << "# WARN: DBSIZE SCAN never performed yet\r\n";
+    } else {
+      string_stream << "# Last DBSIZE SCAN time: " << 
std::put_time(&last_scan_tm, "%a %b %e %H:%M:%S %Y") << "\r\n";
+    }
     string_stream << "db0:keys=" << stats.n_key << ",expires=" << 
stats.n_expires << ",avg_ttl=" << stats.avg_ttl
                   << ",expired=" << stats.n_expired << "\r\n";
     string_stream << "sequence:" << 
storage->GetDB()->GetLatestSequenceNumber() << "\r\n";

Reply via email to