You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by to...@apache.org on 2017/06/13 16:10:19 UTC

[1/5] kudu git commit: maintenance_manager: allow runtime disabling via flag

Repository: kudu
Updated Branches:
  refs/heads/master be62673d9 -> 50c7d3249


maintenance_manager: allow runtime disabling via flag

This should fix a flake in alter_table-test that was causing failures
about 0.3% of the time when I looped it (and worse than that in the
normal test environment).

The issue was that this test sets FLAGS_enable_maintenance_manager to
false at runtime, and then manually triggers compaction operations and
asserts on the results. In commit 40aa4c3c271c9df20a1 I "fixed" the flag
to only be checked at startup rather than in each iteration of the
maintenance scheduler.

Several other tests also set this flag to false, so it's possible this
will reduce other flakiness as well.

After the fix I looped alter_table-test 2000 times in ASAN with no
failures. Prior to it, it failed 3/1000.

Change-Id: I2207c9674fc1016253af038fc8fa8a14d2bb45a0
Reviewed-on: http://gerrit.cloudera.org:8080/7164
Tested-by: Kudu Jenkins
Reviewed-by: Mike Percy <mp...@apache.org>


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

Branch: refs/heads/master
Commit: 9533c57e8b487f09d2a933545280e9ff1e42fbef
Parents: be62673
Author: Todd Lipcon <to...@apache.org>
Authored: Mon Jun 12 17:52:29 2017 -0700
Committer: Todd Lipcon <to...@apache.org>
Committed: Tue Jun 13 02:06:45 2017 +0000

----------------------------------------------------------------------
 src/kudu/util/maintenance_manager.cc | 7 ++++++-
 src/kudu/util/maintenance_manager.h  | 4 ++++
 2 files changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/9533c57e/src/kudu/util/maintenance_manager.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/maintenance_manager.cc b/src/kudu/util/maintenance_manager.cc
index b410646..4bcd888 100644
--- a/src/kudu/util/maintenance_manager.cc
+++ b/src/kudu/util/maintenance_manager.cc
@@ -209,6 +209,10 @@ void MaintenanceManager::UnregisterOp(MaintenanceOp* op) {
   op->manager_.reset();
 }
 
+bool MaintenanceManager::disabled_for_tests() const {
+  return !ANNOTATE_UNPROTECTED_READ(FLAGS_enable_maintenance_manager);
+}
+
 void MaintenanceManager::RunSchedulerThread() {
   if (!FLAGS_enable_maintenance_manager) {
     LOG(INFO) << "Maintenance manager is disabled. Stopping thread.";
@@ -227,7 +231,8 @@ void MaintenanceManager::RunSchedulerThread() {
     //    1) there are no free threads available to perform a maintenance op.
     // or 2) we just tried to schedule an op but found nothing to run.
     // However, if it's time to shut down, we want to do so immediately.
-    while ((running_ops_ >= num_threads_ || prev_iter_found_no_work) && !shutdown_) {
+    while ((running_ops_ >= num_threads_ || prev_iter_found_no_work || disabled_for_tests()) &&
+           !shutdown_) {
       cond_.TimedWait(polling_interval);
       prev_iter_found_no_work = false;
     }

http://git-wip-us.apache.org/repos/asf/kudu/blob/9533c57e/src/kudu/util/maintenance_manager.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/maintenance_manager.h b/src/kudu/util/maintenance_manager.h
index 1d2419a..2509d46 100644
--- a/src/kudu/util/maintenance_manager.h
+++ b/src/kudu/util/maintenance_manager.h
@@ -289,6 +289,10 @@ class MaintenanceManager : public std::enable_shared_from_this<MaintenanceManage
   typedef std::map<MaintenanceOp*, MaintenanceOpStats,
           MaintenanceOpComparator> OpMapTy;
 
+  // Return true if tests have currently disabled the maintenance
+  // manager by way of changing the gflags at runtime.
+  bool disabled_for_tests() const;
+
   void RunSchedulerThread();
 
   // find the best op, or null if there is nothing we want to run


[4/5] kudu git commit: tidy: add and fix modernize-use-emplace and shrink-to-fit

Posted by to...@apache.org.
tidy: add and fix modernize-use-emplace and shrink-to-fit

No fixes for shrink-to-fit. emplace found a bunch.

Change-Id: Ie5a9569e335e11e110336dbc4800441a61bc375c
Reviewed-on: http://gerrit.cloudera.org:8080/7162
Reviewed-by: Dan Burkert <da...@apache.org>
Tested-by: Todd Lipcon <to...@apache.org>


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

Branch: refs/heads/master
Commit: 3ff6c9bac3071fa478984900a544c50002ae537c
Parents: 6b4284d
Author: Todd Lipcon <to...@cloudera.com>
Authored: Mon Jun 12 17:14:39 2017 -0700
Committer: Todd Lipcon <to...@apache.org>
Committed: Tue Jun 13 16:04:38 2017 +0000

----------------------------------------------------------------------
 src/kudu/.clang-tidy                            |  2 +-
 src/kudu/benchmarks/tpch/tpch_real_world.cc     | 12 ++--
 src/kudu/cfile/bloomfile.cc                     |  2 +-
 src/kudu/cfile/cfile-test.cc                    | 10 ++--
 src/kudu/cfile/cfile_writer.cc                  | 12 ++--
 src/kudu/cfile/encoding-test.cc                 |  2 +-
 src/kudu/client/meta_cache.cc                   |  2 +-
 src/kudu/client/predicate-test.cc               |  6 +-
 src/kudu/codegen/codegen-test.cc                |  8 +--
 src/kudu/common/partition.cc                    |  2 +-
 src/kudu/common/row.h                           |  2 +-
 src/kudu/common/schema.cc                       |  4 +-
 src/kudu/common/wire_protocol.cc                |  2 +-
 src/kudu/consensus/quorum_util.cc               |  2 +-
 src/kudu/fs/block_manager-stress-test.cc        |  2 +-
 src/kudu/gutil/strings/join.cc                  |  2 +-
 src/kudu/integration-tests/all_types-itest.cc   |  4 +-
 .../alter_table-randomized-test.cc              |  4 +-
 .../integration-tests/client-stress-test.cc     |  3 +-
 .../integration-tests/create-table-itest.cc     |  2 +-
 .../integration-tests/delete_table-itest.cc     | 33 ++++++-----
 .../integration-tests/disk_reservation-itest.cc | 10 ++--
 .../exactly_once_writes-itest.cc                | 16 +++---
 .../integration-tests/external_mini_cluster.cc  | 32 +++++------
 .../flex_partitioning-itest.cc                  |  4 +-
 .../integration-tests/linked_list-test-util.h   | 25 ++++----
 src/kudu/integration-tests/linked_list-test.cc  | 12 ++--
 .../integration-tests/master-stress-test.cc     | 12 ++--
 .../integration-tests/master_failover-itest.cc  |  8 +--
 src/kudu/integration-tests/mini_cluster.cc      |  2 +-
 .../integration-tests/open-readonly-fs-itest.cc |  6 +-
 .../integration-tests/raft_consensus-itest.cc   | 60 ++++++++++----------
 src/kudu/integration-tests/security-itest.cc    | 16 +++---
 src/kudu/integration-tests/tablet_copy-itest.cc | 34 +++++------
 .../tablet_copy_client_session-itest.cc         |  2 +-
 .../tablet_replacement-itest.cc                 | 12 ++--
 src/kudu/integration-tests/ts_itest-base.h      |  2 +-
 .../integration-tests/version_migration-test.cc |  4 +-
 src/kudu/master/ts_descriptor.cc                |  2 +-
 src/kudu/rpc/rpc_stub-test.cc                   |  4 +-
 src/kudu/server/default-path-handlers.cc        |  2 +-
 src/kudu/server/server_base.cc                  |  2 +-
 src/kudu/server/webserver.cc                    | 24 ++++----
 src/kudu/tablet/deltamemstore.cc                |  2 +-
 src/kudu/tablet/diskrowset-test.cc              |  4 +-
 src/kudu/tablet/local_tablet_writer.h           |  2 +-
 src/kudu/tablet/lock_manager-test.cc            |  2 +-
 src/kudu/tablet/memrowset-test.cc               |  6 +-
 src/kudu/tablet/metadata-test.cc                | 18 +++---
 src/kudu/tablet/rowset_tree.cc                  |  4 +-
 src/kudu/tablet/tablet-schema-test.cc           | 24 ++++----
 src/kudu/tools/ksck.cc                          | 12 ++--
 src/kudu/tools/tool_main.cc                     |  2 +-
 src/kudu/tserver/tablet_copy_service-test.cc    |  2 +-
 src/kudu/tserver/tablet_server-test-base.h      |  4 +-
 src/kudu/util/compression/compression-test.cc   |  4 +-
 src/kudu/util/debug/trace_event_impl.cc         |  2 +-
 src/kudu/util/interval_tree-test.cc             |  8 +--
 src/kudu/util/knapsack_solver-test.cc           |  8 +--
 src/kudu/util/path_util.cc                      |  2 +-
 src/kudu/util/pstack_watcher.cc                 | 28 ++++-----
 src/kudu/util/trace-test.cc                     |  4 +-
 62 files changed, 274 insertions(+), 273 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/.clang-tidy
----------------------------------------------------------------------
diff --git a/src/kudu/.clang-tidy b/src/kudu/.clang-tidy
index 0815904..fff398a 100644
--- a/src/kudu/.clang-tidy
+++ b/src/kudu/.clang-tidy
@@ -14,7 +14,7 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-Checks:          'clang-diagnostic-*,clang-analyzer-*,-clang-analyzer-alpha*,-*,readability-*,-readability-braces-around-statements,llvm-include-order,misc-*,-modernize-*,performance-*,-readability-implicit-bool-cast,google-*,-google-readability-braces-around-statements,-readability-redundant-string-init,modernize-make-shared'
+Checks:          'clang-diagnostic-*,clang-analyzer-*,-clang-analyzer-alpha*,-*,readability-*,-readability-braces-around-statements,llvm-include-order,misc-*,-modernize-*,performance-*,-readability-implicit-bool-cast,google-*,-google-readability-braces-around-statements,-readability-redundant-string-init,modernize-make-shared,modernize-shrink-to-fit,modernize-use-emplace'
 HeaderFilterRegex: '.*,-*.pb.h'
 CheckOptions:
   - key:             readability-identifier-naming.ClassCase

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/benchmarks/tpch/tpch_real_world.cc
----------------------------------------------------------------------
diff --git a/src/kudu/benchmarks/tpch/tpch_real_world.cc b/src/kudu/benchmarks/tpch/tpch_real_world.cc
index de47fbc..6374132 100644
--- a/src/kudu/benchmarks/tpch/tpch_real_world.cc
+++ b/src/kudu/benchmarks/tpch/tpch_real_world.cc
@@ -224,15 +224,15 @@ Status TpchRealWorld::StartDbgens() {
     setenv("DSS_CONFIG", FLAGS_tpch_path_to_dbgen_dir.c_str(), 1);
     vector<string> argv;
     argv.push_back(Substitute("$0/dbgen", FLAGS_tpch_path_to_dbgen_dir));
-    argv.push_back("-q");
-    argv.push_back("-T");
-    argv.push_back("L");
-    argv.push_back("-s");
+    argv.emplace_back("-q");
+    argv.emplace_back("-T");
+    argv.emplace_back("L");
+    argv.emplace_back("-s");
     argv.push_back(Substitute("$0", FLAGS_tpch_scaling_factor));
     if (FLAGS_tpch_num_inserters > 1) {
-      argv.push_back("-C");
+      argv.emplace_back("-C");
       argv.push_back(Substitute("$0", FLAGS_tpch_num_inserters));
-      argv.push_back("-S");
+      argv.emplace_back("-S");
       argv.push_back(Substitute("$0", i));
     }
     gscoped_ptr<Subprocess> dbgen_proc(new Subprocess(argv));

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/cfile/bloomfile.cc
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/bloomfile.cc b/src/kudu/cfile/bloomfile.cc
index 23c143c..7d69ac1 100644
--- a/src/kudu/cfile/bloomfile.cc
+++ b/src/kudu/cfile/bloomfile.cc
@@ -152,7 +152,7 @@ Status BloomFileWriter::FinishCurrentBloomBlock() {
 
   // The data is the concatenation of the header and the bloom itself.
   vector<Slice> slices;
-  slices.push_back(Slice(hdr_str));
+  slices.emplace_back(hdr_str);
   slices.push_back(bloom_builder_.slice());
 
   // Append to the file.

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/cfile/cfile-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/cfile-test.cc b/src/kudu/cfile/cfile-test.cc
index 2ab6b2b..e21d96e 100644
--- a/src/kudu/cfile/cfile-test.cc
+++ b/src/kudu/cfile/cfile-test.cc
@@ -226,10 +226,10 @@ class TestCFile : public CFileTestBase {
     ASSERT_OK(w.Start());
     for (uint32_t i = 0; i < num_entries; i++) {
       vector<Slice> slices;
-      slices.push_back(Slice("Head"));
-      slices.push_back(Slice("Body"));
-      slices.push_back(Slice("Tail"));
-      slices.push_back(Slice(reinterpret_cast<uint8_t *>(&i), 4));
+      slices.emplace_back("Head");
+      slices.emplace_back("Body");
+      slices.emplace_back("Tail");
+      slices.emplace_back(reinterpret_cast<uint8_t *>(&i), 4);
       ASSERT_OK(w.AppendRawBlock(slices, i, nullptr, Slice(), "raw-data"));
     }
     ASSERT_OK(w.Finish());
@@ -834,7 +834,7 @@ TEST_P(TestCFileBothCacheTypes, TestDataCorruption) {
   w.AddMetadataPair("header_key", "header_value");
   ASSERT_OK(w.Start());
   vector<Slice> slices;
-  slices.push_back(Slice("HelloWorld"));
+  slices.emplace_back("HelloWorld");
   ASSERT_OK(w.AppendRawBlock(slices, 1, nullptr, Slice(), "raw-data"));
   ASSERT_OK(w.Finish());
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/cfile/cfile_writer.cc
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/cfile_writer.cc b/src/kudu/cfile/cfile_writer.cc
index a8819ff..dbc47e9 100644
--- a/src/kudu/cfile/cfile_writer.cc
+++ b/src/kudu/cfile/cfile_writer.cc
@@ -181,14 +181,14 @@ Status CFileWriter::Start() {
   pb_util::AppendToString(header, &header_str);
 
   vector<Slice> header_slices;
-  header_slices.push_back(Slice(header_str));
+  header_slices.emplace_back(header_str);
 
   // Append header checksum.
   uint8_t checksum_buf[kChecksumSize];
   if (FLAGS_cfile_write_checksums) {
     uint32_t header_checksum = crc::Crc32c(header_str.data(), header_str.size());
     InlineEncodeFixed32(checksum_buf, header_checksum);
-    header_slices.push_back(Slice(checksum_buf, kChecksumSize));
+    header_slices.emplace_back(checksum_buf, kChecksumSize);
   }
 
   RETURN_NOT_OK_PREPEND(WriteRawData(header_slices), "Couldn't write header");
@@ -272,10 +272,10 @@ Status CFileWriter::FinishAndReleaseBlock(ScopedWritableBlockCloser* closer) {
   if (FLAGS_cfile_write_checksums) {
     uint32_t footer_checksum = crc::Crc32c(footer_str.data(), footer_str.size());
     InlineEncodeFixed32(checksum_buf, footer_checksum);
-    footer_slices.push_back(Slice(checksum_buf, kChecksumSize));
+    footer_slices.emplace_back(checksum_buf, kChecksumSize);
   }
 
-  footer_slices.push_back(Slice(footer_str));
+  footer_slices.emplace_back(footer_str);
   RETURN_NOT_OK_PREPEND(WriteRawData(footer_slices), "Couldn't write footer");
 
   // Done with this block.
@@ -414,7 +414,7 @@ Status CFileWriter::FinishCurDataBlock() {
     Slice null_bitmap = null_bitmap_builder_->Finish();
     PutVarint32(&null_headers, num_elems_in_block);
     PutVarint32(&null_headers, null_bitmap.size());
-    v.push_back(Slice(null_headers.data(), null_headers.size()));
+    v.emplace_back(null_headers.data(), null_headers.size());
     v.push_back(null_bitmap);
   }
   v.push_back(data);
@@ -504,7 +504,7 @@ Status CFileWriter::AddBlock(const vector<Slice> &data_slices,
       checksum = crc::Crc32c(data.data(), data.size(), checksum);
     }
     InlineEncodeFixed32(checksum_buf, checksum);
-    out_slices.push_back(Slice(checksum_buf, kChecksumSize));
+    out_slices.emplace_back(checksum_buf, kChecksumSize);
   }
 
   RETURN_NOT_OK(WriteRawData(out_slices));

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/cfile/encoding-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/encoding-test.cc b/src/kudu/cfile/encoding-test.cc
index 6f5d7e1..db59936 100644
--- a/src/kudu/cfile/encoding-test.cc
+++ b/src/kudu/cfile/encoding-test.cc
@@ -80,7 +80,7 @@ class TestEncoding : public KuduTest {
     std::vector<Slice> slices;
     for (uint i = 0; i < num_items; i++) {
       to_insert.emplace_back(new string(StringPrintf(fmt_str, i)));
-      slices.push_back(Slice(to_insert.back()->data()));
+      slices.emplace_back(to_insert.back()->data());
     }
 
     int rem = slices.size();

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/client/meta_cache.cc
----------------------------------------------------------------------
diff --git a/src/kudu/client/meta_cache.cc b/src/kudu/client/meta_cache.cc
index 398a395..de9698e 100644
--- a/src/kudu/client/meta_cache.cc
+++ b/src/kudu/client/meta_cache.cc
@@ -142,7 +142,7 @@ void RemoteTabletServer::Update(const master::TSInfoPB& pb) {
 
   rpc_hostports_.clear();
   for (const HostPortPB& hostport_pb : pb.rpc_addresses()) {
-    rpc_hostports_.push_back(HostPort(hostport_pb.host(), hostport_pb.port()));
+    rpc_hostports_.emplace_back(hostport_pb.host(), hostport_pb.port());
   }
 }
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/client/predicate-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/client/predicate-test.cc b/src/kudu/client/predicate-test.cc
index ac38511..44c83b3 100644
--- a/src/kudu/client/predicate-test.cc
+++ b/src/kudu/client/predicate-test.cc
@@ -350,9 +350,9 @@ class PredicateTest : public KuduTest {
 
     // Add some additional values to check against.
     vector<string> test_values = values;
-    test_values.push_back("aa");
-    test_values.push_back(string("\1", 1));
-    test_values.push_back(string("a\1", 1));
+    test_values.emplace_back("aa");
+    test_values.emplace_back("\1", 1);
+    test_values.emplace_back("a\1", 1);
 
     for (const string& v : test_values) {
       SCOPED_TRACE(strings::Substitute("test value: '$0'", strings::CHexEscape(v)));

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/codegen/codegen-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/codegen/codegen-test.cc b/src/kudu/codegen/codegen-test.cc
index a63b064..b90bc70 100644
--- a/src/kudu/codegen/codegen-test.cc
+++ b/src/kudu/codegen/codegen-test.cc
@@ -69,10 +69,10 @@ class CodegenTest : public KuduTest {
     base_ = SchemaBuilder(base_).Build(); // add IDs
 
     // Create an extended default schema
-    cols.push_back(ColumnSchema("int32-R ",  INT32, false, kI32R,  nullptr));
-    cols.push_back(ColumnSchema("int32-RW",  INT32, false, kI32R, kI32W));
-    cols.push_back(ColumnSchema("str32-R ", STRING, false, kStrR,  nullptr));
-    cols.push_back(ColumnSchema("str32-RW", STRING, false, kStrR, kStrW));
+    cols.emplace_back("int32-R ",  INT32, false, kI32R,  nullptr);
+    cols.emplace_back("int32-RW",  INT32, false, kI32R, kI32W);
+    cols.emplace_back("str32-R ", STRING, false, kStrR,  nullptr);
+    cols.emplace_back("str32-RW", STRING, false, kStrR, kStrW);
     defaults_.Reset(cols, 1);
     defaults_ = SchemaBuilder(defaults_).Build(); // add IDs
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/common/partition.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/partition.cc b/src/kudu/common/partition.cc
index bbb6343..6d4b6f6 100644
--- a/src/kudu/common/partition.cc
+++ b/src/kudu/common/partition.cc
@@ -751,7 +751,7 @@ string PartitionSchema::RangeKeyDebugString(const ConstContiguousRow& key) const
     string column;
     int32_t column_idx = key.schema()->find_column_by_id(column_id);
     if (column_idx == Schema::kColumnNotFound) {
-      components.push_back("<unknown-column>");
+      components.emplace_back("<unknown-column>");
       break;
     }
     key.schema()->column(column_idx).DebugCellAppend(key.cell(column_idx), &column);

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/common/row.h
----------------------------------------------------------------------
diff --git a/src/kudu/common/row.h b/src/kudu/common/row.h
index 88b5d55..cb68bb9 100644
--- a/src/kudu/common/row.h
+++ b/src/kudu/common/row.h
@@ -199,7 +199,7 @@ class RowProjector {
   friend class Schema;
 
   Status ProjectBaseColumn(size_t proj_col_idx, size_t base_col_idx) {
-    base_cols_mapping_.push_back(ProjectionIdxMapping(proj_col_idx, base_col_idx));
+    base_cols_mapping_.emplace_back(proj_col_idx, base_col_idx);
     return Status::OK();
   }
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/common/schema.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/schema.cc b/src/kudu/common/schema.cc
index 94fcf87..c17ac31 100644
--- a/src/kudu/common/schema.cc
+++ b/src/kudu/common/schema.cc
@@ -265,7 +265,7 @@ Schema Schema::CopyWithColumnIds() const {
   CHECK(!has_column_ids());
   vector<ColumnId> ids;
   for (int32_t i = 0; i < num_columns(); i++) {
-    ids.push_back(ColumnId(kFirstColumnId + i));
+    ids.emplace_back(kFirstColumnId + i);
   }
   return Schema(cols_, ids, num_key_columns_);
 }
@@ -430,7 +430,7 @@ void SchemaBuilder::Reset(const Schema& schema) {
 
   if (col_ids_.empty()) {
     for (int32_t i = 0; i < cols_.size(); ++i) {
-      col_ids_.push_back(ColumnId(kFirstColumnId + i));
+      col_ids_.emplace_back(kFirstColumnId + i);
     }
   }
   if (col_ids_.empty()) {

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/common/wire_protocol.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/wire_protocol.cc b/src/kudu/common/wire_protocol.cc
index 6b4d078..33850a9 100644
--- a/src/kudu/common/wire_protocol.cc
+++ b/src/kudu/common/wire_protocol.cc
@@ -324,7 +324,7 @@ Status ColumnPBsToSchema(const RepeatedPtrField<ColumnSchemaPB>& column_pbs,
       is_handling_key = false;
     }
     if (pb.has_id()) {
-      column_ids.push_back(ColumnId(pb.id()));
+      column_ids.emplace_back(pb.id());
     }
   }
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/consensus/quorum_util.cc
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/quorum_util.cc b/src/kudu/consensus/quorum_util.cc
index a0c4a41..d4b39f4 100644
--- a/src/kudu/consensus/quorum_util.cc
+++ b/src/kudu/consensus/quorum_util.cc
@@ -351,7 +351,7 @@ string DiffConsensusStates(const ConsensusStatePB& old_state,
 
     vector<string> pending_change_strs;
     if (DiffPeers(pending_peer_infos, &pending_change_strs)) {
-      change_strs.push_back("pending config changed");
+      change_strs.emplace_back("pending config changed");
       change_strs.insert(change_strs.end(), pending_change_strs.cbegin(),
                          pending_change_strs.cend());
     }

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/fs/block_manager-stress-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/fs/block_manager-stress-test.cc b/src/kudu/fs/block_manager-stress-test.cc
index 30cc6a9..55de36c 100644
--- a/src/kudu/fs/block_manager-stress-test.cc
+++ b/src/kudu/fs/block_manager-stress-test.cc
@@ -271,7 +271,7 @@ void BlockManagerStressTest<T>::WriterThread() {
       CHECK_OK(block->Append(seed_slice));
 
       dirty_blocks.push_back(block.release());
-      dirty_block_rands.push_back(Random(seed));
+      dirty_block_rands.emplace_back(seed);
     }
 
     // Write a large amount of data to the group of blocks.

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/gutil/strings/join.cc
----------------------------------------------------------------------
diff --git a/src/kudu/gutil/strings/join.cc b/src/kudu/gutil/strings/join.cc
index 8907792..4c289f2 100644
--- a/src/kudu/gutil/strings/join.cc
+++ b/src/kudu/gutil/strings/join.cc
@@ -192,7 +192,7 @@ void JoinCSVLineWithDelimiter(const vector<string>& cols, char delimiter,
       *buf.get() = '"';
       *((buf.get() + 1) + escaped_size) = '"';
       *((buf.get() + 1) + escaped_size + 1) = '\0';
-      quoted_cols.push_back(string(buf.get(), buf.get() + escaped_size + 2));
+      quoted_cols.emplace_back(buf.get(), buf.get() + escaped_size + 2);
     } else {
       quoted_cols.push_back(col);
     }

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/integration-tests/all_types-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/all_types-itest.cc b/src/kudu/integration-tests/all_types-itest.cc
index b5e5ac7..6dd1830 100644
--- a/src/kudu/integration-tests/all_types-itest.cc
+++ b/src/kudu/integration-tests/all_types-itest.cc
@@ -114,7 +114,7 @@ struct SliceKeysTestSetup {
 
   vector<string> GetKeyColumns() const {
     vector<string> key_col;
-    key_col.push_back("key");
+    key_col.emplace_back("key");
     return key_col;
   }
 
@@ -192,7 +192,7 @@ struct IntKeysTestSetup {
 
   vector<string> GetKeyColumns() const {
     vector<string> key_col;
-    key_col.push_back("key");
+    key_col.emplace_back("key");
     return key_col;
   }
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/integration-tests/alter_table-randomized-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/alter_table-randomized-test.cc b/src/kudu/integration-tests/alter_table-randomized-test.cc
index c9af5e2..4852141 100644
--- a/src/kudu/integration-tests/alter_table-randomized-test.cc
+++ b/src/kudu/integration-tests/alter_table-randomized-test.cc
@@ -82,7 +82,7 @@ class AlterTableRandomized : public KuduTest {
     opts.num_tablet_servers = 3;
     // This test produces tables with lots of columns. With container preallocation,
     // we end up using quite a bit of disk space. So, we disable it.
-    opts.extra_tserver_flags.push_back("--log_container_preallocate_bytes=0");
+    opts.extra_tserver_flags.emplace_back("--log_container_preallocate_bytes=0");
     cluster_.reset(new ExternalMiniCluster(std::move(opts)));
     ASSERT_OK(cluster_->Start());
 
@@ -150,7 +150,7 @@ struct RowState {
 struct TableState {
   TableState()
       : rand_(SeedRandom()) {
-    col_names_.push_back("key");
+    col_names_.emplace_back("key");
     col_nullable_.push_back(false);
     col_defaults_.push_back(0);
     AddRangePartition();

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/integration-tests/client-stress-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/client-stress-test.cc b/src/kudu/integration-tests/client-stress-test.cc
index 2718889..91ac4d3 100644
--- a/src/kudu/integration-tests/client-stress-test.cc
+++ b/src/kudu/integration-tests/client-stress-test.cc
@@ -214,8 +214,7 @@ class ClientStressTest_LowMemory : public ClientStressTest {
     ExternalMiniClusterOptions opts;
     opts.extra_tserver_flags.push_back(Substitute(
         "--memory_limit_hard_bytes=$0", kMemLimitBytes));
-    opts.extra_tserver_flags.push_back(
-        "--memory_limit_soft_percentage=0");
+    opts.extra_tserver_flags.emplace_back("--memory_limit_soft_percentage=0");
     return opts;
   }
 };

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/integration-tests/create-table-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/create-table-itest.cc b/src/kudu/integration-tests/create-table-itest.cc
index 8267dff..5854476 100644
--- a/src/kudu/integration-tests/create-table-itest.cc
+++ b/src/kudu/integration-tests/create-table-itest.cc
@@ -55,7 +55,7 @@ TEST_F(CreateTableITest, TestCreateWhenMajorityOfReplicasFailCreation) {
   const int kNumReplicas = 3;
   vector<string> ts_flags;
   vector<string> master_flags;
-  master_flags.push_back("--tablet_creation_timeout_ms=1000");
+  master_flags.emplace_back("--tablet_creation_timeout_ms=1000");
   NO_FATALS(StartCluster(ts_flags, master_flags, kNumReplicas));
 
   // Shut down 2/3 of the tablet servers.

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/integration-tests/delete_table-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/delete_table-itest.cc b/src/kudu/integration-tests/delete_table-itest.cc
index 9419aa7..3d64fc0 100644
--- a/src/kudu/integration-tests/delete_table-itest.cc
+++ b/src/kudu/integration-tests/delete_table-itest.cc
@@ -692,8 +692,8 @@ TEST_F(DeleteTableITest, TestAutoTombstoneAfterTabletCopyRemoteFails) {
 TEST_F(DeleteTableITest, TestMergeConsensusMetadata) {
   // Enable manual leader selection.
   vector<string> ts_flags, master_flags;
-  ts_flags.push_back("--enable_leader_failure_detection=false");
-  master_flags.push_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
+  ts_flags.emplace_back("--enable_leader_failure_detection=false");
+  master_flags.emplace_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
   NO_FATALS(StartCluster(ts_flags, master_flags));
   const MonoDelta timeout = MonoDelta::FromSeconds(10);
   const int kTsIndex = 0;
@@ -812,10 +812,10 @@ TEST_F(DeleteTableITest, TestDeleteFollowerWithReplicatingTransaction) {
 
   const int kNumTabletServers = 5;
   vector<string> ts_flags, master_flags;
-  ts_flags.push_back("--enable_leader_failure_detection=false");
-  ts_flags.push_back("--flush_threshold_mb=0"); // Always be flushing.
-  ts_flags.push_back("--maintenance_manager_polling_interval_ms=100");
-  master_flags.push_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
+  ts_flags.emplace_back("--enable_leader_failure_detection=false");
+  ts_flags.emplace_back("--flush_threshold_mb=0"); // Always be flushing.
+  ts_flags.emplace_back("--maintenance_manager_polling_interval_ms=100");
+  master_flags.emplace_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
   NO_FATALS(StartCluster(ts_flags, master_flags, kNumTabletServers));
 
   const int kTsIndex = 0; // We'll test with the first TS.
@@ -872,11 +872,14 @@ TEST_F(DeleteTableITest, TestDeleteFollowerWithReplicatingTransaction) {
 // tombstoned.
 TEST_F(DeleteTableITest, TestOrphanedBlocksClearedOnDelete) {
   const MonoDelta timeout = MonoDelta::FromSeconds(30);
-  vector<string> ts_flags, master_flags;
-  ts_flags.push_back("--enable_leader_failure_detection=false");
-  ts_flags.push_back("--flush_threshold_mb=0"); // Flush quickly since we wait for a flush to occur.
-  ts_flags.push_back("--maintenance_manager_polling_interval_ms=100");
-  master_flags.push_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
+  vector<string> ts_flags = {
+    "--enable_leader_failure_detection=false",
+    "--flush_threshold_mb=0", // Flush quickly since we wait for a flush to occur.
+    "--maintenance_manager_polling_interval_ms=100"
+  };
+  vector<string> master_flags = {
+    "--catalog_manager_wait_for_new_tablets_to_elect_leader=false"
+  };
   NO_FATALS(StartCluster(ts_flags, master_flags));
 
   const int kFollowerIndex = 0;
@@ -1173,10 +1176,10 @@ TEST_P(DeleteTableTombstonedParamTest, TestTabletTombstone) {
   vector<string> flags;
   // We want fast log rolls and deterministic preallocation, since we wait for
   // a certain number of logs at the beginning of the test.
-  flags.push_back("--log_segment_size_mb=1");
-  flags.push_back("--log_async_preallocate_segments=false");
-  flags.push_back("--log_min_segments_to_retain=3");
-  flags.push_back("--log_compression_codec=NO_COMPRESSION");
+  flags.emplace_back("--log_segment_size_mb=1");
+  flags.emplace_back("--log_async_preallocate_segments=false");
+  flags.emplace_back("--log_min_segments_to_retain=3");
+  flags.emplace_back("--log_compression_codec=NO_COMPRESSION");
   NO_FATALS(StartCluster(flags));
   const string fault_flag = GetParam();
   LOG(INFO) << "Running with fault flag: " << fault_flag;

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/integration-tests/disk_reservation-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/disk_reservation-itest.cc b/src/kudu/integration-tests/disk_reservation-itest.cc
index b19ffa4..b5b589f 100644
--- a/src/kudu/integration-tests/disk_reservation-itest.cc
+++ b/src/kudu/integration-tests/disk_reservation-itest.cc
@@ -51,14 +51,14 @@ class DiskReservationITest : public ExternalMiniClusterITestBase {
 TEST_F(DiskReservationITest, TestFillMultipleDisks) {
   vector<string> ts_flags;
   // Don't preallocate very many bytes so we run the "full disk" check often.
-  ts_flags.push_back("--log_container_preallocate_bytes=100000");
+  ts_flags.emplace_back("--log_container_preallocate_bytes=100000");
   // Set up the tablet so that flushes are constantly occurring.
-  ts_flags.push_back("--flush_threshold_mb=0");
-  ts_flags.push_back("--maintenance_manager_polling_interval_ms=50");
-  ts_flags.push_back("--disable_core_dumps");
+  ts_flags.emplace_back("--flush_threshold_mb=0");
+  ts_flags.emplace_back("--maintenance_manager_polling_interval_ms=50");
+  ts_flags.emplace_back("--disable_core_dumps");
   // Reserve one byte so that when we simulate 0 bytes free below, we'll start
   // failing requests.
-  ts_flags.push_back("--fs_data_dirs_reserved_bytes=1");
+  ts_flags.emplace_back("--fs_data_dirs_reserved_bytes=1");
 
   NO_FATALS(StartCluster(ts_flags, {}, /* num_tablet_servers= */ 1, /* num_data_dirs= */ 2));
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/integration-tests/exactly_once_writes-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/exactly_once_writes-itest.cc b/src/kudu/integration-tests/exactly_once_writes-itest.cc
index b05c537..b2d88b0 100644
--- a/src/kudu/integration-tests/exactly_once_writes-itest.cc
+++ b/src/kudu/integration-tests/exactly_once_writes-itest.cc
@@ -246,17 +246,17 @@ TEST_F(ExactlyOnceSemanticsITest, TestWritesWithExactlyOnceSemanticsWithCrashyNo
   // Crash 2.5% of the time right after sending an RPC. This makes sure we stress the path
   // where there are duplicate handlers for a transaction as a leader crashes right
   // after sending requests to followers.
-  ts_flags.push_back("--fault_crash_after_leader_request_fraction=0.025");
+  ts_flags.emplace_back("--fault_crash_after_leader_request_fraction=0.025");
 
   // Make leader elections faster so we get through more cycles of leaders.
-  ts_flags.push_back("--raft_heartbeat_interval_ms=200");
-  ts_flags.push_back("--leader_failure_monitor_check_mean_ms=100");
-  ts_flags.push_back("--leader_failure_monitor_check_stddev_ms=50");
+  ts_flags.emplace_back("--raft_heartbeat_interval_ms=200");
+  ts_flags.emplace_back("--leader_failure_monitor_check_mean_ms=100");
+  ts_flags.emplace_back("--leader_failure_monitor_check_stddev_ms=50");
 
   // Avoid preallocating segments since bootstrap is a little bit
   // faster if it doesn't have to scan forward through the preallocated
   // log area.
-  ts_flags.push_back("--log_preallocate_segments=false");
+  ts_flags.emplace_back("--log_preallocate_segments=false");
 
   int num_batches = 10;
   if (AllowSlowTests()) {
@@ -280,10 +280,10 @@ TEST_F(ExactlyOnceSemanticsITest, TestWritesWithExactlyOnceSemanticsWithChurnyEl
   // any progress at all.
   ts_flags.push_back("--raft_heartbeat_interval_ms=5");
 #else
-  ts_flags.push_back("--raft_heartbeat_interval_ms=2");
+  ts_flags.emplace_back("--raft_heartbeat_interval_ms=2");
 #endif
-  ts_flags.push_back("--leader_failure_monitor_check_mean_ms=2");
-  ts_flags.push_back("--leader_failure_monitor_check_stddev_ms=1");
+  ts_flags.emplace_back("--leader_failure_monitor_check_mean_ms=2");
+  ts_flags.emplace_back("--leader_failure_monitor_check_stddev_ms=1");
 
   int num_batches = 200;
   if (AllowSlowTests()) {

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/integration-tests/external_mini_cluster.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/external_mini_cluster.cc b/src/kudu/integration-tests/external_mini_cluster.cc
index 3b1ac96..ef15ab9 100644
--- a/src/kudu/integration-tests/external_mini_cluster.cc
+++ b/src/kudu/integration-tests/external_mini_cluster.cc
@@ -667,9 +667,9 @@ Status ExternalDaemon::EnableKerberos(MiniKdc* kdc, const string& bind_host) {
   extra_env_ = kdc->GetEnvVars();
   extra_flags_.push_back(Substitute("--keytab_file=$0", ktpath));
   extra_flags_.push_back(Substitute("--principal=$0", spn));
-  extra_flags_.push_back("--rpc_authentication=required");
-  extra_flags_.push_back("--superuser_acl=test-admin");
-  extra_flags_.push_back("--user_acl=test-user");
+  extra_flags_.emplace_back("--rpc_authentication=required");
+  extra_flags_.emplace_back("--superuser_acl=test-admin");
+  extra_flags_.emplace_back("--user_acl=test-user");
   return Status::OK();
 }
 
@@ -686,7 +686,7 @@ Status ExternalDaemon::StartProcess(const vector<string>& user_flags) {
 
   // Disable fsync to dramatically speed up runtime. This is safe as no tests
   // rely on forcefully cutting power to a machine or equivalent.
-  argv.push_back("--never_fsync");
+  argv.emplace_back("--never_fsync");
 
   // Generate smaller RSA keys -- generating a 1024-bit key is faster
   // than generating the default 2048-bit key, and we don't care about
@@ -697,21 +697,21 @@ Status ExternalDaemon::StartProcess(const vector<string>& user_flags) {
   // the ECDHE-RSA-AES256-GCM-SHA384 suite). However, to work with Java
   // client it's necessary to have at least 1024 bits for certificate RSA key
   // due to Java security policies.
-  argv.push_back("--ipki_server_key_size=1024");
+  argv.emplace_back("--ipki_server_key_size=1024");
 
   // Disable minidumps by default since many tests purposely inject faults.
-  argv.push_back("--enable_minidumps=false");
+  argv.emplace_back("--enable_minidumps=false");
 
   // Disable log redaction.
-  argv.push_back("--redact=flag");
+  argv.emplace_back("--redact=flag");
 
   // Enable metrics logging.
-  argv.push_back("--metrics_log_interval_ms=1000");
+  argv.emplace_back("--metrics_log_interval_ms=1000");
 
   if (logtostderr_) {
     // Ensure that logging goes to the test output and doesn't get buffered.
-    argv.push_back("--logtostderr");
-    argv.push_back("--logbuflevel=-1");
+    argv.emplace_back("--logtostderr");
+    argv.emplace_back("--logbuflevel=-1");
   }
 
   // Even if we are logging to stderr, metrics logs and minidumps end up being
@@ -722,16 +722,16 @@ Status ExternalDaemon::StartProcess(const vector<string>& user_flags) {
   // Tell the server to dump its port information so we can pick it up.
   string info_path = JoinPathSegments(data_dirs_[0], "info.pb");
   argv.push_back("--server_dump_info_path=" + info_path);
-  argv.push_back("--server_dump_info_format=pb");
+  argv.emplace_back("--server_dump_info_format=pb");
 
   // We use ephemeral ports in many tests. They don't work for production, but are OK
   // in unit tests.
-  argv.push_back("--rpc_server_allow_ephemeral_ports");
+  argv.emplace_back("--rpc_server_allow_ephemeral_ports");
 
   // Allow unsafe and experimental flags from tests, since we often use
   // fault injection, etc.
-  argv.push_back("--unlock_experimental_flags");
-  argv.push_back("--unlock_unsafe_flags");
+  argv.emplace_back("--unlock_experimental_flags");
+  argv.emplace_back("--unlock_unsafe_flags");
 
   // Then the "extra flags" passed into the ctor (from the ExternalMiniCluster
   // options struct). These come at the end so they can override things like
@@ -1129,7 +1129,7 @@ ExternalMaster::~ExternalMaster() {
 
 Status ExternalMaster::Start() {
   vector<string> flags(GetCommonFlags());
-  flags.push_back("--webserver_port=0");
+  flags.emplace_back("--webserver_port=0");
   flags.push_back("--rpc_bind_addresses=" + get_rpc_bind_address());
   return StartProcess(flags);
 }
@@ -1233,7 +1233,7 @@ Status ExternalTabletServer::Start() {
                              get_rpc_bind_address()));
   flags.push_back(Substitute("--webserver_interface=$0",
                              get_rpc_bind_address()));
-  flags.push_back("--webserver_port=0");
+  flags.emplace_back("--webserver_port=0");
   flags.push_back("--tserver_master_addrs=" + master_addrs_);
   RETURN_NOT_OK(StartProcess(flags));
   return Status::OK();

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/integration-tests/flex_partitioning-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/flex_partitioning-itest.cc b/src/kudu/integration-tests/flex_partitioning-itest.cc
index 7f90511..deb5831 100644
--- a/src/kudu/integration-tests/flex_partitioning-itest.cc
+++ b/src/kudu/integration-tests/flex_partitioning-itest.cc
@@ -158,8 +158,8 @@ class FlexPartitioningITest : public KuduTest,
     opts.num_tablet_servers = 1;
     // This test produces lots of tablets. With container and log preallocation,
     // we end up using quite a bit of disk space. So, we disable them.
-    opts.extra_tserver_flags.push_back("--log_container_preallocate_bytes=0");
-    opts.extra_tserver_flags.push_back("--log_preallocate_segments=false");
+    opts.extra_tserver_flags.emplace_back("--log_container_preallocate_bytes=0");
+    opts.extra_tserver_flags.emplace_back("--log_preallocate_segments=false");
     cluster_.reset(new ExternalMiniCluster(std::move(opts)));
     ASSERT_OK(cluster_->Start());
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/integration-tests/linked_list-test-util.h
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/linked_list-test-util.h b/src/kudu/integration-tests/linked_list-test-util.h
index 8d3d559..0ce6de1 100644
--- a/src/kudu/integration-tests/linked_list-test-util.h
+++ b/src/kudu/integration-tests/linked_list-test-util.h
@@ -308,21 +308,21 @@ class PeriodicWebUIChecker {
     // List of master and ts web pages to fetch
     vector<std::string> master_pages, ts_pages;
 
-    master_pages.push_back("/metrics");
-    master_pages.push_back("/masters");
-    master_pages.push_back("/tables");
-    master_pages.push_back("/dump-entities");
-    master_pages.push_back("/tablet-servers");
-    master_pages.push_back("/mem-trackers");
-
-    ts_pages.push_back("/metrics");
-    ts_pages.push_back("/tablets");
+    master_pages.emplace_back("/metrics");
+    master_pages.emplace_back("/masters");
+    master_pages.emplace_back("/tables");
+    master_pages.emplace_back("/dump-entities");
+    master_pages.emplace_back("/tablet-servers");
+    master_pages.emplace_back("/mem-trackers");
+
+    ts_pages.emplace_back("/metrics");
+    ts_pages.emplace_back("/tablets");
     if (!tablet_id.empty()) {
       ts_pages.push_back(strings::Substitute("/transactions?tablet_id=$0",
                                              tablet_id));
     }
-    ts_pages.push_back("/maintenance-manager");
-    ts_pages.push_back("/mem-trackers");
+    ts_pages.emplace_back("/maintenance-manager");
+    ts_pages.emplace_back("/mem-trackers");
 
     // Generate list of urls for each master and tablet server
     for (int i = 0; i < cluster.num_masters(); i++) {
@@ -495,8 +495,7 @@ Status LinkedListTester::LoadLinkedList(
     MonoTime now = MonoTime::Now();
     if (next_sample < now) {
       Timestamp now(client_->GetLatestObservedTimestamp());
-      sampled_timestamps_and_counts_.push_back(
-          pair<uint64_t,int64_t>(now.ToUint64() + 1, *written_count));
+      sampled_timestamps_and_counts_.emplace_back(now.ToUint64() + 1, *written_count);
       next_sample += sample_interval;
       LOG(INFO) << "Sample at HT timestamp: " << now.ToString()
                 << " Inserted count: " << *written_count;

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/integration-tests/linked_list-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/linked_list-test.cc b/src/kudu/integration-tests/linked_list-test.cc
index a41846d..16e8d60 100644
--- a/src/kudu/integration-tests/linked_list-test.cc
+++ b/src/kudu/integration-tests/linked_list-test.cc
@@ -87,27 +87,27 @@ class LinkedListTest : public tserver::TabletServerIntegrationTestBase {
   void BuildAndStart() {
     vector<string> common_flags;
 
-    common_flags.push_back("--skip_remove_old_recovery_dir");
+    common_flags.emplace_back("--skip_remove_old_recovery_dir");
 
     // Set history retention to one day, so that we don't GC history in this test.
     // We rely on verifying "back in time" with snapshot scans.
-    common_flags.push_back("--tablet_history_max_age_sec=86400");
+    common_flags.emplace_back("--tablet_history_max_age_sec=86400");
 
     vector<string> ts_flags(common_flags);
     if (FLAGS_stress_flush_compact) {
       // Set the flush threshold low so that we have a mix of flushed and unflushed
       // operations in the WAL, when we bootstrap.
-      ts_flags.push_back("--flush_threshold_mb=1");
+      ts_flags.emplace_back("--flush_threshold_mb=1");
       // Set the compaction budget to be low so that we get multiple passes of compaction
       // instead of selecting all of the rowsets in a single compaction of the whole
       // tablet.
-      ts_flags.push_back("--tablet_compaction_budget_mb=4");
+      ts_flags.emplace_back("--tablet_compaction_budget_mb=4");
       // Set the major delta compaction ratio low enough that we trigger a lot of them.
-      ts_flags.push_back("--tablet_delta_store_major_compact_min_ratio=0.001");
+      ts_flags.emplace_back("--tablet_delta_store_major_compact_min_ratio=0.001");
     }
     if (FLAGS_stress_wal_gc) {
       // Set the size of the WAL segments low so that some can be GC'd.
-      ts_flags.push_back("--log_segment_size_mb=1");
+      ts_flags.emplace_back("--log_segment_size_mb=1");
     }
 
     CreateCluster("linked-list-cluster", ts_flags, common_flags);

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/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 1c13054..5715ba0 100644
--- a/src/kudu/integration-tests/master-stress-test.cc
+++ b/src/kudu/integration-tests/master-stress-test.cc
@@ -95,24 +95,24 @@ class MasterStressTest : public KuduTest {
     // Don't preallocate log segments, since we're creating many tablets here.
     // If each preallocates 64M or so, we use a ton of disk space in this
     // test, and it fails on normal sized /tmp dirs.
-    opts.extra_master_flags.push_back("--log_preallocate_segments=false");
-    opts.extra_tserver_flags.push_back("--log_preallocate_segments=false");
+    opts.extra_master_flags.emplace_back("--log_preallocate_segments=false");
+    opts.extra_tserver_flags.emplace_back("--log_preallocate_segments=false");
 
     // Reduce various timeouts below as to make the detection of leader master
     // failures (specifically, failures as result of long pauses) more rapid.
 
     // Set max missed heartbeats periods to 1.0 (down from 3.0).
-    opts.extra_master_flags.push_back("--leader_failure_max_missed_heartbeat_periods=1.0");
+    opts.extra_master_flags.emplace_back("--leader_failure_max_missed_heartbeat_periods=1.0");
 
     // Set the TS->master heartbeat timeout to 1 second (down from 15 seconds).
-    opts.extra_tserver_flags.push_back("--heartbeat_rpc_timeout_ms=1000");
+    opts.extra_tserver_flags.emplace_back("--heartbeat_rpc_timeout_ms=1000");
 
     // Allow one TS heartbeat failure before retrying with back-off (down from 3).
-    opts.extra_tserver_flags.push_back("--heartbeat_max_failures_before_backoff=1");
+    opts.extra_tserver_flags.emplace_back("--heartbeat_max_failures_before_backoff=1");
 
     // Wait for 500 ms after 'max_consecutive_failed_heartbeats' before trying
     // again (down from 1 second).
-    opts.extra_tserver_flags.push_back("--heartbeat_interval_ms=500");
+    opts.extra_tserver_flags.emplace_back("--heartbeat_interval_ms=500");
 
     cluster_.reset(new ExternalMiniCluster(std::move(opts)));
     ASSERT_OK(cluster_->Start());

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/integration-tests/master_failover-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/master_failover-itest.cc b/src/kudu/integration-tests/master_failover-itest.cc
index 5026e75..e02e5ca 100644
--- a/src/kudu/integration-tests/master_failover-itest.cc
+++ b/src/kudu/integration-tests/master_failover-itest.cc
@@ -71,15 +71,15 @@ class MasterFailoverTest : public KuduTest {
     // long pauses) more rapid.
 
     // Set max missed heartbeats periods to 1.0 (down from 3.0).
-    opts_.extra_master_flags.push_back("--leader_failure_max_missed_heartbeat_periods=1.0");
+    opts_.extra_master_flags.emplace_back("--leader_failure_max_missed_heartbeat_periods=1.0");
 
     // Set the TS->master heartbeat timeout to 1 second (down from 15 seconds).
-    opts_.extra_tserver_flags.push_back("--heartbeat_rpc_timeout_ms=1000");
+    opts_.extra_tserver_flags.emplace_back("--heartbeat_rpc_timeout_ms=1000");
     // Allow one TS heartbeat failure before retrying with back-off (down from 3).
-    opts_.extra_tserver_flags.push_back("--heartbeat_max_failures_before_backoff=1");
+    opts_.extra_tserver_flags.emplace_back("--heartbeat_max_failures_before_backoff=1");
     // Wait for 500 ms after 'max_consecutive_failed_heartbeats'
     // before trying again (down from 1 second).
-    opts_.extra_tserver_flags.push_back("--heartbeat_interval_ms=500");
+    opts_.extra_tserver_flags.emplace_back("--heartbeat_interval_ms=500");
   }
 
   virtual void SetUp() OVERRIDE {

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/integration-tests/mini_cluster.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/mini_cluster.cc b/src/kudu/integration-tests/mini_cluster.cc
index 60ac484..3139dc5 100644
--- a/src/kudu/integration-tests/mini_cluster.cc
+++ b/src/kudu/integration-tests/mini_cluster.cc
@@ -177,7 +177,7 @@ Status MiniCluster::AddTabletServer() {
   // set the master addresses
   tablet_server->options()->master_addresses.clear();
   for (const shared_ptr<MiniMaster>& master : mini_masters_) {
-    tablet_server->options()->master_addresses.push_back(HostPort(master->bound_rpc_addr()));
+    tablet_server->options()->master_addresses.emplace_back(master->bound_rpc_addr());
   }
   RETURN_NOT_OK(tablet_server->Start())
   mini_tablet_servers_.push_back(shared_ptr<MiniTabletServer>(tablet_server.release()));

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/integration-tests/open-readonly-fs-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/open-readonly-fs-itest.cc b/src/kudu/integration-tests/open-readonly-fs-itest.cc
index e17902d..7277e54 100644
--- a/src/kudu/integration-tests/open-readonly-fs-itest.cc
+++ b/src/kudu/integration-tests/open-readonly-fs-itest.cc
@@ -59,9 +59,9 @@ class OpenReadonlyFsITest : public KuduTest {
     // threads to encourage frequent compactions. The net effect of both of
     // these changes: more blocks are written to disk. Turning off container
     // file preallocation forces every append to increase the file size.
-    opts.extra_tserver_flags.push_back("--log_container_preallocate_bytes=0");
-    opts.extra_tserver_flags.push_back("--maintenance_manager_num_threads=16");
-    opts.extra_tserver_flags.push_back("--flush_threshold_mb=1");
+    opts.extra_tserver_flags.emplace_back("--log_container_preallocate_bytes=0");
+    opts.extra_tserver_flags.emplace_back("--maintenance_manager_num_threads=16");
+    opts.extra_tserver_flags.emplace_back("--flush_threshold_mb=1");
 
     cluster_.reset(new ExternalMiniCluster(std::move(opts)));
     ASSERT_OK(cluster_->Start());

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/integration-tests/raft_consensus-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/raft_consensus-itest.cc b/src/kudu/integration-tests/raft_consensus-itest.cc
index 1e48a65..4f7d543 100644
--- a/src/kudu/integration-tests/raft_consensus-itest.cc
+++ b/src/kudu/integration-tests/raft_consensus-itest.cc
@@ -836,23 +836,23 @@ void RaftConsensusITest::CreateClusterForCrashyNodesTests() {
   // Crash 5% of the time just before sending an RPC. With 7 servers,
   // this means we crash about 30% of the time before we've fully
   // replicated the NO_OP at the start of the term.
-  ts_flags.push_back("--fault_crash_on_leader_request_fraction=0.05");
+  ts_flags.emplace_back("--fault_crash_on_leader_request_fraction=0.05");
 
   // Inject latency to encourage the replicas to fall out of sync
   // with each other.
-  ts_flags.push_back("--log_inject_latency");
-  ts_flags.push_back("--log_inject_latency_ms_mean=30");
-  ts_flags.push_back("--log_inject_latency_ms_stddev=60");
+  ts_flags.emplace_back("--log_inject_latency");
+  ts_flags.emplace_back("--log_inject_latency_ms_mean=30");
+  ts_flags.emplace_back("--log_inject_latency_ms_stddev=60");
 
   // Make leader elections faster so we get through more cycles of leaders.
-  ts_flags.push_back("--raft_heartbeat_interval_ms=100");
-  ts_flags.push_back("--leader_failure_monitor_check_mean_ms=50");
-  ts_flags.push_back("--leader_failure_monitor_check_stddev_ms=25");
+  ts_flags.emplace_back("--raft_heartbeat_interval_ms=100");
+  ts_flags.emplace_back("--leader_failure_monitor_check_mean_ms=50");
+  ts_flags.emplace_back("--leader_failure_monitor_check_stddev_ms=25");
 
   // Avoid preallocating segments since bootstrap is a little bit
   // faster if it doesn't have to scan forward through the preallocated
   // log area.
-  ts_flags.push_back("--log_preallocate_segments=false");
+  ts_flags.emplace_back("--log_preallocate_segments=false");
 
   CreateCluster("raft_consensus-itest-crashy-nodes-cluster", ts_flags, {});
 }
@@ -950,10 +950,10 @@ void RaftConsensusITest::CreateClusterForChurnyElectionsTests(
   // any progress at all.
   ts_flags.push_back("--raft_heartbeat_interval_ms=5");
 #else
-  ts_flags.push_back("--raft_heartbeat_interval_ms=1");
+  ts_flags.emplace_back("--raft_heartbeat_interval_ms=1");
 #endif
-  ts_flags.push_back("--leader_failure_monitor_check_mean_ms=1");
-  ts_flags.push_back("--leader_failure_monitor_check_stddev_ms=1");
+  ts_flags.emplace_back("--leader_failure_monitor_check_mean_ms=1");
+  ts_flags.emplace_back("--leader_failure_monitor_check_stddev_ms=1");
 
   ts_flags.insert(ts_flags.end(), extra_ts_flags.cbegin(), extra_ts_flags.cend());
 
@@ -1244,9 +1244,9 @@ void RaftConsensusITest::SetupSingleReplicaTest(TServerDetails** replica_ts) {
   FLAGS_num_tablet_servers = 3;
   vector<string> ts_flags, master_flags;
   // Don't use the hybrid clock as we set logical timestamps on ops.
-  ts_flags.push_back("--use_hybrid_clock=false");
-  ts_flags.push_back("--enable_leader_failure_detection=false");
-  master_flags.push_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
+  ts_flags.emplace_back("--use_hybrid_clock=false");
+  ts_flags.emplace_back("--enable_leader_failure_detection=false");
+  master_flags.emplace_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
   BuildAndStart(ts_flags, master_flags);
 
   // Kill all the servers but one.
@@ -1585,8 +1585,8 @@ TEST_F(RaftConsensusITest, TestLeaderStepDown) {
   FLAGS_num_tablet_servers = 3;
 
   vector<string> ts_flags, master_flags;
-  ts_flags.push_back("--enable_leader_failure_detection=false");
-  master_flags.push_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
+  ts_flags.emplace_back("--enable_leader_failure_detection=false");
+  master_flags.emplace_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
   BuildAndStart(ts_flags, master_flags);
 
   vector<TServerDetails*> tservers;
@@ -1726,7 +1726,7 @@ TEST_F(RaftConsensusITest, TestAddRemoveServer) {
   FLAGS_num_replicas = 3;
   vector<string> ts_flags = { "--enable_leader_failure_detection=false" };
   vector<string> master_flags = { "--master_add_server_when_underreplicated=false" };
-  master_flags.push_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
+  master_flags.emplace_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
   NO_FATALS(BuildAndStart(ts_flags, master_flags));
 
   vector<TServerDetails*> tservers;
@@ -1807,7 +1807,7 @@ TEST_F(RaftConsensusITest, TestReplaceChangeConfigOperation) {
   FLAGS_num_replicas = 3;
   vector<string> ts_flags = { "--enable_leader_failure_detection=false" };
   vector<string> master_flags = { "--master_add_server_when_underreplicated=false" };
-  master_flags.push_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
+  master_flags.emplace_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
   NO_FATALS(BuildAndStart(ts_flags, master_flags));
 
   vector<TServerDetails*> tservers;
@@ -1873,7 +1873,7 @@ TEST_F(RaftConsensusITest, TestAtomicAddRemoveServer) {
   FLAGS_num_replicas = 3;
   vector<string> ts_flags = { "--enable_leader_failure_detection=false" };
   vector<string> master_flags = { "--master_add_server_when_underreplicated=false" };
-  master_flags.push_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
+  master_flags.emplace_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
   NO_FATALS(BuildAndStart(ts_flags, master_flags));
 
   vector<TServerDetails*> tservers;
@@ -1957,8 +1957,8 @@ TEST_F(RaftConsensusITest, TestElectPendingVoter) {
   FLAGS_num_tablet_servers = 5;
   FLAGS_num_replicas = 5;
   vector<string> ts_flags, master_flags;
-  ts_flags.push_back("--enable_leader_failure_detection=false");
-  master_flags.push_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
+  ts_flags.emplace_back("--enable_leader_failure_detection=false");
+  master_flags.emplace_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
   BuildAndStart(ts_flags, master_flags);
 
   vector<TServerDetails*> tservers;
@@ -2070,7 +2070,7 @@ TEST_F(RaftConsensusITest, TestConfigChangeUnderLoad) {
   FLAGS_num_replicas = 3;
   vector<string> ts_flags = { "--enable_leader_failure_detection=false" };
   vector<string> master_flags = { "--master_add_server_when_underreplicated=false" };
-  master_flags.push_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
+  master_flags.emplace_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
   BuildAndStart(ts_flags, master_flags);
 
   vector<TServerDetails*> tservers;
@@ -2242,20 +2242,20 @@ TEST_F(RaftConsensusITest, TestEarlyCommitDespiteMemoryPressure) {
 
   // If failure detection were on, a follower could be elected as leader after
   // we kill the leader below.
-  ts_flags.push_back("--enable_leader_failure_detection=false");
-  master_flags.push_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
+  ts_flags.emplace_back("--enable_leader_failure_detection=false");
+  master_flags.emplace_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
 
   // Very low memory limit to ease testing.
   // When using tcmalloc, we set it to 30MB, since we can get accurate process memory
   // usage statistics. Otherwise, set to only 4MB, since we'll only be throttling based
   // on our tracked memory.
 #ifdef TCMALLOC_ENABLED
-  ts_flags.push_back("--memory_limit_hard_bytes=30000000");
+  ts_flags.emplace_back("--memory_limit_hard_bytes=30000000");
 #else
   ts_flags.push_back("--memory_limit_hard_bytes=4194304");
 #endif
   // Don't let transaction memory tracking get in the way.
-  ts_flags.push_back("--tablet_transaction_memory_limit_mb=-1");
+  ts_flags.emplace_back("--tablet_transaction_memory_limit_mb=-1");
 
   BuildAndStart(ts_flags, master_flags);
 
@@ -2421,7 +2421,7 @@ TEST_F(RaftConsensusITest, TestMemoryRemainsConstantDespiteTwoDeadFollowers) {
   // Start the cluster with a low per-tablet transaction memory limit, so that
   // the test can complete faster.
   vector<string> flags;
-  flags.push_back("--tablet_transaction_memory_limit_mb=2");
+  flags.emplace_back("--tablet_transaction_memory_limit_mb=2");
   BuildAndStart(flags);
 
   // Kill both followers.
@@ -2868,8 +2868,8 @@ TEST_F(RaftConsensusITest, TestUpdateConsensusErrorNonePrepared) {
   const int kNumOps = 10;
 
   vector<string> ts_flags, master_flags;
-  ts_flags.push_back("--enable_leader_failure_detection=false");
-  master_flags.push_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
+  ts_flags.emplace_back("--enable_leader_failure_detection=false");
+  master_flags.emplace_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
   BuildAndStart(ts_flags, master_flags);
 
   vector<TServerDetails*> tservers;
@@ -2958,7 +2958,7 @@ TEST_F(RaftConsensusITest, TestLogIOErrorIsFatal) {
               // Disable core dumps since we will inject FATAL errors, and dumping
               // core can take a long time.
               "--disable_core_dumps"};
-  master_flags.push_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
+  master_flags.emplace_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
   NO_FATALS(BuildAndStart(ts_flags, master_flags));
 
   vector<TServerDetails*> tservers;

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/integration-tests/security-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/security-itest.cc b/src/kudu/integration-tests/security-itest.cc
index 6cd5d36..9688afc 100644
--- a/src/kudu/integration-tests/security-itest.cc
+++ b/src/kudu/integration-tests/security-itest.cc
@@ -42,8 +42,8 @@ class SecurityITest : public KuduTest {
   SecurityITest() {
     cluster_opts_.enable_kerberos = true;
     cluster_opts_.num_tablet_servers = 3;
-    cluster_opts_.extra_master_flags.push_back("--rpc_trace_negotiation");
-    cluster_opts_.extra_tserver_flags.push_back("--rpc_trace_negotiation");
+    cluster_opts_.extra_master_flags.emplace_back("--rpc_trace_negotiation");
+    cluster_opts_.extra_tserver_flags.emplace_back("--rpc_trace_negotiation");
   }
   Status StartCluster() {
     cluster_.reset(new ExternalMiniCluster(cluster_opts_));
@@ -202,18 +202,18 @@ TEST_F(SecurityITest, TestAuthorizedSuperuser) {
 // Test that the web UIs can be entirely disabled, for users who feel they
 // are a security risk.
 TEST_F(SecurityITest, TestDisableWebUI) {
-  cluster_opts_.extra_master_flags.push_back("--webserver_enabled=0");
-  cluster_opts_.extra_tserver_flags.push_back("--webserver_enabled=0");
+  cluster_opts_.extra_master_flags.emplace_back("--webserver_enabled=0");
+  cluster_opts_.extra_tserver_flags.emplace_back("--webserver_enabled=0");
   ASSERT_OK(StartCluster());
   NO_FATALS(SmokeTestCluster());
 }
 
 // Test disabling authentication and encryption.
 TEST_F(SecurityITest, TestDisableAuthenticationEncryption) {
-  cluster_opts_.extra_master_flags.push_back("--rpc_authentication=disabled");
-  cluster_opts_.extra_tserver_flags.push_back("--rpc_authentication=disabled");
-  cluster_opts_.extra_master_flags.push_back("--rpc_encryption=disabled");
-  cluster_opts_.extra_tserver_flags.push_back("--rpc_encryption=disabled");
+  cluster_opts_.extra_master_flags.emplace_back("--rpc_authentication=disabled");
+  cluster_opts_.extra_tserver_flags.emplace_back("--rpc_authentication=disabled");
+  cluster_opts_.extra_master_flags.emplace_back("--rpc_encryption=disabled");
+  cluster_opts_.extra_tserver_flags.emplace_back("--rpc_encryption=disabled");
   cluster_opts_.enable_kerberos = false;
   ASSERT_OK(StartCluster());
   NO_FATALS(SmokeTestCluster());

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/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 2f747c5..7b64dd6 100644
--- a/src/kudu/integration-tests/tablet_copy-itest.cc
+++ b/src/kudu/integration-tests/tablet_copy-itest.cc
@@ -96,8 +96,8 @@ TEST_F(TabletCopyITest, TestRejectRogueLeader) {
   }
 
   vector<string> ts_flags, master_flags;
-  ts_flags.push_back("--enable_leader_failure_detection=false");
-  master_flags.push_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
+  ts_flags.emplace_back("--enable_leader_failure_detection=false");
+  master_flags.emplace_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
   NO_FATALS(StartCluster(ts_flags, master_flags));
 
   const MonoDelta timeout = MonoDelta::FromSeconds(30);
@@ -448,14 +448,14 @@ TEST_F(TabletCopyITest, TestConcurrentTabletCopys) {
   }
 
   vector<string> ts_flags, master_flags;
-  ts_flags.push_back("--enable_leader_failure_detection=false");
-  ts_flags.push_back("--log_cache_size_limit_mb=1");
-  ts_flags.push_back("--log_segment_size_mb=1");
-  ts_flags.push_back("--log_async_preallocate_segments=false");
-  ts_flags.push_back("--log_min_segments_to_retain=100");
-  ts_flags.push_back("--flush_threshold_mb=0"); // Constantly flush.
-  ts_flags.push_back("--maintenance_manager_polling_interval_ms=10");
-  master_flags.push_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
+  ts_flags.emplace_back("--enable_leader_failure_detection=false");
+  ts_flags.emplace_back("--log_cache_size_limit_mb=1");
+  ts_flags.emplace_back("--log_segment_size_mb=1");
+  ts_flags.emplace_back("--log_async_preallocate_segments=false");
+  ts_flags.emplace_back("--log_min_segments_to_retain=100");
+  ts_flags.emplace_back("--flush_threshold_mb=0"); // Constantly flush.
+  ts_flags.emplace_back("--maintenance_manager_polling_interval_ms=10");
+  master_flags.emplace_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
   NO_FATALS(StartCluster(ts_flags, master_flags));
 
   const MonoDelta timeout = MonoDelta::FromSeconds(60);
@@ -692,9 +692,9 @@ int64_t CountLogMessages(ExternalTabletServer* ets) {
 TEST_F(TabletCopyITest, TestDisableTabletCopy_NoTightLoopWhenTabletDeleted) {
   MonoDelta timeout = MonoDelta::FromSeconds(10);
   vector<string> ts_flags, master_flags;
-  ts_flags.push_back("--enable_leader_failure_detection=false");
-  ts_flags.push_back("--enable_tablet_copy=false");
-  master_flags.push_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
+  ts_flags.emplace_back("--enable_leader_failure_detection=false");
+  ts_flags.emplace_back("--enable_tablet_copy=false");
+  master_flags.emplace_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
   NO_FATALS(StartCluster(ts_flags, master_flags));
 
   TestWorkload workload(cluster_.get());
@@ -755,10 +755,10 @@ TEST_F(TabletCopyITest, TestDisableTabletCopy_NoTightLoopWhenTabletDeleted) {
 TEST_F(TabletCopyITest, TestSlowCopyDoesntFail) {
   MonoDelta timeout = MonoDelta::FromSeconds(30);
   vector<string> ts_flags, master_flags;
-  ts_flags.push_back("--enable_leader_failure_detection=false");
-  ts_flags.push_back("--tablet_copy_dowload_file_inject_latency_ms=5000");
-  ts_flags.push_back("--follower_unavailable_considered_failed_sec=2");
-  master_flags.push_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
+  ts_flags.emplace_back("--enable_leader_failure_detection=false");
+  ts_flags.emplace_back("--tablet_copy_dowload_file_inject_latency_ms=5000");
+  ts_flags.emplace_back("--follower_unavailable_considered_failed_sec=2");
+  master_flags.emplace_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
   NO_FATALS(StartCluster(ts_flags, master_flags));
 
   TestWorkload workload(cluster_.get());

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/integration-tests/tablet_copy_client_session-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/tablet_copy_client_session-itest.cc b/src/kudu/integration-tests/tablet_copy_client_session-itest.cc
index 304c9b5..5442cd5 100644
--- a/src/kudu/integration-tests/tablet_copy_client_session-itest.cc
+++ b/src/kudu/integration-tests/tablet_copy_client_session-itest.cc
@@ -57,7 +57,7 @@ void TabletCopyClientSessionITest::PrepareClusterForTabletCopy(
   const int kNumTabletServers = 2;
   // We don't want the master to interfere when we manually make copies of
   // tablets onto servers it doesn't know about.
-  extra_master_flags.push_back("--master_tombstone_evicted_tablet_replicas=false");
+  extra_master_flags.emplace_back("--master_tombstone_evicted_tablet_replicas=false");
   NO_FATALS(StartCluster(extra_tserver_flags, extra_master_flags, kNumTabletServers));
   // Shut down the 2nd tablet server; we'll create tablets on the first one.
   cluster_->tablet_server(1)->Shutdown();

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/integration-tests/tablet_replacement-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/tablet_replacement-itest.cc b/src/kudu/integration-tests/tablet_replacement-itest.cc
index bdf386d..a2d9bbf 100644
--- a/src/kudu/integration-tests/tablet_replacement-itest.cc
+++ b/src/kudu/integration-tests/tablet_replacement-itest.cc
@@ -55,7 +55,7 @@ TEST_F(TabletReplacementITest, TestMasterTombstoneEvictedReplica) {
   vector<string> ts_flags = { "--enable_leader_failure_detection=false" };
   int num_tservers = 5;
   vector<string> master_flags = { "--master_add_server_when_underreplicated=false" };
-  master_flags.push_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
+  master_flags.emplace_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
   NO_FATALS(StartCluster(ts_flags, master_flags, num_tservers));
 
   TestWorkload workload(cluster_.get());
@@ -128,7 +128,7 @@ TEST_F(TabletReplacementITest, TestMasterTombstoneOldReplicaOnReport) {
   MonoDelta timeout = MonoDelta::FromSeconds(30);
   vector<string> ts_flags = { "--enable_leader_failure_detection=false" };
   vector<string> master_flags = { "--master_add_server_when_underreplicated=false" };
-  master_flags.push_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
+  master_flags.emplace_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
   NO_FATALS(StartCluster(ts_flags, master_flags));
 
   TestWorkload workload(cluster_.get());
@@ -240,13 +240,13 @@ TEST_F(TabletReplacementITest, TestRemoteBoostrapWithPendingConfigChangeCommits)
 
   MonoDelta timeout = MonoDelta::FromSeconds(30);
   vector<string> ts_flags;
-  ts_flags.push_back("--enable_leader_failure_detection=false");
+  ts_flags.emplace_back("--enable_leader_failure_detection=false");
   vector<string> master_flags;
   // We will manage doing the AddServer() manually, in order to make this test
   // more deterministic.
-  master_flags.push_back("--master_add_server_when_underreplicated=false");
-  master_flags.push_back("--master_tombstone_evicted_tablet_replicas=false");
-  master_flags.push_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
+  master_flags.emplace_back("--master_add_server_when_underreplicated=false");
+  master_flags.emplace_back("--master_tombstone_evicted_tablet_replicas=false");
+  master_flags.emplace_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false");
   NO_FATALS(StartCluster(ts_flags, master_flags));
 
   TestWorkload workload(cluster_.get());

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/integration-tests/ts_itest-base.h
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/ts_itest-base.h b/src/kudu/integration-tests/ts_itest-base.h
index 7c96bdd..8b3f457 100644
--- a/src/kudu/integration-tests/ts_itest-base.h
+++ b/src/kudu/integration-tests/ts_itest-base.h
@@ -105,7 +105,7 @@ class TabletServerIntegrationTestBase : public TabletServerTestBase {
     // If the caller passed no flags use the default ones, where we stress consensus by setting
     // low timeouts and frequent cache misses.
     if (non_default_ts_flags.empty()) {
-      opts.extra_tserver_flags.push_back("--log_cache_size_limit_mb=10");
+      opts.extra_tserver_flags.emplace_back("--log_cache_size_limit_mb=10");
       opts.extra_tserver_flags.push_back(strings::Substitute("--consensus_rpc_timeout_ms=$0",
                                                              FLAGS_consensus_rpc_timeout_ms));
     } else {

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/integration-tests/version_migration-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/version_migration-test.cc b/src/kudu/integration-tests/version_migration-test.cc
index a31eed8..2a70e8a 100644
--- a/src/kudu/integration-tests/version_migration-test.cc
+++ b/src/kudu/integration-tests/version_migration-test.cc
@@ -79,9 +79,9 @@ void VersionMigrationTest::StartCluster(const vector<string>& extra_ts_flags,
   if (!bin_path.empty()) opts.daemon_bin_path = bin_path;
   opts.num_tablet_servers = num_tablet_servers;
   opts.extra_master_flags = extra_master_flags;
-  opts.extra_master_flags.push_back("--undefok=unlock_experimental_flags,unlock_unsafe_flags");
+  opts.extra_master_flags.emplace_back("--undefok=unlock_experimental_flags,unlock_unsafe_flags");
   opts.extra_tserver_flags = extra_ts_flags;
-  opts.extra_tserver_flags.push_back("--undefok=unlock_experimental_flags,unlock_unsafe_flags");
+  opts.extra_tserver_flags.emplace_back("--undefok=unlock_experimental_flags,unlock_unsafe_flags");
   cluster_.reset(new ExternalMiniCluster(std::move(opts)));
   verifier_.reset(new LogVerifier(cluster_.get()));
   ASSERT_OK(cluster_->Start());

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/master/ts_descriptor.cc
----------------------------------------------------------------------
diff --git a/src/kudu/master/ts_descriptor.cc b/src/kudu/master/ts_descriptor.cc
index 6f93bb3..82c4961 100644
--- a/src/kudu/master/ts_descriptor.cc
+++ b/src/kudu/master/ts_descriptor.cc
@@ -197,7 +197,7 @@ Status TSDescriptor::ResolveSockaddr(Sockaddr* addr) const {
   {
     std::lock_guard<simple_spinlock> l(lock_);
     for (const HostPortPB& addr : registration_->rpc_addresses()) {
-      hostports.push_back(HostPort(addr.host(), addr.port()));
+      hostports.emplace_back(addr.host(), addr.port());
     }
   }
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/rpc/rpc_stub-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/rpc_stub-test.cc b/src/kudu/rpc/rpc_stub-test.cc
index 2fe0708..9ee59b0 100644
--- a/src/kudu/rpc/rpc_stub-test.cc
+++ b/src/kudu/rpc/rpc_stub-test.cc
@@ -340,8 +340,8 @@ TEST_F(RpcStubTest, TestRpcPanic) {
     string executable_path;
     CHECK_OK(env_->GetExecutablePath(&executable_path));
     argv.push_back(executable_path);
-    argv.push_back("--is_panic_test_child");
-    argv.push_back("--gtest_filter=RpcStubTest.TestRpcPanic");
+    argv.emplace_back("--is_panic_test_child");
+    argv.emplace_back("--gtest_filter=RpcStubTest.TestRpcPanic");
     Subprocess subp(argv);
     subp.ShareParentStderr(false);
     CHECK_OK(subp.Start());

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/server/default-path-handlers.cc
----------------------------------------------------------------------
diff --git a/src/kudu/server/default-path-handlers.cc b/src/kudu/server/default-path-handlers.cc
index f4b3f27..7f32e26 100644
--- a/src/kudu/server/default-path-handlers.cc
+++ b/src/kudu/server/default-path-handlers.cc
@@ -227,7 +227,7 @@ static void WriteMetricsAsJson(const MetricRegistry* const metrics,
     SplitStringUsing(*requested_metrics_param, ",", &requested_metrics);
   } else {
     // Default to including all metrics.
-    requested_metrics.push_back("*");
+    requested_metrics.emplace_back("*");
   }
 
   WARN_NOT_OK(metrics->WriteAsJson(&writer, requested_metrics, opts),

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/server/server_base.cc
----------------------------------------------------------------------
diff --git a/src/kudu/server/server_base.cc b/src/kudu/server/server_base.cc
index ed036ad..eba74ae 100644
--- a/src/kudu/server/server_base.cc
+++ b/src/kudu/server/server_base.cc
@@ -391,7 +391,7 @@ void ServerBase::MetricsLoggingThread() {
 
     // Collect the metrics JSON string.
     vector<string> metrics;
-    metrics.push_back("*");
+    metrics.emplace_back("*");
     MetricJsonOptions opts;
     opts.include_raw_histograms = true;
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/server/webserver.cc
----------------------------------------------------------------------
diff --git a/src/kudu/server/webserver.cc b/src/kudu/server/webserver.cc
index 2c35402..2a22b5b 100644
--- a/src/kudu/server/webserver.cc
+++ b/src/kudu/server/webserver.cc
@@ -144,10 +144,10 @@ Status Webserver::Start() {
 
   if (static_pages_available()) {
     LOG(INFO) << "Document root: " << opts_.doc_root;
-    options.push_back("document_root");
+    options.emplace_back("document_root");
     options.push_back(opts_.doc_root);
-    options.push_back("enable_directory_listing");
-    options.push_back("no");
+    options.emplace_back("enable_directory_listing");
+    options.emplace_back("no");
   } else {
     LOG(INFO)<< "Document root disabled";
   }
@@ -158,14 +158,14 @@ Status Webserver::Start() {
     // Initialize OpenSSL, and prevent Squeasel from also performing global OpenSSL
     // initialization.
     security::InitializeOpenSSL();
-    options.push_back("ssl_global_init");
-    options.push_back("false");
+    options.emplace_back("ssl_global_init");
+    options.emplace_back("false");
 
-    options.push_back("ssl_certificate");
+    options.emplace_back("ssl_certificate");
     options.push_back(opts_.certificate_file);
 
     if (!opts_.private_key_file.empty()) {
-      options.push_back("ssl_private_key");
+      options.emplace_back("ssl_private_key");
       options.push_back(opts_.private_key_file);
 
       string key_password;
@@ -182,13 +182,13 @@ Status Webserver::Start() {
         }
         StripTrailingWhitespace(&key_password);
       }
-      options.push_back("ssl_private_key_password");
+      options.emplace_back("ssl_private_key_password");
       options.push_back(key_password); // maybe empty if not configured.
     }
   }
 
   if (!opts_.authentication_domain.empty()) {
-    options.push_back("authentication_domain");
+    options.emplace_back("authentication_domain");
     options.push_back(opts_.authentication_domain);
   }
 
@@ -201,11 +201,11 @@ Status Webserver::Start() {
       return Status::InvalidArgument(ss.str());
     }
     LOG(INFO) << "Webserver: Password file is " << opts_.password_file;
-    options.push_back("global_auth_file");
+    options.emplace_back("global_auth_file");
     options.push_back(opts_.password_file);
   }
 
-  options.push_back("listening_ports");
+  options.emplace_back("listening_ports");
   string listening_str;
   RETURN_NOT_OK(BuildListenSpec(&listening_str));
   options.push_back(listening_str);
@@ -224,7 +224,7 @@ Status Webserver::Start() {
   }
 
   // Num threads
-  options.push_back("num_threads");
+  options.emplace_back("num_threads");
   options.push_back(std::to_string(opts_.num_worker_threads));
 
   // mongoose ignores SIGCHLD and we need it to run kinit. This means that since

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/tablet/deltamemstore.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/deltamemstore.cc b/src/kudu/tablet/deltamemstore.cc
index 204efba..dc52c28 100644
--- a/src/kudu/tablet/deltamemstore.cc
+++ b/src/kudu/tablet/deltamemstore.cc
@@ -278,7 +278,7 @@ Status DMSIterator::PrepareBatch(size_t nrows, PrepareFlag flag) {
           // just overwrite that one.
           if (updates_by_col_[col_idx].empty() ||
               updates_by_col_[col_idx].back().row_id != key.row_idx()) {
-            updates_by_col_[col_idx].push_back(ColumnUpdate());
+            updates_by_col_[col_idx].emplace_back();
           }
 
           ColumnUpdate& cu = updates_by_col_[col_idx].back();

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/tablet/diskrowset-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/diskrowset-test.cc b/src/kudu/tablet/diskrowset-test.cc
index 6b9ee3b..71c92b2 100644
--- a/src/kudu/tablet/diskrowset-test.cc
+++ b/src/kudu/tablet/diskrowset-test.cc
@@ -318,7 +318,7 @@ TEST_F(TestRowSet, TestFlushedUpdatesRespectMVCC) {
 
   // Take a snapshot of the pre-update state.
   vector<MvccSnapshot> snaps;
-  snaps.push_back(MvccSnapshot(mvcc_));
+  snaps.emplace_back(mvcc_);
 
 
   // Update the single row multiple times, taking an MVCC snapshot
@@ -347,7 +347,7 @@ TEST_F(TestRowSet, TestFlushedUpdatesRespectMVCC) {
       ASSERT_EQ(0L, result.mutated_stores(0).dms_id());
       tx.Commit();
     }
-    snaps.push_back(MvccSnapshot(mvcc_));
+    snaps.emplace_back(mvcc_);
   }
 
   // Ensure that MVCC is respected by reading the value at each of the stored

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/tablet/local_tablet_writer.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/local_tablet_writer.h b/src/kudu/tablet/local_tablet_writer.h
index 6bc3f6e..b92a409 100644
--- a/src/kudu/tablet/local_tablet_writer.h
+++ b/src/kudu/tablet/local_tablet_writer.h
@@ -80,7 +80,7 @@ class LocalTabletWriter {
   Status Write(RowOperationsPB::Type type,
                const KuduPartialRow& row) {
     vector<Op> ops;
-    ops.push_back(Op(type, &row));
+    ops.emplace_back(type, &row);
     return WriteBatch(ops);
   }
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/tablet/lock_manager-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/lock_manager-test.cc b/src/kudu/tablet/lock_manager-test.cc
index fd55f2b..d505989 100644
--- a/src/kudu/tablet/lock_manager-test.cc
+++ b/src/kudu/tablet/lock_manager-test.cc
@@ -263,7 +263,7 @@ TEST_F(LockManagerTest, TestUncontended) {
   }
   vector<Slice> slices;
   for (int i = 0; i < FLAGS_num_test_threads; i++) {
-    slices.push_back(Slice(slice_strings[i]));
+    slices.emplace_back(slice_strings[i]);
   }
   vector<shared_ptr<LmTestResource> > resources;
   for (int i = 0; i < FLAGS_num_test_threads; i++) {

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/tablet/memrowset-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/memrowset-test.cc b/src/kudu/tablet/memrowset-test.cc
index 2b223b6..c8dab7e 100644
--- a/src/kudu/tablet/memrowset-test.cc
+++ b/src/kudu/tablet/memrowset-test.cc
@@ -474,7 +474,7 @@ TEST_F(TestMemRowSet, TestInsertionMVCC) {
     }
 
     // Transaction is committed. Save the snapshot after this commit.
-    snapshots.push_back(MvccSnapshot(mvcc_));
+    snapshots.emplace_back(mvcc_);
   }
   LOG(INFO) << "MemRowSet after inserts:";
   ASSERT_OK(mrs->DebugDump());
@@ -503,7 +503,7 @@ TEST_F(TestMemRowSet, TestUpdateMVCC) {
 
   vector<MvccSnapshot> snapshots;
   // First snapshot is after insertion
-  snapshots.push_back(MvccSnapshot(mvcc_));
+  snapshots.emplace_back(mvcc_);
 
   // Update the row 5 times (setting its int column to increasing ints 1-5)
   for (uint32_t i = 1; i <= 5; i++) {
@@ -513,7 +513,7 @@ TEST_F(TestMemRowSet, TestUpdateMVCC) {
     ASSERT_EQ(0L, result.mutated_stores(0).mrs_id());
 
     // Transaction is committed. Save the snapshot after this commit.
-    snapshots.push_back(MvccSnapshot(mvcc_));
+    snapshots.emplace_back(mvcc_);
   }
 
   LOG(INFO) << "MemRowSet after updates:";

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/tablet/metadata-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/metadata-test.cc b/src/kudu/tablet/metadata-test.cc
index a404e6d..6ec3901 100644
--- a/src/kudu/tablet/metadata-test.cc
+++ b/src/kudu/tablet/metadata-test.cc
@@ -56,8 +56,8 @@ class MetadataTest : public KuduTest {
 // Swap out some deltas from the middle of the list
 TEST_F(MetadataTest, RSMD_TestReplaceDeltas_1) {
   vector<BlockId> to_replace;
-  to_replace.push_back(BlockId(2));
-  to_replace.push_back(BlockId(3));
+  to_replace.emplace_back(2);
+  to_replace.emplace_back(3);
 
   ASSERT_OK(meta_->CommitUpdate(
               RowSetMetadataUpdate()
@@ -69,8 +69,8 @@ TEST_F(MetadataTest, RSMD_TestReplaceDeltas_1) {
 // Swap out some deltas from the beginning of the list
 TEST_F(MetadataTest, RSMD_TestReplaceDeltas_2) {
   vector<BlockId> to_replace;
-  to_replace.push_back(BlockId(1));
-  to_replace.push_back(BlockId(2));
+  to_replace.emplace_back(1);
+  to_replace.emplace_back(2);
 
   ASSERT_OK(meta_->CommitUpdate(
               RowSetMetadataUpdate()
@@ -82,8 +82,8 @@ TEST_F(MetadataTest, RSMD_TestReplaceDeltas_2) {
 // Swap out some deltas from the end of the list
 TEST_F(MetadataTest, RSMD_TestReplaceDeltas_3) {
   vector<BlockId> to_replace;
-  to_replace.push_back(BlockId(3));
-  to_replace.push_back(BlockId(4));
+  to_replace.emplace_back(3);
+  to_replace.emplace_back(4);
 
   ASSERT_OK(meta_->CommitUpdate(
               RowSetMetadataUpdate()
@@ -95,8 +95,8 @@ TEST_F(MetadataTest, RSMD_TestReplaceDeltas_3) {
 // Swap out a non-contiguous list, check error.
 TEST_F(MetadataTest, RSMD_TestReplaceDeltas_Bad_NonContiguous) {
   vector<BlockId> to_replace;
-  to_replace.push_back(BlockId(2));
-  to_replace.push_back(BlockId(4));
+  to_replace.emplace_back(2);
+  to_replace.emplace_back(4);
 
   Status s = meta_->CommitUpdate(
     RowSetMetadataUpdate()
@@ -113,7 +113,7 @@ TEST_F(MetadataTest, RSMD_TestReplaceDeltas_Bad_NonContiguous) {
 // Swap out a list which contains an invalid element, check error.
 TEST_F(MetadataTest, RSMD_TestReplaceDeltas_Bad_DoesntExist) {
   vector<BlockId> to_replace;
-  to_replace.push_back(BlockId(555));
+  to_replace.emplace_back(555);
 
   Status s = meta_->CommitUpdate(
     RowSetMetadataUpdate()

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/tablet/rowset_tree.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/rowset_tree.cc b/src/kudu/tablet/rowset_tree.cc
index 272468a..4c748e6 100644
--- a/src/kudu/tablet/rowset_tree.cc
+++ b/src/kudu/tablet/rowset_tree.cc
@@ -135,8 +135,8 @@ Status RowSetTree::Reset(const RowSetVector &rowsets) {
     rsit->max_key = std::move(max_key);
 
     // Load into key endpoints.
-    endpoints.push_back(RSEndpoint(rsit->rowset, START, rsit->min_key));
-    endpoints.push_back(RSEndpoint(rsit->rowset, STOP, rsit->max_key));
+    endpoints.emplace_back(rsit->rowset, START, rsit->min_key);
+    endpoints.emplace_back(rsit->rowset, STOP, rsit->max_key);
 
     entries.push_back(rsit.release());
   }

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/tablet/tablet-schema-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/tablet-schema-test.cc b/src/kudu/tablet/tablet-schema-test.cc
index 0b95271..8b2a659 100644
--- a/src/kudu/tablet/tablet-schema-test.cc
+++ b/src/kudu/tablet/tablet-schema-test.cc
@@ -144,9 +144,9 @@ TEST_F(TestTabletSchema, TestWrite) {
 
   // Verify the default value
   std::vector<std::pair<string, string> > keys;
-  keys.push_back(std::pair<string, string>(Substitute("key=$0", s2Key),
-                                           Substitute("c2=$0", c2_write_default)));
-  keys.push_back(std::pair<string, string>("", Substitute("c2=$0", c2_read_default)));
+  keys.emplace_back(Substitute("key=$0", s2Key),
+                                           Substitute("c2=$0", c2_write_default));
+  keys.emplace_back("", Substitute("c2=$0", c2_read_default));
   VerifyTabletRows(s2, keys);
 
   // Delete the row
@@ -187,10 +187,10 @@ TEST_F(TestTabletSchema, TestReInsert) {
 
   // Verify the default value
   std::vector<std::pair<string, string> > keys;
-  keys.push_back(std::pair<string, string>(Substitute("key=$0", s1Key),
-                                           Substitute("c2=$0", c2_read_default)));
-  keys.push_back(std::pair<string, string>(Substitute("key=$0", s2Key),
-                                           Substitute("c2=$0", c2_write_default)));
+  keys.emplace_back(Substitute("key=$0", s1Key),
+                                           Substitute("c2=$0", c2_read_default));
+  keys.emplace_back(Substitute("key=$0", s2Key),
+                                           Substitute("c2=$0", c2_write_default));
   VerifyTabletRows(s2, keys);
 
   // Try compact all (different schemas)
@@ -217,8 +217,8 @@ TEST_F(TestTabletSchema, TestRenameProjection) {
   // Read and verify using the s2 schema
   keys.clear();
   for (int i = 1; i <= 4; ++i) {
-    keys.push_back(std::pair<string, string>(Substitute("key=$0", i),
-                                             Substitute("c1_renamed=$0", i)));
+    keys.emplace_back(Substitute("key=$0", i),
+                                             Substitute("c1_renamed=$0", i));
   }
   VerifyTabletRows(s2, keys);
 
@@ -230,7 +230,7 @@ TEST_F(TestTabletSchema, TestRenameProjection) {
 
   // Read and verify using the s2 schema
   keys.clear();
-  keys.push_back(std::pair<string, string>("key=2", "c1_renamed=6"));
+  keys.emplace_back("key=2", "c1_renamed=6");
   VerifyTabletRows(s2, keys);
 }
 
@@ -243,7 +243,7 @@ TEST_F(TestTabletSchema, TestDeleteAndReAddColumn) {
   MutateRow(client_schema_, /* key= */ 1, /* col_idx= */ 1, /* new_val= */ 2);
 
   keys.clear();
-  keys.push_back(std::pair<string, string>("key=1", "c1=2"));
+  keys.emplace_back("key=1", "c1=2");
   VerifyTabletRows(client_schema_, keys);
 
   // Switch schema to s2
@@ -257,7 +257,7 @@ TEST_F(TestTabletSchema, TestDeleteAndReAddColumn) {
 
   // Verify that the new 'c1' have the default value
   keys.clear();
-  keys.push_back(std::pair<string, string>("key=1", "c1=NULL"));
+  keys.emplace_back("key=1", "c1=NULL");
   VerifyTabletRows(s2, keys);
 }
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/tools/ksck.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tools/ksck.cc b/src/kudu/tools/ksck.cc
index a99d4c1..7505b67 100644
--- a/src/kudu/tools/ksck.cc
+++ b/src/kudu/tools/ksck.cc
@@ -845,12 +845,12 @@ Ksck::CheckResult Ksck::VerifyTablet(const shared_ptr<KsckTablet>& tablet, int t
     // Fill out the columns with info from the replicas.
     for (const auto& replica : replica_infos) {
       char label = FindOrDie(peer_uuid_mapping, replica.ts->uuid());
-      sources.push_back(string(1, label));
+      sources.emplace_back(1, label);
       if (!replica.consensus_state) {
-        voters.push_back("[config not available]");
-        terms.push_back("");
-        indexes.push_back("");
-        committed.push_back("");
+        voters.emplace_back("[config not available]");
+        terms.emplace_back("");
+        indexes.emplace_back("");
+        committed.emplace_back("");
         continue;
       }
       voters.push_back(format_peers(peer_uuid_mapping, replica.consensus_state.get()));
@@ -858,7 +858,7 @@ Ksck::CheckResult Ksck::VerifyTablet(const shared_ptr<KsckTablet>& tablet, int t
                       std::to_string(replica.consensus_state->term.get()) : "");
       indexes.push_back(replica.consensus_state->opid_index ?
                         std::to_string(replica.consensus_state->opid_index.get()) : "");
-      committed.push_back(replica.consensus_state->type == KsckConsensusConfigType::PENDING ?
+      committed.emplace_back(replica.consensus_state->type == KsckConsensusConfigType::PENDING ?
                           "No" : "Yes");
     }
     vector<vector<string>> columns{ sources, voters, terms, indexes, committed };

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/tools/tool_main.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tools/tool_main.cc b/src/kudu/tools/tool_main.cc
index e3be7ed..4cc10c7 100644
--- a/src/kudu/tools/tool_main.cc
+++ b/src/kudu/tools/tool_main.cc
@@ -190,7 +190,7 @@ int RunTool(int argc, char** argv, bool show_help) {
         // Invoke the action with whatever arguments remain, skipping this one.
         deque<string> remaining_args;
         for (int j = i + 1; j < argc; j++) {
-          remaining_args.push_back(argv[j]);
+          remaining_args.emplace_back(argv[j]);
         }
         return DispatchCommand(chain, next_action, remaining_args);
       }


[2/5] kudu git commit: tidy: add and fix modernize-make-shared

Posted by to...@apache.org.
tidy: add and fix modernize-make-shared

Also ran tidy --fix to apply these changes.

Change-Id: Ie859db564e9c91520bb2c74be9cdaa29753694f7
Reviewed-on: http://gerrit.cloudera.org:8080/7161
Reviewed-by: Dan Burkert <da...@apache.org>
Tested-by: Todd Lipcon <to...@apache.org>


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

Branch: refs/heads/master
Commit: 6b4284ddf93a6f14845d61fb0160794bb7d34e93
Parents: 9533c57
Author: Todd Lipcon <to...@cloudera.com>
Authored: Mon Jun 12 16:51:24 2017 -0700
Committer: Todd Lipcon <to...@apache.org>
Committed: Tue Jun 13 16:03:59 2017 +0000

----------------------------------------------------------------------
 src/kudu/.clang-tidy                                |  2 +-
 src/kudu/cfile/type_encodings.cc                    |  2 +-
 src/kudu/cfile/type_encodings.h                     |  3 ++-
 src/kudu/common/types.cc                            |  2 +-
 src/kudu/common/types.h                             |  2 ++
 src/kudu/integration-tests/external_mini_cluster.cc |  4 ++--
 src/kudu/integration-tests/mini_cluster.cc          |  4 ++--
 src/kudu/tablet/lock_manager-test.cc                | 15 +++++++--------
 src/kudu/tools/ksck_remote.cc                       |  4 ++--
 src/kudu/util/map-util-test.cc                      |  2 +-
 10 files changed, 21 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/6b4284dd/src/kudu/.clang-tidy
----------------------------------------------------------------------
diff --git a/src/kudu/.clang-tidy b/src/kudu/.clang-tidy
index e94a29d..0815904 100644
--- a/src/kudu/.clang-tidy
+++ b/src/kudu/.clang-tidy
@@ -14,7 +14,7 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-Checks:          'clang-diagnostic-*,clang-analyzer-*,-clang-analyzer-alpha*,-*,readability-*,-readability-braces-around-statements,llvm-include-order,misc-*,-modernize-*,performance-*,-readability-implicit-bool-cast,google-*,-google-readability-braces-around-statements,-readability-redundant-string-init'
+Checks:          'clang-diagnostic-*,clang-analyzer-*,-clang-analyzer-alpha*,-*,readability-*,-readability-braces-around-statements,llvm-include-order,misc-*,-modernize-*,performance-*,-readability-implicit-bool-cast,google-*,-google-readability-braces-around-statements,-readability-redundant-string-init,modernize-make-shared'
 HeaderFilterRegex: '.*,-*.pb.h'
 CheckOptions:
   - key:             readability-identifier-naming.ClassCase

http://git-wip-us.apache.org/repos/asf/kudu/blob/6b4284dd/src/kudu/cfile/type_encodings.cc
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/type_encodings.cc b/src/kudu/cfile/type_encodings.cc
index 3eae786..4cc9e7c 100644
--- a/src/kudu/cfile/type_encodings.cc
+++ b/src/kudu/cfile/type_encodings.cc
@@ -280,7 +280,7 @@ class TypeEncodingResolver {
     }
     mapping_.insert(
         make_pair(make_pair(type, encoding),
-                  shared_ptr<TypeEncodingInfo>(new TypeEncodingInfo(traits))));
+                  std::make_shared<TypeEncodingInfo>(traits)));
   }
 
   unordered_map<pair<DataType, EncodingType>,

http://git-wip-us.apache.org/repos/asf/kudu/blob/6b4284dd/src/kudu/cfile/type_encodings.h
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/type_encodings.h b/src/kudu/cfile/type_encodings.h
index 3a712d7..c9b8a4b 100644
--- a/src/kudu/cfile/type_encodings.h
+++ b/src/kudu/cfile/type_encodings.h
@@ -18,6 +18,7 @@
 #define KUDU_CFILE_TYPE_ENCODINGS_H_
 
 #include "kudu/common/common.pb.h"
+#include "kudu/util/make_shared.h"
 #include "kudu/util/status.h"
 
 namespace kudu {
@@ -52,7 +53,7 @@ class TypeEncodingInfo {
   Status CreateBlockDecoder(BlockDecoder **bd, const Slice &slice,
                             CFileIterator *iter) const;
  private:
-
+  ALLOW_MAKE_SHARED(TypeEncodingInfo);
   friend class TypeEncodingResolver;
   template<typename TypeEncodingTraitsClass> TypeEncodingInfo(TypeEncodingTraitsClass t);
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/6b4284dd/src/kudu/common/types.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/types.cc b/src/kudu/common/types.cc
index df7e89f..f55c4e6 100644
--- a/src/kudu/common/types.cc
+++ b/src/kudu/common/types.cc
@@ -86,7 +86,7 @@ class TypeInfoResolver {
 
   template<DataType type> void AddMapping() {
     TypeTraits<type> traits;
-    mapping_.insert(make_pair(type, shared_ptr<TypeInfo>(new TypeInfo(traits))));
+    mapping_.insert(make_pair(type, std::make_shared<TypeInfo>(traits)));
   }
 
   unordered_map<DataType,

http://git-wip-us.apache.org/repos/asf/kudu/blob/6b4284dd/src/kudu/common/types.h
----------------------------------------------------------------------
diff --git a/src/kudu/common/types.h b/src/kudu/common/types.h
index 2e8b40b..6e418dc 100644
--- a/src/kudu/common/types.h
+++ b/src/kudu/common/types.h
@@ -28,6 +28,7 @@
 #include "kudu/gutil/mathlimits.h"
 #include "kudu/gutil/strings/escaping.h"
 #include "kudu/gutil/strings/numbers.h"
+#include "kudu/util/make_shared.h"
 #include "kudu/util/slice.h"
 
 namespace kudu {
@@ -68,6 +69,7 @@ class TypeInfo {
   }
 
  private:
+  ALLOW_MAKE_SHARED(TypeInfo);
   friend class TypeInfoResolver;
   template<typename Type> TypeInfo(Type t);
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/6b4284dd/src/kudu/integration-tests/external_mini_cluster.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/external_mini_cluster.cc b/src/kudu/integration-tests/external_mini_cluster.cc
index bc9ab1b..3b1ac96 100644
--- a/src/kudu/integration-tests/external_mini_cluster.cc
+++ b/src/kudu/integration-tests/external_mini_cluster.cc
@@ -601,8 +601,8 @@ std::shared_ptr<MasterServiceProxy> ExternalMiniCluster::master_proxy() const {
 
 std::shared_ptr<MasterServiceProxy> ExternalMiniCluster::master_proxy(int idx) const {
   CHECK_LT(idx, masters_.size());
-  return std::shared_ptr<MasterServiceProxy>(
-      new MasterServiceProxy(messenger_, CHECK_NOTNULL(master(idx))->bound_rpc_addr()));
+  return std::make_shared<MasterServiceProxy>(
+      messenger_, CHECK_NOTNULL(master(idx))->bound_rpc_addr());
 }
 
 Status ExternalMiniCluster::CreateClient(client::KuduClientBuilder* builder,

http://git-wip-us.apache.org/repos/asf/kudu/blob/6b4284dd/src/kudu/integration-tests/mini_cluster.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/mini_cluster.cc b/src/kudu/integration-tests/mini_cluster.cc
index 549d2f2..60ac484 100644
--- a/src/kudu/integration-tests/mini_cluster.cc
+++ b/src/kudu/integration-tests/mini_cluster.cc
@@ -341,8 +341,8 @@ std::shared_ptr<MasterServiceProxy> MiniCluster::master_proxy() const {
 }
 
 std::shared_ptr<MasterServiceProxy> MiniCluster::master_proxy(int idx) const {
-  return std::shared_ptr<MasterServiceProxy>(
-      new MasterServiceProxy(messenger_, CHECK_NOTNULL(mini_master(idx))->bound_rpc_addr()));
+  return std::make_shared<MasterServiceProxy>(
+      messenger_, CHECK_NOTNULL(mini_master(idx))->bound_rpc_addr());
 }
 
 } // namespace kudu

http://git-wip-us.apache.org/repos/asf/kudu/blob/6b4284dd/src/kudu/tablet/lock_manager-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/lock_manager-test.cc b/src/kudu/tablet/lock_manager-test.cc
index f599e2b..fd55f2b 100644
--- a/src/kudu/tablet/lock_manager-test.cc
+++ b/src/kudu/tablet/lock_manager-test.cc
@@ -160,9 +160,8 @@ class LmTestThread {
       std::vector<shared_ptr<ScopedRowLock> > locks;
       // TODO: We don't have an API for multi-row
       for (const Slice* key : keys_) {
-        locks.push_back(shared_ptr<ScopedRowLock>(
-                          new ScopedRowLock(manager_, my_txn,
-                                            *key, LockManager::LOCK_EXCLUSIVE)));
+        locks.push_back(std::make_shared<ScopedRowLock>(
+            manager_, my_txn, *key, LockManager::LOCK_EXCLUSIVE));
       }
 
       for (LmTestResource* r : resources_) {
@@ -249,8 +248,8 @@ TEST_F(LockManagerTest, TestContention) {
          r != resources.end(); ++r) {
       keys.push_back((*r)->id());
     }
-    threads.push_back(shared_ptr<LmTestThread>(
-        new LmTestThread(&lock_manager_, keys, resources)));
+    threads.push_back(std::make_shared<LmTestThread>(
+        &lock_manager_, keys, resources));
   }
   runPerformanceTest("Contended", &threads);
 }
@@ -269,7 +268,7 @@ TEST_F(LockManagerTest, TestUncontended) {
   vector<shared_ptr<LmTestResource> > resources;
   for (int i = 0; i < FLAGS_num_test_threads; i++) {
     resources.push_back(
-        shared_ptr<LmTestResource>(new LmTestResource(&slices[i])));
+        std::make_shared<LmTestResource>(&slices[i]));
   }
   vector<shared_ptr<LmTestThread> > threads;
   for (int i = 0; i < FLAGS_num_test_threads; ++i) {
@@ -277,8 +276,8 @@ TEST_F(LockManagerTest, TestUncontended) {
     k.push_back(&slices[i]);
     vector<LmTestResource*> r;
     r.push_back(resources[i].get());
-    threads.push_back(shared_ptr<LmTestThread>(
-        new LmTestThread(&lock_manager_, k, r)));
+    threads.push_back(std::make_shared<LmTestThread>(
+        &lock_manager_, k, r));
   }
   runPerformanceTest("Uncontended", &threads);
 }

http://git-wip-us.apache.org/repos/asf/kudu/blob/6b4284dd/src/kudu/tools/ksck_remote.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tools/ksck_remote.cc b/src/kudu/tools/ksck_remote.cc
index 0a3d8e4..6b4d98f 100644
--- a/src/kudu/tools/ksck_remote.cc
+++ b/src/kudu/tools/ksck_remote.cc
@@ -350,8 +350,8 @@ Status RemoteKsckMaster::RetrieveTabletsList(const shared_ptr<KsckTable>& table)
         new KsckTablet(table.get(), t->tablet().id()));
     vector<shared_ptr<KsckTabletReplica>> replicas;
     for (const auto* r : t->tablet().replicas()) {
-      replicas.push_back(shared_ptr<KsckTabletReplica>(
-          new KsckTabletReplica(r->ts().uuid(), r->is_leader())));
+      replicas.push_back(std::make_shared<KsckTabletReplica>(
+          r->ts().uuid(), r->is_leader()));
     }
     tablet->set_replicas(replicas);
     tablets.push_back(tablet);

http://git-wip-us.apache.org/repos/asf/kudu/blob/6b4284dd/src/kudu/util/map-util-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/map-util-test.cc b/src/kudu/util/map-util-test.cc
index 1e818a2..eb456d3 100644
--- a/src/kudu/util/map-util-test.cc
+++ b/src/kudu/util/map-util-test.cc
@@ -91,7 +91,7 @@ TEST(EraseKeyReturnValuePtrTest, TestRawAndSmartSmartPointers) {
   map<string, shared_ptr<string>> my_map2;
   shared_ptr<string> value2 = EraseKeyReturnValuePtr(&my_map2, "key");
   ASSERT_TRUE(value2.get() == nullptr);
-  my_map2.emplace("key", shared_ptr<string>(new string("hello_world")));
+  my_map2.emplace("key", std::make_shared<string>("hello_world"));
   value2 = EraseKeyReturnValuePtr(&my_map2, "key");
   ASSERT_EQ(*value2, "hello_world");
   map<string, string*> my_map_raw;


[5/5] kudu git commit: tidy: add and fix modernize-pass-by-value

Posted by to...@apache.org.
tidy: add and fix modernize-pass-by-value

Change-Id: Ia074f3fc756f093f80550598466fad30e6ee240d
Reviewed-on: http://gerrit.cloudera.org:8080/7163
Reviewed-by: Dan Burkert <da...@apache.org>
Tested-by: Kudu Jenkins


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

Branch: refs/heads/master
Commit: 50c7d3249ab5ca19fb4d3c0c8748a4a1c5945a12
Parents: 3ff6c9b
Author: Todd Lipcon <to...@cloudera.com>
Authored: Mon Jun 12 17:27:16 2017 -0700
Committer: Todd Lipcon <to...@apache.org>
Committed: Tue Jun 13 16:04:48 2017 +0000

----------------------------------------------------------------------
 src/kudu/.clang-tidy                            |  2 +-
 src/kudu/client/error-internal.cc               |  6 ++++--
 src/kudu/client/error-internal.h                |  2 +-
 src/kudu/client/scan_predicate-internal.h       |  5 +++--
 src/kudu/consensus/consensus-test-util.h        |  6 +++---
 src/kudu/consensus/leader_election.cc           |  5 +++--
 src/kudu/consensus/leader_election.h            |  2 +-
 src/kudu/gutil/bind_internal.h                  |  6 ++++--
 src/kudu/integration-tests/ts_recovery-itest.cc |  9 +++++----
 src/kudu/master/catalog_manager.cc              |  4 ++--
 src/kudu/master/master-test.cc                  |  8 ++++----
 src/kudu/rpc/client_negotiation.cc              |  5 +++--
 src/kudu/rpc/client_negotiation.h               |  2 +-
 src/kudu/rpc/request_tracker.cc                 |  5 +++--
 src/kudu/rpc/request_tracker.h                  |  2 +-
 src/kudu/security/test/mini_kdc.cc              |  5 +++--
 src/kudu/security/test/mini_kdc.h               |  2 +-
 src/kudu/security/token_signing_key.cc          |  4 ++--
 src/kudu/security/token_signing_key.h           |  2 +-
 src/kudu/tablet/delta_tracker.cc                |  5 +++--
 src/kudu/tablet/delta_tracker.h                 |  2 +-
 src/kudu/tablet/diskrowset.cc                   |  5 +++--
 src/kudu/tablet/diskrowset.h                    |  2 +-
 src/kudu/tablet/multi_column_writer.cc          |  6 ++++--
 src/kudu/tablet/multi_column_writer.h           |  2 +-
 src/kudu/tablet/tablet_replica.cc               |  4 ++--
 src/kudu/tablet/tablet_replica.h                |  2 +-
 src/kudu/tools/ksck_remote.h                    |  5 +++--
 src/kudu/tools/tool_action.cc                   | 10 +++++-----
 src/kudu/tools/tool_action.h                    |  4 ++--
 src/kudu/tserver/heartbeater.cc                 |  7 ++++---
 src/kudu/util/file_cache.cc                     |  5 +++--
 src/kudu/util/subprocess.cc                     |  5 +++--
 33 files changed, 82 insertions(+), 64 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/50c7d324/src/kudu/.clang-tidy
----------------------------------------------------------------------
diff --git a/src/kudu/.clang-tidy b/src/kudu/.clang-tidy
index fff398a..97f98f1 100644
--- a/src/kudu/.clang-tidy
+++ b/src/kudu/.clang-tidy
@@ -14,7 +14,7 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-Checks:          'clang-diagnostic-*,clang-analyzer-*,-clang-analyzer-alpha*,-*,readability-*,-readability-braces-around-statements,llvm-include-order,misc-*,-modernize-*,performance-*,-readability-implicit-bool-cast,google-*,-google-readability-braces-around-statements,-readability-redundant-string-init,modernize-make-shared,modernize-shrink-to-fit,modernize-use-emplace'
+Checks:          'clang-diagnostic-*,clang-analyzer-*,-clang-analyzer-alpha*,-*,readability-*,-readability-braces-around-statements,llvm-include-order,misc-*,-modernize-*,performance-*,-readability-implicit-bool-cast,google-*,-google-readability-braces-around-statements,-readability-redundant-string-init,modernize-make-shared,modernize-shrink-to-fit,modernize-use-emplace,modernize-pass-by-value'
 HeaderFilterRegex: '.*,-*.pb.h'
 CheckOptions:
   - key:             readability-identifier-naming.ClassCase

http://git-wip-us.apache.org/repos/asf/kudu/blob/50c7d324/src/kudu/client/error-internal.cc
----------------------------------------------------------------------
diff --git a/src/kudu/client/error-internal.cc b/src/kudu/client/error-internal.cc
index efb673e..75f30dd 100644
--- a/src/kudu/client/error-internal.cc
+++ b/src/kudu/client/error-internal.cc
@@ -17,14 +17,16 @@
 
 #include "kudu/client/error-internal.h"
 
+#include <utility>
+
 namespace kudu {
 
 namespace client {
 
 KuduError::Data::Data(gscoped_ptr<KuduWriteOperation> failed_op,
-                      const Status& status) :
+                      Status status) :
   failed_op_(std::move(failed_op)),
-  status_(status) {
+  status_(std::move(status)) {
 }
 
 } // namespace client

http://git-wip-us.apache.org/repos/asf/kudu/blob/50c7d324/src/kudu/client/error-internal.h
----------------------------------------------------------------------
diff --git a/src/kudu/client/error-internal.h b/src/kudu/client/error-internal.h
index cfbd2fe..71715f6 100644
--- a/src/kudu/client/error-internal.h
+++ b/src/kudu/client/error-internal.h
@@ -26,7 +26,7 @@ namespace client {
 
 class KuduError::Data {
  public:
-  Data(gscoped_ptr<KuduWriteOperation> failed_op, const Status& error);
+  Data(gscoped_ptr<KuduWriteOperation> failed_op, Status error);
   ~Data() = default;
 
   gscoped_ptr<KuduWriteOperation> failed_op_;

http://git-wip-us.apache.org/repos/asf/kudu/blob/50c7d324/src/kudu/client/scan_predicate-internal.h
----------------------------------------------------------------------
diff --git a/src/kudu/client/scan_predicate-internal.h b/src/kudu/client/scan_predicate-internal.h
index c3716cc..acca88f 100644
--- a/src/kudu/client/scan_predicate-internal.h
+++ b/src/kudu/client/scan_predicate-internal.h
@@ -17,6 +17,7 @@
 #ifndef KUDU_CLIENT_SCAN_PREDICATE_INTERNAL_H
 #define KUDU_CLIENT_SCAN_PREDICATE_INTERNAL_H
 
+#include <utility>
 #include <vector>
 
 #include "kudu/client/scan_predicate.h"
@@ -47,8 +48,8 @@ class KuduPredicate::Data {
 // the error is returned.
 class ErrorPredicateData : public KuduPredicate::Data {
  public:
-  explicit ErrorPredicateData(const Status& s)
-      : status_(s) {
+  explicit ErrorPredicateData(Status s)
+      : status_(std::move(s)) {
   }
 
   virtual ~ErrorPredicateData() {

http://git-wip-us.apache.org/repos/asf/kudu/blob/50c7d324/src/kudu/consensus/consensus-test-util.h
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/consensus-test-util.h b/src/kudu/consensus/consensus-test-util.h
index 380d82b..20cc0a9 100644
--- a/src/kudu/consensus/consensus-test-util.h
+++ b/src/kudu/consensus/consensus-test-util.h
@@ -289,8 +289,8 @@ class MockedPeerProxy : public TestPeerProxy {
 class NoOpTestPeerProxy : public TestPeerProxy {
  public:
 
-  explicit NoOpTestPeerProxy(ThreadPool* pool, const consensus::RaftPeerPB& peer_pb)
-    : TestPeerProxy(pool), peer_pb_(peer_pb) {
+  explicit NoOpTestPeerProxy(ThreadPool* pool, consensus::RaftPeerPB peer_pb)
+    : TestPeerProxy(pool), peer_pb_(std::move(peer_pb)) {
     last_received_.CopyFrom(MinimumOpId());
   }
 
@@ -366,7 +366,7 @@ typedef std::unordered_map<std::string, scoped_refptr<RaftConsensus> > TestPeerM
 // Thread-safe manager for list of peers being used in tests.
 class TestPeerMapManager {
  public:
-  explicit TestPeerMapManager(const RaftConfigPB& config) : config_(config) {}
+  explicit TestPeerMapManager(RaftConfigPB config) : config_(std::move(config)) {}
 
   void AddPeer(const std::string& peer_uuid, const scoped_refptr<RaftConsensus>& peer) {
     std::lock_guard<simple_spinlock> lock(lock_);

http://git-wip-us.apache.org/repos/asf/kudu/blob/50c7d324/src/kudu/consensus/leader_election.cc
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/leader_election.cc b/src/kudu/consensus/leader_election.cc
index fad0eb1..2d371d1 100644
--- a/src/kudu/consensus/leader_election.cc
+++ b/src/kudu/consensus/leader_election.cc
@@ -20,6 +20,7 @@
 #include <algorithm>
 #include <boost/bind.hpp>
 #include <mutex>
+#include <utility>
 
 #include "kudu/consensus/consensus_peers.h"
 #include "kudu/consensus/metadata.pb.h"
@@ -130,9 +131,9 @@ bool VoteCounter::AreAllVotesIn() const {
 // ElectionResult
 ///////////////////////////////////////////////////
 
-ElectionResult::ElectionResult(const VoteRequestPB& vote_request, ElectionVote decision,
+ElectionResult::ElectionResult(VoteRequestPB vote_request, ElectionVote decision,
                                ConsensusTerm highest_voter_term, const std::string& message)
-  : vote_request(vote_request),
+  : vote_request(std::move(vote_request)),
     decision(decision),
     highest_voter_term(highest_voter_term),
     message(message) {

http://git-wip-us.apache.org/repos/asf/kudu/blob/50c7d324/src/kudu/consensus/leader_election.h
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/leader_election.h b/src/kudu/consensus/leader_election.h
index d0f15ce..487e34c 100644
--- a/src/kudu/consensus/leader_election.h
+++ b/src/kudu/consensus/leader_election.h
@@ -100,7 +100,7 @@ class VoteCounter {
 // The result of a leader election.
 struct ElectionResult {
  public:
-  ElectionResult(const VoteRequestPB& vote_request, ElectionVote decision,
+  ElectionResult(VoteRequestPB vote_request, ElectionVote decision,
                  ConsensusTerm highest_term, const std::string& message);
 
   // The vote request that was sent to the voters for this election.

http://git-wip-us.apache.org/repos/asf/kudu/blob/50c7d324/src/kudu/gutil/bind_internal.h
----------------------------------------------------------------------
diff --git a/src/kudu/gutil/bind_internal.h b/src/kudu/gutil/bind_internal.h
index 6764d7e..84d7363 100644
--- a/src/kudu/gutil/bind_internal.h
+++ b/src/kudu/gutil/bind_internal.h
@@ -10,6 +10,8 @@
 #ifndef KUDU_GUTIL_BIND_INTERNAL_H_
 #define KUDU_GUTIL_BIND_INTERNAL_H_
 
+#include <utility>
+
 #include "kudu/gutil/bind_helpers.h"
 #include "kudu/gutil/callback_internal.h"
 #include "kudu/gutil/raw_scoped_refptr_mismatch_checker.h"
@@ -2542,11 +2544,11 @@ struct BindState<Runnable, RunType, void(P1, P2, P3,
   typedef UnwrapTraits<P3> Bound3UnwrapTraits;
   typedef UnwrapTraits<P4> Bound4UnwrapTraits;
 
-  BindState(Runnable runnable, P1 p1, P2 p2, const P3& p3, P4 p4)
+  BindState(Runnable runnable, P1 p1, P2 p2, P3 p3, P4 p4)
       : runnable_(std::move(runnable)),
         p1_(std::move(p1)),
         p2_(std::move(p2)),
-        p3_(p3),
+        p3_(std::move(p3)),
         p4_(std::move(p4)) {
     MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
   }

http://git-wip-us.apache.org/repos/asf/kudu/blob/50c7d324/src/kudu/integration-tests/ts_recovery-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/ts_recovery-itest.cc b/src/kudu/integration-tests/ts_recovery-itest.cc
index 9391717..c2f6241 100644
--- a/src/kudu/integration-tests/ts_recovery-itest.cc
+++ b/src/kudu/integration-tests/ts_recovery-itest.cc
@@ -17,6 +17,7 @@
 
 #include <memory>
 #include <string>
+#include <utility>
 
 #include <glog/stl_logging.h>
 
@@ -440,12 +441,12 @@ class UpdaterThreads {
   // 'inserted' is an atomic integer which stores the number of rows
   // which have been inserted up to that point.
   UpdaterThreads(AtomicInt<int32_t>* inserted,
-                 const shared_ptr<KuduClient>& client,
-                 const shared_ptr<KuduTable>& table)
+                 shared_ptr<KuduClient> client,
+                 shared_ptr<KuduTable> table)
     : should_run_(false),
       inserted_(inserted),
-      client_(client),
-      table_(table) {
+      client_(std::move(client)),
+      table_(std::move(table)) {
   }
 
   // Start running the updater threads.

http://git-wip-us.apache.org/repos/asf/kudu/blob/50c7d324/src/kudu/master/catalog_manager.cc
----------------------------------------------------------------------
diff --git a/src/kudu/master/catalog_manager.cc b/src/kudu/master/catalog_manager.cc
index 73e0c24..0065d88 100644
--- a/src/kudu/master/catalog_manager.cc
+++ b/src/kudu/master/catalog_manager.cc
@@ -3343,13 +3343,13 @@ class AsyncAddServerTask : public RetryingTSRpcTask {
  public:
   AsyncAddServerTask(Master *master,
                      const scoped_refptr<TabletInfo>& tablet,
-                     const ConsensusStatePB& cstate,
+                     ConsensusStatePB cstate,
                      ThreadSafeRandom* rng)
     : RetryingTSRpcTask(master,
                         gscoped_ptr<TSPicker>(new PickLeaderReplica(tablet)),
                         tablet->table()),
       tablet_(tablet),
-      cstate_(cstate),
+      cstate_(std::move(cstate)),
       rng_(rng) {
     deadline_ = MonoTime::Max(); // Never time out.
   }

http://git-wip-us.apache.org/repos/asf/kudu/blob/50c7d324/src/kudu/master/master-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/master/master-test.cc b/src/kudu/master/master-test.cc
index 1dfce4e..0ba583a 100644
--- a/src/kudu/master/master-test.cc
+++ b/src/kudu/master/master-test.cc
@@ -806,10 +806,10 @@ TEST_F(MasterTest, TestGetTableSchemaIsAtomicWithCreateTable) {
 class MasterMetadataVerifier : public TableVisitor,
                                public TabletVisitor {
  public:
-  MasterMetadataVerifier(const unordered_set<string>& live_table_names,
-                         const multiset<string>& dead_table_names)
-    : live_table_names_(live_table_names),
-      dead_table_names_(dead_table_names) {
+  MasterMetadataVerifier(unordered_set<string>  live_table_names,
+                         multiset<string>  dead_table_names)
+    : live_table_names_(std::move(live_table_names)),
+      dead_table_names_(std::move(dead_table_names)) {
   }
 
   virtual Status VisitTable(const std::string& table_id,

http://git-wip-us.apache.org/repos/asf/kudu/blob/50c7d324/src/kudu/rpc/client_negotiation.cc
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/client_negotiation.cc b/src/kudu/rpc/client_negotiation.cc
index c1e6581..d6eb022 100644
--- a/src/kudu/rpc/client_negotiation.cc
+++ b/src/kudu/rpc/client_negotiation.cc
@@ -23,6 +23,7 @@
 #include <memory>
 #include <set>
 #include <string>
+#include <utility>
 
 #include <gflags/gflags.h>
 #include <glog/logging.h>
@@ -108,14 +109,14 @@ static Status StatusFromRpcError(const ErrorStatusPB& error) {
 
 ClientNegotiation::ClientNegotiation(unique_ptr<Socket> socket,
                                      const security::TlsContext* tls_context,
-                                     const boost::optional<security::SignedTokenPB>& authn_token,
+                                     boost::optional<security::SignedTokenPB> authn_token,
                                      RpcEncryption encryption)
     : socket_(std::move(socket)),
       helper_(SaslHelper::CLIENT),
       tls_context_(tls_context),
       encryption_(encryption),
       tls_negotiated_(false),
-      authn_token_(authn_token),
+      authn_token_(std::move(authn_token)),
       psecret_(nullptr, std::free),
       negotiated_authn_(AuthenticationType::INVALID),
       negotiated_mech_(SaslMechanism::INVALID),

http://git-wip-us.apache.org/repos/asf/kudu/blob/50c7d324/src/kudu/rpc/client_negotiation.h
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/client_negotiation.h b/src/kudu/rpc/client_negotiation.h
index aa8c6d9..7279632 100644
--- a/src/kudu/rpc/client_negotiation.h
+++ b/src/kudu/rpc/client_negotiation.h
@@ -60,7 +60,7 @@ class ClientNegotiation {
   // The provided TlsContext must outlive this negotiation instance.
   ClientNegotiation(std::unique_ptr<Socket> socket,
                     const security::TlsContext* tls_context,
-                    const boost::optional<security::SignedTokenPB>& authn_token,
+                    boost::optional<security::SignedTokenPB> authn_token,
                     RpcEncryption encryption);
 
   // Enable PLAIN authentication.

http://git-wip-us.apache.org/repos/asf/kudu/blob/50c7d324/src/kudu/rpc/request_tracker.cc
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/request_tracker.cc b/src/kudu/rpc/request_tracker.cc
index 84a445e..0a3dc27 100644
--- a/src/kudu/rpc/request_tracker.cc
+++ b/src/kudu/rpc/request_tracker.cc
@@ -18,6 +18,7 @@
 #include "kudu/rpc/request_tracker.h"
 
 #include <mutex>
+#include <utility>
 
 #include "kudu/gutil/map-util.h"
 
@@ -26,8 +27,8 @@ namespace rpc {
 
 const RequestTracker::SequenceNumber RequestTracker::kNoSeqNo = -1;
 
-RequestTracker::RequestTracker(const string& client_id)
-    : client_id_(client_id),
+RequestTracker::RequestTracker(string client_id)
+    : client_id_(std::move(client_id)),
       next_(0) {}
 
 Status RequestTracker::NewSeqNo(SequenceNumber* seq_no) {

http://git-wip-us.apache.org/repos/asf/kudu/blob/50c7d324/src/kudu/rpc/request_tracker.h
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/request_tracker.h b/src/kudu/rpc/request_tracker.h
index 9698d58..7542bd1 100644
--- a/src/kudu/rpc/request_tracker.h
+++ b/src/kudu/rpc/request_tracker.h
@@ -49,7 +49,7 @@ class RequestTracker : public RefCountedThreadSafe<RequestTracker> {
  public:
   typedef int64_t SequenceNumber;
   static const RequestTracker::SequenceNumber kNoSeqNo;
-  explicit RequestTracker(const std::string& client_id);
+  explicit RequestTracker(std::string client_id);
 
   // Creates a new, unique, sequence number.
   // Sequence numbers are assigned in increasing integer order.

http://git-wip-us.apache.org/repos/asf/kudu/blob/50c7d324/src/kudu/security/test/mini_kdc.cc
----------------------------------------------------------------------
diff --git a/src/kudu/security/test/mini_kdc.cc b/src/kudu/security/test/mini_kdc.cc
index 4b84bf2..b297d9b 100644
--- a/src/kudu/security/test/mini_kdc.cc
+++ b/src/kudu/security/test/mini_kdc.cc
@@ -24,6 +24,7 @@
 #include <map>
 #include <memory>
 #include <string>
+#include <utility>
 
 #include <glog/logging.h>
 
@@ -54,8 +55,8 @@ MiniKdc::MiniKdc()
     : MiniKdc(MiniKdcOptions()) {
 }
 
-MiniKdc::MiniKdc(const MiniKdcOptions& options)
-    : options_(options) {
+MiniKdc::MiniKdc(MiniKdcOptions options)
+    : options_(std::move(options)) {
   if (options_.realm.empty()) {
     options_.realm = "KRBTEST.COM";
   }

http://git-wip-us.apache.org/repos/asf/kudu/blob/50c7d324/src/kudu/security/test/mini_kdc.h
----------------------------------------------------------------------
diff --git a/src/kudu/security/test/mini_kdc.h b/src/kudu/security/test/mini_kdc.h
index f80aac1..5f8ee4d 100644
--- a/src/kudu/security/test/mini_kdc.h
+++ b/src/kudu/security/test/mini_kdc.h
@@ -62,7 +62,7 @@ class MiniKdc {
   MiniKdc();
 
   // Creates a new MiniKdc with the provided options.
-  explicit MiniKdc(const MiniKdcOptions& options);
+  explicit MiniKdc(MiniKdcOptions options);
 
   ~MiniKdc();
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/50c7d324/src/kudu/security/token_signing_key.cc
----------------------------------------------------------------------
diff --git a/src/kudu/security/token_signing_key.cc b/src/kudu/security/token_signing_key.cc
index 20bcfbe..3808cc8 100644
--- a/src/kudu/security/token_signing_key.cc
+++ b/src/kudu/security/token_signing_key.cc
@@ -33,8 +33,8 @@ using std::string;
 namespace kudu {
 namespace security {
 
-TokenSigningPublicKey::TokenSigningPublicKey(const TokenSigningPublicKeyPB& pb)
-    : pb_(pb) {
+TokenSigningPublicKey::TokenSigningPublicKey(TokenSigningPublicKeyPB pb)
+    : pb_(std::move(pb)) {
 }
 
 TokenSigningPublicKey::~TokenSigningPublicKey() {

http://git-wip-us.apache.org/repos/asf/kudu/blob/50c7d324/src/kudu/security/token_signing_key.h
----------------------------------------------------------------------
diff --git a/src/kudu/security/token_signing_key.h b/src/kudu/security/token_signing_key.h
index b3cd658..3a85b33 100644
--- a/src/kudu/security/token_signing_key.h
+++ b/src/kudu/security/token_signing_key.h
@@ -36,7 +36,7 @@ namespace security {
 // This represents a standalone public key useful for token verification.
 class TokenSigningPublicKey {
  public:
-  explicit TokenSigningPublicKey(const TokenSigningPublicKeyPB& pb);
+  explicit TokenSigningPublicKey(TokenSigningPublicKeyPB pb);
   ~TokenSigningPublicKey();
 
   const TokenSigningPublicKeyPB& pb() const {

http://git-wip-us.apache.org/repos/asf/kudu/blob/50c7d324/src/kudu/tablet/delta_tracker.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/delta_tracker.cc b/src/kudu/tablet/delta_tracker.cc
index b293611..5e0bdf1 100644
--- a/src/kudu/tablet/delta_tracker.cc
+++ b/src/kudu/tablet/delta_tracker.cc
@@ -21,6 +21,7 @@
 #include <glog/stl_logging.h>
 #include <mutex>
 #include <set>
+#include <utility>
 
 #include "kudu/gutil/strings/join.h"
 #include "kudu/gutil/strings/strip.h"
@@ -64,12 +65,12 @@ Status DeltaTracker::Open(const shared_ptr<RowSetMetadata>& rowset_metadata,
 DeltaTracker::DeltaTracker(shared_ptr<RowSetMetadata> rowset_metadata,
                            rowid_t num_rows,
                            LogAnchorRegistry* log_anchor_registry,
-                           const TabletMemTrackers& mem_trackers)
+                           TabletMemTrackers mem_trackers)
     : rowset_metadata_(std::move(rowset_metadata)),
       num_rows_(num_rows),
       open_(false),
       log_anchor_registry_(log_anchor_registry),
-      mem_trackers_(mem_trackers),
+      mem_trackers_(std::move(mem_trackers)),
       dms_empty_(true) {}
 
 Status DeltaTracker::OpenDeltaReaders(const vector<BlockId>& blocks,

http://git-wip-us.apache.org/repos/asf/kudu/blob/50c7d324/src/kudu/tablet/delta_tracker.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/delta_tracker.h b/src/kudu/tablet/delta_tracker.h
index 4caee2c..77b86e1 100644
--- a/src/kudu/tablet/delta_tracker.h
+++ b/src/kudu/tablet/delta_tracker.h
@@ -241,7 +241,7 @@ class DeltaTracker {
 
   DeltaTracker(std::shared_ptr<RowSetMetadata> rowset_metadata,
                rowid_t num_rows, log::LogAnchorRegistry* log_anchor_registry,
-               const TabletMemTrackers& mem_trackers);
+               TabletMemTrackers mem_trackers);
 
   Status DoOpen();
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/50c7d324/src/kudu/tablet/diskrowset.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/diskrowset.cc b/src/kudu/tablet/diskrowset.cc
index 0884a91..ab8280e 100644
--- a/src/kudu/tablet/diskrowset.cc
+++ b/src/kudu/tablet/diskrowset.cc
@@ -20,6 +20,7 @@
 #include <algorithm>
 #include <map>
 #include <mutex>
+#include <utility>
 #include <vector>
 
 #include <boost/optional.hpp>
@@ -488,11 +489,11 @@ Status DiskRowSet::Open(const shared_ptr<RowSetMetadata>& rowset_metadata,
 
 DiskRowSet::DiskRowSet(shared_ptr<RowSetMetadata> rowset_metadata,
                        LogAnchorRegistry* log_anchor_registry,
-                       const TabletMemTrackers& mem_trackers)
+                       TabletMemTrackers mem_trackers)
     : rowset_metadata_(std::move(rowset_metadata)),
       open_(false),
       log_anchor_registry_(log_anchor_registry),
-      mem_trackers_(mem_trackers) {}
+      mem_trackers_(std::move(mem_trackers)) {}
 
 Status DiskRowSet::Open() {
   TRACE_EVENT0("tablet", "DiskRowSet::Open");

http://git-wip-us.apache.org/repos/asf/kudu/blob/50c7d324/src/kudu/tablet/diskrowset.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/diskrowset.h b/src/kudu/tablet/diskrowset.h
index 59d20eb..c32155e 100644
--- a/src/kudu/tablet/diskrowset.h
+++ b/src/kudu/tablet/diskrowset.h
@@ -402,7 +402,7 @@ class DiskRowSet : public RowSet {
 
   DiskRowSet(std::shared_ptr<RowSetMetadata> rowset_metadata,
              log::LogAnchorRegistry* log_anchor_registry,
-             const TabletMemTrackers& mem_trackers);
+             TabletMemTrackers mem_trackers);
 
   Status Open();
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/50c7d324/src/kudu/tablet/multi_column_writer.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/multi_column_writer.cc b/src/kudu/tablet/multi_column_writer.cc
index 3500283..abcd259 100644
--- a/src/kudu/tablet/multi_column_writer.cc
+++ b/src/kudu/tablet/multi_column_writer.cc
@@ -17,6 +17,8 @@
 
 #include "kudu/tablet/multi_column_writer.h"
 
+#include <utility>
+
 #include "kudu/cfile/cfile_writer.h"
 #include "kudu/common/rowblock.h"
 #include "kudu/common/schema.h"
@@ -34,11 +36,11 @@ using std::unique_ptr;
 
 MultiColumnWriter::MultiColumnWriter(FsManager* fs,
                                      const Schema* schema,
-                                     const string& tablet_id)
+                                     string tablet_id)
   : fs_(fs),
     schema_(schema),
     finished_(false),
-    tablet_id_(tablet_id) {
+    tablet_id_(std::move(tablet_id)) {
 }
 
 MultiColumnWriter::~MultiColumnWriter() {

http://git-wip-us.apache.org/repos/asf/kudu/blob/50c7d324/src/kudu/tablet/multi_column_writer.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/multi_column_writer.h b/src/kudu/tablet/multi_column_writer.h
index 7b527eb..77e6a12 100644
--- a/src/kudu/tablet/multi_column_writer.h
+++ b/src/kudu/tablet/multi_column_writer.h
@@ -48,7 +48,7 @@ class MultiColumnWriter {
  public:
   MultiColumnWriter(FsManager* fs,
                     const Schema* schema,
-                    const std::string& tablet_id);
+                    std::string tablet_id);
 
   virtual ~MultiColumnWriter();
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/50c7d324/src/kudu/tablet/tablet_replica.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/tablet_replica.cc b/src/kudu/tablet/tablet_replica.cc
index 61cb3bb..8636829 100644
--- a/src/kudu/tablet/tablet_replica.cc
+++ b/src/kudu/tablet/tablet_replica.cc
@@ -102,12 +102,12 @@ using strings::Substitute;
 using tserver::TabletServerErrorPB;
 
 TabletReplica::TabletReplica(const scoped_refptr<TabletMetadata>& meta,
-                             const consensus::RaftPeerPB& local_peer_pb,
+                             consensus::RaftPeerPB local_peer_pb,
                              ThreadPool* apply_pool,
                              Callback<void(const std::string& reason)> mark_dirty_clbk)
     : meta_(meta),
       tablet_id_(meta->tablet_id()),
-      local_peer_pb_(local_peer_pb),
+      local_peer_pb_(std::move(local_peer_pb)),
       state_(NOT_STARTED),
       last_status_("Tablet initializing..."),
       apply_pool_(apply_pool),

http://git-wip-us.apache.org/repos/asf/kudu/blob/50c7d324/src/kudu/tablet/tablet_replica.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/tablet_replica.h b/src/kudu/tablet/tablet_replica.h
index 15ec7dc..74d0283 100644
--- a/src/kudu/tablet/tablet_replica.h
+++ b/src/kudu/tablet/tablet_replica.h
@@ -69,7 +69,7 @@ class TabletReplica : public RefCountedThreadSafe<TabletReplica>,
                       public consensus::ReplicaTransactionFactory {
  public:
   TabletReplica(const scoped_refptr<TabletMetadata>& meta,
-                const consensus::RaftPeerPB& local_peer_pb, ThreadPool* apply_pool,
+                consensus::RaftPeerPB local_peer_pb, ThreadPool* apply_pool,
                 Callback<void(const std::string& reason)> mark_dirty_clbk);
 
   // Initializes the TabletReplica, namely creating the Log and initializing

http://git-wip-us.apache.org/repos/asf/kudu/blob/50c7d324/src/kudu/tools/ksck_remote.h
----------------------------------------------------------------------
diff --git a/src/kudu/tools/ksck_remote.h b/src/kudu/tools/ksck_remote.h
index 177f2b8..add2a80 100644
--- a/src/kudu/tools/ksck_remote.h
+++ b/src/kudu/tools/ksck_remote.h
@@ -20,6 +20,7 @@
 
 #include <memory>
 #include <string>
+#include <utility>
 #include <vector>
 
 #include "kudu/client/client.h"
@@ -94,9 +95,9 @@ class RemoteKsckMaster : public KsckMaster {
 
  private:
 
-  RemoteKsckMaster(const std::vector<std::string>& master_addresses,
+  RemoteKsckMaster(std::vector<std::string> master_addresses,
                    std::shared_ptr<rpc::Messenger> messenger)
-      : master_addresses_(master_addresses),
+      : master_addresses_(std::move(master_addresses)),
         messenger_(std::move(messenger)) {
   }
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/50c7d324/src/kudu/tools/tool_action.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tools/tool_action.cc b/src/kudu/tools/tool_action.cc
index 4bef6e8..8e7ced2 100644
--- a/src/kudu/tools/tool_action.cc
+++ b/src/kudu/tools/tool_action.cc
@@ -112,8 +112,8 @@ string SpacePad(StringPiece s, int len) {
 
 } // anonymous namespace
 
-ModeBuilder::ModeBuilder(const string& name)
-    : name_(name) {
+ModeBuilder::ModeBuilder(string name)
+    : name_(std::move(name)) {
 }
 
 ModeBuilder& ModeBuilder::Description(const string& description) {
@@ -190,9 +190,9 @@ string Mode::BuildHelpXML(const vector<Mode*>& chain) const {
   return xml;
 }
 
-ActionBuilder::ActionBuilder(const string& name, const ActionRunner& runner)
-    : name_(name),
-      runner_(runner) {
+ActionBuilder::ActionBuilder(string name, ActionRunner runner)
+    : name_(std::move(name)),
+      runner_(std::move(runner)) {
 }
 
 ActionBuilder& ActionBuilder::Description(const string& description) {

http://git-wip-us.apache.org/repos/asf/kudu/blob/50c7d324/src/kudu/tools/tool_action.h
----------------------------------------------------------------------
diff --git a/src/kudu/tools/tool_action.h b/src/kudu/tools/tool_action.h
index ab0e467..16aeb76 100644
--- a/src/kudu/tools/tool_action.h
+++ b/src/kudu/tools/tool_action.h
@@ -70,7 +70,7 @@ class ModeBuilder {
  public:
   // Creates a new ModeBuilder with a specific name (e.g. "fs"). The name
   // uniquely identifies the mode amongst its siblings in the tree.
-  explicit ModeBuilder(const std::string& name);
+  explicit ModeBuilder(std::string name);
 
   // Sets the description of this mode (e.g. "Operate on a local Kudu
   // filesystem"), to be used when printing help.
@@ -191,7 +191,7 @@ class ActionBuilder {
   // Creates a new ActionBuilder with a specific name (e.g. "format") and
   // action runner. The name uniquely identifies the action amongst its
   // siblings in the tree.
-  ActionBuilder(const std::string& name, const ActionRunner& runner);
+  ActionBuilder(std::string name, ActionRunner runner);
 
   // Sets the description of this action (e.g. "Format a new Kudu filesystem"),
   // to be used when printing the parent mode's help and the action's help.

http://git-wip-us.apache.org/repos/asf/kudu/blob/50c7d324/src/kudu/tserver/heartbeater.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/heartbeater.cc b/src/kudu/tserver/heartbeater.cc
index b64d053..3c0f56e 100644
--- a/src/kudu/tserver/heartbeater.cc
+++ b/src/kudu/tserver/heartbeater.cc
@@ -20,6 +20,7 @@
 #include <atomic>
 #include <memory>
 #include <string>
+#include <utility>
 #include <vector>
 
 #include <boost/optional.hpp>
@@ -93,7 +94,7 @@ Status MasterServiceProxyForHostPort(const HostPort& hostport,
 // This is basically the "PIMPL" pattern.
 class Heartbeater::Thread {
  public:
-  Thread(const HostPort& master_address, TabletServer* server);
+  Thread(HostPort master_address, TabletServer* server);
 
   Status Start();
   Status Stop();
@@ -266,8 +267,8 @@ void Heartbeater::MarkTabletReportsAcknowledgedForTests(
 // Heartbeater::Thread
 ////////////////////////////////////////////////////////////
 
-Heartbeater::Thread::Thread(const HostPort& master_address, TabletServer* server)
-  : master_address_(master_address),
+Heartbeater::Thread::Thread(HostPort master_address, TabletServer* server)
+  : master_address_(std::move(master_address)),
     server_(server),
     consecutive_failed_heartbeats_(0),
     next_report_seq_(0),

http://git-wip-us.apache.org/repos/asf/kudu/blob/50c7d324/src/kudu/util/file_cache.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/file_cache.cc b/src/kudu/util/file_cache.cc
index 07babad..de0cae7 100644
--- a/src/kudu/util/file_cache.cc
+++ b/src/kudu/util/file_cache.cc
@@ -21,6 +21,7 @@
 #include <memory>
 #include <mutex>
 #include <string>
+#include <utility>
 #include <vector>
 
 #include <gflags/gflags.h>
@@ -86,9 +87,9 @@ template <class FileType>
 class BaseDescriptor {
  public:
   BaseDescriptor(FileCache<FileType>* file_cache,
-                 const string& filename)
+                 string filename)
       : file_cache_(file_cache),
-        file_name_(filename) {}
+        file_name_(std::move(filename)) {}
 
   ~BaseDescriptor() {
     VLOG(2) << "Out of scope descriptor with file name: " << filename();

http://git-wip-us.apache.org/repos/asf/kudu/blob/50c7d324/src/kudu/util/subprocess.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/subprocess.cc b/src/kudu/util/subprocess.cc
index ec032cd..1f38b9f 100644
--- a/src/kudu/util/subprocess.cc
+++ b/src/kudu/util/subprocess.cc
@@ -32,6 +32,7 @@
 #include <memory>
 #include <sstream>
 #include <string>
+#include <utility>
 #include <vector>
 
 #include <ev++.h>
@@ -161,8 +162,8 @@ void RedirectToDevNull(int fd) {
 // Stateful libev watcher to help ReadFdsFully().
 class ReadFdsFullyHelper {
  public:
-  ReadFdsFullyHelper(const string& progname, ev::dynamic_loop* loop, int fd)
-      : progname_(progname) {
+  ReadFdsFullyHelper(string progname, ev::dynamic_loop* loop, int fd)
+      : progname_(std::move(progname)) {
     // Bind the watcher to the provided loop, to this functor, and to the
     // readable fd.
     watcher_.set(*loop);


[3/5] kudu git commit: tidy: add and fix modernize-use-emplace and shrink-to-fit

Posted by to...@apache.org.
http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/tserver/tablet_copy_service-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/tablet_copy_service-test.cc b/src/kudu/tserver/tablet_copy_service-test.cc
index 420bd28..ffa35bb 100644
--- a/src/kudu/tserver/tablet_copy_service-test.cc
+++ b/src/kudu/tserver/tablet_copy_service-test.cc
@@ -245,7 +245,7 @@ TEST_F(TabletCopyServiceTest, TestBeginConcurrently) {
 // Test bad session id error condition.
 TEST_F(TabletCopyServiceTest, TestInvalidSessionId) {
   vector<string> bad_session_ids;
-  bad_session_ids.push_back("hodor");
+  bad_session_ids.emplace_back("hodor");
   bad_session_ids.push_back(GetLocalUUID());
 
   // Fetch a block for a non-existent session.

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/tserver/tablet_server-test-base.h
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/tablet_server-test-base.h b/src/kudu/tserver/tablet_server-test-base.h
index 178bb11..800c5cd 100644
--- a/src/kudu/tserver/tablet_server-test-base.h
+++ b/src/kudu/tserver/tablet_server-test-base.h
@@ -102,7 +102,7 @@ class TabletServerTestBase : public KuduTest {
     // heartbeats, even if there happens to be a master running on this machine.
     mini_server_.reset(new MiniTabletServer(GetTestPath("TabletServerTest-fsroot"), 0));
     mini_server_->options()->master_addresses.clear();
-    mini_server_->options()->master_addresses.push_back(HostPort("255.255.255.255", 1));
+    mini_server_->options()->master_addresses.emplace_back("255.255.255.255", 1);
     ASSERT_OK(mini_server_->Start());
 
     // Set up a tablet inside the server.
@@ -345,7 +345,7 @@ class TabletServerTestBase : public KuduTest {
     // Start server.
     mini_server_.reset(new MiniTabletServer(GetTestPath("TabletServerTest-fsroot"), 0));
     mini_server_->options()->master_addresses.clear();
-    mini_server_->options()->master_addresses.push_back(HostPort("255.255.255.255", 1));
+    mini_server_->options()->master_addresses.emplace_back("255.255.255.255", 1);
     // this should open the tablet created on StartTabletServer()
     RETURN_NOT_OK(mini_server_->Start());
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/util/compression/compression-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/compression/compression-test.cc b/src/kudu/util/compression/compression-test.cc
index 1befbe5..36d003c 100644
--- a/src/kudu/util/compression/compression-test.cc
+++ b/src/kudu/util/compression/compression-test.cc
@@ -59,9 +59,9 @@ static void TestCompressionCodec(CompressionType compression) {
 
   // Compress slices and uncompress
   vector<Slice> v;
-  v.push_back(Slice(ibuffer, 1));
+  v.emplace_back(ibuffer, 1);
   for (int i = 1; i <= kInputSize; i += 7)
-    v.push_back(Slice(ibuffer + i, 7));
+    v.emplace_back(ibuffer + i, 7);
   ASSERT_OK(codec->Compress(Slice(ibuffer, kInputSize), cbuffer.get(), &compressed));
   ASSERT_OK(codec->Uncompress(Slice(cbuffer.get(), compressed), ubuffer, kInputSize));
   ASSERT_EQ(0, memcmp(ibuffer, ubuffer, kInputSize));

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/util/debug/trace_event_impl.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/debug/trace_event_impl.cc b/src/kudu/util/debug/trace_event_impl.cc
index f976c87..5755e30 100644
--- a/src/kudu/util/debug/trace_event_impl.cc
+++ b/src/kudu/util/debug/trace_event_impl.cc
@@ -982,7 +982,7 @@ void TraceSamplingThread::RegisterSampleBucket(
   // that uses the sample_buckets_, because it is guaranteed that
   // RegisterSampleBucket is called before the sampling thread is created.
   DCHECK(!thread_running_);
-  sample_buckets_.push_back(TraceBucketData(bucket, name, callback));
+  sample_buckets_.emplace_back(bucket, name, callback);
 }
 
 // static

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/util/interval_tree-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/interval_tree-test.cc b/src/kudu/util/interval_tree-test.cc
index 34a1d07..0386dab 100644
--- a/src/kudu/util/interval_tree-test.cc
+++ b/src/kudu/util/interval_tree-test.cc
@@ -187,16 +187,16 @@ static vector<IntInterval> CreateRandomIntervals(int n = 100) {
   for (int i = 0; i < n; i++) {
     int l = rand() % 100; // NOLINT(runtime/threadsafe_fn)
     int r = l + rand() % 20; // NOLINT(runtime/threadsafe_fn)
-    intervals.push_back(IntInterval(l, r, i));
+    intervals.emplace_back(l, r, i);
   }
   return intervals;
 }
 
 TEST_F(TestIntervalTree, TestBasic) {
   vector<IntInterval> intervals;
-  intervals.push_back(IntInterval(1, 2, 1));
-  intervals.push_back(IntInterval(3, 4, 2));
-  intervals.push_back(IntInterval(1, 4, 3));
+  intervals.emplace_back(1, 2, 1);
+  intervals.emplace_back(3, 4, 2);
+  intervals.emplace_back(1, 4, 3);
   IntervalTree<IntTraits> t(intervals);
 
   for (int i = 0; i <= 5; i++) {

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/util/knapsack_solver-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/knapsack_solver-test.cc b/src/kudu/util/knapsack_solver-test.cc
index 4d95ada..787fcd1 100644
--- a/src/kudu/util/knapsack_solver-test.cc
+++ b/src/kudu/util/knapsack_solver-test.cc
@@ -81,10 +81,10 @@ TEST_F(TestKnapsack, Basics) {
   KnapsackSolver<TestItemTraits> solver;
 
   vector<TestItem> in;
-  in.push_back(TestItem(500, 3));
-  in.push_back(TestItem(110, 1));
-  in.push_back(TestItem(125, 1));
-  in.push_back(TestItem(100, 1));
+  in.emplace_back(500, 3);
+  in.emplace_back(110, 1);
+  in.emplace_back(125, 1);
+  in.emplace_back(100, 1);
 
   vector<int> out;
   double max_val;

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/util/path_util.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/path_util.cc b/src/kudu/util/path_util.cc
index 6a095cc..091950a 100644
--- a/src/kudu/util/path_util.cc
+++ b/src/kudu/util/path_util.cc
@@ -56,7 +56,7 @@ std::string JoinPathSegments(const std::string &a,
 vector<string> SplitPath(const string& path) {
   if (path.empty()) return {};
   vector<string> segments;
-  if (path[0] == '/') segments.push_back("/");
+  if (path[0] == '/') segments.emplace_back("/");
   vector<StringPiece> pieces = Split(path, "/", SkipEmpty());
   for (const StringPiece& piece : pieces) {
     segments.emplace_back(piece.data(), piece.size());

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/util/pstack_watcher.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/pstack_watcher.cc b/src/kudu/util/pstack_watcher.cc
index 4ba7ada..e4fbddf 100644
--- a/src/kudu/util/pstack_watcher.cc
+++ b/src/kudu/util/pstack_watcher.cc
@@ -126,29 +126,29 @@ Status PstackWatcher::DumpPidStacks(pid_t pid, int flags) {
 Status PstackWatcher::RunGdbStackDump(pid_t pid, int flags) {
   // Command: gdb -quiet -batch -nx -ex cmd1 -ex cmd2 /proc/$PID/exe $PID
   vector<string> argv;
-  argv.push_back("gdb");
+  argv.emplace_back("gdb");
   // Don't print introductory version/copyright messages.
-  argv.push_back("-quiet");
+  argv.emplace_back("-quiet");
   // Exit after processing all of the commands below.
-  argv.push_back("-batch");
+  argv.emplace_back("-batch");
   // Don't run commands from .gdbinit
-  argv.push_back("-nx");
+  argv.emplace_back("-nx");
   // On RHEL6 and older Ubuntu, we occasionally would see gdb spin forever
   // trying to collect backtraces. Setting a backtrace limit is a reasonable
   // workaround, since we don't really expect >100-deep stacks anyway.
   //
   // See https://bugs.launchpad.net/ubuntu/+source/gdb/+bug/434168
-  argv.push_back("-ex");
-  argv.push_back("set backtrace limit 100");
-  argv.push_back("-ex");
-  argv.push_back("set print pretty on");
-  argv.push_back("-ex");
-  argv.push_back("info threads");
-  argv.push_back("-ex");
-  argv.push_back("thread apply all bt");
+  argv.emplace_back("-ex");
+  argv.emplace_back("set backtrace limit 100");
+  argv.emplace_back("-ex");
+  argv.emplace_back("set print pretty on");
+  argv.emplace_back("-ex");
+  argv.emplace_back("info threads");
+  argv.emplace_back("-ex");
+  argv.emplace_back("thread apply all bt");
   if (flags & DUMP_FULL) {
-    argv.push_back("-ex");
-    argv.push_back("thread apply all bt full");
+    argv.emplace_back("-ex");
+    argv.emplace_back("thread apply all bt full");
   }
   string executable;
   Env* env = Env::Default();

http://git-wip-us.apache.org/repos/asf/kudu/blob/3ff6c9ba/src/kudu/util/trace-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/trace-test.cc b/src/kudu/util/trace-test.cc
index 6c38b0c..77c3c91 100644
--- a/src/kudu/util/trace-test.cc
+++ b/src/kudu/util/trace-test.cc
@@ -439,9 +439,9 @@ class TraceEventCallbackTest : public KuduTest {
                        const uint64_t arg_values[],
                        unsigned char flags) {
     s_instance->collected_events_phases_.push_back(phase);
-    s_instance->collected_events_categories_.push_back(
+    s_instance->collected_events_categories_.emplace_back(
         TraceLog::GetCategoryGroupName(category_group_enabled));
-    s_instance->collected_events_names_.push_back(name);
+    s_instance->collected_events_names_.emplace_back(name);
     s_instance->collected_events_timestamps_.push_back(timestamp);
   }
 };