quickstep-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zu...@apache.org
Subject [4/6] incubator-quickstep git commit: Removed StorageManager from QueryProcessor.
Date Thu, 17 Nov 2016 20:17:08 GMT
Removed StorageManager from QueryProcessor.


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

Branch: refs/heads/decrementNumQueuedWorkOrders
Commit: 9a005f36944de0eebd1bf764124fc7876e62d934
Parents: ea5f28b
Author: Zuyu Zhang <zuyuz@apache.org>
Authored: Mon Nov 14 21:09:28 2016 -0800
Committer: Harshad Deshmukh <hbdeshmukh@apache.org>
Committed: Thu Nov 17 14:02:51 2016 -0600

----------------------------------------------------------------------
 cli/CommandExecutor.cpp            |  5 +++--
 cli/QuickstepCli.cpp               | 17 +++++++++--------
 query_optimizer/CMakeLists.txt     |  1 -
 query_optimizer/QueryProcessor.hpp | 15 +--------------
 4 files changed, 13 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/9a005f36/cli/CommandExecutor.cpp
----------------------------------------------------------------------
diff --git a/cli/CommandExecutor.cpp b/cli/CommandExecutor.cpp
index fea4b74..4ab32de 100644
--- a/cli/CommandExecutor.cpp
+++ b/cli/CommandExecutor.cpp
@@ -260,7 +260,7 @@ inline std::vector<TypedValue> executeQueryForSingleRow(
   // Drop the result relation.
   DropRelation::Drop(*query_result_relation,
                      query_processor->getDefaultDatabase(),
-                     query_processor->getStorageManager());
+                     storage_manager);
 
   return values;
 }
@@ -292,10 +292,10 @@ void executeAnalyze(const PtrVector<ParseString> *arguments,
                     const tmb::client_id main_thread_client_id,
                     const tmb::client_id foreman_client_id,
                     MessageBus *bus,
+                    StorageManager *storage_manager,
                     QueryProcessor *query_processor,
                     FILE *out) {
   const CatalogDatabase &database = *query_processor->getDefaultDatabase();
-  StorageManager *storage_manager = query_processor->getStorageManager();
 
   std::unique_ptr<SqlParserWrapper> parser_wrapper(new SqlParserWrapper());
   std::vector<std::reference_wrapper<const CatalogRelation>> relations;
@@ -396,6 +396,7 @@ void executeCommand(const ParseStatement &statement,
                    main_thread_client_id,
                    foreman_client_id,
                    bus,
+                   storage_manager,
                    query_processor, out);
   } else {
     THROW_SQL_ERROR_AT(command.command()) << "Invalid Command";

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/9a005f36/cli/QuickstepCli.cpp
----------------------------------------------------------------------
diff --git a/cli/QuickstepCli.cpp b/cli/QuickstepCli.cpp
index 31d9834..31215f6 100644
--- a/cli/QuickstepCli.cpp
+++ b/cli/QuickstepCli.cpp
@@ -240,6 +240,7 @@ int main(int argc, char* argv[]) {
       && (fixed_storage_path.back() != quickstep::kPathSeparator)) {
     fixed_storage_path.push_back(quickstep::kPathSeparator);
   }
+  quickstep::StorageManager storage_manager(fixed_storage_path);
 
   string catalog_path(fixed_storage_path);
   catalog_path.append("catalog.pb.bin");
@@ -281,10 +282,10 @@ int main(int argc, char* argv[]) {
     catalog_file.close();
   }
 
-  // Setup QueryProcessor, including CatalogDatabase and StorageManager.
+  // Setup QueryProcessor, including CatalogDatabase.
   std::unique_ptr<QueryProcessor> query_processor;
   try {
-    query_processor.reset(new QueryProcessor(catalog_path, fixed_storage_path));
+    query_processor = std::make_unique<QueryProcessor>(catalog_path);
   } catch (const std::exception &e) {
     LOG(FATAL) << "FATAL ERROR DURING STARTUP: "
                << e.what()
@@ -308,7 +309,7 @@ int main(int argc, char* argv[]) {
     printf("Preloading the buffer pool ... ");
     fflush(stdout);
     quickstep::PreloaderThread preloader(*query_processor->getDefaultDatabase(),
-                                         query_processor->getStorageManager(),
+                                         &storage_manager,
                                          worker_cpu_affinities.front());
 
     preloader.start();
@@ -357,7 +358,7 @@ int main(int argc, char* argv[]) {
       &worker_directory,
       &bus,
       query_processor->getDefaultDatabase(),
-      query_processor->getStorageManager(),
+      &storage_manager,
       -1,  // Don't pin the Foreman thread.
       num_numa_nodes_system,
       quickstep::FLAGS_profile_and_report_workorder_perf || quickstep::FLAGS_visualize_execution_dag);
@@ -412,7 +413,7 @@ int main(int argc, char* argv[]) {
                 main_thread_client_id,
                 foreman.getBusClientID(),
                 &bus,
-                query_processor->getStorageManager(),
+                &storage_manager,
                 query_processor.get(),
                 stdout);
           } catch (const quickstep::SqlError &sql_error) {
@@ -458,16 +459,16 @@ int main(int argc, char* argv[]) {
           const CatalogRelation *query_result_relation = query_handle->getQueryResultRelation();
           if (query_result_relation) {
             PrintToScreen::PrintRelation(*query_result_relation,
-                                         query_processor->getStorageManager(),
+                                         &storage_manager,
                                          stdout);
             PrintToScreen::PrintOutputSize(
                 *query_result_relation,
-                query_processor->getStorageManager(),
+                &storage_manager,
                 stdout);
 
             DropRelation::Drop(*query_result_relation,
                                query_processor->getDefaultDatabase(),
-                               query_processor->getStorageManager());
+                               &storage_manager);
           }
 
           query_processor->saveCatalog();

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/9a005f36/query_optimizer/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/query_optimizer/CMakeLists.txt b/query_optimizer/CMakeLists.txt
index 00d5163..10c52a1 100644
--- a/query_optimizer/CMakeLists.txt
+++ b/query_optimizer/CMakeLists.txt
@@ -234,7 +234,6 @@ target_link_libraries(quickstep_queryoptimizer_QueryProcessor
                       quickstep_catalog_Catalog_proto
                       quickstep_queryoptimizer_Optimizer
                       quickstep_queryoptimizer_OptimizerContext
-                      quickstep_storage_StorageManager
                       quickstep_utility_Macros)
 target_link_libraries(quickstep_queryoptimizer_Validator
                       glog

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/9a005f36/query_optimizer/QueryProcessor.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/QueryProcessor.hpp b/query_optimizer/QueryProcessor.hpp
index 5d3818e..5e5c115 100644
--- a/query_optimizer/QueryProcessor.hpp
+++ b/query_optimizer/QueryProcessor.hpp
@@ -27,7 +27,6 @@
 
 #include "catalog/Catalog.hpp"
 #include "query_optimizer/Optimizer.hpp"
-#include "storage/StorageManager.hpp"
 #include "utility/Macros.hpp"
 
 namespace quickstep {
@@ -130,13 +129,9 @@ class QueryProcessor {
    * @brief Constructor.
    *
    * @param catalog_filename The file to read the serialized catalog from.
-   * @param storage_path The filesystem directory where blocks are stored on
-   *        disk.
    **/
-  QueryProcessor(const std::string &catalog_filename,
-                 const std::string &storage_path)
+  explicit QueryProcessor(const std::string &catalog_filename)
       : catalog_filename_(catalog_filename),
-        storage_manager_(std::make_unique<StorageManager>(storage_path)),
         catalog_altered_(false),
         query_id_(0) {
     loadCatalog();
@@ -185,13 +180,6 @@ class QueryProcessor {
     return catalog_->getDatabaseByNameMutable("default");
   }
 
-  /**
-   * @brief Get the StorageManager held by this QueryProcessor.
-   **/
-  StorageManager* getStorageManager() const {
-    return storage_manager_.get();
-  }
-
  private:
   void loadCatalog();  // If it exists, free catalog_ before calling this
 
@@ -200,7 +188,6 @@ class QueryProcessor {
   std::string catalog_filename_;
 
   std::unique_ptr<Catalog> catalog_;
-  std::unique_ptr<StorageManager> storage_manager_;
 
   bool catalog_altered_;
 


Mime
View raw message