quickstep-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zu...@apache.org
Subject incubator-quickstep git commit: Fixed the bug that Executor / Cli does not create directory for StorageManager.
Date Wed, 14 Mar 2018 19:42:53 GMT
Repository: incubator-quickstep
Updated Branches:
  refs/heads/master d27733908 -> 7cc928429


Fixed the bug that Executor / Cli does not create directory for StorageManager.


Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/7cc92842
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/7cc92842
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/7cc92842

Branch: refs/heads/master
Commit: 7cc92842966e0dcf6402f56687df2af0ca2ebcc5
Parents: d277339
Author: Zuyu Zhang <zuyu@cs.wisc.edu>
Authored: Wed Feb 28 21:03:46 2018 -0600
Committer: Zuyu Zhang <zuyu@cs.wisc.edu>
Committed: Wed Mar 14 14:42:11 2018 -0500

----------------------------------------------------------------------
 CMakeLists.txt                 |  1 +
 cli/DefaultsConfigurator.cpp   | 14 +++++++++-----
 cli/DefaultsConfigurator.hpp   |  7 +++++++
 cli/distributed/CMakeLists.txt |  1 +
 cli/distributed/Cli.cpp        |  3 +++
 cli/distributed/Executor.cpp   |  3 +++
 6 files changed, 24 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/7cc92842/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c777a6a..3965851 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -792,6 +792,7 @@ if (ENABLE_DISTRIBUTED)
                         glog
                         quickstep_catalog_CatalogRelation
                         quickstep_cli_Constants
+                        quickstep_cli_DefaultsConfigurator
                         quickstep_cli_Flags
                         quickstep_cli_LineReader
                         quickstep_cli_PrintToScreen

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/7cc92842/cli/DefaultsConfigurator.cpp
----------------------------------------------------------------------
diff --git a/cli/DefaultsConfigurator.cpp b/cli/DefaultsConfigurator.cpp
index 21b0af6..0e1f64c 100644
--- a/cli/DefaultsConfigurator.cpp
+++ b/cli/DefaultsConfigurator.cpp
@@ -41,10 +41,7 @@ using std::string;
 
 namespace quickstep {
 
-void DefaultsConfigurator::InitializeDefaultDatabase(const string &storage_path, const
string &catalog_path) {
-  // TODO(jmp): Refactor the code in this file!
-  LOG(INFO) << "Initializing the database, creating a new catalog file and storage
directory";
-
+void DefaultsConfigurator::CreateDirectory(const std::string &storage_path) {
   // Create the directory
   // TODO(jmp): At some point, likely in C++-17, we will just have the
   //            filesystem path, and we can clean this up
@@ -54,11 +51,18 @@ void DefaultsConfigurator::InitializeDefaultDatabase(const string &storage_path,
       << "\nCheck if the directory already exists. If so, delete it or move it before
initializing";
 #else
   {
-    const string path_name = "mkdir " + storage_path;
+    const string path_name = "mkdir -p " + storage_path;
     CHECK(!std::system(path_name.c_str()))
          << "Failed when attempting to create the directory: " << storage_path;
   }
 #endif  // QUICKSTEP_OS_WINDOWS
+}
+
+void DefaultsConfigurator::InitializeDefaultDatabase(const string &storage_path, const
string &catalog_path) {
+  // TODO(jmp): Refactor the code in this file!
+  LOG(INFO) << "Initializing the database, creating a new catalog file and storage
directory";
+
+  CreateDirectory(storage_path);
 
   // Create the default catalog file.
   std::ofstream catalog_file(catalog_path.c_str());

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/7cc92842/cli/DefaultsConfigurator.hpp
----------------------------------------------------------------------
diff --git a/cli/DefaultsConfigurator.hpp b/cli/DefaultsConfigurator.hpp
index 4b534d6..28d84b8 100644
--- a/cli/DefaultsConfigurator.hpp
+++ b/cli/DefaultsConfigurator.hpp
@@ -116,6 +116,13 @@ class DefaultsConfigurator {
   static void InitializeDefaultDatabase(const std::string &storage_path,
                                         const std::string &catalog_path);
 
+  /**
+   * @brief Create the directory.
+   *
+   * @param storage_path The filesystem directory for StorageManager.
+   **/
+  static void CreateDirectory(const std::string &storage_path);
+
  private:
   /**
    * @brief Private constructor to disable instantiation of the class.

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/7cc92842/cli/distributed/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/cli/distributed/CMakeLists.txt b/cli/distributed/CMakeLists.txt
index 6a31895..93d3b5e 100644
--- a/cli/distributed/CMakeLists.txt
+++ b/cli/distributed/CMakeLists.txt
@@ -55,6 +55,7 @@ target_link_libraries(quickstep_cli_distributed_Conductor
 target_link_libraries(quickstep_cli_distributed_Executor
                       glog
                       quickstep_catalog_CatalogTypedefs
+                      quickstep_cli_DefaultsConfigurator
                       quickstep_cli_Flags
                       quickstep_cli_InputParserUtil
                       quickstep_cli_distributed_Role

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/7cc92842/cli/distributed/Cli.cpp
----------------------------------------------------------------------
diff --git a/cli/distributed/Cli.cpp b/cli/distributed/Cli.cpp
index 9f48ecc..665ab9b 100644
--- a/cli/distributed/Cli.cpp
+++ b/cli/distributed/Cli.cpp
@@ -31,6 +31,7 @@
 #include "catalog/CatalogRelation.hpp"
 #include "cli/CliConfig.h"  // For QUICKSTEP_USE_LINENOISE.
 #include "cli/Constants.hpp"
+#include "cli/DefaultsConfigurator.hpp"
 #include "cli/Flags.hpp"
 
 #ifdef QUICKSTEP_USE_LINENOISE
@@ -112,6 +113,8 @@ void Cli::init() {
   bus_.RegisterClientAsSender(cli_id_, kBlockDomainRegistrationMessage);
   bus_.RegisterClientAsReceiver(cli_id_, kBlockDomainRegistrationResponseMessage);
 
+  DefaultsConfigurator::CreateDirectory(FLAGS_storage_path);
+
   client_id locator_client_id;
   storage_manager_ = make_unique<StorageManager>(
       FLAGS_storage_path,

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/7cc92842/cli/distributed/Executor.cpp
----------------------------------------------------------------------
diff --git a/cli/distributed/Executor.cpp b/cli/distributed/Executor.cpp
index 4ca5693..d8e63ce 100644
--- a/cli/distributed/Executor.cpp
+++ b/cli/distributed/Executor.cpp
@@ -24,6 +24,7 @@
 #include <vector>
 
 #include "catalog/CatalogTypedefs.hpp"
+#include "cli/DefaultsConfigurator.hpp"
 #include "cli/Flags.hpp"
 #include "cli/InputParserUtil.hpp"
 #include "query_execution/BlockLocatorUtil.hpp"
@@ -76,6 +77,8 @@ void Executor::init() {
   worker_directory_ =
       make_unique<WorkerDirectory>(worker_client_ids.size(), worker_client_ids, worker_numa_nodes);
 
+  DefaultsConfigurator::CreateDirectory(FLAGS_storage_path);
+
   client_id locator_client_id;
   storage_manager_ = make_unique<StorageManager>(
       FLAGS_storage_path,


Mime
View raw message