Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ydb/apps/ydb/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

* Replaced option `--query-settings` by `--query-prefix` one in `ydb workload <workload> run`.
* Added new options to `ydb workload topic`: --tx-commit-interval and --tx-commit-messages, allowing you to specify commit interval either in milliseconds or in number of messages written.
Also now you can load test YDB topics, using wide transactions that span over all partitions in the topic. This works both in write and in end-to-end workload scenarios.

Expand Down
6 changes: 4 additions & 2 deletions ydb/public/lib/ydb_cli/commands/ydb_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ void TWorkloadCommandBenchmark::Config(TConfig& config) {
config.Opts->AddLongOption("plan", "Query plans report file name")
.DefaultValue("")
.StoreResult(&PlanFileName);
config.Opts->AddLongOption("query-settings", "Query settings.\nEvery setting is a line that will be added to the beginning of each query. For multiple settings lines use this option several times.")
.DefaultValue("")
config.Opts->AddLongOption("query-settings")
.AppendTo(&QuerySettings).Hidden();
config.Opts->AddLongOption("query-prefix", "Query prefix.\nEvery prefix is a line that will be added to the beginning of each query. For multiple prefixes lines use this option several times.")
.AppendTo(&QuerySettings);
config.Opts->MutuallyExclusive("query-prefix", "query-settings");
auto fillTestCases = [](TStringBuf line, std::function<void(ui32)>&& op) {
for (const auto& token : StringSplitter(line).Split(',').SkipEmpty()) {
TStringBuf part = token.Token();
Expand Down
14 changes: 8 additions & 6 deletions ydb/tests/olap/lib/ydb_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ def __init__(self,
timeout: float,
check_canonical: CheckCanonicalPolicy,
query_syntax: str,
scale: Optional[int]):
scale: Optional[int],
query_prefix: Optional[str]):
def _get_output_path(ext: str) -> str:
return yatest.common.test_output_path(f'q{query_num}.{ext}')

Expand All @@ -85,6 +86,7 @@ def _get_output_path(ext: str) -> str:
self.check_canonical = check_canonical
self.query_syntax = query_syntax
self.scale = scale
self.query_prefix = query_prefix
self._nodes_info: dict[str, dict[str, int]] = {}
self._plan_path = _get_output_path('plan')
self._query_output_path = _get_output_path('out')
Expand Down Expand Up @@ -210,9 +212,8 @@ def _get_cmd(self) -> list[str]:
'--global-timeout', f'{self.timeout}s',
'--verbose'
]
query_preffix = get_external_param('query-prefix', '')
if query_preffix:
cmd += ['--query-settings', query_preffix]
if self.query_prefix:
cmd += ['--query-prefix', self.query_prefix]
if self.check_canonical != CheckCanonicalPolicy.NO:
cmd.append('--check-canonical')
if self.query_syntax:
Expand Down Expand Up @@ -248,7 +249,7 @@ def process(self) -> YdbCliHelper.WorkloadRunResult:
@staticmethod
def workload_run(workload_type: WorkloadType, path: str, query_num: int, iterations: int = 5,
timeout: float = 100., check_canonical: CheckCanonicalPolicy = CheckCanonicalPolicy.NO, query_syntax: str = '',
scale: Optional[int] = None) -> YdbCliHelper.WorkloadRunResult:
scale: Optional[int] = None, query_prefix=None) -> YdbCliHelper.WorkloadRunResult:
return YdbCliHelper.WorkloadProcessor(
workload_type,
path,
Expand All @@ -257,5 +258,6 @@ def workload_run(workload_type: WorkloadType, path: str, query_num: int, iterati
timeout,
check_canonical,
query_syntax,
scale
scale,
query_prefix=query_prefix
).process()
37 changes: 24 additions & 13 deletions ydb/tests/olap/load/lib/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from ydb.tests.olap.lib.ydb_cluster import YdbCluster
from ydb.tests.olap.lib.allure_utils import allure_test_description
from ydb.tests.olap.lib.results_processor import ResultsProcessor
from ydb.tests.olap.lib.utils import get_external_param
from ydb.tests.olap.scenario.helpers.scenario_tests_helper import ScenarioTestHelper
from time import time
from typing import Optional
Expand All @@ -15,9 +16,10 @@

class LoadSuiteBase:
class QuerySettings:
def __init__(self, iterations: Optional[int] = None, timeout: Optional[float] = None) -> None:
def __init__(self, iterations: Optional[int] = None, timeout: Optional[float] = None, query_prefix: Optional[str] = None) -> None:
self.iterations = iterations
self.timeout = timeout
self.query_prefix = query_prefix

iterations: int = 5
workload_type: WorkloadType = None
Expand All @@ -27,6 +29,7 @@ def __init__(self, iterations: Optional[int] = None, timeout: Optional[float] =
query_syntax: str = ''
query_settings: dict[int, LoadSuiteBase.QuerySettings] = {}
scale: Optional[int] = None
query_prefix: str = get_external_param('query-prefix', '')

@classmethod
def suite(cls) -> str:
Expand All @@ -36,14 +39,20 @@ def suite(cls) -> str:
return result

@classmethod
def _get_iterations(cls, query_num: int) -> int:
q = cls.query_settings.get(query_num, None)
return q.iterations if q is not None and q.iterations is not None else cls.iterations

@classmethod
def _get_timeout(cls, query_num: int) -> float:
q = cls.query_settings.get(query_num, None)
return q.timeout if q is not None and q.timeout is not None else cls.timeout
def _get_query_settings(cls, query_num: int) -> QuerySettings:
result = LoadSuiteBase.QuerySettings(
iterations=cls.iterations,
timeout=cls.timeout,
query_prefix=cls.query_prefix
)
q = cls.query_settings.get(query_num, LoadSuiteBase.QuerySettings())
if q.iterations is not None:
result.iterations = q.iterations
if q.timeout is not None:
result.timeout = q.timeout
if q.query_prefix is not None:
result.query_prefix = q.query_prefix
return result

@classmethod
def _test_name(cls, query_num: int) -> str:
Expand Down Expand Up @@ -204,16 +213,18 @@ def run_workload_test(self, path: str, query_num: int) -> None:
for param in allure_test_result.parameters:
if param.name == 'query_num':
param.mode = allure.parameter_mode.HIDDEN.value
qparams = self._get_query_settings(query_num)
start_time = time()
result = YdbCliHelper.workload_run(
path=path,
query_num=query_num,
iterations=self._get_iterations(query_num),
iterations=qparams.iterations,
workload_type=self.workload_type,
timeout=self._get_timeout(query_num),
timeout=qparams.timeout,
check_canonical=self.check_canonical,
query_syntax=self.query_syntax,
scale=self.scale
scale=self.scale,
query_prefix=qparams.query_prefix
)
allure_test_description(self.suite(), self._test_name(query_num), refference_set=self.refference, start_time=start_time, end_time=time())
self.process_query_result(result, query_num, self._get_iterations(query_num), True)
self.process_query_result(result, query_num, qparams.iterations, True)
4 changes: 4 additions & 0 deletions ydb/tests/olap/load/lib/tpcds.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ class TestTpcds10(TpcdsSuiteBase):
scale: int = 10
check_canonical: bool = CheckCanonicalPolicy.WARNING
timeout = max(TpcdsSuiteBase.timeout, 300.)
query_settings = {
# temporary, https://github.com/ydb-platform/ydb/issues/11767#issuecomment-2553353146
72: LoadSuiteBase.QuerySettings(query_prefix='pragma ydb.UseGraceJoinCoreForMap = "false";'),
}
tables_size: dict[str, int] = {
'call_center': 24,
'catalog_page': 12000,
Expand Down
Loading