kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject [3/5] kudu git commit: Rename LogicalClock::NowForMetrics() to GetCurrentTime()
Date Fri, 11 Nov 2016 01:50:27 GMT
Rename LogicalClock::NowForMetrics() to GetCurrentTime()

This renames this method and makes it public. The reasoning is
twofold: NowForMetrics() used to actually increase the clock's
value, which doesn't seem right; It's handy to be able to get
the clock's current value for tests.

Change-Id: Iac6f8dd9e79657b81409127e539e509da4b2b8de
Reviewed-on: http://gerrit.cloudera.org:8080/4989
Tested-by: Kudu Jenkins
Reviewed-by: Jean-Daniel Cryans <jdcryans@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/9c8c0800
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/9c8c0800
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/9c8c0800

Branch: refs/heads/master
Commit: 9c8c08009be80d4ed3b37ca0b0b9f0345eaba7b6
Parents: e640f0e
Author: David Alves <dralves@apache.org>
Authored: Mon Nov 7 20:23:40 2016 -0800
Committer: David Ribeiro Alves <dralves@apache.org>
Committed: Thu Nov 10 18:49:36 2016 +0000

----------------------------------------------------------------------
 src/kudu/server/logical_clock.cc | 5 ++---
 src/kudu/server/logical_clock.h  | 7 ++++---
 2 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/9c8c0800/src/kudu/server/logical_clock.cc
----------------------------------------------------------------------
diff --git a/src/kudu/server/logical_clock.cc b/src/kudu/server/logical_clock.cc
index 7f79d56..ca3a30e 100644
--- a/src/kudu/server/logical_clock.cc
+++ b/src/kudu/server/logical_clock.cc
@@ -85,16 +85,15 @@ LogicalClock* LogicalClock::CreateStartingAt(const Timestamp& timestamp)
{
   return new LogicalClock(timestamp.value() - 1);
 }
 
-uint64_t LogicalClock::NowForMetrics() {
+uint64_t LogicalClock::GetCurrentTime() {
   // We don't want reading metrics to change the clock.
   return NoBarrier_Load(&now_);
 }
 
-
 void LogicalClock::RegisterMetrics(const scoped_refptr<MetricEntity>& metric_entity)
{
   METRIC_logical_clock_timestamp.InstantiateFunctionGauge(
       metric_entity,
-      Bind(&LogicalClock::NowForMetrics, Unretained(this)))
+      Bind(&LogicalClock::GetCurrentTime, Unretained(this)))
     ->AutoDetachToLastValue(&metric_detacher_);
 }
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/9c8c0800/src/kudu/server/logical_clock.h
----------------------------------------------------------------------
diff --git a/src/kudu/server/logical_clock.h b/src/kudu/server/logical_clock.h
index 4de22b5..8f5ac33 100644
--- a/src/kudu/server/logical_clock.h
+++ b/src/kudu/server/logical_clock.h
@@ -64,6 +64,10 @@ class LogicalClock : public Clock {
 
   virtual std::string Stringify(Timestamp timestamp) OVERRIDE;
 
+  // Used to get the timestamp without incrementing the logical component.
+  // Mostly used for tests/metrics.
+  uint64_t GetCurrentTime();
+
   // Logical clock doesn't support COMMIT_WAIT.
   virtual bool SupportsExternalConsistencyMode(ExternalConsistencyMode mode) OVERRIDE {
     return mode != COMMIT_WAIT;
@@ -76,9 +80,6 @@ class LogicalClock : public Clock {
   // Should use LogicalClock::CreatingStartingAt()
   explicit LogicalClock(Timestamp::val_type initial_time) : now_(initial_time) {}
 
-  // Used to get the timestamp for metrics.
-  uint64_t NowForMetrics();
-
   base::subtle::Atomic64 now_;
 
   FunctionGaugeDetacher metric_detacher_;


Mime
View raw message