Skip to content

Commit 8624fed

Browse files
authored
Merge 70a26b7 into d7b232d
2 parents d7b232d + 70a26b7 commit 8624fed

File tree

2 files changed

+370
-0
lines changed

2 files changed

+370
-0
lines changed
Lines changed: 365 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,365 @@
1+
# -*- coding: utf-8 -*-
2+
import os
3+
4+
import pytest
5+
6+
import yatest
7+
8+
from ydb.tests.library.harness.kikimr_runner import KiKiMR
9+
from ydb.tests.library.harness.kikimr_config import KikimrConfigGenerator
10+
from ydb.tests.library.harness.param_constants import kikimr_driver_path
11+
from ydb.tests.library.common.types import Erasure
12+
from ydb.tests.stress.simple_queue.workload import Workload
13+
14+
last_stable_binary_path = yatest.common.binary_path("ydb/tests/library/compatibility/ydbd-last-stable")
15+
current_binary_path = kikimr_driver_path()
16+
17+
all_binary_combinations = [
18+
[last_stable_binary_path],
19+
[current_binary_path],
20+
[last_stable_binary_path, current_binary_path],
21+
]
22+
all_binary_combinations_ids = ["last_stable", "current", "mixed"]
23+
24+
25+
class TestStress(object):
26+
@pytest.fixture(autouse=True, params=all_binary_combinations, ids=all_binary_combinations_ids)
27+
def setup(self, request):
28+
binary_paths = request.param
29+
self.config = KikimrConfigGenerator(
30+
erasure=Erasure.MIRROR_3_DC,
31+
binary_paths=binary_paths,
32+
# uncomment for 64 datetime in tpc-h/tpc-ds
33+
# extra_feature_flags={"enable_table_datetime64": True},
34+
)
35+
36+
self.cluster = KiKiMR(self.config)
37+
self.cluster.start()
38+
self.endpoint = "%s:%s" % (self.cluster.nodes[1].host, self.cluster.nodes[1].port)
39+
output_path = yatest.common.test_output_path()
40+
self.output_f = open(os.path.join(output_path, "out.log"), "w")
41+
yield
42+
self.cluster.stop()
43+
44+
def get_command_prefix_log(self, subcmds: list[str], path: str) -> list[str]:
45+
return (
46+
[
47+
yatest.common.binary_path(os.getenv("YDB_CLI_BINARY")),
48+
"--verbose",
49+
"--endpoint",
50+
"grpc://localhost:%d" % self.cluster.nodes[1].grpc_port,
51+
"--database=/Root",
52+
"workload",
53+
"log",
54+
]
55+
+ subcmds
56+
+ ["--path", path]
57+
)
58+
59+
def set_auto_partitioning_size_mb(self, path, size_mb):
60+
yatest.common.execute(
61+
[
62+
yatest.common.binary_path(os.getenv("YDB_CLI_BINARY")),
63+
"--verbose",
64+
"--endpoint",
65+
"grpc://localhost:%d" % self.cluster.nodes[1].grpc_port,
66+
"--database=/Root",
67+
"sql", "-s",
68+
"ALTER TABLE `{}` SET (AUTO_PARTITIONING_PARTITION_SIZE_MB={})".format(path, size_mb),
69+
],
70+
stdout=self.output_f,
71+
stderr=self.output_f,
72+
)
73+
74+
@pytest.mark.parametrize("store_type", ["row"])
75+
def test_log(self, store_type):
76+
timeout_scale = 60
77+
78+
upload_commands = [
79+
# bulk upsert workload
80+
self.get_command_prefix_log(subcmds=["run", "bulk_upsert"], path=store_type)
81+
+ ["--seconds", str(timeout_scale), "--threads", "10", "--rows", "2000"],
82+
# upsert workload
83+
self.get_command_prefix_log(subcmds=["run", "upsert"], path=store_type)
84+
+ ["--seconds", str(timeout_scale), "--threads", "10"],
85+
# insert workload
86+
self.get_command_prefix_log(subcmds=["run", "insert"], path=store_type)
87+
+ ["--seconds", str(timeout_scale), "--threads", "10"],
88+
]
89+
# init
90+
yatest.common.execute(
91+
self.get_command_prefix_log(subcmds=["init"], path=store_type)
92+
+ [
93+
"--store",
94+
store_type,
95+
"--min-partitions",
96+
"100",
97+
"--partition-size",
98+
"10",
99+
"--auto-partition",
100+
"0",
101+
"--ttl",
102+
"10",
103+
],
104+
stdout=self.output_f,
105+
stderr=self.output_f,
106+
)
107+
108+
yatest.common.execute(
109+
self.get_command_prefix_log(subcmds=["import", "--bulk-size", "1000", "-t", "1", "generator"], path=store_type),
110+
stdout=self.output_f,
111+
stderr=self.output_f,
112+
wait=True,
113+
)
114+
select = yatest.common.execute(
115+
self.get_command_prefix_log(subcmds=["run", "select"], path=store_type)
116+
+ [
117+
"--client-timeout",
118+
"10000",
119+
"--threads",
120+
"10",
121+
"--seconds",
122+
str(timeout_scale * len(upload_commands)),
123+
],
124+
wait=False,
125+
stdout=self.output_f,
126+
stderr=self.output_f,
127+
)
128+
129+
for i, command in enumerate(upload_commands):
130+
yatest.common.execute(
131+
command,
132+
wait=True,
133+
stdout=self.output_f,
134+
stderr=self.output_f,
135+
)
136+
137+
select.wait()
138+
139+
@pytest.mark.skip(reason="Too huge logs")
140+
@pytest.mark.parametrize("mode", ["row"])
141+
def test_simple_queue(self, mode: str):
142+
with Workload(f"grpc://localhost:{self.cluster.nodes[1].grpc_port}", "/Root", 180, mode) as workload:
143+
for handle in workload.loop():
144+
handle()
145+
146+
@pytest.mark.parametrize("store_type", ["row"])
147+
def test_kv(self, store_type):
148+
init_command_prefix = [
149+
yatest.common.binary_path(os.getenv("YDB_CLI_BINARY")),
150+
"--verbose",
151+
"--endpoint",
152+
"grpc://localhost:%d" % self.cluster.nodes[1].grpc_port,
153+
"--database=/Root",
154+
"workload",
155+
"kv",
156+
"init",
157+
"--min-partitions",
158+
"10",
159+
"--partition-size",
160+
"10",
161+
"--auto-partition",
162+
"0",
163+
"--init-upserts",
164+
"0",
165+
"--cols",
166+
"5",
167+
"--int-cols",
168+
"2",
169+
"--key-cols",
170+
"3",
171+
]
172+
173+
run_command_prefix = [
174+
yatest.common.binary_path(os.getenv("YDB_CLI_BINARY")),
175+
"--verbose",
176+
"--endpoint",
177+
"grpc://localhost:%d" % self.cluster.nodes[1].grpc_port,
178+
"--database=/Root",
179+
"workload",
180+
"kv",
181+
"run",
182+
"mixed",
183+
"--seconds",
184+
"180",
185+
"--threads",
186+
"10",
187+
"--cols",
188+
"5",
189+
"--len",
190+
"200",
191+
"--int-cols",
192+
"2",
193+
"--key-cols",
194+
"3",
195+
]
196+
197+
init_command = init_command_prefix
198+
init_command.extend(
199+
[
200+
"--path",
201+
store_type,
202+
"--store",
203+
store_type,
204+
]
205+
)
206+
run_command = run_command_prefix
207+
run_command.extend(
208+
[
209+
"--path",
210+
store_type,
211+
]
212+
)
213+
yatest.common.execute(init_command, wait=True, stdout=self.output_f, stderr=self.output_f)
214+
yatest.common.execute(run_command, wait=True, stdout=self.output_f, stderr=self.output_f)
215+
216+
@pytest.mark.parametrize("store_type", ["row"])
217+
def test_tpch1(self, store_type):
218+
init_command = [
219+
yatest.common.binary_path(os.getenv("YDB_CLI_BINARY")),
220+
"--verbose",
221+
"--endpoint",
222+
"grpc://localhost:%d" % self.cluster.nodes[1].grpc_port,
223+
"--database=/Root",
224+
"workload",
225+
"tpch",
226+
"-p",
227+
"tpch",
228+
"init",
229+
"--store={}".format(store_type),
230+
"--datetime", # use 32 bit dates instead of 64 (not supported in 24-4)
231+
]
232+
import_command = [
233+
yatest.common.binary_path(os.getenv("YDB_CLI_BINARY")),
234+
"--verbose",
235+
"--endpoint",
236+
"grpc://localhost:%d" % self.cluster.nodes[1].grpc_port,
237+
"--database=/Root",
238+
"workload",
239+
"tpch",
240+
"-p",
241+
"tpch",
242+
"import",
243+
"generator",
244+
"--scale=1",
245+
]
246+
run_command = [
247+
yatest.common.binary_path(os.getenv("YDB_CLI_BINARY")),
248+
"--verbose",
249+
"--endpoint",
250+
"grpc://localhost:%d" % self.cluster.nodes[1].grpc_port,
251+
"--database=/Root",
252+
"workload",
253+
"tpch",
254+
"-p",
255+
"tpch",
256+
"run",
257+
"--scale=1",
258+
"--exclude",
259+
# not working for row tables
260+
"17",
261+
"--check-canonical",
262+
]
263+
264+
yatest.common.execute(init_command, wait=True, stdout=self.output_f, stderr=self.output_f)
265+
266+
# make tables distributed across nodes
267+
tables = [
268+
"lineitem",
269+
"nation",
270+
"orders",
271+
"part",
272+
"partsupp",
273+
"region",
274+
"supplier",
275+
]
276+
for table in tables:
277+
self.set_auto_partitioning_size_mb("tpch/{}".format(table), 25)
278+
279+
yatest.common.execute(import_command, wait=True, stdout=self.output_f, stderr=self.output_f)
280+
yatest.common.execute(run_command, wait=True, stdout=self.output_f, stderr=self.output_f)
281+
282+
@pytest.mark.skip(reason="Not stabilized yet")
283+
@pytest.mark.parametrize("store_type", ["row"])
284+
def test_tpcds1(self, store_type):
285+
init_command = [
286+
yatest.common.binary_path(os.getenv("YDB_CLI_BINARY")),
287+
"--verbose",
288+
"--endpoint",
289+
"grpc://localhost:%d" % self.cluster.nodes[1].grpc_port,
290+
"--database=/Root",
291+
"workload",
292+
"tpcds",
293+
"-p",
294+
"tpcds",
295+
296+
"init",
297+
"--store={}".format(store_type),
298+
"--datetime", # use 32 bit dates instead of 64 (not supported in 24-4)
299+
]
300+
import_command = [
301+
yatest.common.binary_path(os.getenv("YDB_CLI_BINARY")),
302+
"--verbose",
303+
"--endpoint",
304+
"grpc://localhost:%d" % self.cluster.nodes[1].grpc_port,
305+
"--database=/Root",
306+
"workload",
307+
"tpcds",
308+
"-p",
309+
"tpcds",
310+
"import",
311+
"generator",
312+
"--scale=1",
313+
]
314+
run_command = [
315+
yatest.common.binary_path(os.getenv("YDB_CLI_BINARY")),
316+
"--verbose",
317+
"--endpoint",
318+
"grpc://localhost:%d" % self.cluster.nodes[1].grpc_port,
319+
"--database=/Root",
320+
"workload",
321+
"tpcds",
322+
"-p",
323+
"tpcds",
324+
"run",
325+
"--scale=1",
326+
"--check-canonical",
327+
"--exclude",
328+
# not working for row tables
329+
"5,7,14,18,22,23,24,26,27,31,33,39,46,51,54,56,58,60,61,64,66,67,68,72,75,77,78,79,80,93",
330+
]
331+
332+
yatest.common.execute(init_command, wait=True, stdout=self.output_f, stderr=self.output_f)
333+
334+
# make table distributed across nodes
335+
tables = [
336+
"call_center",
337+
"catalog_page",
338+
"catalog_returns",
339+
"catalog_sales",
340+
"customer",
341+
"customer_demographics",
342+
"date_dim",
343+
"household_demographics",
344+
"income_band",
345+
"inventory",
346+
"item",
347+
"promotion",
348+
"reason",
349+
"ship_mode",
350+
"store",
351+
"store_returns",
352+
"store_sales",
353+
"time_dim",
354+
"warehouse",
355+
"web_page",
356+
"web_returns",
357+
"web_sales",
358+
"web_site",
359+
]
360+
361+
for table in tables:
362+
self.set_auto_partitioning_size_mb("tpcds/{}".format(table), 25)
363+
364+
yatest.common.execute(import_command, wait=True, stdout=self.output_f, stderr=self.output_f)
365+
yatest.common.execute(run_command, wait=True, stdout=self.output_f, stderr=self.output_f)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
11
PY3TEST()
22
ENV(YDB_DRIVER_BINARY="ydb/apps/ydbd/ydbd")
3+
ENV(YDB_CLI_BINARY="ydb/apps/ydb/ydb")
34

45
TEST_SRCS(
56
test_followers.py
67
test_compatibility.py
8+
test_stress.py
79
)
810

911
SIZE(LARGE)
12+
REQUIREMENTS(cpu:all)
1013
INCLUDE(${ARCADIA_ROOT}/ydb/tests/large.inc)
1114

1215
DEPENDS(
16+
ydb/apps/ydb
1317
ydb/apps/ydbd
1418
ydb/tests/library/compatibility
1519
)
1620

1721
PEERDIR(
1822
ydb/tests/library
23+
ydb/tests/stress/simple_queue/workload
1924
)
2025

2126
END()

0 commit comments

Comments
 (0)