mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-02 14:15:46 +00:00
Recently, in commit 49026dc319, the
way to choose the number of tablets in a new keyspace changed.
This broke the test we had for a memory leak when many tablets were
used, which saw the old syntax wasn't recognized and assumed Scylla
is running without tablet support - so the test was skipped.
Let's fix the syntax. After this patch the test passes if the tablets
experimental feature is enabled, and only skipped if it isn't.
Signed-off-by: Nadav Har'El <nyh@scylladb.com>
48 lines
2.3 KiB
Python
48 lines
2.3 KiB
Python
# Copyright 2023-present ScyllaDB
|
|
#
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
#############################################################################
|
|
# Some tests for the new "tablets"-based replication, replicating the old
|
|
# "vnodes". Eventually, ScyllaDB will use tablets by default and all tests
|
|
# will run using tablets, but these tests are for specific issues discovered
|
|
# while developing tablets that didn't exist for vnodes. Note that most tests
|
|
# for tablets require multiple nodes, and are in the test/topology*
|
|
# directory, so here we'll probably only ever have a handful of single-node
|
|
# tests.
|
|
#############################################################################
|
|
|
|
import pytest
|
|
from util import unique_name
|
|
from cassandra.protocol import ConfigurationException
|
|
|
|
# A fixture similar to "test_keyspace", just creates a keyspace that enables
|
|
# tablets with initial_tablets=128
|
|
# The "initial_tablets" feature doesn't work if the "tablets" experimental
|
|
# feature is not turned on; In such a case, the tests using this fixture
|
|
# will be skipped.
|
|
@pytest.fixture(scope="module")
|
|
def test_keyspace_128_tablets(cql, this_dc):
|
|
name = unique_name()
|
|
try:
|
|
cql.execute("CREATE KEYSPACE " + name + " WITH REPLICATION = { 'class' : 'NetworkTopologyStrategy', '" + this_dc + "': 1 } AND TABLETS = { 'enabled': true, 'initial': 128 }")
|
|
except ConfigurationException:
|
|
pytest.skip('Scylla does not support initial_tablets, or the tablets feature is not enabled')
|
|
yield name
|
|
cql.execute("DROP KEYSPACE " + name)
|
|
|
|
# In the past (issue #16493), repeatedly creating and deleting a table
|
|
# would leak memory. Creating a table with 128 tablets would make this
|
|
# leak 128 times more serious and cause a failure faster. This is a
|
|
# reproducer for this problem. We basically expect this test not to
|
|
# OOM Scylla - the test doesn't "check" anything, the way it failed was
|
|
# for Scylla to run out of memory and then fail one of the CREATE TABLE
|
|
# or DROP TABLE operations in the loop.
|
|
# Note that this test doesn't even involve any data inside the table.
|
|
# Reproduces #16493.
|
|
def test_create_loop_with_tablets(cql, test_keyspace_128_tablets):
|
|
table = test_keyspace_128_tablets + "." + unique_name()
|
|
for i in range(100):
|
|
cql.execute(f"CREATE TABLE {table} (p int PRIMARY KEY, v int)")
|
|
cql.execute("DROP TABLE " + table)
|