Bug fixed in \analyze command and reuse code. - The \analyze command issues SQL queries. Due to a recent change in the execution engine, there was a bug in issuing the queries, which is fixed in this branch. - Reuse code to receive feedback from Foreman upon query completion. - Minor inclusion fixes in touched files.
Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/a7013627 Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/a7013627 Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/a7013627 Branch: refs/heads/adaptive-bloom-filters Commit: a7013627ecfab78aa80b483ee7f910ef7ea014d9 Parents: 4931623 Author: Harshad Deshmukh <hbdeshm...@apache.org> Authored: Wed Jun 15 14:10:43 2016 -0500 Committer: Harshad Deshmukh <hbdeshm...@apache.org> Committed: Wed Jun 15 14:10:43 2016 -0500 ---------------------------------------------------------------------- cli/CommandExecutor.cpp | 2 ++ cli/QuickstepCli.cpp | 9 ++------ query_execution/QueryExecutionUtil.hpp | 23 ++++++++++++++++++++ .../tests/ExecutionGeneratorTestRunner.cpp | 10 ++++----- .../tests/ExecutionGeneratorTestRunner.hpp | 3 +++ 5 files changed, 34 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/a7013627/cli/CommandExecutor.cpp ---------------------------------------------------------------------- diff --git a/cli/CommandExecutor.cpp b/cli/CommandExecutor.cpp index dc14741..7083ef5 100644 --- a/cli/CommandExecutor.cpp +++ b/cli/CommandExecutor.cpp @@ -220,6 +220,8 @@ inline TypedValue executeQueryForSingleResult( QueryExecutionUtil::ConstructAndSendAdmitRequestMessage( main_thread_client_id, foreman_client_id, query_handle.get(), bus); + QueryExecutionUtil::ReceiveQueryCompletionMessage(main_thread_client_id, bus); + // Retrieve the scalar result from the result relation. const CatalogRelation *query_result_relation = query_handle->getQueryResultRelation(); DCHECK(query_result_relation != nullptr); http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/a7013627/cli/QuickstepCli.cpp ---------------------------------------------------------------------- diff --git a/cli/QuickstepCli.cpp b/cli/QuickstepCli.cpp index 0b64fda..35bd16e 100644 --- a/cli/QuickstepCli.cpp +++ b/cli/QuickstepCli.cpp @@ -88,7 +88,6 @@ typedef quickstep::LineReaderDumb LineReaderImpl; #include "tmb/id_typedefs.h" #include "tmb/message_bus.h" #include "tmb/message_style.h" -#include "tmb/tagged_message.h" namespace quickstep { class CatalogRelation; @@ -119,7 +118,6 @@ using quickstep::QueryHandle; using quickstep::QueryPlan; using quickstep::QueryProcessor; using quickstep::SqlParserWrapper; -using quickstep::TaggedMessage; using quickstep::Worker; using quickstep::WorkerDirectory; using quickstep::WorkerMessage; @@ -128,7 +126,6 @@ using quickstep::kPoisonMessage; using quickstep::kWorkloadCompletionMessage; using tmb::client_id; -using tmb::AnnotatedMessage; namespace quickstep { @@ -440,10 +437,8 @@ int main(int argc, char* argv[]) { &bus); try { - const AnnotatedMessage annotated_msg = - bus.Receive(main_thread_client_id, 0, true); - const TaggedMessage &tagged_message = annotated_msg.tagged_message; - DCHECK_EQ(kWorkloadCompletionMessage, tagged_message.message_type()); + QueryExecutionUtil::ReceiveQueryCompletionMessage( + main_thread_client_id, &bus); end = std::chrono::steady_clock::now(); const CatalogRelation *query_result_relation = query_handle->getQueryResultRelation(); http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/a7013627/query_execution/QueryExecutionUtil.hpp ---------------------------------------------------------------------- diff --git a/query_execution/QueryExecutionUtil.hpp b/query_execution/QueryExecutionUtil.hpp index 78fd159..6ea4a29 100644 --- a/query_execution/QueryExecutionUtil.hpp +++ b/query_execution/QueryExecutionUtil.hpp @@ -25,13 +25,18 @@ #include "query_execution/WorkerMessage.hpp" #include "utility/Macros.hpp" +#include "glog/logging.h" + #include "tmb/address.h" +#include "tmb/id_typedefs.h" #include "tmb/message_style.h" #include "tmb/message_bus.h" #include "tmb/tagged_message.h" namespace quickstep { +class QueryHandle; + /** * @brief A static class for reusable methods in query_execution module. **/ @@ -91,6 +96,24 @@ class QueryExecutionUtil { bus, sender_id, receiver_id, std::move(admit_tagged_message)); } + /** + * @brief Receive a query completion message. + * + * @param receiver_id The TMB client ID of the receiver thread. + * @param bus A pointer to the TMB. + * + * @note Right now the query completion message is of no interest to the + * caller. In the future, if this message needs to be fetched, make this + * function return the TaggedMessage. + **/ + static void ReceiveQueryCompletionMessage(const tmb::client_id receiver_id, + tmb::MessageBus *bus) { + const AnnotatedMessage annotated_msg = + bus->Receive(receiver_id, 0, true); + const TaggedMessage &tagged_message = annotated_msg.tagged_message; + DCHECK_EQ(kWorkloadCompletionMessage, tagged_message.message_type()); + } + static void BroadcastPoisonMessage(const tmb::client_id sender_id, tmb::MessageBus *bus) { // Terminate all threads. // The sender thread broadcasts poison message to the workers and foreman. http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/a7013627/query_optimizer/tests/ExecutionGeneratorTestRunner.cpp ---------------------------------------------------------------------- diff --git a/query_optimizer/tests/ExecutionGeneratorTestRunner.cpp b/query_optimizer/tests/ExecutionGeneratorTestRunner.cpp index ea871d0..8c1d306 100644 --- a/query_optimizer/tests/ExecutionGeneratorTestRunner.cpp +++ b/query_optimizer/tests/ExecutionGeneratorTestRunner.cpp @@ -42,7 +42,8 @@ #include "glog/logging.h" -#include "tmb/tagged_message.h" +#include "tmb/id_typedefs.h" +#include "tmb/message_bus.h" namespace quickstep { @@ -101,11 +102,8 @@ void ExecutionGeneratorTestRunner::runTestCase( &query_handle, &bus_); - // Receive workload completion message from Foreman. - const AnnotatedMessage annotated_msg = - bus_.Receive(main_thread_client_id_, 0, true); - const TaggedMessage &tagged_message = annotated_msg.tagged_message; - DCHECK_EQ(kWorkloadCompletionMessage, tagged_message.message_type()); + QueryExecutionUtil::ReceiveQueryCompletionMessage( + main_thread_client_id_, &bus_); const CatalogRelation *query_result_relation = query_handle.getQueryResultRelation(); if (query_result_relation) { http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/a7013627/query_optimizer/tests/ExecutionGeneratorTestRunner.hpp ---------------------------------------------------------------------- diff --git a/query_optimizer/tests/ExecutionGeneratorTestRunner.hpp b/query_optimizer/tests/ExecutionGeneratorTestRunner.hpp index 9204073..bb2a26f 100644 --- a/query_optimizer/tests/ExecutionGeneratorTestRunner.hpp +++ b/query_optimizer/tests/ExecutionGeneratorTestRunner.hpp @@ -35,6 +35,9 @@ #include "utility/Macros.hpp" #include "utility/textbased_test/TextBasedTestDriver.hpp" +#include "tmb/id_typedefs.h" +#include "tmb/message_bus.h" + namespace quickstep { namespace optimizer {