Skip to content

Commit 028e318

Browse files
committed
tablets it: Use table tablet options if available
initial_tablets was deprecated in newer releases in favor of per-table options. It looks like it also stopped working like before - when running the default policy test I saw there was 1 tablet present, despite initial_tablets being set to 16.
1 parent 92f7f49 commit 028e318

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

scylla/tests/integration/load_balancing/tablets.rs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use std::sync::Arc;
22

33
use crate::utils::{
44
execute_prepared_statement_everywhere, execute_unprepared_statement_everywhere,
5-
scylla_supports_tablets, setup_tracing, test_with_3_node_cluster, unique_keyspace_name,
6-
PerformDDL,
5+
scylla_supports_tablets, setup_tracing, supports_feature, test_with_3_node_cluster,
6+
unique_keyspace_name, PerformDDL,
77
};
88

99
use futures::future::try_join_all;
@@ -168,17 +168,31 @@ fn count_tablet_feedbacks(
168168
}
169169

170170
async fn prepare_schema(session: &Session, ks: &str, table: &str, tablet_count: usize) {
171+
let supports_table_tablet_options = supports_feature(session, "TABLET_OPTIONS").await;
172+
let (keyspace_tablet_opts, table_tablet_opts) = if supports_table_tablet_options {
173+
(
174+
"AND tablets = { 'enabled': true }".to_string(),
175+
format!("WITH tablets = {{ 'min_tablet_count': {tablet_count} }}"),
176+
)
177+
} else {
178+
(
179+
format!("AND tablets = {{ 'initial': {tablet_count} }}"),
180+
String::new(),
181+
)
182+
};
183+
171184
session
172185
.ddl(format!(
173186
"CREATE KEYSPACE IF NOT EXISTS {ks}
174187
WITH REPLICATION = {{'class' : 'NetworkTopologyStrategy', 'replication_factor' : 2}}
175-
AND tablets = {{ 'initial': {tablet_count} }}"
188+
{keyspace_tablet_opts}"
176189
))
177190
.await
178191
.unwrap();
179192
session
180193
.ddl(format!(
181-
"CREATE TABLE IF NOT EXISTS {ks}.{table} (a int, b int, c text, primary key (a, b))"
194+
"CREATE TABLE IF NOT EXISTS {ks}.{table} (a int, b int, c text, primary key (a, b))
195+
{table_tablet_opts}"
182196
))
183197
.await
184198
.unwrap();

0 commit comments

Comments
 (0)