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


The following commit(s) were added to refs/heads/master by this push:
     new 2095f8c  [tests] fix potential memory leak
2095f8c is described below

commit 2095f8c25ba7973cab360ec4791d939f2c4bf615
Author: Alexey Serbin <[email protected]>
AuthorDate: Thu Jul 30 22:56:51 2020 -0700

    [tests] fix potential memory leak
    
    Fixed memory leak in kudu-tool-test when running calling RunLoadgen()
    multiple times in a test scenario.  For details, see
    
https://gerrit.cloudera.org/#/c/16253/4/src/kudu/tools/kudu-tool-test.cc@2281
    
    Change-Id: Ie2e6132eb4cb027055b1523ff4e89d206d7eb973
    Reviewed-on: http://gerrit.cloudera.org:8080/16265
    Tested-by: Alexey Serbin <[email protected]>
    Reviewed-by: Andrew Wong <[email protected]>
---
 src/kudu/integration-tests/cluster_itest_util.cc | 2 +-
 src/kudu/tools/kudu-tool-test.cc                 | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/kudu/integration-tests/cluster_itest_util.cc 
b/src/kudu/integration-tests/cluster_itest_util.cc
index 0e8551e..26d27c1 100644
--- a/src/kudu/integration-tests/cluster_itest_util.cc
+++ b/src/kudu/integration-tests/cluster_itest_util.cc
@@ -302,11 +302,11 @@ Status WaitUntilAllReplicasHaveOp(const int64_t log_index,
 Status CreateTabletServerMap(const shared_ptr<MasterServiceProxy>& 
master_proxy,
                              const shared_ptr<Messenger>& messenger,
                              unordered_map<string, TServerDetails*>* ts_map) {
+  CHECK(ts_map->empty());
   const MonoDelta kTimeout = MonoDelta::FromSeconds(30);
   vector<ListTabletServersResponsePB_Entry> tservers;
   RETURN_NOT_OK(ListTabletServers(master_proxy, kTimeout, &tservers));
 
-  ts_map->clear();
   for (const auto& entry : tservers) {
     HostPort host_port = HostPortFromPB(entry.registration().rpc_addresses(0));
     vector<Sockaddr> addresses;
diff --git a/src/kudu/tools/kudu-tool-test.cc b/src/kudu/tools/kudu-tool-test.cc
index b51160c..cfc4595 100644
--- a/src/kudu/tools/kudu-tool-test.cc
+++ b/src/kudu/tools/kudu-tool-test.cc
@@ -912,6 +912,7 @@ void 
ToolTest::StartExternalMiniCluster(ExternalMiniClusterOptions opts) {
   cluster_.reset(new ExternalMiniCluster(std::move(opts)));
   ASSERT_OK(cluster_->Start());
   inspect_.reset(new MiniClusterFsInspector(cluster_.get()));
+  STLDeleteValues(&ts_map_);
   ASSERT_OK(CreateTabletServerMap(cluster_->master_proxy(0),
                                   cluster_->messenger(), &ts_map_));
 }

Reply via email to