Skip to content

Create tables in tenant #17912

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 30 additions & 6 deletions ydb/tests/olap/data_quotas/test_quota_exhaustion.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ def upsert_until_overload(self, do_upsert, timeout_seconds=0):
for i in range(ROWS_CHUNKS_COUNT):
res = do_upsert(i)
print(f"upsert #{i} ok, result:", res, file=sys.stderr)
described = self.cluster.client.describe('/Root', '')
described = self.cluster.client.describe('/Root/test', '')
print('Disk space usage {}'.format(described.PathDescription.DomainDescription.DiskSpaceUsage), file=sys.stderr)
print('Quota exceeded {}'.format(described.PathDescription.DomainDescription.DomainState.DiskQuotaExceeded), file=sys.stderr)
if timeout_seconds:
assert time.time() <= deadline, "deadline exceeded"
Expand All @@ -90,19 +91,42 @@ def upsert_until_overload(self, do_upsert, timeout_seconds=0):
@link_test_case("#13529")
def test(self):
"""As per https://github.com/ydb-platform/ydb/issues/13529"""
self.database_name = '/Root'

self.database_name = os.path.join('/Root', 'test')
print('Database name {}'.format(self.database_name), file=sys.stderr)
self.cluster.create_database(
self.database_name,
storage_pool_units_count={
'hdd': 1
},
)
self.cluster.register_and_start_slots(self.database_name, count=1)
self.cluster.wait_tenant_up(self.database_name)

# Set soft and hard quotas to 40 Mb
self.alter_database_quotas(self.cluster.nodes[1], self.database_name, """
data_size_hard_quota: 40000000
data_size_soft_quota: 40000000
""")

session = self.make_session()

table_path = os.path.join(self.database_name, 'huge')

# Overflow the database
self.create_test_table(session, 'huge')
self.create_test_table(session, table_path)
self.upsert_until_overload(lambda i: self.upsert_test_chunk(session, 'huge', i, retries=0))

# Cleanup
session.execute_with_retries("""DROP TABLE huge""")

session.execute_with_retries(f"""DROP TABLE `{table_path}`""")

table_path = os.path.join(self.database_name, 'small')
# Check database health after cleanup
self.create_test_table(session, 'small')
self.upsert_test_chunk(session, 'small', 0)
described = self.cluster.client.describe('/Root/test', '')
print('Disk space usage {}'.format(described.PathDescription.DomainDescription.DiskSpaceUsage), file=sys.stderr)
self.create_test_table(session, table_path)
self.upsert_test_chunk(session, table_path, 0)

def delete_test_chunk(self, session, table, chunk_id, retries=10):
session.execute_with_retries(f"""
Expand Down
Loading