kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject kudu git commit: fs: replace CreateDirWithMissing with env_util calls
Date Sat, 04 Nov 2017 05:09:11 GMT
Repository: kudu
Updated Branches:
  refs/heads/master 3e821ced2 -> b167b98e4


fs: replace CreateDirWithMissing with env_util calls

Change-Id: I9983466e31f694d3b1c748d548ab3dafe2cbb1c0
Reviewed-on: http://gerrit.cloudera.org:8080/8469
Reviewed-by: Andrew Wong <awong@cloudera.com>
Tested-by: Adar Dembo <adar@cloudera.com>


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

Branch: refs/heads/master
Commit: b167b98e41538f565c6e5d00002ab9df9ed7a845
Parents: 3e821ce
Author: Adar Dembo <adar@cloudera.com>
Authored: Thu Nov 2 17:04:22 2017 -0700
Committer: Adar Dembo <adar@cloudera.com>
Committed: Sat Nov 4 05:08:54 2017 +0000

----------------------------------------------------------------------
 src/kudu/consensus/consensus_meta.cc        | 4 +++-
 src/kudu/consensus/log.cc                   | 3 ++-
 src/kudu/fs/fs_manager.cc                   | 8 ++------
 src/kudu/fs/fs_manager.h                    | 3 ---
 src/kudu/tablet/tablet_bootstrap.cc         | 5 +++--
 src/kudu/tserver/tablet_copy_client-test.cc | 6 ++++--
 6 files changed, 14 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/b167b98e/src/kudu/consensus/consensus_meta.cc
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/consensus_meta.cc b/src/kudu/consensus/consensus_meta.cc
index 9954c8a..f112f94 100644
--- a/src/kudu/consensus/consensus_meta.cc
+++ b/src/kudu/consensus/consensus_meta.cc
@@ -31,6 +31,7 @@
 #include "kudu/gutil/port.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/util/env.h"
+#include "kudu/util/env_util.h"
 #include "kudu/util/fault_injection.h"
 #include "kudu/util/flag_tags.h"
 #include "kudu/util/logging.h"
@@ -273,7 +274,8 @@ Status ConsensusMetadata::Flush(FlushMode flush_mode) {
   // Create directories if needed.
   string dir = fs_manager_->GetConsensusMetadataDir();
   bool created_dir = false;
-  RETURN_NOT_OK_PREPEND(fs_manager_->CreateDirIfMissing(dir, &created_dir),
+  RETURN_NOT_OK_PREPEND(env_util::CreateDirIfMissing(
+      fs_manager_->env(), dir, &created_dir),
                         "Unable to create consensus metadata root dir");
   // fsync() parent dir if we had to create the dir.
   if (PREDICT_FALSE(created_dir)) {

http://git-wip-us.apache.org/repos/asf/kudu/blob/b167b98e/src/kudu/consensus/log.cc
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/log.cc b/src/kudu/consensus/log.cc
index fe642a6..5d82ebc 100644
--- a/src/kudu/consensus/log.cc
+++ b/src/kudu/consensus/log.cc
@@ -438,7 +438,8 @@ Status Log::Open(const LogOptions &options,
                  scoped_refptr<Log>* log) {
 
   string tablet_wal_path = fs_manager->GetTabletWalDir(tablet_id);
-  RETURN_NOT_OK(fs_manager->CreateDirIfMissing(tablet_wal_path));
+  RETURN_NOT_OK(env_util::CreateDirIfMissing(
+      fs_manager->env(), tablet_wal_path));
 
   scoped_refptr<Log> new_log(new Log(options,
                                      fs_manager,

http://git-wip-us.apache.org/repos/asf/kudu/blob/b167b98e/src/kudu/fs/fs_manager.cc
----------------------------------------------------------------------
diff --git a/src/kudu/fs/fs_manager.cc b/src/kudu/fs/fs_manager.cc
index 8699a3a..4f1679c 100644
--- a/src/kudu/fs/fs_manager.cc
+++ b/src/kudu/fs/fs_manager.cc
@@ -410,7 +410,7 @@ Status FsManager::CreateInitialFileSystemLayout(boost::optional<string>
uuid) {
     }
     string root_name = root.path;
     bool created;
-    RETURN_NOT_OK_PREPEND(CreateDirIfMissing(root_name, &created),
+    RETURN_NOT_OK_PREPEND(env_util::CreateDirIfMissing(env_, root_name, &created),
                           "Unable to create FSManager root");
     if (created) {
       dirs_to_delete.emplace_back(root_name);
@@ -426,7 +426,7 @@ Status FsManager::CreateInitialFileSystemLayout(boost::optional<string>
uuid) {
                                     GetConsensusMetadataDir() };
   for (const string& dir : ancillary_dirs) {
     bool created;
-    RETURN_NOT_OK_PREPEND(CreateDirIfMissing(dir, &created),
+    RETURN_NOT_OK_PREPEND(env_util::CreateDirIfMissing(env_, dir, &created),
                           Substitute("Unable to create directory $0", dir));
     if (created) {
       dirs_to_delete.emplace_back(dir);
@@ -492,10 +492,6 @@ Status FsManager::WriteInstanceMetadata(const InstanceMetadataPB&
metadata,
   return Status::OK();
 }
 
-Status FsManager::CreateDirIfMissing(const string& path, bool* created) {
-  return env_util::CreateDirIfMissing(env_, path, created);
-}
-
 const string& FsManager::uuid() const {
   return CHECK_NOTNULL(metadata_.get())->uuid();
 }

http://git-wip-us.apache.org/repos/asf/kudu/blob/b167b98e/src/kudu/fs/fs_manager.h
----------------------------------------------------------------------
diff --git a/src/kudu/fs/fs_manager.h b/src/kudu/fs/fs_manager.h
index 62dec7a..a603a56 100644
--- a/src/kudu/fs/fs_manager.h
+++ b/src/kudu/fs/fs_manager.h
@@ -17,7 +17,6 @@
 
 #pragma once
 
-#include <cstddef>
 #include <cstdint>
 #include <iosfwd>
 #include <memory>
@@ -230,8 +229,6 @@ class FsManager {
     return env_->GetChildren(path, objects);
   }
 
-  Status CreateDirIfMissing(const std::string& path, bool* created = NULL);
-
   fs::DataDirManager* dd_manager() const {
     return dd_manager_.get();
   }

http://git-wip-us.apache.org/repos/asf/kudu/blob/b167b98e/src/kudu/tablet/tablet_bootstrap.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/tablet_bootstrap.cc b/src/kudu/tablet/tablet_bootstrap.cc
index d5c8a3c..01dc75c 100644
--- a/src/kudu/tablet/tablet_bootstrap.cc
+++ b/src/kudu/tablet/tablet_bootstrap.cc
@@ -78,6 +78,7 @@
 #include "kudu/tserver/tserver_admin.pb.h"
 #include "kudu/util/debug/trace_event.h"
 #include "kudu/util/env.h"
+#include "kudu/util/env_util.h"
 #include "kudu/util/fault_injection.h"
 #include "kudu/util/flag_tags.h"
 #include "kudu/util/logging.h"
@@ -639,7 +640,7 @@ Status TabletBootstrap::PrepareRecoveryDir(bool* needs_recovery) {
                             "Could not recursively delete old log dir " + log_dir);
     }
 
-    RETURN_NOT_OK_PREPEND(fs_manager->CreateDirIfMissing(log_dir),
+    RETURN_NOT_OK_PREPEND(env_util::CreateDirIfMissing(fs_manager->env(), log_dir),
                           "Failed to create log directory " + log_dir);
 
     *needs_recovery = true;
@@ -649,7 +650,7 @@ Status TabletBootstrap::PrepareRecoveryDir(bool* needs_recovery) {
   // If we made it here, there was no pre-existing recovery dir.
   // Now we look for log files in log_dir, and if we find any then we rename
   // the whole log_dir to a recovery dir and return needs_recovery = true.
-  RETURN_NOT_OK_PREPEND(fs_manager->CreateDirIfMissing(log_dir),
+  RETURN_NOT_OK_PREPEND(env_util::CreateDirIfMissing(fs_manager->env(), log_dir),
                         "Failed to create log dir");
 
   vector<string> children;

http://git-wip-us.apache.org/repos/asf/kudu/blob/b167b98e/src/kudu/tserver/tablet_copy_client-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/tablet_copy_client-test.cc b/src/kudu/tserver/tablet_copy_client-test.cc
index 3ea60be..ab99a21 100644
--- a/src/kudu/tserver/tablet_copy_client-test.cc
+++ b/src/kudu/tserver/tablet_copy_client-test.cc
@@ -189,7 +189,8 @@ TEST_F(TabletCopyClientTest, TestDownloadBlock) {
 
 // Basic WAL segment download unit test.
 TEST_F(TabletCopyClientTest, TestDownloadWalSegment) {
-  ASSERT_OK(fs_manager_->CreateDirIfMissing(fs_manager_->GetTabletWalDir(GetTabletId())));
+  ASSERT_OK(env_util::CreateDirIfMissing(
+      env_, fs_manager_->GetTabletWalDir(GetTabletId())));
 
   uint64_t seqno = client_->wal_seqnos_[0];
   string path = fs_manager_->GetWalSegmentFileName(GetTabletId(), seqno);
@@ -348,7 +349,8 @@ TEST_P(TabletCopyClientAbortTest, TestAbort) {
   ASSERT_EQ(kNumBlocksToCreate + num_blocks_downloaded, new_local_block_ids.size());
 
   // Download a WAL segment.
-  ASSERT_OK(fs_manager_->CreateDirIfMissing(fs_manager_->GetTabletWalDir(GetTabletId())));
+  ASSERT_OK(env_util::CreateDirIfMissing(
+      env_, fs_manager_->GetTabletWalDir(GetTabletId())));
   uint64_t seqno = client_->wal_seqnos_[0];
   ASSERT_OK(client_->DownloadWAL(seqno));
   string wal_path = fs_manager_->GetWalSegmentFileName(GetTabletId(), seqno);


Mime
View raw message