|
3 | 3 | import sys
|
4 | 4 | import logging
|
5 | 5 | import time
|
| 6 | +import pytest |
6 | 7 |
|
7 | 8 | import ydb
|
8 | 9 | from ydb.tests.library.harness.kikimr_config import KikimrConfigGenerator
|
@@ -241,3 +242,55 @@ def test_duplicates(self):
|
241 | 242 | self.upsert_until_overload(lambda i: self.upsert_test_chunk(session, table_path, 0, retries=0), timeout_seconds=200)
|
242 | 243 |
|
243 | 244 | assert self.wait_for(lambda: self.try_upsert_test_chunk(session, table_path, 1), 300), "can't write after overload by duplicates"
|
| 245 | + |
| 246 | + @link_test_case("#14696") |
| 247 | + @pytest.mark.skip(reason="https://github.com/ydb-platform/ydb/issues/19629") |
| 248 | + def test_delete_after_overloaded(self): |
| 249 | + self.database_name = os.path.join('/Root', 'test') |
| 250 | + |
| 251 | + self.cluster.create_database( |
| 252 | + self.database_name, |
| 253 | + storage_pool_units_count={ |
| 254 | + 'hdd': 1 |
| 255 | + }, |
| 256 | + ) |
| 257 | + |
| 258 | + self.cluster.register_and_start_slots(self.database_name, count=1) |
| 259 | + self.cluster.wait_tenant_up(self.database_name) |
| 260 | + |
| 261 | + self.alter_database_quotas(self.cluster.nodes[1], self.database_name, """ |
| 262 | + data_size_hard_quota: 40000000 |
| 263 | + data_size_soft_quota: 40000000 |
| 264 | + """) |
| 265 | + |
| 266 | + session = self.make_session() |
| 267 | + table_path = os.path.join(self.database_name, 'huge') |
| 268 | + |
| 269 | + self.create_test_table(session, table_path) |
| 270 | + |
| 271 | + session.execute_with_retries( |
| 272 | + f""" |
| 273 | + ALTER OBJECT `{table_path}` (TYPE TABLE) SET (ACTION=UPSERT_OPTIONS, `COMPACTION_PLANNER.CLASS_NAME`=`lc-buckets`, `COMPACTION_PLANNER.FEATURES`=` |
| 274 | + {{"levels" : [{{"class_name" : "OneLayer", "portions_live_duration" : "200s", "expected_blobs_size" : 1000000000000, "portions_count_available" : 2}}, |
| 275 | + {{"class_name" : "OneLayer"}}]}}`); |
| 276 | + """ |
| 277 | + ) |
| 278 | + |
| 279 | + self.upsert_until_overload(lambda i: self.upsert_test_chunk(session, table_path, i, retries=0)) |
| 280 | + |
| 281 | + for i in range(100): |
| 282 | + while True: |
| 283 | + try: |
| 284 | + self.delete_test_chunk(session, table_path, i, retries=10) |
| 285 | + break |
| 286 | + except (ydb.issues.Overloaded, ydb.issues.Unavailable): |
| 287 | + time.sleep(1) |
| 288 | + |
| 289 | + def can_write(): |
| 290 | + try: |
| 291 | + self.upsert_test_chunk(session, table_path, 0, retries=0) |
| 292 | + return True |
| 293 | + except (ydb.issues.Overloaded, ydb.issues.Unavailable): |
| 294 | + return False |
| 295 | + |
| 296 | + assert self.wait_for(can_write, 300) |
0 commit comments