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 2022/05/10 17:51:26 UTC

[kudu] 02/03: [client] add DISALLOW_COPY_AND_ASSIGN() for a few classes

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 948417a460587a655773ed4bb1869b4bc5aa83f8
Author: Alexey Serbin <al...@apache.org>
AuthorDate: Mon May 9 20:03:08 2022 -0700

    [client] add DISALLOW_COPY_AND_ASSIGN() for a few classes
    
    After making the copy constructor and the assignment operator for the
    ResourceMetrics class private, I took a quick look at the other exported
    classes in the Kudu C++ client API and added corresponding macro
    where appropriate.
    
    Strictly speaking, this change breaks the ABI compatibility for the
    Kudu C++ client API, but a code that would use these privatized members
    was unsafe anyways.  I guess it's easier to fix the linker error after
    upgrading to a newer version of the Kudu client library than have
    a hidden memory corruption problem in a Kudu C++ application.
    
    Change-Id: I5369760db3040c0357517903dab6ff4e2acb7656
    Reviewed-on: http://gerrit.cloudera.org:8080/18511
    Tested-by: Kudu Jenkins
    Reviewed-by: Riza Suminto <ri...@cloudera.com>
    Reviewed-by: Attila Bukor <ab...@apache.org>
---
 src/kudu/client/client.h | 2 ++
 src/kudu/client/schema.h | 5 +++++
 2 files changed, 7 insertions(+)

diff --git a/src/kudu/client/client.h b/src/kudu/client/client.h
index bf94a7b26..65980a075 100644
--- a/src/kudu/client/client.h
+++ b/src/kudu/client/client.h
@@ -3359,6 +3359,8 @@ class KUDU_EXPORT KuduPartitioner {
 
   explicit KuduPartitioner(Data* data);
   Data* data_; // Owned.
+
+  DISALLOW_COPY_AND_ASSIGN(KuduPartitioner);
 };
 
 
diff --git a/src/kudu/client/schema.h b/src/kudu/client/schema.h
index 6791e5674..2fae75907 100644
--- a/src/kudu/client/schema.h
+++ b/src/kudu/client/schema.h
@@ -29,6 +29,7 @@
 #ifdef KUDU_HEADERS_NO_STUBS
 #include <gtest/gtest_prod.h>
 
+#include "kudu/gutil/macros.h"
 #include "kudu/gutil/port.h"
 #else
 #include "kudu/client/stubs.h"
@@ -552,6 +553,8 @@ class KUDU_EXPORT KuduColumnSpec {
 
   // Owned.
   Data* data_;
+
+  DISALLOW_COPY_AND_ASSIGN(KuduColumnSpec);
 };
 
 /// @brief Builder API for constructing a KuduSchema object.
@@ -613,6 +616,8 @@ class KUDU_EXPORT KuduSchemaBuilder {
 
   // Owned.
   Data* data_;
+
+  DISALLOW_COPY_AND_ASSIGN(KuduSchemaBuilder);
 };
 
 /// @brief A representation of a table's schema.