Skip to content

Commit 3286068

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 2201a15 commit 3286068

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

sdcm/fill_db_data.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -3186,8 +3186,7 @@ def enable_cdc_for_tables(self) -> bool:
31863186
@cached_property
31873187
def tablets_enabled(self) -> bool:
31883188
"""Check is tablets enabled on cluster"""
3189-
with self.db_cluster.cql_connection_patient(self.db_cluster.nodes[0]) as session:
3190-
return is_tablets_feature_enabled(session)
3189+
return is_tablets_feature_enabled(self.db_cluster.nodes[0])
31913190

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

sdcm/nemesis.py

+12-16
Original file line numberDiff line numberDiff line change
@@ -1005,10 +1005,9 @@ def disrupt_restart_with_resharding(self):
10051005
"Run 'disrupt_nodetool_flush_and_reshard_on_kubernetes' instead")
10061006

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

10131012
murmur3_partitioner_ignore_msb_bits = 15 # pylint: disable=invalid-name
10141013
self.log.info(f'Restart node with resharding. New murmur3_partitioner_ignore_msb_bits value: '
@@ -1424,10 +1423,9 @@ def disrupt_nodetool_flush_and_reshard_on_kubernetes(self):
14241423
if not self._is_it_on_kubernetes():
14251424
raise UnsupportedNemesis('It is supported only on kubernetes')
14261425
# If tablets in use, skipping resharding since it is not supported.
1427-
with self.cluster.cql_connection_patient(self.target_node) as session:
1428-
if is_tablets_feature_enabled(session=session):
1429-
if SkipPerIssues('https://github.com/scylladb/scylladb/issues/16739', params=self.tester.params):
1430-
raise UnsupportedNemesis('https://github.com/scylladb/scylladb/issues/16739')
1426+
if is_tablets_feature_enabled(self.target_node):
1427+
if SkipPerIssues('https://github.com/scylladb/scylladb/issues/16739', params=self.tester.params):
1428+
raise UnsupportedNemesis('https://github.com/scylladb/scylladb/issues/16739')
14311429

14321430
dc_idx = 0
14331431
for node in self.cluster.nodes:
@@ -1710,10 +1708,9 @@ def disrupt_nodetool_refresh(self, big_sstable: bool = False):
17101708
# NOTE: resharding happens only if we have more than 1 core.
17111709
# We may have 1 core in a K8S multitenant setup.
17121710
# If tablets in use, skipping resharding validation since it doesn't work the same as vnodes
1713-
with self.cluster.cql_connection_patient(self.cluster.nodes[0]) as session:
1714-
if shards_num > 1 and not is_tablets_feature_enabled(session=session):
1715-
SstableLoadUtils.validate_resharding_after_refresh(
1716-
node=node, system_log_follower=system_log_follower)
1711+
if shards_num > 1 and not is_tablets_feature_enabled(self.cluster.nodes[0]):
1712+
SstableLoadUtils.validate_resharding_after_refresh(
1713+
node=node, system_log_follower=system_log_follower)
17171714

17181715
# Verify that the special key is loaded by SELECT query
17191716
result = self.target_node.run_cqlsh(query_verify)
@@ -5103,10 +5100,9 @@ def _wait_for_tablets_balanced(self, node):
51035100
if not node.raft.is_enabled:
51045101
self.log.info("Raft is disabled, skipping wait for balance")
51055102
return
5106-
with self.cluster.cql_connection_patient(node=node) as session:
5107-
if not is_tablets_feature_enabled(session):
5108-
self.log.info("Tablets are disabled, skipping wait for balance")
5109-
return
5103+
if not is_tablets_feature_enabled(node):
5104+
self.log.info("Tablets are disabled, skipping wait for balance")
5105+
return
51105106
time.sleep(60) # one minute gap before checking, just to give some time to the state machine
51115107
client = RemoteCurlClient(host="127.0.0.1:10000", endpoint="", node=node)
51125108
self.log.info("Waiting for tablets to be balanced")

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

@@ -71,8 +70,14 @@ def is_consistent_topology_changes_feature_enabled(session: Session) -> bool:
7170
return CONSISTENT_TOPOLOGY_CHANGES_FEATURE in get_enabled_features(session)
7271

7372

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

0 commit comments

Comments
 (0)