You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by al...@apache.org on 2024/11/12 17:50:40 UTC

(kudu) branch master updated (e471f58f7 -> 880641660)

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

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


    from e471f58f7 [consensus] replace chromium atomics with STL ones
     new 4ed31b55f [client] fix doxygen warning
     new 880641660 [client] remove chromium Atomics from C++ client

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/kudu/client/client-internal.cc |  5 +++--
 src/kudu/client/client-internal.h  |  4 ++--
 src/kudu/client/client-test.cc     | 20 +++++++-------------
 src/kudu/client/scan_batch.h       |  2 ++
 4 files changed, 14 insertions(+), 17 deletions(-)


(kudu) 02/02: [client] remove chromium Atomics from C++ client

Posted by al...@apache.org.
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 8806416603d70b14ef0432461fb035a39a5074e0
Author: Alexey Serbin <al...@apache.org>
AuthorDate: Wed Nov 6 19:45:01 2024 -0800

    [client] remove chromium Atomics from C++ client
    
    This patch replaces chromium-derived atomics with STL-based ones,
    but otherwise it doesn't contain any functional modifications.
    
    Change-Id: I0d25fb40d95b12c98bbb82ee0e489e325db1d433
    Reviewed-on: http://gerrit.cloudera.org:8080/22037
    Tested-by: Alexey Serbin <al...@apache.org>
    Reviewed-by: Mahesh Reddy <mr...@cloudera.com>
    Reviewed-by: Yifan Zhang <ch...@163.com>
---
 src/kudu/client/client-internal.cc |  5 +++--
 src/kudu/client/client-internal.h  |  4 ++--
 src/kudu/client/client-test.cc     | 20 +++++++-------------
 3 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/src/kudu/client/client-internal.cc b/src/kudu/client/client-internal.cc
index d57595ee1..9a2237e53 100644
--- a/src/kudu/client/client-internal.cc
+++ b/src/kudu/client/client-internal.cc
@@ -63,6 +63,7 @@
 #include "kudu/security/cert.h"
 #include "kudu/security/tls_context.h"
 #include "kudu/util/async_util.h"
+#include "kudu/util/atomic-utils.h"
 #include "kudu/util/logging.h"
 #include "kudu/util/net/dns_resolver.h"
 #include "kudu/util/net/net_util.h"
@@ -968,11 +969,11 @@ KuduClient::Data::txn_manager_proxy() const {
 }
 
 uint64_t KuduClient::Data::GetLatestObservedTimestamp() const {
-  return latest_observed_timestamp_.Load();
+  return latest_observed_timestamp_.load(std::memory_order_relaxed);
 }
 
 void KuduClient::Data::UpdateLatestObservedTimestamp(uint64_t timestamp) {
-  latest_observed_timestamp_.StoreMax(timestamp);
+  AtomicStoreMax(latest_observed_timestamp_, timestamp);
 }
 
 } // namespace client
diff --git a/src/kudu/client/client-internal.h b/src/kudu/client/client-internal.h
index 6efcd78b3..2bf217794 100644
--- a/src/kudu/client/client-internal.h
+++ b/src/kudu/client/client-internal.h
@@ -16,6 +16,7 @@
 // under the License.
 #pragma once
 
+#include <atomic>
 #include <cstdint>
 #include <functional>
 #include <map>
@@ -34,7 +35,6 @@
 #include "kudu/gutil/ref_counted.h"
 #include "kudu/rpc/rpc_controller.h"
 #include "kudu/rpc/user_credentials.h"
-#include "kudu/util/atomic.h"
 #include "kudu/util/locks.h"
 #include "kudu/util/monotime.h"
 #include "kudu/util/net/net_util.h"
@@ -362,7 +362,7 @@ class KuduClient::Data {
   // in-depth explanation of why this is needed and how it works.
   mutable simple_spinlock leader_master_lock_;
 
-  AtomicInt<uint64_t> latest_observed_timestamp_;
+  std::atomic<uint64_t> latest_observed_timestamp_;
 
  private:
   DISALLOW_COPY_AND_ASSIGN(Data);
diff --git a/src/kudu/client/client-test.cc b/src/kudu/client/client-test.cc
index d6e118879..9f4162230 100644
--- a/src/kudu/client/client-test.cc
+++ b/src/kudu/client/client-test.cc
@@ -78,7 +78,6 @@
 #include "kudu/common/wire_protocol.h"
 #include "kudu/common/wire_protocol.pb.h"
 #include "kudu/consensus/metadata.pb.h"
-#include "kudu/gutil/atomicops.h"
 #include "kudu/gutil/casts.h"
 #include "kudu/gutil/integral_types.h"
 #include "kudu/gutil/map-util.h"
@@ -206,10 +205,6 @@ METRIC_DECLARE_histogram(handler_latency_kudu_master_MasterService_GetTableSchem
 METRIC_DECLARE_histogram(handler_latency_kudu_master_MasterService_GetTabletLocations);
 METRIC_DECLARE_histogram(handler_latency_kudu_tserver_TabletServerService_Scan);
 
-using base::subtle::Atomic32;
-using base::subtle::NoBarrier_AtomicIncrement;
-using base::subtle::NoBarrier_Load;
-using base::subtle::NoBarrier_Store;
 using google::protobuf::util::MessageDifferencer;
 using kudu::cluster::InternalMiniCluster;
 using kudu::cluster::InternalMiniClusterOptions;
@@ -6100,16 +6095,16 @@ TEST_F(ClientTest, TestMasterLookupPermits) {
 namespace {
 class DLSCallback : public KuduStatusCallback {
  public:
-  explicit DLSCallback(Atomic32* i) : i_(i) {
+  explicit DLSCallback(atomic<uint32_t>* i) : i_(i) {
   }
 
   void Run(const Status& s) override {
     CHECK_OK(s);
-    NoBarrier_AtomicIncrement(i_, 1);
+    i_->fetch_add(1, std::memory_order_relaxed);
     delete this;
   }
  private:
-  Atomic32* const i_;
+  atomic<uint32_t>* const i_;
 };
 
 // Returns col1 value of first row.
@@ -6214,9 +6209,8 @@ TEST_F(ClientTest, TestDeadlockSimulation) {
   }
 
   // Run async calls - one thread updates sequentially, another in reverse.
-  Atomic32 ctr1, ctr2;
-  NoBarrier_Store(&ctr1, 0);
-  NoBarrier_Store(&ctr2, 0);
+  atomic<uint32_t> ctr1(0);
+  atomic<uint32_t> ctr2(0);
   for (int i = 0; i < kNumSessions; ++i) {
     // The callbacks are freed after they are invoked.
     fwd_sessions[i]->FlushAsync(new DLSCallback(&ctr1));
@@ -6226,8 +6220,8 @@ TEST_F(ClientTest, TestDeadlockSimulation) {
   // Spin while waiting for ops to complete.
   int lctr1, lctr2, prev1 = 0, prev2 = 0;
   do {
-    lctr1 = NoBarrier_Load(&ctr1);
-    lctr2 = NoBarrier_Load(&ctr2);
+    lctr1 = ctr1.load(std::memory_order_relaxed);
+    lctr2 = ctr2.load(std::memory_order_relaxed);
     // Display progress in 10% increments.
     if (prev1 == 0 || lctr1 + lctr2 - prev1 - prev2 > kNumSessions / 10) {
       LOG(INFO) << "# updates: " << lctr1 << " fwd, " << lctr2 << " rev";


(kudu) 01/02: [client] fix doxygen warning

Posted by al...@apache.org.
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 4ed31b55ff39bd75465fc17f725f130f1a2167e1
Author: Alexey Serbin <al...@apache.org>
AuthorDate: Fri Nov 8 17:14:38 2024 -0800

    [client] fix doxygen warning
    
    Before this patch, doxygen of 1.11 and newer versions would output
    the following warnings when generating documentation for Kudu C++
    client API:
    
      scan_batch.h:163: warning: Compound kudu::client::KuduScanBatch::RowPtr is not documented.
      scan_batch.h:378: warning: Compound kudu::client::KuduScanBatch::const_iterator is not documented.
    
    Change-Id: I07c51acf8cb9d0a314731781c177ea8f7b4f9889
    Reviewed-on: http://gerrit.cloudera.org:8080/22048
    Tested-by: Alexey Serbin <al...@apache.org>
    Reviewed-by: Abhishek Chennaka <ac...@cloudera.com>
---
 src/kudu/client/scan_batch.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/kudu/client/scan_batch.h b/src/kudu/client/scan_batch.h
index cef7f7609..2259df6f1 100644
--- a/src/kudu/client/scan_batch.h
+++ b/src/kudu/client/scan_batch.h
@@ -160,6 +160,7 @@ class KUDU_EXPORT KuduScanBatch {
   DISALLOW_COPY_AND_ASSIGN(KuduScanBatch);
 };
 
+/// @brief A handle for a single row in @c KuduScanBatch
 class KUDU_EXPORT KuduScanBatch::RowPtr {
  public:
   /// Construct an invalid RowPtr. Before use, you must assign
@@ -375,6 +376,7 @@ class KUDU_EXPORT KuduScanBatch::RowPtr {
 // required by the STL iterator traits, the deprecation warnings are silenced.
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+/// @brief Iterator to work with immutable KuduScanBatch instances
 class KUDU_EXPORT KuduScanBatch::const_iterator
     : public std::iterator<std::forward_iterator_tag, KuduScanBatch::RowPtr> {
  public: