Repository: kudu Updated Branches: refs/heads/master b46c4ecf9 -> c516e1412
env: remove EnvWrapper We're not using it in a useful way right now, and to be honest I don't remember us ever using it. So let's remove it to reduce the number of places that need to be updated when adding a new env function. Change-Id: Iad08a90351bbf5477c7b92a50b72bcf2d105e7fb Reviewed-on: http://gerrit.cloudera.org:8080/5027 Reviewed-by: Todd Lipcon <[email protected]> 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/c516e141 Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/c516e141 Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/c516e141 Branch: refs/heads/master Commit: c516e141255ce1de4eca8a3f6989440e2f4eda70 Parents: b46c4ec Author: Adar Dembo <[email protected]> Authored: Thu Nov 3 19:56:30 2016 -0700 Committer: Adar Dembo <[email protected]> Committed: Tue Nov 15 03:10:15 2016 +0000 ---------------------------------------------------------------------- .../benchmarks/tpch/rpc_line_item_dao-test.cc | 2 +- src/kudu/benchmarks/tpch/tpch1.cc | 6 +- src/kudu/cfile/bloomfile-test-base.h | 2 +- src/kudu/cfile/cfile-test-base.h | 2 +- src/kudu/client/client-test.cc | 2 +- src/kudu/client/predicate-test.cc | 2 +- src/kudu/client/scan_token-test.cc | 2 +- src/kudu/consensus/consensus_meta-test.cc | 2 +- src/kudu/consensus/consensus_peers-test.cc | 2 +- src/kudu/consensus/consensus_queue-test.cc | 2 +- src/kudu/consensus/log-test-base.h | 2 +- src/kudu/consensus/log-test.cc | 3 +- src/kudu/consensus/log_cache-test.cc | 2 +- .../consensus/raft_consensus_quorum-test.cc | 2 +- src/kudu/fs/block_manager-stress-test.cc | 2 +- src/kudu/fs/block_manager-test.cc | 4 +- src/kudu/fs/block_manager_util-test.cc | 24 ++-- src/kudu/fs/fs_manager-test.cc | 2 +- src/kudu/integration-tests/alter_table-test.cc | 2 +- .../create-table-stress-test.cc | 2 +- .../full_stack-insert-scan-test.cc | 2 +- src/kudu/integration-tests/fuzz-itest.cc | 2 +- .../master_replication-itest.cc | 2 +- .../integration-tests/mini_cluster-itest-base.h | 2 +- src/kudu/integration-tests/registration-test.cc | 2 +- .../integration-tests/table_locations-itest.cc | 2 +- src/kudu/integration-tests/tablet_copy-itest.cc | 2 +- .../ts_tablet_manager-itest.cc | 2 +- .../update_scan_delta_compact-test.cc | 2 +- src/kudu/server/webserver-test.cc | 2 +- src/kudu/tablet/compaction-test.cc | 2 +- src/kudu/tablet/delta_compaction-test.cc | 2 +- src/kudu/tablet/deltafile-test.cc | 2 +- src/kudu/tablet/deltamemstore-test.cc | 2 +- src/kudu/tools/ksck_remote-test.cc | 2 +- src/kudu/tools/kudu-tool-test.cc | 18 +-- src/kudu/tserver/tablet_server-test.cc | 3 +- src/kudu/util/env-test.cc | 50 ++++---- src/kudu/util/env.cc | 3 - src/kudu/util/env.h | 113 ------------------- src/kudu/util/pb_util-test.cc | 26 ++--- src/kudu/util/rolling_log-test.cc | 6 +- src/kudu/util/test_util.cc | 8 +- src/kudu/util/test_util.h | 5 +- 44 files changed, 101 insertions(+), 230 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/benchmarks/tpch/rpc_line_item_dao-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/benchmarks/tpch/rpc_line_item_dao-test.cc b/src/kudu/benchmarks/tpch/rpc_line_item_dao-test.cc index b6a2f8e..b57d4dc 100644 --- a/src/kudu/benchmarks/tpch/rpc_line_item_dao-test.cc +++ b/src/kudu/benchmarks/tpch/rpc_line_item_dao-test.cc @@ -47,7 +47,7 @@ class RpcLineItemDAOTest : public KuduTest { KuduTest::SetUp(); // Start minicluster - cluster_.reset(new MiniCluster(env_.get(), MiniClusterOptions())); + cluster_.reset(new MiniCluster(env_, MiniClusterOptions())); ASSERT_OK(cluster_->Start()); const char *kTableName = "tpch1"; http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/benchmarks/tpch/tpch1.cc ---------------------------------------------------------------------- diff --git a/src/kudu/benchmarks/tpch/tpch1.cc b/src/kudu/benchmarks/tpch/tpch1.cc index 05c7b32..3cd1384 100644 --- a/src/kudu/benchmarks/tpch/tpch1.cc +++ b/src/kudu/benchmarks/tpch/tpch1.cc @@ -245,16 +245,16 @@ int main(int argc, char **argv) { kudu::ParseCommandLineFlags(&argc, &argv, true); kudu::InitGoogleLoggingSafe(argv[0]); - gscoped_ptr<kudu::Env> env; + kudu::Env* env; gscoped_ptr<kudu::MiniCluster> cluster; string master_address; if (FLAGS_use_mini_cluster) { - env.reset(new kudu::EnvWrapper(kudu::Env::Default())); + env = kudu::Env::Default(); kudu::Status s = env->CreateDir(FLAGS_mini_cluster_base_dir); CHECK(s.IsAlreadyPresent() || s.ok()) << s.ToString(); kudu::MiniClusterOptions options; options.data_root = FLAGS_mini_cluster_base_dir; - cluster.reset(new kudu::MiniCluster(env.get(), options)); + cluster.reset(new kudu::MiniCluster(env, options)); CHECK_OK(cluster->StartSync()); master_address = cluster->mini_master()->bound_rpc_addr_str(); } else { http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/cfile/bloomfile-test-base.h ---------------------------------------------------------------------- diff --git a/src/kudu/cfile/bloomfile-test-base.h b/src/kudu/cfile/bloomfile-test-base.h index 53a6eda..68ce025 100644 --- a/src/kudu/cfile/bloomfile-test-base.h +++ b/src/kudu/cfile/bloomfile-test-base.h @@ -50,7 +50,7 @@ class BloomFileTestBase : public KuduTest { void SetUp() OVERRIDE { KuduTest::SetUp(); - fs_manager_.reset(new FsManager(env_.get(), GetTestPath("fs_root"))); + fs_manager_.reset(new FsManager(env_, GetTestPath("fs_root"))); ASSERT_OK(fs_manager_->CreateInitialFileSystemLayout()); ASSERT_OK(fs_manager_->Open()); } http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/cfile/cfile-test-base.h ---------------------------------------------------------------------- diff --git a/src/kudu/cfile/cfile-test-base.h b/src/kudu/cfile/cfile-test-base.h index 000c741..aa1ca8c 100644 --- a/src/kudu/cfile/cfile-test-base.h +++ b/src/kudu/cfile/cfile-test-base.h @@ -297,7 +297,7 @@ class CFileTestBase : public KuduTest { void SetUp() OVERRIDE { KuduTest::SetUp(); - fs_manager_.reset(new FsManager(env_.get(), GetTestPath("fs_root"))); + fs_manager_.reset(new FsManager(env_, GetTestPath("fs_root"))); ASSERT_OK(fs_manager_->CreateInitialFileSystemLayout()); ASSERT_OK(fs_manager_->Open()); } http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/client/client-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/client/client-test.cc b/src/kudu/client/client-test.cc index 0c419ba..c6ae8b8 100644 --- a/src/kudu/client/client-test.cc +++ b/src/kudu/client/client-test.cc @@ -138,7 +138,7 @@ class ClientTest : public KuduTest { FLAGS_scanner_gc_check_interval_us = 50 * 1000; // 50 milliseconds. // Start minicluster and wait for tablet servers to connect to master. - cluster_.reset(new MiniCluster(env_.get(), MiniClusterOptions())); + cluster_.reset(new MiniCluster(env_, MiniClusterOptions())); ASSERT_OK(cluster_->Start()); // Connect to the cluster. http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/client/predicate-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/client/predicate-test.cc b/src/kudu/client/predicate-test.cc index cc0cdbb..19c408d 100644 --- a/src/kudu/client/predicate-test.cc +++ b/src/kudu/client/predicate-test.cc @@ -49,7 +49,7 @@ class PredicateTest : public KuduTest { void SetUp() override { // Set up the mini cluster - cluster_.reset(new MiniCluster(env_.get(), MiniClusterOptions())); + cluster_.reset(new MiniCluster(env_, MiniClusterOptions())); ASSERT_OK(cluster_->Start()); ASSERT_OK(cluster_->CreateClient(nullptr, &client_)); } http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/client/scan_token-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/client/scan_token-test.cc b/src/kudu/client/scan_token-test.cc index 4f1a251..2a26b69 100644 --- a/src/kudu/client/scan_token-test.cc +++ b/src/kudu/client/scan_token-test.cc @@ -47,7 +47,7 @@ class ScanTokenTest : public KuduTest { void SetUp() override { // Set up the mini cluster - cluster_.reset(new MiniCluster(env_.get(), MiniClusterOptions())); + cluster_.reset(new MiniCluster(env_, MiniClusterOptions())); ASSERT_OK(cluster_->Start()); ASSERT_OK(cluster_->CreateClient(nullptr, &client_)); } http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/consensus/consensus_meta-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/consensus/consensus_meta-test.cc b/src/kudu/consensus/consensus_meta-test.cc index a548037..e2d033c 100644 --- a/src/kudu/consensus/consensus_meta-test.cc +++ b/src/kudu/consensus/consensus_meta-test.cc @@ -46,7 +46,7 @@ const int64_t kInitialTerm = 3; class ConsensusMetadataTest : public KuduTest { public: ConsensusMetadataTest() - : fs_manager_(env_.get(), GetTestPath("fs_root")) { + : fs_manager_(env_, GetTestPath("fs_root")) { } virtual void SetUp() OVERRIDE { http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/consensus/consensus_peers-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/consensus/consensus_peers-test.cc b/src/kudu/consensus/consensus_peers-test.cc index ee8c6ab..7b2240a 100644 --- a/src/kudu/consensus/consensus_peers-test.cc +++ b/src/kudu/consensus/consensus_peers-test.cc @@ -53,7 +53,7 @@ class ConsensusPeersTest : public KuduTest { virtual void SetUp() OVERRIDE { KuduTest::SetUp(); - fs_manager_.reset(new FsManager(env_.get(), GetTestPath("fs_root"))); + fs_manager_.reset(new FsManager(env_, GetTestPath("fs_root"))); CHECK_OK(fs_manager_->CreateInitialFileSystemLayout()); CHECK_OK(Log::Open(options_, fs_manager_.get(), http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/consensus/consensus_queue-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/consensus/consensus_queue-test.cc b/src/kudu/consensus/consensus_queue-test.cc index 3a939b5..42fa0c0 100644 --- a/src/kudu/consensus/consensus_queue-test.cc +++ b/src/kudu/consensus/consensus_queue-test.cc @@ -56,7 +56,7 @@ class ConsensusQueueTest : public KuduTest { virtual void SetUp() OVERRIDE { KuduTest::SetUp(); - fs_manager_.reset(new FsManager(env_.get(), GetTestPath("fs_root"))); + fs_manager_.reset(new FsManager(env_, GetTestPath("fs_root"))); ASSERT_OK(fs_manager_->CreateInitialFileSystemLayout()); ASSERT_OK(fs_manager_->Open()); CHECK_OK(log::Log::Open(log::LogOptions(), http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/consensus/log-test-base.h ---------------------------------------------------------------------- diff --git a/src/kudu/consensus/log-test-base.h b/src/kudu/consensus/log-test-base.h index 2a862d5..dac1935 100644 --- a/src/kudu/consensus/log-test-base.h +++ b/src/kudu/consensus/log-test-base.h @@ -163,7 +163,7 @@ class LogTestBase : public KuduTest { virtual void SetUp() OVERRIDE { KuduTest::SetUp(); current_index_ = 1; - fs_manager_.reset(new FsManager(env_.get(), GetTestPath("fs_root"))); + fs_manager_.reset(new FsManager(env_, GetTestPath("fs_root"))); metric_registry_.reset(new MetricRegistry()); metric_entity_ = METRIC_ENTITY_tablet.Instantiate(metric_registry_.get(), "log-test-base"); ASSERT_OK(fs_manager_->CreateInitialFileSystemLayout()); http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/consensus/log-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/consensus/log-test.cc b/src/kudu/consensus/log-test.cc index 907a99c..2140b2d 100644 --- a/src/kudu/consensus/log-test.cc +++ b/src/kudu/consensus/log-test.cc @@ -294,8 +294,7 @@ void LogTest::DoCorruptionTest(CorruptionType type, CorruptionPosition place, offset = entry.offset_in_segment + kEntryHeaderSize + 1; break; } - ASSERT_OK(CorruptLogFile( - env_.get(), log_->ActiveSegmentPathForTests(), type, offset)); + ASSERT_OK(CorruptLogFile(env_, log_->ActiveSegmentPathForTests(), type, offset)); // Open a new reader -- we don't reuse the existing LogReader from log_ // because it has a cached header. http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/consensus/log_cache-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/consensus/log_cache-test.cc b/src/kudu/consensus/log_cache-test.cc index 28e6a32..cb26b50 100644 --- a/src/kudu/consensus/log_cache-test.cc +++ b/src/kudu/consensus/log_cache-test.cc @@ -53,7 +53,7 @@ class LogCacheTest : public KuduTest { virtual void SetUp() OVERRIDE { KuduTest::SetUp(); - fs_manager_.reset(new FsManager(env_.get(), GetTestPath("fs_root"))); + fs_manager_.reset(new FsManager(env_, GetTestPath("fs_root"))); ASSERT_OK(fs_manager_->CreateInitialFileSystemLayout()); ASSERT_OK(fs_manager_->Open()); CHECK_OK(log::Log::Open(log::LogOptions(), http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/consensus/raft_consensus_quorum-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/consensus/raft_consensus_quorum-test.cc b/src/kudu/consensus/raft_consensus_quorum-test.cc index 7e7c80d..433ef6e 100644 --- a/src/kudu/consensus/raft_consensus_quorum-test.cc +++ b/src/kudu/consensus/raft_consensus_quorum-test.cc @@ -119,7 +119,7 @@ class RaftConsensusQuorumTest : public KuduTest { opts.parent_mem_tracker = parent_mem_tracker; opts.wal_path = test_path; opts.data_paths = { test_path }; - gscoped_ptr<FsManager> fs_manager(new FsManager(env_.get(), opts)); + gscoped_ptr<FsManager> fs_manager(new FsManager(env_, opts)); RETURN_NOT_OK(fs_manager->CreateInitialFileSystemLayout()); RETURN_NOT_OK(fs_manager->Open()); http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/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 0c128a1..caf7710 100644 --- a/src/kudu/fs/block_manager-stress-test.cc +++ b/src/kudu/fs/block_manager-stress-test.cc @@ -114,7 +114,7 @@ class BlockManagerStressTest : public KuduTest { opts.root_paths = strings::Split(FLAGS_block_manager_paths, ",", strings::SkipEmpty()); } - return new T(env_.get(), opts); + return new T(env_, opts); } void RunTest(int secs) { http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/fs/block_manager-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/fs/block_manager-test.cc b/src/kudu/fs/block_manager-test.cc index fc65fd1..8d47534 100644 --- a/src/kudu/fs/block_manager-test.cc +++ b/src/kudu/fs/block_manager-test.cc @@ -107,7 +107,7 @@ class BlockManagerTest : public KuduTest { opts.metric_entity = metric_entity; opts.parent_mem_tracker = parent_mem_tracker; opts.root_paths = paths; - return new T(env_.get(), opts); + return new T(env_, opts); } Status ReopenBlockManager(const scoped_refptr<MetricEntity>& metric_entity, @@ -169,7 +169,7 @@ void BlockManagerTest<FileBlockManager>::RunMultipathTest(const vector<string>& continue; } PathInstanceMetadataPB instance; - ASSERT_OK(pb_util::ReadPBContainerFromPath(env_.get(), + ASSERT_OK(pb_util::ReadPBContainerFromPath(env_, JoinPathSegments(path, child), &instance)); } http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/fs/block_manager_util-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/fs/block_manager_util-test.cc b/src/kudu/fs/block_manager_util-test.cc index e5144e8..c194a6c 100644 --- a/src/kudu/fs/block_manager_util-test.cc +++ b/src/kudu/fs/block_manager_util-test.cc @@ -43,14 +43,14 @@ TEST_F(KuduTest, Lifecycle) { // Test that the metadata file was created. { - PathInstanceMetadataFile file(env_.get(), kType, kFileName); + PathInstanceMetadataFile file(env_, kType, kFileName); ASSERT_OK(file.Create(kUuid, { kUuid })); } ASSERT_TRUE(env_->FileExists(kFileName)); // Test that we could open and parse it. { - PathInstanceMetadataFile file(env_.get(), kType, kFileName); + PathInstanceMetadataFile file(env_, kType, kFileName); ASSERT_OK(file.LoadFromDisk()); PathInstanceMetadataPB* md = file.metadata(); ASSERT_EQ(kType, md->block_manager_type()); @@ -62,7 +62,7 @@ TEST_F(KuduTest, Lifecycle) { // Test that expecting a different type of block manager fails. { - PathInstanceMetadataFile file(env_.get(), "other type", kFileName); + PathInstanceMetadataFile file(env_, "other type", kFileName); PathInstanceMetadataPB pb; ASSERT_TRUE(file.LoadFromDisk().IsIOError()); } @@ -73,22 +73,22 @@ TEST_F(KuduTest, Locking) { string kFileName = JoinPathSegments(GetTestDataDirectory(), "foo"); string kUuid = "a_uuid"; - PathInstanceMetadataFile file(env_.get(), kType, kFileName); + PathInstanceMetadataFile file(env_, kType, kFileName); ASSERT_OK(file.Create(kUuid, { kUuid })); - PathInstanceMetadataFile first(env_.get(), kType, kFileName); + PathInstanceMetadataFile first(env_, kType, kFileName); ASSERT_OK(first.LoadFromDisk()); ASSERT_OK(first.Lock()); ASSERT_DEATH({ - PathInstanceMetadataFile second(env_.get(), kType, kFileName); + PathInstanceMetadataFile second(env_, kType, kFileName); CHECK_OK(second.LoadFromDisk()); CHECK_OK(second.Lock()); }, "Could not lock"); ASSERT_OK(first.Unlock()); ASSERT_DEATH({ - PathInstanceMetadataFile second(env_.get(), kType, kFileName); + PathInstanceMetadataFile second(env_, kType, kFileName); CHECK_OK(second.LoadFromDisk()); Status s = second.Lock(); if (s.ok()) { @@ -136,14 +136,14 @@ TEST_F(KuduTest, CheckIntegrity) { { // Test consistent path sets. - EXPECT_NO_FATAL_FAILURE(RunCheckIntegrityTest(env_.get(), path_sets, "OK")); + EXPECT_NO_FATAL_FAILURE(RunCheckIntegrityTest(env_, path_sets, "OK")); } { // Test where two path sets claim the same UUID. vector<PathSetPB> path_sets_copy(path_sets); path_sets_copy[1].set_uuid(path_sets_copy[0].uuid()); EXPECT_NO_FATAL_FAILURE(RunCheckIntegrityTest( - env_.get(), path_sets_copy, + env_, path_sets_copy, "IO error: File 1 claimed uuid fee already claimed by file 0")); } { @@ -153,7 +153,7 @@ TEST_F(KuduTest, CheckIntegrity) { ps.add_all_uuids("fee"); } EXPECT_NO_FATAL_FAILURE(RunCheckIntegrityTest( - env_.get(), path_sets_copy, + env_, path_sets_copy, "IO error: File 0 has duplicate uuids: fee,fi,fo,fum,fee")); } { @@ -161,7 +161,7 @@ TEST_F(KuduTest, CheckIntegrity) { vector<PathSetPB> path_sets_copy(path_sets); path_sets_copy[1].set_uuid("something_else"); EXPECT_NO_FATAL_FAILURE(RunCheckIntegrityTest( - env_.get(), path_sets_copy, + env_, path_sets_copy, "IO error: File 1 claimed uuid something_else which is not in " "all_uuids (fee,fi,fo,fum)")); } @@ -170,7 +170,7 @@ TEST_F(KuduTest, CheckIntegrity) { vector<PathSetPB> path_sets_copy(path_sets); path_sets_copy[1].add_all_uuids("another_uuid"); EXPECT_NO_FATAL_FAILURE(RunCheckIntegrityTest( - env_.get(), path_sets_copy, + env_, path_sets_copy, "IO error: File 1 claimed all_uuids fee,fi,fo,fum,another_uuid but " "file 0 claimed all_uuids fee,fi,fo,fum")); } http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/fs/fs_manager-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/fs/fs_manager-test.cc b/src/kudu/fs/fs_manager-test.cc index 747352e..8077a7b 100644 --- a/src/kudu/fs/fs_manager-test.cc +++ b/src/kudu/fs/fs_manager-test.cc @@ -52,7 +52,7 @@ class FsManagerTestBase : public KuduTest { FsManagerOpts opts; opts.wal_path = wal_path; opts.data_paths = data_paths; - fs_manager_.reset(new FsManager(env_.get(), opts)); + fs_manager_.reset(new FsManager(env_, opts)); } void TestReadWriteDataFile(const Slice& data) { http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/integration-tests/alter_table-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/integration-tests/alter_table-test.cc b/src/kudu/integration-tests/alter_table-test.cc index 20a48d7..f82279d 100644 --- a/src/kudu/integration-tests/alter_table-test.cc +++ b/src/kudu/integration-tests/alter_table-test.cc @@ -106,7 +106,7 @@ class AlterTableTest : public KuduTest { MiniClusterOptions opts; opts.num_tablet_servers = num_replicas(); - cluster_.reset(new MiniCluster(env_.get(), opts)); + cluster_.reset(new MiniCluster(env_, opts)); ASSERT_OK(cluster_->Start()); CHECK_OK(KuduClientBuilder() http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/integration-tests/create-table-stress-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/integration-tests/create-table-stress-test.cc b/src/kudu/integration-tests/create-table-stress-test.cc index 00f3558..357a0e7 100644 --- a/src/kudu/integration-tests/create-table-stress-test.cc +++ b/src/kudu/integration-tests/create-table-stress-test.cc @@ -86,7 +86,7 @@ class CreateTableStressTest : public KuduTest { KuduTest::SetUp(); MiniClusterOptions opts; opts.num_tablet_servers = 3; - cluster_.reset(new MiniCluster(env_.get(), opts)); + cluster_.reset(new MiniCluster(env_, opts)); ASSERT_OK(cluster_->Start()); ASSERT_OK(KuduClientBuilder() http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/integration-tests/full_stack-insert-scan-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/integration-tests/full_stack-insert-scan-test.cc b/src/kudu/integration-tests/full_stack-insert-scan-test.cc index 11d3d40..555e5b7 100644 --- a/src/kudu/integration-tests/full_stack-insert-scan-test.cc +++ b/src/kudu/integration-tests/full_stack-insert-scan-test.cc @@ -157,7 +157,7 @@ class FullStackInsertScanTest : public KuduTest { void InitCluster() { // Start mini-cluster with 1 tserver, config client options - cluster_.reset(new MiniCluster(env_.get(), MiniClusterOptions())); + cluster_.reset(new MiniCluster(env_, MiniClusterOptions())); ASSERT_OK(cluster_->Start()); KuduClientBuilder builder; builder.add_master_server_addr( http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/integration-tests/fuzz-itest.cc ---------------------------------------------------------------------- diff --git a/src/kudu/integration-tests/fuzz-itest.cc b/src/kudu/integration-tests/fuzz-itest.cc index 2134a56..3468c47 100644 --- a/src/kudu/integration-tests/fuzz-itest.cc +++ b/src/kudu/integration-tests/fuzz-itest.cc @@ -142,7 +142,7 @@ class FuzzTest : public KuduTest { KuduTest::SetUp(); MiniClusterOptions opts; - cluster_.reset(new MiniCluster(env_.get(), opts)); + cluster_.reset(new MiniCluster(env_, opts)); ASSERT_OK(cluster_->Start()); CHECK_OK(KuduClientBuilder() .add_master_server_addr(cluster_->mini_master()->bound_rpc_addr_str()) http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/integration-tests/master_replication-itest.cc ---------------------------------------------------------------------- diff --git a/src/kudu/integration-tests/master_replication-itest.cc b/src/kudu/integration-tests/master_replication-itest.cc index 7647420..c30acfe 100644 --- a/src/kudu/integration-tests/master_replication-itest.cc +++ b/src/kudu/integration-tests/master_replication-itest.cc @@ -66,7 +66,7 @@ class MasterReplicationTest : public KuduTest { virtual void SetUp() OVERRIDE { KuduTest::SetUp(); - cluster_.reset(new MiniCluster(env_.get(), opts_)); + cluster_.reset(new MiniCluster(env_, opts_)); ASSERT_OK(cluster_->Start()); } http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/integration-tests/mini_cluster-itest-base.h ---------------------------------------------------------------------- diff --git a/src/kudu/integration-tests/mini_cluster-itest-base.h b/src/kudu/integration-tests/mini_cluster-itest-base.h index 4df41ce..b62f56a 100644 --- a/src/kudu/integration-tests/mini_cluster-itest-base.h +++ b/src/kudu/integration-tests/mini_cluster-itest-base.h @@ -50,7 +50,7 @@ class MiniClusterITestBase : public KuduTest { void MiniClusterITestBase::StartCluster(int num_tablet_servers) { MiniClusterOptions opts; opts.num_tablet_servers = num_tablet_servers; - cluster_.reset(new MiniCluster(env_.get(), opts)); + cluster_.reset(new MiniCluster(env_, opts)); ASSERT_OK(cluster_->Start()); ASSERT_OK(cluster_->CreateClient(nullptr, &client_)); } http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/integration-tests/registration-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/integration-tests/registration-test.cc b/src/kudu/integration-tests/registration-test.cc index 55ba9b1..255c152 100644 --- a/src/kudu/integration-tests/registration-test.cc +++ b/src/kudu/integration-tests/registration-test.cc @@ -63,7 +63,7 @@ class RegistrationTest : public KuduTest { KuduTest::SetUp(); - cluster_.reset(new MiniCluster(env_.get(), MiniClusterOptions())); + cluster_.reset(new MiniCluster(env_, MiniClusterOptions())); ASSERT_OK(cluster_->Start()); } http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/integration-tests/table_locations-itest.cc ---------------------------------------------------------------------- diff --git a/src/kudu/integration-tests/table_locations-itest.cc b/src/kudu/integration-tests/table_locations-itest.cc index db71877..385b2a5 100644 --- a/src/kudu/integration-tests/table_locations-itest.cc +++ b/src/kudu/integration-tests/table_locations-itest.cc @@ -59,7 +59,7 @@ class TableLocationsTest : public KuduTest { MiniClusterOptions opts; opts.num_tablet_servers = kNumTabletServers; - cluster_.reset(new MiniCluster(env_.get(), opts)); + cluster_.reset(new MiniCluster(env_, opts)); ASSERT_OK(cluster_->Start()); // Create a client proxy to the master. http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/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 2a76d10..0f97efa 100644 --- a/src/kudu/integration-tests/tablet_copy-itest.cc +++ b/src/kudu/integration-tests/tablet_copy-itest.cc @@ -376,7 +376,7 @@ TEST_F(TabletCopyITest, TestDeleteTabletDuringTabletCopy) { ASSERT_OK(env_->CreateDir(testbase)); opts.wal_path = JoinPathSegments(testbase, "wals"); opts.data_paths.push_back(JoinPathSegments(testbase, "data-0")); - gscoped_ptr<FsManager> fs_manager(new FsManager(env_.get(), opts)); + gscoped_ptr<FsManager> fs_manager(new FsManager(env_, opts)); ASSERT_OK(fs_manager->CreateInitialFileSystemLayout()); ASSERT_OK(fs_manager->Open()); http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/integration-tests/ts_tablet_manager-itest.cc ---------------------------------------------------------------------- diff --git a/src/kudu/integration-tests/ts_tablet_manager-itest.cc b/src/kudu/integration-tests/ts_tablet_manager-itest.cc index 16d516d..3ada5ce 100644 --- a/src/kudu/integration-tests/ts_tablet_manager-itest.cc +++ b/src/kudu/integration-tests/ts_tablet_manager-itest.cc @@ -94,7 +94,7 @@ void TsTabletManagerITest::SetUp() { MiniClusterOptions opts; opts.num_tablet_servers = kNumReplicas; - cluster_.reset(new MiniCluster(env_.get(), opts)); + cluster_.reset(new MiniCluster(env_, opts)); ASSERT_OK(cluster_->Start()); ASSERT_OK(cluster_->CreateClient(nullptr, &client_)); } http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/integration-tests/update_scan_delta_compact-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/integration-tests/update_scan_delta_compact-test.cc b/src/kudu/integration-tests/update_scan_delta_compact-test.cc index 95bdfc9..9a33e4a 100644 --- a/src/kudu/integration-tests/update_scan_delta_compact-test.cc +++ b/src/kudu/integration-tests/update_scan_delta_compact-test.cc @@ -114,7 +114,7 @@ class UpdateScanDeltaCompactionTest : public KuduTest { void InitCluster() { // Start mini-cluster with 1 tserver. - cluster_.reset(new MiniCluster(env_.get(), MiniClusterOptions())); + cluster_.reset(new MiniCluster(env_, MiniClusterOptions())); ASSERT_OK(cluster_->Start()); KuduClientBuilder client_builder; client_builder.add_master_server_addr( http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/server/webserver-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/server/webserver-test.cc b/src/kudu/server/webserver-test.cc index 9357434..5ad7aa4 100644 --- a/src/kudu/server/webserver-test.cc +++ b/src/kudu/server/webserver-test.cc @@ -148,7 +148,7 @@ TEST_F(WebserverTest, TestStaticFiles) { ASSERT_EQ("Remote error: HTTP 404", s.ToString()); // Create the file and fetch again. This time it should succeed. - ASSERT_OK(WriteStringToFile(env_.get(), "hello world", + ASSERT_OK(WriteStringToFile(env_, "hello world", strings::Substitute("$0/foo.txt", static_dir_))); ASSERT_OK(curl_.FetchURL(strings::Substitute("http://$0/foo.txt", addr_.ToString()), &buf_)); http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/tablet/compaction-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/tablet/compaction-test.cc b/src/kudu/tablet/compaction-test.cc index a558da2..2924d7c 100644 --- a/src/kudu/tablet/compaction-test.cc +++ b/src/kudu/tablet/compaction-test.cc @@ -362,7 +362,7 @@ class TestCompaction : public KuduRowSetTest { } } else { string tablet_id = "KuduCompactionBenchTablet"; - FsManager fs_manager(env_.get(), FLAGS_merge_benchmark_input_dir); + FsManager fs_manager(env_, FLAGS_merge_benchmark_input_dir); scoped_refptr<TabletMetadata> input_meta; ASSERT_OK(TabletMetadata::Load(&fs_manager, tablet_id, &input_meta)); http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/tablet/delta_compaction-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/tablet/delta_compaction-test.cc b/src/kudu/tablet/delta_compaction-test.cc index d0795cc..7504f88 100644 --- a/src/kudu/tablet/delta_compaction-test.cc +++ b/src/kudu/tablet/delta_compaction-test.cc @@ -87,7 +87,7 @@ class TestDeltaCompaction : public KuduTest { virtual void SetUp() OVERRIDE { KuduTest::SetUp(); SeedRandom(); - fs_manager_.reset(new FsManager(env_.get(), GetTestPath("fs_root"))); + fs_manager_.reset(new FsManager(env_, GetTestPath("fs_root"))); ASSERT_OK(fs_manager_->CreateInitialFileSystemLayout()); ASSERT_OK(fs_manager_->Open()); } http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/tablet/deltafile-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/tablet/deltafile-test.cc b/src/kudu/tablet/deltafile-test.cc index 8f82b37..56df74d 100644 --- a/src/kudu/tablet/deltafile-test.cc +++ b/src/kudu/tablet/deltafile-test.cc @@ -58,7 +58,7 @@ class TestDeltaFile : public KuduTest { public: void SetUp() OVERRIDE { - fs_manager_.reset(new FsManager(env_.get(), GetTestDataDirectory() + "/fs")); + fs_manager_.reset(new FsManager(env_, GetTestDataDirectory() + "/fs")); ASSERT_OK(fs_manager_->CreateInitialFileSystemLayout()); ASSERT_OK(fs_manager_->Open()); } http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/tablet/deltamemstore-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/tablet/deltamemstore-test.cc b/src/kudu/tablet/deltamemstore-test.cc index 65e78f6..389225b 100644 --- a/src/kudu/tablet/deltamemstore-test.cc +++ b/src/kudu/tablet/deltamemstore-test.cc @@ -60,7 +60,7 @@ class TestDeltaMemStore : public KuduTest { void SetUp() OVERRIDE { KuduTest::SetUp(); - fs_manager_.reset(new FsManager(env_.get(), GetTestPath("fs_root"))); + fs_manager_.reset(new FsManager(env_, GetTestPath("fs_root"))); ASSERT_OK(fs_manager_->CreateInitialFileSystemLayout()); ASSERT_OK(fs_manager_->Open()); } http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/tools/ksck_remote-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/tools/ksck_remote-test.cc b/src/kudu/tools/ksck_remote-test.cc index 6dc792d..00591af 100644 --- a/src/kudu/tools/ksck_remote-test.cc +++ b/src/kudu/tools/ksck_remote-test.cc @@ -84,7 +84,7 @@ class RemoteKsckTest : public KuduTest { opts.num_masters = opts.master_rpc_ports.size(); opts.num_tablet_servers = 3; - mini_cluster_.reset(new MiniCluster(env_.get(), opts)); + mini_cluster_.reset(new MiniCluster(env_, opts)); ASSERT_OK(mini_cluster_->Start()); // Connect to the cluster. http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/tools/kudu-tool-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/tools/kudu-tool-test.cc b/src/kudu/tools/kudu-tool-test.cc index 03adaee..176b5a2 100644 --- a/src/kudu/tools/kudu-tool-test.cc +++ b/src/kudu/tools/kudu-tool-test.cc @@ -250,7 +250,7 @@ void ToolTest::StartMiniCluster(int num_masters, MiniClusterOptions opts; opts.num_masters = num_masters; opts.num_tablet_servers = num_tablet_servers; - mini_cluster_.reset(new MiniCluster(env_.get(), opts)); + mini_cluster_.reset(new MiniCluster(env_, opts)); ASSERT_OK(mini_cluster_->Start()); } @@ -408,7 +408,7 @@ TEST_F(ToolTest, TestActionHelp) { TEST_F(ToolTest, TestFsFormat) { const string kTestDir = GetTestPath("test"); NO_FATALS(RunActionStdoutNone(Substitute("fs format --fs_wal_dir=$0", kTestDir))); - FsManager fs(env_.get(), kTestDir); + FsManager fs(env_, kTestDir); ASSERT_OK(fs.Open()); ObjectIdGenerator generator; @@ -423,7 +423,7 @@ TEST_F(ToolTest, TestFsFormatWithUuid) { string original_uuid = generator.Next(); NO_FATALS(RunActionStdoutNone(Substitute( "fs format --fs_wal_dir=$0 --uuid=$1", kTestDir, original_uuid))); - FsManager fs(env_.get(), kTestDir); + FsManager fs(env_, kTestDir); ASSERT_OK(fs.Open()); string canonicalized_uuid; @@ -436,7 +436,7 @@ TEST_F(ToolTest, TestFsDumpUuid) { const string kTestDir = GetTestPath("test"); string uuid; { - FsManager fs(env_.get(), kTestDir); + FsManager fs(env_, kTestDir); ASSERT_OK(fs.CreateInitialFileSystemLayout()); ASSERT_OK(fs.Open()); uuid = fs.uuid(); @@ -454,7 +454,7 @@ TEST_F(ToolTest, TestPbcDump) { string instance_path; { ObjectIdGenerator generator; - FsManager fs(env_.get(), kTestDir); + FsManager fs(env_, kTestDir); ASSERT_OK(fs.CreateInitialFileSystemLayout(generator.Next())); ASSERT_OK(fs.Open()); uuid = fs.uuid(); @@ -484,7 +484,7 @@ TEST_F(ToolTest, TestPbcDump) { TEST_F(ToolTest, TestFsDumpCFile) { const int kNumEntries = 8192; const string kTestDir = GetTestPath("test"); - FsManager fs(env_.get(), kTestDir); + FsManager fs(env_, kTestDir); ASSERT_OK(fs.CreateInitialFileSystemLayout()); ASSERT_OK(fs.Open()); @@ -540,7 +540,7 @@ TEST_F(ToolTest, TestWalDump) { const Schema kSchema(GetSimpleTestSchema()); const Schema kSchemaWithIds(SchemaBuilder(kSchema).Build()); - FsManager fs(env_.get(), kTestDir); + FsManager fs(env_, kTestDir); ASSERT_OK(fs.CreateInitialFileSystemLayout()); ASSERT_OK(fs.Open()); @@ -658,7 +658,7 @@ TEST_F(ToolTest, TestLocalReplicaDumpMeta) { const Schema kSchema(GetSimpleTestSchema()); const Schema kSchemaWithIds(SchemaBuilder(kSchema).Build()); - FsManager fs(env_.get(), kTestDir); + FsManager fs(env_, kTestDir); ASSERT_OK(fs.CreateInitialFileSystemLayout()); ASSERT_OK(fs.Open()); @@ -703,7 +703,7 @@ TEST_F(ToolTest, TestFsDumpTree) { const Schema kSchema(GetSimpleTestSchema()); const Schema kSchemaWithIds(SchemaBuilder(kSchema).Build()); - FsManager fs(env_.get(), kTestDir); + FsManager fs(env_, kTestDir); ASSERT_OK(fs.CreateInitialFileSystemLayout()); ASSERT_OK(fs.Open()); http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/tserver/tablet_server-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/tserver/tablet_server-test.cc b/src/kudu/tserver/tablet_server-test.cc index 76ddad6..69c7e9c 100644 --- a/src/kudu/tserver/tablet_server-test.cc +++ b/src/kudu/tserver/tablet_server-test.cc @@ -976,8 +976,7 @@ TEST_F(TabletServerTest, TestClientGetsErrorBackWhenRecoveryFailed) { string log_path = tablet_peer_->log()->ActiveSegmentPathForTests(); ShutdownTablet(); - ASSERT_OK(log::CorruptLogFile(env_.get(), log_path, - log::FLIP_BYTE, 300)); + ASSERT_OK(log::CorruptLogFile(env_, log_path, log::FLIP_BYTE, 300)); ASSERT_FALSE(ShutdownAndRebuildTablet().ok()); http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/util/env-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/util/env-test.cc b/src/kudu/util/env-test.cc index 4348d74..5d11167 100644 --- a/src/kudu/util/env-test.cc +++ b/src/kudu/util/env-test.cc @@ -139,7 +139,7 @@ class TestEnv : public KuduTest { bool fast, bool pre_allocate, const WritableFileOptions& opts) { const string kTestPath = GetTestPath("test_env_appendvec_read_append"); shared_ptr<WritableFile> file; - ASSERT_OK(env_util::OpenFileForWrite(opts, env_.get(), kTestPath, &file)); + ASSERT_OK(env_util::OpenFileForWrite(opts, env_, kTestPath, &file)); if (pre_allocate) { ASSERT_OK(file->PreAllocate(num_slices * slice_size * iterations)); @@ -154,7 +154,7 @@ class TestEnv : public KuduTest { shared_ptr<RandomAccessFile> raf; if (!fast) { - ASSERT_OK(env_util::OpenFileForRandom(env_.get(), kTestPath, &raf)); + ASSERT_OK(env_util::OpenFileForRandom(env_, kTestPath, &raf)); } srand(123); @@ -184,7 +184,7 @@ class TestEnv : public KuduTest { ASSERT_OK(file->Close()); if (fast) { - ASSERT_OK(env_util::OpenFileForRandom(env_.get(), kTestPath, &raf)); + ASSERT_OK(env_util::OpenFileForRandom(env_, kTestPath, &raf)); } for (int i = 0; i < iterations; i++) { ASSERT_NO_FATAL_FAILURE(ReadAndVerifyTestData(raf.get(), num_slices * slice_size * i, @@ -207,8 +207,7 @@ TEST_F(TestEnv, TestPreallocate) { LOG(INFO) << "Testing PreAllocate()"; string test_path = GetTestPath("test_env_wf"); shared_ptr<WritableFile> file; - ASSERT_OK(env_util::OpenFileForWrite(WritableFileOptions(), - env_.get(), test_path, &file)); + ASSERT_OK(env_util::OpenFileForWrite(env_, test_path, &file)); // pre-allocate 1 MB ASSERT_OK(file->PreAllocate(kOneMb)); @@ -247,8 +246,7 @@ TEST_F(TestEnv, TestConsecutivePreallocate) { LOG(INFO) << "Testing consecutive PreAllocate()"; string test_path = GetTestPath("test_env_wf"); shared_ptr<WritableFile> file; - ASSERT_OK(env_util::OpenFileForWrite( - WritableFileOptions(), env_.get(), test_path, &file)); + ASSERT_OK(env_util::OpenFileForWrite(env_, test_path, &file)); // pre-allocate 64 MB ASSERT_OK(file->PreAllocate(64 * kOneMb)); @@ -489,16 +487,16 @@ TEST_F(TestEnv, TestOverwrite) { // File does not exist, create it. shared_ptr<WritableFile> writer; - ASSERT_OK(env_util::OpenFileForWrite(env_.get(), test_path, &writer)); + ASSERT_OK(env_util::OpenFileForWrite(env_, test_path, &writer)); // File exists, overwrite it. - ASSERT_OK(env_util::OpenFileForWrite(env_.get(), test_path, &writer)); + ASSERT_OK(env_util::OpenFileForWrite(env_, test_path, &writer)); // File exists, try to overwrite (and fail). WritableFileOptions opts; opts.mode = Env::CREATE_NON_EXISTING; Status s = env_util::OpenFileForWrite(opts, - env_.get(), test_path, &writer); + env_, test_path, &writer); ASSERT_TRUE(s.IsAlreadyPresent()); } @@ -511,7 +509,7 @@ TEST_F(TestEnv, TestReopen) { // Create the file and write to it. shared_ptr<WritableFile> writer; ASSERT_OK(env_util::OpenFileForWrite(WritableFileOptions(), - env_.get(), test_path, &writer)); + env_, test_path, &writer)); ASSERT_OK(writer->Append(first)); ASSERT_EQ(first.length(), writer->Size()); ASSERT_OK(writer->Close()); @@ -520,7 +518,7 @@ TEST_F(TestEnv, TestReopen) { WritableFileOptions reopen_opts; reopen_opts.mode = Env::OPEN_EXISTING; ASSERT_OK(env_util::OpenFileForWrite(reopen_opts, - env_.get(), test_path, &writer)); + env_, test_path, &writer)); ASSERT_EQ(first.length(), writer->Size()); ASSERT_OK(writer->Append(second)); ASSERT_EQ(first.length() + second.length(), writer->Size()); @@ -528,7 +526,7 @@ TEST_F(TestEnv, TestReopen) { // Check that the file has both strings. shared_ptr<RandomAccessFile> reader; - ASSERT_OK(env_util::OpenFileForRandom(env_.get(), test_path, &reader)); + ASSERT_OK(env_util::OpenFileForRandom(env_, test_path, &reader)); uint64_t size; ASSERT_OK(reader->Size(&size)); ASSERT_EQ(first.length() + second.length(), size); @@ -592,18 +590,18 @@ TEST_F(TestEnv, TestWalk) { string file_one = "file_1"; string file_two = "file_2"; vector<string> expected; - ASSERT_OK(CreateDir(env_.get(), root, &expected)); - ASSERT_OK(CreateFile(env_.get(), JoinPathSegments(root, file_one), &expected)); - ASSERT_OK(CreateFile(env_.get(), JoinPathSegments(root, file_two), &expected)); - ASSERT_OK(CreateDir(env_.get(), subdir_a, &expected)); - ASSERT_OK(CreateFile(env_.get(), JoinPathSegments(subdir_a, file_one), &expected)); - ASSERT_OK(CreateFile(env_.get(), JoinPathSegments(subdir_a, file_two), &expected)); - ASSERT_OK(CreateDir(env_.get(), subdir_b, &expected)); - ASSERT_OK(CreateFile(env_.get(), JoinPathSegments(subdir_b, file_one), &expected)); - ASSERT_OK(CreateFile(env_.get(), JoinPathSegments(subdir_b, file_two), &expected)); - ASSERT_OK(CreateDir(env_.get(), subdir_c, &expected)); - ASSERT_OK(CreateFile(env_.get(), JoinPathSegments(subdir_c, file_one), &expected)); - ASSERT_OK(CreateFile(env_.get(), JoinPathSegments(subdir_c, file_two), &expected)); + ASSERT_OK(CreateDir(env_, root, &expected)); + ASSERT_OK(CreateFile(env_, JoinPathSegments(root, file_one), &expected)); + ASSERT_OK(CreateFile(env_, JoinPathSegments(root, file_two), &expected)); + ASSERT_OK(CreateDir(env_, subdir_a, &expected)); + ASSERT_OK(CreateFile(env_, JoinPathSegments(subdir_a, file_one), &expected)); + ASSERT_OK(CreateFile(env_, JoinPathSegments(subdir_a, file_two), &expected)); + ASSERT_OK(CreateDir(env_, subdir_b, &expected)); + ASSERT_OK(CreateFile(env_, JoinPathSegments(subdir_b, file_one), &expected)); + ASSERT_OK(CreateFile(env_, JoinPathSegments(subdir_b, file_two), &expected)); + ASSERT_OK(CreateDir(env_, subdir_c, &expected)); + ASSERT_OK(CreateFile(env_, JoinPathSegments(subdir_c, file_one), &expected)); + ASSERT_OK(CreateFile(env_, JoinPathSegments(subdir_c, file_two), &expected)); // Do the walk. // @@ -766,7 +764,7 @@ TEST_F(TestEnv, TestGetBytesFree) { ASSERT_OK(env_->DeleteFile(kTestFilePath)); } ASSERT_OK(env_->GetBytesFree(kDataDir, &orig_bytes_free)); - NO_FATALS(WriteTestFile(env_.get(), kTestFilePath, kFileSizeBytes)); + NO_FATALS(WriteTestFile(env_, kTestFilePath, kFileSizeBytes)); ASSERT_OK(env_->GetBytesFree(kDataDir, &cur_bytes_free)); if (orig_bytes_free - cur_bytes_free >= kFileSizeBytes) break; } http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/util/env.cc ---------------------------------------------------------------------- diff --git a/src/kudu/util/env.cc b/src/kudu/util/env.cc index 2ea9622..7a55d57 100644 --- a/src/kudu/util/env.cc +++ b/src/kudu/util/env.cc @@ -82,7 +82,4 @@ Status ReadFileToString(Env* env, const std::string& fname, faststring* data) { return s; } -EnvWrapper::~EnvWrapper() { -} - } // namespace kudu http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/util/env.h ---------------------------------------------------------------------- diff --git a/src/kudu/util/env.h b/src/kudu/util/env.h index 7eb97e7..60cb8f5 100644 --- a/src/kudu/util/env.h +++ b/src/kudu/util/env.h @@ -526,119 +526,6 @@ extern Status WriteStringToFile(Env* env, const Slice& data, extern Status ReadFileToString(Env* env, const std::string& fname, faststring* data); -// An implementation of Env that forwards all calls to another Env. -// May be useful to clients who wish to override just part of the -// functionality of another Env. -class EnvWrapper : public Env { - public: - // Initialize an EnvWrapper that delegates all calls to *t - explicit EnvWrapper(Env* t) : target_(t) { } - virtual ~EnvWrapper(); - - // Return the target to which this Env forwards all calls - Env* target() const { return target_; } - - // The following text is boilerplate that forwards all methods to target() - Status NewSequentialFile(const std::string& f, gscoped_ptr<SequentialFile>* r) OVERRIDE { - return target_->NewSequentialFile(f, r); - } - Status NewRandomAccessFile(const std::string& f, - gscoped_ptr<RandomAccessFile>* r) OVERRIDE { - return target_->NewRandomAccessFile(f, r); - } - Status NewRandomAccessFile(const RandomAccessFileOptions& opts, - const std::string& f, - gscoped_ptr<RandomAccessFile>* r) OVERRIDE { - return target_->NewRandomAccessFile(opts, f, r); - } - Status NewWritableFile(const std::string& f, gscoped_ptr<WritableFile>* r) OVERRIDE { - return target_->NewWritableFile(f, r); - } - Status NewWritableFile(const WritableFileOptions& o, - const std::string& f, - gscoped_ptr<WritableFile>* r) OVERRIDE { - return target_->NewWritableFile(o, f, r); - } - Status NewTempWritableFile(const WritableFileOptions& o, const std::string& t, - std::string* f, gscoped_ptr<WritableFile>* r) OVERRIDE { - return target_->NewTempWritableFile(o, t, f, r); - } - Status NewRWFile(const std::string& f, gscoped_ptr<RWFile>* r) OVERRIDE { - return target_->NewRWFile(f, r); - } - Status NewRWFile(const RWFileOptions& o, - const std::string& f, - gscoped_ptr<RWFile>* r) OVERRIDE { - return target_->NewRWFile(o, f, r); - } - Status NewTempRWFile(const RWFileOptions& o, const std::string& t, - std::string* f, gscoped_ptr<RWFile>* r) OVERRIDE { - return target_->NewTempRWFile(o, t, f, r); - } - bool FileExists(const std::string& f) OVERRIDE { return target_->FileExists(f); } - Status GetChildren(const std::string& dir, std::vector<std::string>* r) OVERRIDE { - return target_->GetChildren(dir, r); - } - Status DeleteFile(const std::string& f) OVERRIDE { return target_->DeleteFile(f); } - Status CreateDir(const std::string& d) OVERRIDE { return target_->CreateDir(d); } - Status SyncDir(const std::string& d) OVERRIDE { return target_->SyncDir(d); } - Status DeleteDir(const std::string& d) OVERRIDE { return target_->DeleteDir(d); } - Status DeleteRecursively(const std::string& d) OVERRIDE { return target_->DeleteRecursively(d); } - Status GetFileSize(const std::string& f, uint64_t* s) OVERRIDE { - return target_->GetFileSize(f, s); - } - Status GetFileSizeOnDisk(const std::string& f, uint64_t* s) OVERRIDE { - return target_->GetFileSizeOnDisk(f, s); - } - Status GetFileSizeOnDiskRecursively(const std::string& root, uint64_t* bytes_used) OVERRIDE { - return target_->GetFileSizeOnDiskRecursively(root, bytes_used); - } - Status GetBlockSize(const std::string& f, uint64_t* s) OVERRIDE { - return target_->GetBlockSize(f, s); - } - Status GetBytesFree(const std::string& path, int64_t* bytes_free) OVERRIDE { - return target_->GetBytesFree(path, bytes_free); - } - Status RenameFile(const std::string& s, const std::string& t) OVERRIDE { - return target_->RenameFile(s, t); - } - Status LockFile(const std::string& f, FileLock** l) OVERRIDE { - return target_->LockFile(f, l); - } - Status UnlockFile(FileLock* l) OVERRIDE { return target_->UnlockFile(l); } - virtual Status GetTestDirectory(std::string* path) OVERRIDE { - return target_->GetTestDirectory(path); - } - uint64_t NowMicros() OVERRIDE { - return target_->NowMicros(); - } - void SleepForMicroseconds(int micros) OVERRIDE { - target_->SleepForMicroseconds(micros); - } - uint64_t gettid() OVERRIDE { - return target_->gettid(); - } - Status GetExecutablePath(std::string* path) OVERRIDE { - return target_->GetExecutablePath(path); - } - Status IsDirectory(const std::string& path, bool* is_dir) OVERRIDE { - return target_->IsDirectory(path, is_dir); - } - Status Walk(const std::string& root, - DirectoryOrder order, - const WalkCallback& cb) OVERRIDE { - return target_->Walk(root, order, cb); - } - Status Canonicalize(const std::string& path, std::string* result) OVERRIDE { - return target_->Canonicalize(path, result); - } - Status GetTotalRAMBytes(int64_t* ram) OVERRIDE { - return target_->GetTotalRAMBytes(ram); - } - private: - Env* target_; -}; - } // namespace kudu #endif // STORAGE_LEVELDB_INCLUDE_ENV_H_ http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/util/pb_util-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/util/pb_util-test.cc b/src/kudu/util/pb_util-test.cc index 093d5c9..3d7a780 100644 --- a/src/kudu/util/pb_util-test.cc +++ b/src/kudu/util/pb_util-test.cc @@ -108,7 +108,7 @@ Status TestPBUtil::CreateKnownGoodContainerFile(CreateMode create, SyncMode sync ProtoContainerTestPB test_pb; test_pb.set_name(kTestKeyvalName); test_pb.set_value(kTestKeyvalValue); - return WritePBContainerToPath(env_.get(), path_, test_pb, create, sync); + return WritePBContainerToPath(env_, path_, test_pb, create, sync); } Status TestPBUtil::NewPBCWriter(int version, RWFileOptions opts, @@ -179,7 +179,7 @@ Status TestPBUtil::TruncateFile(const string& path, uint64_t size) { TEST_F(TestPBUtil, TestWritableFileOutputStream) { shared_ptr<WritableFile> file; string path = GetTestPath("test.out"); - ASSERT_OK(env_util::OpenFileForWrite(env_.get(), path, &file)); + ASSERT_OK(env_util::OpenFileForWrite(env_, path, &file)); WritableFileOutputStream stream(file.get(), 4096); @@ -233,7 +233,7 @@ TEST_F(TestPBUtil, TestPBContainerSimple) { // Read it back, should validate and contain the expected values. ProtoContainerTestPB test_pb; - ASSERT_OK(ReadPBContainerFromPath(env_.get(), path_, &test_pb)); + ASSERT_OK(ReadPBContainerFromPath(env_, path_, &test_pb)); ASSERT_EQ(kTestKeyvalName, test_pb.name()); ASSERT_EQ(kTestKeyvalValue, test_pb.value()); @@ -246,7 +246,7 @@ TEST_F(TestPBUtil, TestPBContainerSimple) { TEST_P(TestPBContainerVersions, TestCorruption) { // Test that we indicate when the file does not exist. ProtoContainerTestPB test_pb; - Status s = ReadPBContainerFromPath(env_.get(), path_, &test_pb); + Status s = ReadPBContainerFromPath(env_, path_, &test_pb); ASSERT_TRUE(s.IsNotFound()) << "Should not be found: " << path_ << ": " << s.ToString(); // Test that an empty file looks like corruption. @@ -256,7 +256,7 @@ TEST_P(TestPBContainerVersions, TestCorruption) { ASSERT_OK(env_->NewWritableFile(path_, &file)); ASSERT_OK(file->Close()); } - s = ReadPBContainerFromPath(env_.get(), path_, &test_pb); + s = ReadPBContainerFromPath(env_, path_, &test_pb); ASSERT_TRUE(s.IsIncomplete()) << "Should be zero length: " << path_ << ": " << s.ToString(); ASSERT_STR_CONTAINS(s.ToString(), "File size not large enough to be valid"); @@ -265,7 +265,7 @@ TEST_P(TestPBContainerVersions, TestCorruption) { uint64_t known_good_size = 0; ASSERT_OK(env_->GetFileSize(path_, &known_good_size)); ASSERT_OK(TruncateFile(path_, known_good_size - 2)); - s = ReadPBContainerFromPath(env_.get(), path_, &test_pb); + s = ReadPBContainerFromPath(env_, path_, &test_pb); if (version_ == 1) { ASSERT_TRUE(s.IsCorruption()) << "Should be incorrect size: " << path_ << ": " << s.ToString(); } else { @@ -276,14 +276,14 @@ TEST_P(TestPBContainerVersions, TestCorruption) { // Test corrupted magic. ASSERT_OK(CreateKnownGoodContainerFileWithVersion(version_)); ASSERT_OK(BitFlipFileByteRange(path_, 0, 2)); - s = ReadPBContainerFromPath(env_.get(), path_, &test_pb); + s = ReadPBContainerFromPath(env_, path_, &test_pb); ASSERT_TRUE(s.IsCorruption()) << "Should have invalid magic: " << path_ << ": " << s.ToString(); ASSERT_STR_CONTAINS(s.ToString(), "Invalid magic number"); // Test corrupted version. ASSERT_OK(CreateKnownGoodContainerFileWithVersion(version_)); ASSERT_OK(BitFlipFileByteRange(path_, 8, 2)); - s = ReadPBContainerFromPath(env_.get(), path_, &test_pb); + s = ReadPBContainerFromPath(env_, path_, &test_pb); ASSERT_TRUE(s.IsNotSupported()) << "Should have unsupported version number: " << path_ << ": " << s.ToString(); ASSERT_STR_CONTAINS(s.ToString(), " Protobuf container has unsupported version"); @@ -292,7 +292,7 @@ TEST_P(TestPBContainerVersions, TestCorruption) { if (version_ >= 2) { ASSERT_OK(CreateKnownGoodContainerFileWithVersion(version_)); ASSERT_OK(BitFlipFileByteRange(path_, 12, 2)); - s = ReadPBContainerFromPath(env_.get(), path_, &test_pb); + s = ReadPBContainerFromPath(env_, path_, &test_pb); ASSERT_TRUE(s.IsCorruption()) << "Should have corrupted file header checksum: " << path_ << ": " << s.ToString(); ASSERT_STR_CONTAINS(s.ToString(), "File header checksum does not match"); @@ -304,7 +304,7 @@ TEST_P(TestPBContainerVersions, TestCorruption) { // Test corrupted data length. ASSERT_OK(CreateKnownGoodContainerFileWithVersion(version_)); ASSERT_OK(BitFlipFileByteRange(path_, kFirstRecordOffset, 2)); - s = ReadPBContainerFromPath(env_.get(), path_, &test_pb); + s = ReadPBContainerFromPath(env_, path_, &test_pb); if (version_ == 1) { ASSERT_TRUE(s.IsCorruption()) << s.ToString(); ASSERT_STR_CONTAINS(s.ToString(), "File size not large enough to be valid"); @@ -317,7 +317,7 @@ TEST_P(TestPBContainerVersions, TestCorruption) { // Test corrupted data (looks like bad checksum). ASSERT_OK(CreateKnownGoodContainerFileWithVersion(version_)); ASSERT_OK(BitFlipFileByteRange(path_, kFirstRecordOffset + 4, 2)); - s = ReadPBContainerFromPath(env_.get(), path_, &test_pb); + s = ReadPBContainerFromPath(env_, path_, &test_pb); ASSERT_TRUE(s.IsCorruption()) << "Should be incorrect checksum: " << path_ << ": " << s.ToString(); ASSERT_STR_CONTAINS(s.ToString(), "Incorrect checksum"); @@ -325,7 +325,7 @@ TEST_P(TestPBContainerVersions, TestCorruption) { // Test corrupted checksum. ASSERT_OK(CreateKnownGoodContainerFileWithVersion(version_)); ASSERT_OK(BitFlipFileByteRange(path_, known_good_size - 4, 2)); - s = ReadPBContainerFromPath(env_.get(), path_, &test_pb); + s = ReadPBContainerFromPath(env_, path_, &test_pb); ASSERT_TRUE(s.IsCorruption()) << "Should be incorrect checksum: " << path_ << ": " << s.ToString(); ASSERT_STR_CONTAINS(s.ToString(), "Incorrect checksum"); @@ -406,7 +406,7 @@ TEST_P(TestPBContainerVersions, TestAppendAfterPartialWrite) { TEST_P(TestPBContainerVersions, TestSingleMessage) { ASSERT_OK(CreateKnownGoodContainerFileWithVersion(version_)); ProtoContainerTestPB test_pb; - ASSERT_OK(ReadPBContainerFromPath(env_.get(), path_, &test_pb)); + ASSERT_OK(ReadPBContainerFromPath(env_, path_, &test_pb)); ASSERT_EQ(kTestKeyvalName, test_pb.name()); ASSERT_EQ(kTestKeyvalValue, test_pb.value()); } http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/util/rolling_log-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/util/rolling_log-test.cc b/src/kudu/util/rolling_log-test.cc index cff1542..3c6f60b 100644 --- a/src/kudu/util/rolling_log-test.cc +++ b/src/kudu/util/rolling_log-test.cc @@ -68,7 +68,7 @@ class RollingLogTest : public KuduTest { // Test with compression off. TEST_F(RollingLogTest, TestLog) { - RollingLog log(env_.get(), log_dir_, "mylog"); + RollingLog log(env_, log_dir_, "mylog"); log.SetCompressionEnabled(false); log.SetSizeLimitBytes(100); @@ -87,7 +87,7 @@ TEST_F(RollingLogTest, TestLog) { faststring data; string path = JoinPathSegments(log_dir_, children[0]); - ASSERT_OK(ReadFileToString(env_.get(), path, &data)); + ASSERT_OK(ReadFileToString(env_, path, &data)); ASSERT_TRUE(HasPrefixString(data.ToString(), "Hello world\n")) << "Data missing"; ASSERT_LE(data.size(), 100) << "Size limit not respected"; @@ -95,7 +95,7 @@ TEST_F(RollingLogTest, TestLog) { // Test with compression on. TEST_F(RollingLogTest, TestCompression) { - RollingLog log(env_.get(), log_dir_, "mylog"); + RollingLog log(env_, log_dir_, "mylog"); ASSERT_OK(log.Open()); StringPiece data = "Hello world\n"; http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/util/test_util.cc ---------------------------------------------------------------------- diff --git a/src/kudu/util/test_util.cc b/src/kudu/util/test_util.cc index 1c0b133..7a74a9f 100644 --- a/src/kudu/util/test_util.cc +++ b/src/kudu/util/test_util.cc @@ -57,13 +57,7 @@ bool g_is_gtest = true; /////////////////////////////////////////////////// KuduTest::KuduTest() - : env_(new EnvWrapper(Env::Default())), - test_dir_(GetTestDataDirectory()) { -} - -// env passed in from subclass, for tests that run in-memory -KuduTest::KuduTest(Env *env) - : env_(env), + : env_(Env::Default()), test_dir_(GetTestDataDirectory()) { } http://git-wip-us.apache.org/repos/asf/kudu/blob/c516e141/src/kudu/util/test_util.h ---------------------------------------------------------------------- diff --git a/src/kudu/util/test_util.h b/src/kudu/util/test_util.h index ba26742..238fa1d 100644 --- a/src/kudu/util/test_util.h +++ b/src/kudu/util/test_util.h @@ -36,9 +36,6 @@ class KuduTest : public ::testing::Test { public: KuduTest(); - // Env passed in from subclass, for tests that run in-memory. - explicit KuduTest(Env *env); - virtual ~KuduTest(); virtual void SetUp() OVERRIDE; @@ -55,7 +52,7 @@ class KuduTest : public ::testing::Test { // the test ends. std::string GetTestPath(const std::string& relative_path); - gscoped_ptr<Env> env_; + Env* env_; google::FlagSaver flag_saver_; // Reset flags on every test. private:
