Skip to content

Commit 9b8901f

Browse files
boomballaromange
andauthored
Feat config management (#5388)
* feat(server): config info reporting and config_file rewrite support * feat(server): add process_id field to INFO SERVER output for Redis compatibility - Output process_id (PID) in the INFO SERVER section, matching Redis order and naming. - Use getpid() and ensure <unistd.h> is included for portability. * fixed: Changing the comment language Co-authored-by: Roman Gershman <[email protected]> Signed-off-by: boomballa <[email protected]> The hz flag was defined as int32_t but declared as uint32_t in some files, causing absl::flags to abort at runtime due to type mismatch. This commit unifies all declarations to int32_t, fixing the crash. --------- Signed-off-by: boomballa <[email protected]> Co-authored-by: Roman Gershman <[email protected]>
1 parent b08aabd commit 9b8901f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/server/server_family.cc

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <croncpp.h> // cron::cronexpr
1414
#include <sys/resource.h>
1515
#include <sys/utsname.h>
16+
#include <unistd.h> // for getpid()
1617

1718
#include <algorithm>
1819
#include <chrono>
@@ -140,7 +141,7 @@ ABSL_FLAG(string, availability_zone, "",
140141

141142
ABSL_DECLARE_FLAG(int32_t, port);
142143
ABSL_DECLARE_FLAG(bool, cache_mode);
143-
ABSL_DECLARE_FLAG(uint32_t, hz);
144+
ABSL_DECLARE_FLAG(int32_t, hz);
144145
ABSL_DECLARE_FLAG(bool, tls);
145146
ABSL_DECLARE_FLAG(string, tls_ca_cert_file);
146147
ABSL_DECLARE_FLAG(string, tls_ca_cert_dir);
@@ -2478,6 +2479,8 @@ string ServerFamily::FormatInfoMetrics(const Metrics& m, std::string_view sectio
24782479
append("dragonfly_version", GetVersion());
24792480
append("redis_mode", GetRedisMode());
24802481
append("arch_bits", 64);
2482+
// Add process_id for Redis compatibility (same order as Redis INFO output).
2483+
append("process_id", getpid());
24812484

24822485
if (show_managed_info) {
24832486
append("os", GetOSString());
@@ -2495,6 +2498,11 @@ string ServerFamily::FormatInfoMetrics(const Metrics& m, std::string_view sectio
24952498
uint64_t uptime = time(NULL) - start_time_;
24962499
append("uptime_in_seconds", uptime);
24972500
append("uptime_in_days", uptime / (3600 * 24));
2501+
2502+
append("hz", GetFlag(FLAGS_hz));
2503+
append("executable", base::kProgramName);
2504+
absl::CommandLineFlag* flagfile_flag = absl::FindCommandLineFlag("flagfile");
2505+
append("config_file", flagfile_flag->CurrentValue());
24982506
};
24992507

25002508
auto add_clients_info = [&] {

0 commit comments

Comments
 (0)