Skip to content

Commit b1b6596

Browse files
committed
Add quota limits
1 parent 1977ab5 commit b1b6596

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

ydb/tests/olap/test_quota_exhaustion.py

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
import os
2+
import subprocess
13
import sys
4+
import time
25

36
import ydb
47
from ydb.tests.library.harness.kikimr_config import KikimrConfigGenerator
@@ -85,15 +88,57 @@ def delete_until_overload(self, session, table):
8588
print('delete: got overload issue', file=sys.stderr)
8689
return i
8790

91+
def ydbcli_db_schema_exec(self, node, operation_proto):
92+
endpoint = f"{node.host}:{node.port}"
93+
args = [
94+
node.binary_path,
95+
f"--server=grpc://{endpoint}",
96+
"db",
97+
"schema",
98+
"exec",
99+
operation_proto,
100+
]
101+
command = subprocess.run(args, capture_output=True)
102+
assert command.returncode == 0, command.stderr.decode("utf-8")
103+
104+
105+
def alter_database_quotas(self, node, database_path, database_quotas):
106+
alter_proto = """ModifyScheme {
107+
OperationType: ESchemeOpAlterSubDomain
108+
WorkingDir: "%s"
109+
SubDomain {
110+
Name: "%s"
111+
DatabaseQuotas {
112+
%s
113+
}
114+
}
115+
}""" % (
116+
os.path.dirname(database_path),
117+
os.path.basename(database_path),
118+
database_quotas,
119+
)
120+
121+
self.ydbcli_db_schema_exec(node, alter_proto)
122+
88123
def test_delete(self):
89124
"""As per https://github.com/ydb-platform/ydb/issues/13653"""
90125
session = self.make_session()
91126

127+
# Set soft and hard quotas to 6GB
128+
self.alter_database_quotas(self.cluster.nodes[1], '/Root', """
129+
data_size_hard_quota: 6000000000
130+
data_size_soft_quota: 6000000000
131+
""")
132+
92133
# Overflow the database
93134
self.create_test_table(session, 'huge')
94135
self.upsert_until_overload(session, 'huge')
95136

96-
# Check that deletions will lead to overflow, too
137+
# Check that deletion works at least first time
138+
# self.delete_test_chunk(session, 'huge', 0)
139+
# ^ uncomment after fixing https://github.com/ydb-platform/ydb/issues/13808
140+
141+
# Check that deletions will lead to overflow at some moment
97142
i = self.delete_until_overload(session, 'huge')
98143

99144
# Try to wait until deletion works again (after compaction)

0 commit comments

Comments
 (0)