diff --git a/src/include/settings/settings_callbacks.h b/src/include/settings/settings_callbacks.h index cdf095e930..eb4ca7b980 100644 --- a/src/include/settings/settings_callbacks.h +++ b/src/include/settings/settings_callbacks.h @@ -96,6 +96,10 @@ class Callbacks { static void MetricsQueryTraceOutput(void *old_value, void *new_value, DBMain *db_main, common::ManagedPointer action_context); + /** Update the query execution mode in TrafficCop */ + static void CompiledQueryExecution(void *old_value, void *new_value, DBMain *db_main, + common::ManagedPointer action_context); + /** Set the forecast sample limit. */ static void ForecastSampleLimit(void *old_value, void *new_value, DBMain *db_main, common::ManagedPointer action_context); diff --git a/src/include/settings/settings_defs.h b/src/include/settings/settings_defs.h index 9693be5e80..3344b58da3 100644 --- a/src/include/settings/settings_defs.h +++ b/src/include/settings/settings_defs.h @@ -409,8 +409,8 @@ SETTING_bool( compiled_query_execution, "Compile queries to native machine code using LLVM, rather than relying on TPL interpretation (default: false).", false, - false, - noisepage::settings::Callbacks::NoOp + true, + noisepage::settings::Callbacks::CompiledQueryExecution ) SETTING_string( diff --git a/src/include/traffic_cop/traffic_cop.h b/src/include/traffic_cop/traffic_cop.h index 3698800879..f5fd70b67f 100644 --- a/src/include/traffic_cop/traffic_cop.h +++ b/src/include/traffic_cop/traffic_cop.h @@ -260,6 +260,14 @@ class TrafficCop { */ void SetOptimizerTimeout(const uint64_t optimizer_timeout) { optimizer_timeout_ = optimizer_timeout; } + /** + * Adjust the TrafficCop's execution mode value (for use by SettingsManager) + * @param is_compiled set execution_mode_ to Compiled if true; Interpret if false + */ + void SetExecutionMode(bool is_compiled) { + execution_mode_ = is_compiled ? execution::vm::ExecutionMode::Compiled : execution::vm::ExecutionMode::Interpret; + } + /** * @return true if query caching enabled, false otherwise */ @@ -274,7 +282,7 @@ class TrafficCop { common::ManagedPointer stats_storage_; uint64_t optimizer_timeout_; const bool use_query_cache_; - const execution::vm::ExecutionMode execution_mode_; + execution::vm::ExecutionMode execution_mode_; }; } // namespace noisepage::trafficcop diff --git a/src/settings/settings_callbacks.cpp b/src/settings/settings_callbacks.cpp index 5c88086747..8eeb4e01e7 100644 --- a/src/settings/settings_callbacks.cpp +++ b/src/settings/settings_callbacks.cpp @@ -186,6 +186,14 @@ void Callbacks::MetricsQueryTraceOutput(void *const old_value, void *const new_v action_context->SetState(common::ActionState::SUCCESS); } +void Callbacks::CompiledQueryExecution(void *const old_value, void *const new_value, DBMain *const db_main, + common::ManagedPointer action_context) { + action_context->SetState(common::ActionState::IN_PROGRESS); + bool is_compiled = *static_cast(new_value); + db_main->GetTrafficCop()->SetExecutionMode(is_compiled); + action_context->SetState(common::ActionState::SUCCESS); +} + void Callbacks::ForecastSampleLimit(void *old_value, void *new_value, DBMain *db_main, common::ManagedPointer action_context) { action_context->SetState(common::ActionState::IN_PROGRESS);