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

alexey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit c96a8377038e4dea7ebafb2afe6afe1fb8da245d
Author: Alexey Serbin <[email protected]>
AuthorDate: Wed Aug 9 14:48:56 2023 -0700

    [clock] clearer logging on the hybrid clock time source
    
    This patch updates the logging messages about the time source used
    for the hybrid clock's initialization.
    
    Prior to this patch, it could be reported that the system auto-selected
    a particular time source, but in fact the effective time source would be
    specified explicitly via the --time_source flag and it was not 'auto',
    so the time source auto-selection hadn't been involved at all.  That's
    confusing, so here is a fix.
    
    Change-Id: Ib1bdd13cd2894954002a79258a46aeaee1a44fcf
    Reviewed-on: http://gerrit.cloudera.org:8080/20337
    Tested-by: Kudu Jenkins
    Reviewed-by: Abhishek Chennaka <[email protected]>
---
 src/kudu/clock/hybrid_clock.cc | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/kudu/clock/hybrid_clock.cc b/src/kudu/clock/hybrid_clock.cc
index eab378c55..820d93c4e 100644
--- a/src/kudu/clock/hybrid_clock.cc
+++ b/src/kudu/clock/hybrid_clock.cc
@@ -260,8 +260,6 @@ Status HybridClock::Init() {
   TimeSource time_source = TimeSource::UNKNOWN;
   RETURN_NOT_OK(SelectTimeSource(
       FLAGS_time_source, &time_source, instance_metadata_.get()));
-  LOG(INFO) << Substitute("auto-selected time source: $0",
-                          TimeSourceToString(time_source));
   return InitWithTimeSource(time_source);
 }
 
@@ -560,6 +558,8 @@ Status HybridClock::SelectTimeSource(const string& 
time_source_str,
     SetCommandLineOptionWithMode("time_source",
                                  TimeSourceToString(result_time_source),
                                  FlagSettingMode::SET_FLAGS_DEFAULT);
+    LOG(INFO) << Substitute("auto-selected time source '$0' for the hybrid 
clock",
+                            TimeSourceToString(result_time_source));
   } else if (iequals(time_source_str, TIME_SOURCE_MOCK)) {
     result_time_source = TimeSource::MOCK;
 #if defined(KUDU_HAS_SYSTEM_TIME_SOURCE)
@@ -581,6 +581,8 @@ Status HybridClock::SelectTimeSource(const string& 
time_source_str,
 Status HybridClock::InitWithTimeSource(TimeSource time_source) {
   DCHECK_EQ(kNotInitialized, state_);
 
+  LOG(INFO) << Substitute("initializing the hybrid clock with '$0' time 
source",
+                          TimeSourceToString(time_source));
   switch (time_source) {
     case TimeSource::NTP_SYNC_BUILTIN:
       time_service_.reset(new clock::BuiltInNtp(metric_entity_));
@@ -597,7 +599,7 @@ Status HybridClock::InitWithTimeSource(TimeSource 
time_source) {
       time_service_.reset(new clock::MockNtp);
       break;
     default:
-      return Status::InvalidArgument("invalid time source for hybrid clock",
+      return Status::InvalidArgument("invalid time source for the hybrid 
clock",
                                      TimeSourceToString(time_source));
   }
   if (FLAGS_hybrid_clock_inject_init_delay_ms > 0) {

Reply via email to