diff options
author | dennnniska <dennnis@ydb.tech> | 2025-05-22 11:15:16 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-22 11:15:16 +0300 |
commit | 09df44ef8c5b9ed326d48d1e37596e90acdd876b (patch) | |
tree | 9fa801c57c5ca86c0e9d0dcd8dda9def89c7b263 | |
parent | 832745c71bc3ced584b5b877d259952fa1db8d6f (diff) | |
download | ydb-09df44ef8c5b9ed326d48d1e37596e90acdd876b.tar.gz |
Test for partition stats (#18637)
3 files changed, 34 insertions, 1 deletions
diff --git a/ydb/tests/stress/oltp_workload/workload/__init__.py b/ydb/tests/stress/oltp_workload/workload/__init__.py index 8ae07f50f3c..1a2ecf2f238 100644 --- a/ydb/tests/stress/oltp_workload/workload/__init__.py +++ b/ydb/tests/stress/oltp_workload/workload/__init__.py @@ -5,6 +5,7 @@ import threading from ydb.tests.stress.oltp_workload.workload.type.vector_index import WorkloadVectorIndex from ydb.tests.stress.oltp_workload.workload.type.insert_delete_all_types import WorkloadInsertDeleteAllTypes +from ydb.tests.stress.oltp_workload.workload.type.select_partition import WorkloadSelectPartition ydb.interceptor.monkey_patch_event_handler() @@ -33,7 +34,8 @@ class WorkloadRunner: stop = threading.Event() workloads = [ WorkloadInsertDeleteAllTypes(self.client, self.name, stop), - WorkloadVectorIndex(self.client, self.name, stop) + WorkloadVectorIndex(self.client, self.name, stop), + WorkloadSelectPartition(self.client, self.name, stop) ] for w in workloads: diff --git a/ydb/tests/stress/oltp_workload/workload/type/select_partition.py b/ydb/tests/stress/oltp_workload/workload/type/select_partition.py new file mode 100644 index 00000000000..9c894c7a2e5 --- /dev/null +++ b/ydb/tests/stress/oltp_workload/workload/type/select_partition.py @@ -0,0 +1,30 @@ +import threading +import time + +from ydb.tests.stress.common.common import WorkloadBase + + +class WorkloadSelectPartition(WorkloadBase): + def __init__(self, client, prefix, stop): + super().__init__(client, prefix, "", stop) + self.lock = threading.Lock() + self.time_check = 2 + + def get_stat(self): + return "" + + def _loop(self): + while not self.is_stop_requested(): + # del where after https://github.com/ydb-platform/ydb/pull/18404 + sql_select = """ + SELECT * FROM `.sys/partition_stats` + WHERE Path = '/Root/oltp_workload/insert_delete_all_types/table' + """ + result_set = self.client.query(sql_select, False) + rows = result_set[0].rows + if len(rows) != 1: + raise "partitiont > 1" + time.sleep(self.time_check) + + def get_workload_thread_funcs(self): + return [self._loop] diff --git a/ydb/tests/stress/oltp_workload/workload/type/ya.make b/ydb/tests/stress/oltp_workload/workload/type/ya.make index 6305dc752ca..62d4504cf68 100644 --- a/ydb/tests/stress/oltp_workload/workload/type/ya.make +++ b/ydb/tests/stress/oltp_workload/workload/type/ya.make @@ -3,6 +3,7 @@ PY3_LIBRARY() PY_SRCS( vector_index.py insert_delete_all_types.py + select_partition.py ) PEERDIR( |