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 2020/11/10 00:48:02 UTC

[kudu] branch master updated (5faf797 -> 75bb0ea)

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 5faf797  KUDU-1563 Use DELETE_IGNORE in KuduRestore job
     new 3c6438d  [tool] fix tpch1 overlapped flag table_name
     new 75bb0ea  [client] use make_shared for a few call sites

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/benchmarks/tpch/tpch1.cc  |  9 +++++----
 src/kudu/client/client-internal.cc |  5 +++--
 src/kudu/client/meta_cache.cc      | 12 ++++++++----
 src/kudu/client/meta_cache.h       |  4 +---
 4 files changed, 17 insertions(+), 13 deletions(-)


[kudu] 01/02: [tool] fix tpch1 overlapped flag table_name

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 3c6438d94b9d71ad97c15b8b44893631fe4b66a9
Author: ningw <19...@gmail.com>
AuthorDate: Tue Nov 3 17:45:03 2020 +0800

    [tool] fix tpch1 overlapped flag table_name
    
    ERROR: flag 'table_name' was defined more than once
    (in files '/data/src/kudu/tools/tool_action_common.cc' and '/data/src/kudu/benchmarks/tpch/tpch1.cc').
    
    Change-Id: I7adda247007ba5f3af52aa33603f719b99c0d4b2
    Reviewed-on: http://gerrit.cloudera.org:8080/16693
    Tested-by: Kudu Jenkins
    Reviewed-by: Bankim Bhavsar <ba...@cloudera.com>
---
 src/kudu/benchmarks/tpch/tpch1.cc | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/kudu/benchmarks/tpch/tpch1.cc b/src/kudu/benchmarks/tpch/tpch1.cc
index 3471602..34231c7 100644
--- a/src/kudu/benchmarks/tpch/tpch1.cc
+++ b/src/kudu/benchmarks/tpch/tpch1.cc
@@ -104,8 +104,7 @@ DEFINE_int32(tpch_max_batch_size, 1000,
              "Maximum number of inserts/updates to batch at once.  Set to 0 "
              "to delegate the batching control to the logic of the "
              "KuduSession running in AUTO_BACKGROUND_MODE flush mode.");
-DEFINE_string(table_name, "lineitem",
-              "The table name to write/read");
+DECLARE_string(table_name);
 
 using kudu::client::KuduRowResult;
 using std::string;
@@ -132,7 +131,7 @@ struct SliceMapKey {
 
   // This copies the string out of the result buffer
   void RelocateSlice() {
-    auto buf = new uint8_t[slice.size()];
+    auto* buf = new uint8_t[slice.size()];
     slice.relocate(buf);
   }
 
@@ -273,8 +272,10 @@ int main(int argc, char **argv) {
     master_address = FLAGS_master_address;
   }
 
+  string tpch_table_name = FLAGS_table_name.empty() ? "lineitem" : FLAGS_table_name;
+
   unique_ptr<kudu::RpcLineItemDAO> dao(new kudu::RpcLineItemDAO(
-      master_address, FLAGS_table_name, FLAGS_tpch_max_batch_size,
+      master_address, std::move(tpch_table_name), FLAGS_tpch_max_batch_size,
       /* timeout_ms = */ 5000, kudu::RpcLineItemDAO::RANGE,
       /* num_buckets = */ 1));
   dao->Init();


[kudu] 02/02: [client] use make_shared for a few call sites

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 75bb0ea1b1a543a32d87b0f14671aa9eb7571dfb
Author: Alexey Serbin <al...@apache.org>
AuthorDate: Mon Nov 9 12:19:09 2020 -0800

    [client] use make_shared for a few call sites
    
    This changelist replaces std::shared_ptr<X> x = new X(...)
    with std::shared_ptr<X> x = std::make_shared<X>(...) in a few places in
    Kudu C++ client.  The latter form is better from the standpoint
    of memory allocations count, as described at
    
      https://en.cppreference.com/w/cpp/memory/shared_ptr/make_shared#Notes
    
    I also modernized the code in updated files a bit.
    
    Change-Id: I0c1b8bdfffec596db6a262c195cc94796d1bc1d5
    Reviewed-on: http://gerrit.cloudera.org:8080/16703
    Tested-by: Kudu Jenkins
    Reviewed-by: Mahesh Reddy <mr...@cloudera.com>
    Reviewed-by: Bankim Bhavsar <ba...@cloudera.com>
---
 src/kudu/client/client-internal.cc |  5 +++--
 src/kudu/client/meta_cache.cc      | 12 ++++++++----
 src/kudu/client/meta_cache.h       |  4 +---
 3 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/src/kudu/client/client-internal.cc b/src/kudu/client/client-internal.cc
index 26fd9c9..a55e5aa 100644
--- a/src/kudu/client/client-internal.cc
+++ b/src/kudu/client/client-internal.cc
@@ -560,7 +560,7 @@ Status KuduClient::Data::GetTableSchema(KuduClient* client,
   rpc.SendRpc();
   RETURN_NOT_OK(sync.Wait());
   // Parse the server schema out of the response.
-  unique_ptr<Schema> new_schema(new Schema());
+  unique_ptr<Schema> new_schema(new Schema);
   RETURN_NOT_OK(SchemaFromPB(resp.schema(), new_schema.get()));
 
   // Parse the server partition schema out of the response.
@@ -662,7 +662,8 @@ void KuduClient::Data::ConnectedToClusterCb(
       location_ = connect_response.client_location();
       cluster_id_ = connect_response.cluster_id();
 
-      master_proxy_.reset(new MasterServiceProxy(messenger_, leader_addr, leader_hostname));
+      master_proxy_ = std::make_shared<MasterServiceProxy>(
+          messenger_, leader_addr, leader_hostname);
       master_proxy_->set_user_credentials(user_credentials_);
     }
   }
diff --git a/src/kudu/client/meta_cache.cc b/src/kudu/client/meta_cache.cc
index 5e3d110..3abf7ab 100644
--- a/src/kudu/client/meta_cache.cc
+++ b/src/kudu/client/meta_cache.cc
@@ -115,12 +115,16 @@ void RemoteTabletServer::DnsResolutionFinished(const HostPort& hp,
 
   VLOG(1) << "Successfully resolved " << hp.ToString() << ": "
           << (*addrs)[0].ToString();
+  auto proxy = std::make_shared<TabletServerServiceProxy>(
+        client->data_->messenger_, (*addrs)[0], hp.host());
+  proxy->set_user_credentials(client->data_->user_credentials_);
+  auto admin_proxy = std::make_shared<TabletServerAdminServiceProxy>(
+        client->data_->messenger_, (*addrs)[0], hp.host());
 
   {
     std::lock_guard<simple_spinlock> l(lock_);
-    proxy_.reset(new TabletServerServiceProxy(client->data_->messenger_, (*addrs)[0], hp.host()));
-    admin_proxy_.reset(
-        new TabletServerAdminServiceProxy(client->data_->messenger_, (*addrs)[0], hp.host()));
+    proxy_ = std::move(proxy);
+    admin_proxy_ = std::move(admin_proxy);
     proxy_->set_user_credentials(client->data_->user_credentials_);
   }
   user_callback(s);
@@ -144,7 +148,7 @@ void RemoteTabletServer::InitProxy(KuduClient* client, const StatusCallback& cb)
     hp = rpc_hostports_[0];
   }
 
-  auto addrs = new vector<Sockaddr>();
+  auto addrs = new vector<Sockaddr>;
 
   if (FLAGS_client_use_unix_domain_sockets && unix_domain_socket_path_ &&
       client->data_->IsLocalHostPort(hp)) {
diff --git a/src/kudu/client/meta_cache.h b/src/kudu/client/meta_cache.h
index 9daa8e5..d7e8481 100644
--- a/src/kudu/client/meta_cache.h
+++ b/src/kudu/client/meta_cache.h
@@ -16,8 +16,7 @@
 // under the License.
 //
 // This module is internal to the client and not a public API.
-#ifndef KUDU_CLIENT_META_CACHE_H
-#define KUDU_CLIENT_META_CACHE_H
+#pragma once
 
 #include <atomic>
 #include <map>
@@ -530,4 +529,3 @@ class MetaCache : public RefCountedThreadSafe<MetaCache> {
 } // namespace internal
 } // namespace client
 } // namespace kudu
-#endif /* KUDU_CLIENT_META_CACHE_H */