Skip to content

Commit 09df44e

Browse files
authored
Test for partition stats (#18637)
1 parent 832745c commit 09df44e

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

ydb/tests/stress/oltp_workload/workload/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
from ydb.tests.stress.oltp_workload.workload.type.vector_index import WorkloadVectorIndex
77
from ydb.tests.stress.oltp_workload.workload.type.insert_delete_all_types import WorkloadInsertDeleteAllTypes
8+
from ydb.tests.stress.oltp_workload.workload.type.select_partition import WorkloadSelectPartition
89

910
ydb.interceptor.monkey_patch_event_handler()
1011

@@ -33,7 +34,8 @@ def run(self):
3334
stop = threading.Event()
3435
workloads = [
3536
WorkloadInsertDeleteAllTypes(self.client, self.name, stop),
36-
WorkloadVectorIndex(self.client, self.name, stop)
37+
WorkloadVectorIndex(self.client, self.name, stop),
38+
WorkloadSelectPartition(self.client, self.name, stop)
3739
]
3840

3941
for w in workloads:
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import threading
2+
import time
3+
4+
from ydb.tests.stress.common.common import WorkloadBase
5+
6+
7+
class WorkloadSelectPartition(WorkloadBase):
8+
def __init__(self, client, prefix, stop):
9+
super().__init__(client, prefix, "", stop)
10+
self.lock = threading.Lock()
11+
self.time_check = 2
12+
13+
def get_stat(self):
14+
return ""
15+
16+
def _loop(self):
17+
while not self.is_stop_requested():
18+
# del where after https://github.com/ydb-platform/ydb/pull/18404
19+
sql_select = """
20+
SELECT * FROM `.sys/partition_stats`
21+
WHERE Path = '/Root/oltp_workload/insert_delete_all_types/table'
22+
"""
23+
result_set = self.client.query(sql_select, False)
24+
rows = result_set[0].rows
25+
if len(rows) != 1:
26+
raise "partitiont > 1"
27+
time.sleep(self.time_check)
28+
29+
def get_workload_thread_funcs(self):
30+
return [self._loop]

ydb/tests/stress/oltp_workload/workload/type/ya.make

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ PY3_LIBRARY()
33
PY_SRCS(
44
vector_index.py
55
insert_delete_all_types.py
6+
select_partition.py
67
)
78

89
PEERDIR(

0 commit comments

Comments
 (0)