From d59aee8f547471072f2881a57e4264c697191835 Mon Sep 17 00:00:00 2001 From: Yoshiaki Nishimura Date: Fri, 25 Oct 2024 11:54:44 +0900 Subject: [PATCH] add sql.scan_default_parallel config. param. --- examples/service_benchmark/main.cpp | 1 + include/jogasaki/configuration.h | 10 ++++++++++ src/jogasaki/api/impl/database.cpp | 1 + src/jogasaki/api/resource/bridge.cpp | 3 +++ 4 files changed, 15 insertions(+) diff --git a/examples/service_benchmark/main.cpp b/examples/service_benchmark/main.cpp index afc9af3d..d8906166 100644 --- a/examples/service_benchmark/main.cpp +++ b/examples/service_benchmark/main.cpp @@ -112,6 +112,7 @@ DEFINE_bool(ddl, false, "issue ddl instead of using built-in table. Required for DEFINE_bool(secondary, false, "use secondary index"); //NOLINT DEFINE_int64(scan_block_size, 100, "max records processed by scan operator before yielding to other tasks"); //NOLINT DEFINE_int64(scan_yield_interval, 1, "max time (ms) processed by scan operator before yielding to other tasks"); //NOLINT +DEFINE_int64(scan_default_parallel, 1, "max parallel execution count of scan tasks"); //NOLINT namespace tateyama::service_benchmark { diff --git a/include/jogasaki/configuration.h b/include/jogasaki/configuration.h index f028e665..3f9d9a0b 100644 --- a/include/jogasaki/configuration.h +++ b/include/jogasaki/configuration.h @@ -490,6 +490,14 @@ class configuration { direct_commit_callback_ = arg; } + [[nodiscard]] std::size_t scan_default_parallel() const noexcept { + return scan_default_parallel_; + } + + void scan_default_parallel(std::size_t arg) noexcept { + scan_default_parallel_ = arg; + } + friend inline std::ostream& operator<<(std::ostream& out, configuration const& cfg) { //NOLINTBEGIN @@ -546,6 +554,7 @@ class configuration { print_non_default(rtx_parallel_scan); print_non_default(thousandths_ratio_check_local_first); print_non_default(direct_commit_callback); + print_non_default(scan_default_parallel); if(cfg.req_cancel_config()) { out << "req_cancel_config:" << *cfg.req_cancel_config() << " "; \ @@ -606,6 +615,7 @@ class configuration { bool rtx_parallel_scan_ = false; std::size_t thousandths_ratio_check_local_first_ = 100; bool direct_commit_callback_ = false; + std::size_t scan_default_parallel_ = 1; }; diff --git a/src/jogasaki/api/impl/database.cpp b/src/jogasaki/api/impl/database.cpp index fc130e2e..64b44ab6 100644 --- a/src/jogasaki/api/impl/database.cpp +++ b/src/jogasaki/api/impl/database.cpp @@ -180,6 +180,7 @@ void dump_public_configurations(configuration const& cfg) { LOGCFG << "(dev_rtx_parallel_scan) " << cfg.rtx_parallel_scan() << " : whether to enable parallel scan for RTX"; LOGCFG << "(dev_thousandths_ratio_check_local_first) " << cfg.thousandths_ratio_check_local_first() << " : how frequently (represented as count out of 1000 executions) task scheduler checks local task queue first"; LOGCFG << "(dev_direct_commit_callback) " << cfg.direct_commit_callback() << " : whether to make callback directly from shirakami to client on pre-commit response (only for `available` and `accepted`)"; + LOGCFG << "(scan_default_parallel) " << cfg.scan_default_parallel() << " : max parallel execution count of scan tasks"; } status database::start() { diff --git a/src/jogasaki/api/resource/bridge.cpp b/src/jogasaki/api/resource/bridge.cpp index b4237cd9..62348ec0 100644 --- a/src/jogasaki/api/resource/bridge.cpp +++ b/src/jogasaki/api/resource/bridge.cpp @@ -260,6 +260,9 @@ bool process_sql_config(std::shared_ptr& ret, tateyama: if (auto v = jogasaki_config->get("dev_direct_commit_callback")) { ret->direct_commit_callback(v.value()); } + if (auto v = jogasaki_config->get("scan_default_parallel")) { + ret->scan_default_parallel(v.value()); + } return true; }