Skip to content

Commit 3175b11

Browse files
jsmolarsoyacz
authored andcommitted
fix(LoaderUtilsMixin): table_enabled was allways True as this feature is enabled
Enabling/disabling tablets was changed. Now we have to check scylla yaml or keystore schema. For more info see - scylladb/scylladb#21451 - scylladb/scylladb#21614 (cherry picked from commit b03a690)
1 parent c3fc4bd commit 3175b11

File tree

8 files changed

+41
-21
lines changed

8 files changed

+41
-21
lines changed

sdcm/cluster.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -5044,10 +5044,9 @@ def get_node_ip_list(verification_node):
50445044
self.test_config.tester_obj().monitors.reconfigure_scylla_monitoring()
50455045

50465046
def decommission(self, node: BaseNode, timeout: int | float = None) -> DataCenterTopologyRfControl | None:
5047-
with node.parent_cluster.cql_connection_patient(node) as session:
5048-
if tablets_enabled := is_tablets_feature_enabled(session):
5049-
dc_topology_rf_change = DataCenterTopologyRfControl(target_node=node)
5050-
dc_topology_rf_change.decrease_keyspaces_rf()
5047+
if tablets_enabled := is_tablets_feature_enabled(node):
5048+
dc_topology_rf_change = DataCenterTopologyRfControl(target_node=node)
5049+
dc_topology_rf_change.decrease_keyspaces_rf()
50515050
with adaptive_timeout(operation=Operations.DECOMMISSION, node=node):
50525051
node.run_nodetool("decommission", timeout=timeout, long_running=True, retry=0)
50535052
self.verify_decommission(node)

sdcm/fill_db_data.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -3192,8 +3192,7 @@ def is_counter_supported(self) -> bool:
31923192
@property
31933193
def tablets_enabled(self) -> bool:
31943194
"""Check is tablets enabled on cluster"""
3195-
with self.db_cluster.cql_connection_patient(self.db_cluster.nodes[0]) as session:
3196-
return is_tablets_feature_enabled(session)
3195+
return is_tablets_feature_enabled(self.db_cluster.nodes[0])
31973196

31983197
@retrying(n=3, sleep_time=20, allowed_exceptions=ProtocolException)
31993198
def truncate_table(self, session, truncate): # pylint: disable=no-self-use

sdcm/nemesis.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1008,10 +1008,9 @@ def disrupt_restart_with_resharding(self):
10081008
"Run 'disrupt_nodetool_flush_and_reshard_on_kubernetes' instead")
10091009

10101010
# If tablets in use, skipping resharding since it is not supported.
1011-
with self.cluster.cql_connection_patient(self.target_node) as session:
1012-
if is_tablets_feature_enabled(session=session):
1013-
if SkipPerIssues('https://github.com/scylladb/scylladb/issues/16739', params=self.tester.params):
1014-
raise UnsupportedNemesis('https://github.com/scylladb/scylladb/issues/16739')
1011+
if is_tablets_feature_enabled(self.target_node):
1012+
if SkipPerIssues('https://github.com/scylladb/scylladb/issues/16739', params=self.tester.params):
1013+
raise UnsupportedNemesis('https://github.com/scylladb/scylladb/issues/16739')
10151014

10161015
murmur3_partitioner_ignore_msb_bits = 15 # pylint: disable=invalid-name
10171016
self.log.info(f'Restart node with resharding. New murmur3_partitioner_ignore_msb_bits value: '

sdcm/tester.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -799,9 +799,12 @@ def reliable_replication_factor(self) -> int:
799799
"""
800800
n_db_nodes = str(self.params.get('n_db_nodes'))
801801
min_nodes_dc = min([int(nodes_num) for nodes_num in n_db_nodes.split() if int(nodes_num) > 0])
802-
with self.db_cluster.cql_connection_patient(self.db_cluster.nodes[0]) as session:
803-
# In case tablets are enabled, it's better to set RF smaller than dc-nodes-number, so decommission is allowed.
804-
return max([min_nodes_dc - 1, 1]) if is_tablets_feature_enabled(session) else min_nodes_dc
802+
803+
# In case tablets are enabled, it's better to set RF smaller than dc-nodes-number, so decommission is allowed.
804+
rf_candidate = max([min_nodes_dc - 1, 1]
805+
) if is_tablets_feature_enabled(self.db_cluster.nodes[0]) else min_nodes_dc
806+
# NOTE: use RF=3 at max to avoid problems on big setups
807+
return min(rf_candidate, 3)
805808

806809
@property
807810
def test_id(self):

sdcm/utils/features.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
CONSISTENT_TOPOLOGY_CHANGES_FEATURE = "SUPPORTS_CONSISTENT_TOPOLOGY_CHANGES"
1818
CONSISTENT_CLUSTER_MANAGEMENT_FEATURE = "SUPPORTS_RAFT_CLUSTER_MANAGEMENT"
19-
TABLETS_FEATURE = "TABLETS"
2019

2120
LOGGER = logging.getLogger(__name__)
2221

@@ -75,8 +74,14 @@ def is_consistent_topology_changes_feature_enabled(session: Session) -> bool:
7574
return CONSISTENT_TOPOLOGY_CHANGES_FEATURE in get_enabled_features(session)
7675

7776

78-
def is_tablets_feature_enabled(session: Session) -> bool:
77+
def is_tablets_feature_enabled(node) -> bool:
7978
""" Check whether tablets enabled
80-
if you need from a specific node use `patient_exclusive_cql_connection` session
8179
"""
82-
return TABLETS_FEATURE in get_enabled_features(session)
80+
with node.remote_scylla_yaml() as scylla_yaml:
81+
# for backward compatibility of 2024.1 and earlier
82+
if "tablets" in scylla_yaml.experimental_features:
83+
return True
84+
if scylla_yaml.dict().get("enable_tablets"):
85+
return True
86+
87+
return False

sdcm/utils/loader_utils.py

+7
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@
1515
import os
1616
import re
1717
import time
18+
from functools import cached_property
1819

1920
from sdcm.sct_events import Severity
2021
from sdcm.sct_events.system import TestFrameworkEvent
22+
from sdcm.utils.features import is_tablets_feature_enabled
2123

2224
DEFAULT_USER = "cassandra"
2325
DEFAULT_USER_PASSWORD = "cassandra"
@@ -88,6 +90,11 @@ def assemble_and_run_all_stress_cmd_by_ks_names(self, stress_queue, stress_cmd,
8890
}
8991
self._run_all_stress_cmds(stress_queue, params)
9092

93+
@cached_property
94+
def tablets_enabled(self):
95+
# is tablets feature enabled in Scylla configuration.
96+
return is_tablets_feature_enabled(self.db_cluster.nodes[0])
97+
9198
def _run_all_stress_cmds(self, stress_queue, params):
9299
stress_cmds = params['stress_cmd']
93100
if not isinstance(stress_cmds, list):

sdcm/utils/tablets/common.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,9 @@ def wait_for_tablets_balanced(node):
3434
if not node.raft.is_enabled:
3535
LOGGER.info("Raft is disabled, skipping wait for balance")
3636
return
37-
with node.parent_cluster.cql_connection_patient(node=node) as session:
38-
if not is_tablets_feature_enabled(session):
39-
LOGGER.info("Tablets are disabled, skipping wait for balance")
40-
return
37+
if not is_tablets_feature_enabled(node):
38+
LOGGER.info("Tablets are disabled, skipping wait for balance")
39+
return
4140
time.sleep(60) # one minute gap before checking, just to give some time to the state machine
4241
client = RemoteCurlClient(host="127.0.0.1:10000", endpoint="", node=node)
4342
LOGGER.info("Waiting for tablets to be balanced")

sla_per_user_system_test.py

+9
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from sdcm.sct_events import Severity
2323
from sdcm.sct_events.workload_prioritisation import WorkloadPrioritisationEvent
2424
from test_lib.sla import ServiceLevel, Role, User
25+
from sdcm.utils.features import is_tablets_feature_enabled
2526

2627

2728
# pylint: disable=too-many-public-methods
@@ -371,6 +372,14 @@ def test_read_throughput_1to5_ratio(self):
371372

372373
def _two_users_load_througput_workload(self, shares, load, expected_shares_ratio=None):
373374
session = self.prepare_schema()
375+
376+
if is_tablets_feature_enabled(self.db_cluster.nodes[0]):
377+
self.run_pre_create_keyspace()
378+
# after several test runs with Tablets decided to decrease by half of the percent(usually tests show about 96.8 - 97.5)
379+
# due to unbalanced shards utilization with tablets(particular tablet belong to particular shard)
380+
# during gauss distribution read
381+
self.MIN_CPU_UTILIZATION = 96.5
382+
374383
self.create_test_data_and_wait_no_compaction()
375384

376385
# Define Service Levels/Roles/Users

0 commit comments

Comments
 (0)