kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [1/2] kudu git commit: [MonoTime] use operator '<' instead of ComesBefore
Date Tue, 15 Nov 2016 22:15:10 GMT
Repository: kudu
Updated Branches:
  refs/heads/master 866e861d0 -> 11ae3171c


[MonoTime] use operator '<' instead of ComesBefore

To bring better readability and please syntactic sugar addicts, use
operator '<' instead of MonoTime::ComesBefore().

This change does not contain functional changes.

Change-Id: I09f134241825aa19cea95bfa9e678cb3abae8807
Reviewed-on: http://gerrit.cloudera.org:8080/5086
Reviewed-by: Todd Lipcon <todd@apache.org>
Tested-by: Alexey Serbin <aserbin@cloudera.com>


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

Branch: refs/heads/master
Commit: af14f44c84d09183838ed26e1e1fb132750773c0
Parents: 866e861
Author: Alexey Serbin <aserbin@cloudera.com>
Authored: Mon Nov 14 21:08:02 2016 -0800
Committer: Alexey Serbin <aserbin@cloudera.com>
Committed: Tue Nov 15 19:03:17 2016 +0000

----------------------------------------------------------------------
 src/kudu/integration-tests/master-stress-test.cc | 2 +-
 src/kudu/integration-tests/tablet_copy-itest.cc  | 4 ++--
 src/kudu/rpc/exactly_once_rpc-test.cc            | 4 ++--
 src/kudu/rpc/result_tracker.cc                   | 4 ++--
 src/kudu/tserver/tablet_copy_service.cc          | 4 ++--
 5 files changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/af14f44c/src/kudu/integration-tests/master-stress-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/master-stress-test.cc b/src/kudu/integration-tests/master-stress-test.cc
index 875d901..a9b362c 100644
--- a/src/kudu/integration-tests/master-stress-test.cc
+++ b/src/kudu/integration-tests/master-stress-test.cc
@@ -289,7 +289,7 @@ class MasterStressTest : public KuduTest {
     deadline.AddDelta(MonoDelta::FromSeconds(FLAGS_num_seconds_to_run));
 
     MonoTime now(MonoTime::Now());
-    while (now.ComesBefore(deadline)) {
+    while (now < deadline) {
       ExternalMaster* master = cluster_->master(
           rand_.Uniform(cluster_->num_masters()));
       master->Shutdown();

http://git-wip-us.apache.org/repos/asf/kudu/blob/af14f44c/src/kudu/integration-tests/tablet_copy-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/tablet_copy-itest.cc b/src/kudu/integration-tests/tablet_copy-itest.cc
index 0f97efa..b201d0a 100644
--- a/src/kudu/integration-tests/tablet_copy-itest.cc
+++ b/src/kudu/integration-tests/tablet_copy-itest.cc
@@ -218,7 +218,7 @@ TEST_F(TabletCopyITest, TestRejectRogueLeader) {
   // Loop for a few seconds to ensure that the tablet doesn't transition to READY.
   MonoTime deadline = MonoTime::Now();
   deadline.AddDelta(MonoDelta::FromSeconds(5));
-  while (MonoTime::Now().ComesBefore(deadline)) {
+  while (MonoTime::Now() < deadline) {
     ASSERT_OK(itest::ListTablets(ts, timeout, &tablets));
     ASSERT_EQ(1, tablets.size());
     ASSERT_EQ(TABLET_DATA_TOMBSTONED, tablets[0].tablet_status().tablet_data_state());
@@ -244,7 +244,7 @@ TEST_F(TabletCopyITest, TestRejectRogueLeader) {
   // Wait another few seconds to be sure the tablet copy is rejected.
   deadline = MonoTime::Now();
   deadline.AddDelta(MonoDelta::FromSeconds(5));
-  while (MonoTime::Now().ComesBefore(deadline)) {
+  while (MonoTime::Now() < deadline) {
     ASSERT_OK(itest::ListTablets(ts, timeout, &tablets));
     ASSERT_EQ(1, tablets.size());
     ASSERT_EQ(TABLET_DATA_TOMBSTONED, tablets[0].tablet_status().tablet_data_state());

http://git-wip-us.apache.org/repos/asf/kudu/blob/af14f44c/src/kudu/rpc/exactly_once_rpc-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/exactly_once_rpc-test.cc b/src/kudu/rpc/exactly_once_rpc-test.cc
index 0eacd42..707d06e 100644
--- a/src/kudu/rpc/exactly_once_rpc-test.cc
+++ b/src/kudu/rpc/exactly_once_rpc-test.cc
@@ -255,7 +255,7 @@ class ExactlyOnceRpcTest : public RpcTestBase {
     MonoTime run_until = MonoTime::Now();
     run_until.AddDelta(run_for);
     int counter = 0;
-    while (MonoTime::Now().ComesBefore(run_until)) {
+    while (MonoTime::Now() < run_until) {
       unique_ptr<RetriableRpcExactlyOnceAdder> adder(new RetriableRpcExactlyOnceAdder(
           test_picker_, request_tracker_, client_messenger_, 1,
           rand() % (2 * FLAGS_remember_responses_ttl_ms)));
@@ -293,7 +293,7 @@ class ExactlyOnceRpcTest : public RpcTestBase {
     // but we should get a new response.
     bool result_gced = false;
     bool client_gced = false;
-    while (MonoTime::Now().ComesBefore(run_until)) {
+    while (MonoTime::Now() < run_until) {
       ExactlyOnceResponsePB response;
       Status s = MakeAddCall(sequence_number, 0, &response);
       if (s.ok()) {

http://git-wip-us.apache.org/repos/asf/kudu/blob/af14f44c/src/kudu/rpc/result_tracker.cc
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/result_tracker.cc b/src/kudu/rpc/result_tracker.cc
index 2638492..0f22d66 100644
--- a/src/kudu/rpc/result_tracker.cc
+++ b/src/kudu/rpc/result_tracker.cc
@@ -454,7 +454,7 @@ void ResultTracker::GCResults() {
   // If we've heard from a client recently, but some of its responses are old, GC those responses.
   for (auto iter = clients_.begin(); iter != clients_.end();) {
     auto& client_state = iter->second;
-    if (client_state->last_heard_from.ComesBefore(time_to_gc_clients_from)) {
+    if (client_state->last_heard_from < time_to_gc_clients_from) {
       // Client should be GCed.
       bool ongoing_request = false;
       client_state->GCCompletionRecords(
@@ -479,7 +479,7 @@ void ResultTracker::GCResults() {
           mem_tracker_,
           [&] (SequenceNumber, CompletionRecord* completion_record) {
             return completion_record->state != RpcState::IN_PROGRESS &&
-                completion_record->last_updated.ComesBefore(time_to_gc_responses_from);
+                completion_record->last_updated < time_to_gc_responses_from;
           });
       ++iter;
     }

http://git-wip-us.apache.org/repos/asf/kudu/blob/af14f44c/src/kudu/tserver/tablet_copy_service.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/tablet_copy_service.cc b/src/kudu/tserver/tablet_copy_service.cc
index caf35b5..571f2d6 100644
--- a/src/kudu/tserver/tablet_copy_service.cc
+++ b/src/kudu/tserver/tablet_copy_service.cc
@@ -333,13 +333,13 @@ Status TabletCopyServiceImpl::DoEndTabletCopySessionUnlocked(
 void TabletCopyServiceImpl::EndExpiredSessions() {
   do {
     MutexLock l(sessions_lock_);
-    MonoTime now = MonoTime::Now();
+    const MonoTime now = MonoTime::Now();
 
     vector<string> expired_session_ids;
     for (const MonoTimeMap::value_type& entry : session_expirations_) {
       const string& session_id = entry.first;
       const MonoTime& expiration = entry.second;
-      if (expiration.ComesBefore(now)) {
+      if (expiration < now) {
         expired_session_ids.push_back(session_id);
       }
     }


Mime
View raw message