|
| 1 | +import os |
| 2 | +import subprocess |
1 | 3 | import sys
|
| 4 | +import time |
2 | 5 |
|
3 | 6 | import ydb
|
4 | 7 | from ydb.tests.library.harness.kikimr_config import KikimrConfigGenerator
|
@@ -85,15 +88,57 @@ def delete_until_overload(self, session, table):
|
85 | 88 | print('delete: got overload issue', file=sys.stderr)
|
86 | 89 | return i
|
87 | 90 |
|
| 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 | + |
88 | 123 | def test_delete(self):
|
89 | 124 | """As per https://github.com/ydb-platform/ydb/issues/13653"""
|
90 | 125 | session = self.make_session()
|
91 | 126 |
|
| 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 | + |
92 | 133 | # Overflow the database
|
93 | 134 | self.create_test_table(session, 'huge')
|
94 | 135 | self.upsert_until_overload(session, 'huge')
|
95 | 136 |
|
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 |
97 | 142 | i = self.delete_until_overload(session, 'huge')
|
98 | 143 |
|
99 | 144 | # Try to wait until deletion works again (after compaction)
|
|
0 commit comments