From f165b396fd109194483350cda842599d2c8b5fe5 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Tue, 26 May 2026 11:34:53 +0300 Subject: [PATCH] schema_builder: make shard_count an explicit constructor parameter A recent Seastar update deprecated smp::count and introduced this_smp_shard_count() as a replacement. One difference is that this_smp_shard_count() wants to run on a reactor thread. This poses a problem for non-reactor tests (BOOST_AUTO_TEST_CASE) that nevertheless use a schema, as the schema_builder constructor references smp::count. If we replace it with this_smp_shard_count() then it will crash when running without a reactor. To fix, remove the implicit this_smp_shard_count() call from raw_schema's constructor and require callers to pass shard_count explicitly to schema_builder. This allows tests that don't run on a reactor thread to construct schemas without crashing. Production code and reactor-based tests pass this_smp_shard_count(). Non-reactor test files (expr_test, keys_test, nonwrapping_interval_test, wrapping_interval_test, bti_key_translation_test, range_tombstone_list_test) pass a fixed shard count of 1. Note: sstable_test.cc is a Seastar test file (SEASTAR_THREAD_TEST_CASE) but also contains one plain BOOST_AUTO_TEST_CASE (test_empty_key_view_comparison) that constructs a schema_builder without a reactor context. This test also receives a fixed shard count of 1. --- alternator/executor.cc | 8 +- cdc/log.cc | 2 +- cql3/statements/create_index_statement.cc | 2 +- cql3/statements/create_table_statement.cc | 2 +- cql3/statements/create_view_statement.cc | 2 +- db/schema_tables.cc | 34 ++-- db/system_distributed_keyspace.cc | 8 +- db/system_keyspace.cc | 92 +++++------ db/virtual_tables.cc | 32 ++-- ent/encryption/replicated_key_provider.cc | 2 +- replica/mutation_dump.cc | 2 +- replica/tablets.cc | 8 +- schema/schema.cc | 11 +- schema/schema.hh | 2 +- schema/schema_builder.hh | 3 +- service/paxos/paxos_state.cc | 2 +- test/boost/bloom_filter_test.cc | 2 +- test/boost/broken_sstable_test.cc | 24 +-- test/boost/bti_index_test.cc | 2 +- test/boost/bti_key_translation_test.cc | 8 +- test/boost/cache_mutation_reader_test.cc | 2 +- test/boost/cdc_test.cc | 2 +- test/boost/cell_locker_test.cc | 6 +- test/boost/compaction_group_test.cc | 4 +- test/boost/compound_test.cc | 10 +- test/boost/counter_test.cc | 2 +- test/boost/cql_functions_test.cc | 4 +- test/boost/cql_query_large_test.cc | 2 +- test/boost/cql_query_test.cc | 22 +-- test/boost/database_test.cc | 20 +-- test/boost/database_test.hh | 2 +- test/boost/expr_test.cc | 72 ++++----- test/boost/frozen_mutation_test.cc | 2 +- test/boost/group0_test.cc | 4 +- test/boost/incremental_compaction_test.cc | 14 +- test/boost/keys_test.cc | 16 +- test/boost/memtable_test.cc | 14 +- test/boost/mutation_fragment_test.cc | 6 +- test/boost/mutation_query_test.cc | 4 +- test/boost/mutation_reader_test.cc | 6 +- test/boost/mutation_test.cc | 66 ++++---- test/boost/mvcc_test.cc | 2 +- test/boost/network_topology_strategy_test.cc | 8 +- test/boost/nonwrapping_interval_test.cc | 2 +- test/boost/partitioner_test.cc | 10 +- test/boost/querier_cache_test.cc | 2 +- test/boost/range_tombstone_list_test.cc | 2 +- .../reader_concurrency_semaphore_test.cc | 2 +- test/boost/row_cache_test.cc | 20 +-- test/boost/schema_change_test.cc | 20 +-- test/boost/schema_loader_test.cc | 2 +- test/boost/schema_registry_test.cc | 28 ++-- test/boost/sstable_3_x_test.cc | 148 +++++++++--------- test/boost/sstable_compaction_test.cc | 100 ++++++------ test/boost/sstable_datafile_test.cc | 84 +++++----- test/boost/sstable_directory_test.cc | 2 +- test/boost/sstable_mutation_test.cc | 34 ++-- test/boost/sstable_resharding_test.cc | 2 +- test/boost/sstable_test.cc | 6 +- test/boost/sstable_test.hh | 22 +-- test/boost/storage_proxy_test.cc | 2 +- test/boost/tablets_test.cc | 10 +- test/boost/view_build_test.cc | 4 +- test/boost/virtual_table_test.cc | 2 +- test/boost/wrapping_interval_test.cc | 2 +- test/lib/data_model.cc | 2 +- test/lib/mutation_source_test.cc | 8 +- test/lib/random_schema.cc | 2 +- test/lib/simple_schema.hh | 2 +- test/lib/test_services.cc | 2 +- test/manual/enormous_table_scan_test.cc | 4 +- test/manual/row_locker_test.cc | 4 +- test/perf/memory_footprint_test.cc | 4 +- test/perf/perf_bti_key_translation.cc | 2 +- test/perf/perf_mutation.cc | 2 +- test/perf/perf_row_cache_reads.cc | 2 +- test/perf/perf_row_cache_update.cc | 12 +- test/perf/perf_simple_query.cc | 4 +- test/perf/perf_sstable.hh | 2 +- test/perf/perf_tablets.cc | 2 +- test/perf/tablet_load_balancing.cc | 2 +- test/unit/row_cache_alloc_stress_test.cc | 2 +- tools/schema_loader.cc | 6 +- tools/scylla-sstable.cc | 2 +- tools/scylla-types.cc | 2 +- 85 files changed, 557 insertions(+), 555 deletions(-) diff --git a/alternator/executor.cc b/alternator/executor.cc index 801c3d959a..12df2a03da 100644 --- a/alternator/executor.cc +++ b/alternator/executor.cc @@ -1436,7 +1436,7 @@ future executor::create_table_on_shard0(service:: tracing::add_alternator_table_name(trace_state, table_name); - schema_builder builder(keyspace_name, table_name); + schema_builder builder(this_smp_shard_count(), keyspace_name, table_name); auto [hash_key, range_key] = parse_key_schema(request, ""); add_column(builder, hash_key, *attribute_definitions, column_kind::partition_key); unused_attribute_definitions.erase(hash_key); @@ -1478,7 +1478,7 @@ future executor::create_table_on_shard0(service:: } // FIXME: read and handle "Projection" parameter. This will // require the MV code to copy just parts of the attrs map. - schema_builder view_builder(keyspace_name, vname); + schema_builder view_builder(this_smp_shard_count(), keyspace_name, vname); auto [view_hash_key, view_range_key] = parse_key_schema(l, "Local Secondary Index"); if (view_hash_key != hash_key) { co_return api_error::validation("LocalSecondaryIndex hash key must match the base table hash key"); @@ -1531,7 +1531,7 @@ future executor::create_table_on_shard0(service:: elogger.trace("Adding GSI {}", index_name); // FIXME: read and handle "Projection" parameter. This will // require the MV code to copy just parts of the attrs map. - schema_builder view_builder(keyspace_name, vname); + schema_builder view_builder(this_smp_shard_count(), keyspace_name, vname); auto [view_hash_key, view_range_key] = parse_key_schema(g, "GlobalSecondaryIndexes"); // If an attribute is already a real column in the base table @@ -2156,7 +2156,7 @@ future executor::update_table(client_state& clien elogger.trace("Adding GSI {}", index_name); // FIXME: read and handle "Projection" parameter. This will // require the MV code to copy just parts of the attrs map. - schema_builder view_builder(keyspace_name, vname); + schema_builder view_builder(this_smp_shard_count(), keyspace_name, vname); auto [view_hash_key, view_range_key] = parse_key_schema(it->value, "GlobalSecondaryIndexUpdates"); // If an attribute is already a real column in the base // table (i.e., a key attribute in the base table), diff --git a/cdc/log.cc b/cdc/log.cc index 97f3e716d9..a00f095363 100644 --- a/cdc/log.cc +++ b/cdc/log.cc @@ -719,7 +719,7 @@ static void add_columns_to_cdc_log(schema_builder& b, const schema& s, static schema_ptr create_log_schema(const schema& s, const replica::database& db, const keyspace_metadata& ksm, api::timestamp_type timestamp, std::optional uuid, schema_ptr old) { - schema_builder b(s.ks_name(), log_name(s.cf_name())); + schema_builder b(this_smp_shard_count(), s.ks_name(), log_name(s.cf_name())); b.with_partitioner(cdc::cdc_partitioner::classname); diff --git a/cql3/statements/create_index_statement.cc b/cql3/statements/create_index_statement.cc index cca7231bf0..b30e3b9d77 100644 --- a/cql3/statements/create_index_statement.cc +++ b/cql3/statements/create_index_statement.cc @@ -182,7 +182,7 @@ view_ptr create_index_statement::create_view_for_index(const schema_ptr schema, const data_dictionary::database& db) const { sstring index_target_name = im.options().at(cql3::statements::index_target::target_option_name); - schema_builder builder{schema->ks_name(), secondary_index::index_table_name(im.name())}; + schema_builder builder{this_smp_shard_count(), schema->ks_name(), secondary_index::index_table_name(im.name())}; auto target_info = secondary_index::target_parser::parse(schema, im); const auto* index_target = im.local() ? target_info.ck_columns.front() : target_info.pk_columns.front(); auto target_type = target_info.type; diff --git a/cql3/statements/create_table_statement.cc b/cql3/statements/create_table_statement.cc index 1e4bf74786..e51aa87bca 100644 --- a/cql3/statements/create_table_statement.cc +++ b/cql3/statements/create_table_statement.cc @@ -109,7 +109,7 @@ create_table_statement::prepare_schema_mutations(query_processor& qp, const quer * @throws InvalidRequestException on failure to validate parsed parameters */ schema_ptr create_table_statement::get_cf_meta_data(const data_dictionary::database db) const { - schema_builder builder{keyspace(), column_family(), _id}; + schema_builder builder{this_smp_shard_count(), keyspace(), column_family(), _id}; apply_properties_to(builder, db); return builder.build(_use_compact_storage ? schema_builder::compact_storage::yes : schema_builder::compact_storage::no); } diff --git a/cql3/statements/create_view_statement.cc b/cql3/statements/create_view_statement.cc index 679408c238..c890621df5 100644 --- a/cql3/statements/create_view_statement.cc +++ b/cql3/statements/create_view_statement.cc @@ -343,7 +343,7 @@ std::pair create_view_statement::prepare_view( warnings.emplace_back(std::move(warning_text)); } - schema_builder builder{keyspace(), column_family()}; + schema_builder builder{this_smp_shard_count(), keyspace(), column_family()}; auto add_columns = [this, &builder] (std::vector& defs, column_kind kind) mutable { for (auto* def : defs) { auto&& type = _properties.get_reversable_type(*def->column_specification->name, def->type); diff --git a/db/schema_tables.cc b/db/schema_tables.cc index 1c01f0644a..4bb08d9bd7 100644 --- a/db/schema_tables.cc +++ b/db/schema_tables.cc @@ -207,7 +207,7 @@ namespace v3 { schema_ptr keyspaces() { static thread_local auto schema = [] { - schema_builder builder(generate_legacy_id(NAME, KEYSPACES), NAME, KEYSPACES, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, KEYSPACES), NAME, KEYSPACES, // partition key {{"keyspace_name", utf8_type}}, // clustering key @@ -233,7 +233,7 @@ schema_ptr keyspaces() { schema_ptr scylla_keyspaces() { static thread_local auto schema = [] { - schema_builder builder(generate_legacy_id(NAME, SCYLLA_KEYSPACES), NAME, SCYLLA_KEYSPACES, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, SCYLLA_KEYSPACES), NAME, SCYLLA_KEYSPACES, // partition key {{"keyspace_name", utf8_type}}, // clustering key @@ -259,7 +259,7 @@ schema_ptr scylla_keyspaces() { schema_ptr tables() { static thread_local auto schema = [] { - schema_builder builder(generate_legacy_id(NAME, TABLES), NAME, TABLES, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, TABLES), NAME, TABLES, // partition key {{"keyspace_name", utf8_type}}, // clustering key @@ -309,7 +309,7 @@ schema_ptr scylla_tables(schema_features features) { schema_ptr& s = schemas[has_in_memory]; if (!s) { auto id = generate_legacy_id(NAME, SCYLLA_TABLES); - auto sb = schema_builder(NAME, SCYLLA_TABLES, std::make_optional(id)) + auto sb = schema_builder(this_smp_shard_count(), NAME, SCYLLA_TABLES, std::make_optional(id)) .with_column("keyspace_name", utf8_type, column_kind::partition_key) .with_column("table_name", utf8_type, column_kind::clustering_key) .with_column("version", uuid_type); @@ -360,7 +360,7 @@ schema_ptr scylla_tables(schema_features features) { // VIEW" would list them - while it should only list real, selected, columns. static schema_ptr columns_schema(const char* columns_table_name) { - schema_builder builder(generate_legacy_id(NAME, columns_table_name), NAME, columns_table_name, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, columns_table_name), NAME, columns_table_name, // partition key {{"keyspace_name", utf8_type}}, // clustering key @@ -423,7 +423,7 @@ const std::unordered_set& schema_tables_holding_schema_mutations() { // is defined in column_computation.hh and system_schema docs. // static schema_ptr computed_columns_schema(const char* columns_table_name) { - schema_builder builder(generate_legacy_id(NAME, columns_table_name), NAME, columns_table_name, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, columns_table_name), NAME, columns_table_name, // partition key {{"keyspace_name", utf8_type}}, // clustering key @@ -447,7 +447,7 @@ schema_ptr computed_columns() { schema_ptr dropped_columns() { static thread_local auto schema = [] { - schema_builder builder(generate_legacy_id(NAME, DROPPED_COLUMNS), NAME, DROPPED_COLUMNS, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, DROPPED_COLUMNS), NAME, DROPPED_COLUMNS, // partition key {{"keyspace_name", utf8_type}}, // clustering key @@ -471,7 +471,7 @@ schema_ptr dropped_columns() { schema_ptr triggers() { static thread_local auto schema = [] { - schema_builder builder(generate_legacy_id(NAME, TRIGGERS), NAME, TRIGGERS, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, TRIGGERS), NAME, TRIGGERS, // partition key {{"keyspace_name", utf8_type}}, // clustering key @@ -494,7 +494,7 @@ schema_ptr triggers() { schema_ptr views() { static thread_local auto schema = [] { - schema_builder builder(generate_legacy_id(NAME, VIEWS), NAME, VIEWS, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, VIEWS), NAME, VIEWS, // partition key {{"keyspace_name", utf8_type}}, // clustering key @@ -540,7 +540,7 @@ schema_ptr views() { schema_ptr indexes() { static thread_local auto schema = [] { - schema_builder builder(generate_legacy_id(NAME, INDEXES), NAME, INDEXES, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, INDEXES), NAME, INDEXES, // partition key {{"keyspace_name", utf8_type}}, // clustering key @@ -564,7 +564,7 @@ schema_ptr indexes() { schema_ptr types() { static thread_local auto schema = [] { - schema_builder builder(generate_legacy_id(NAME, TYPES), NAME, TYPES, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, TYPES), NAME, TYPES, // partition key {{"keyspace_name", utf8_type}}, // clustering key @@ -588,7 +588,7 @@ schema_ptr types() { schema_ptr functions() { static thread_local auto schema = [] { - schema_builder builder(generate_legacy_id(NAME, FUNCTIONS), NAME, FUNCTIONS, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, FUNCTIONS), NAME, FUNCTIONS, // partition key {{"keyspace_name", utf8_type}}, // clustering key @@ -615,7 +615,7 @@ schema_ptr functions() { schema_ptr aggregates() { static thread_local auto schema = [] { - schema_builder builder(generate_legacy_id(NAME, AGGREGATES), NAME, AGGREGATES, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, AGGREGATES), NAME, AGGREGATES, // partition key {{"keyspace_name", utf8_type}}, // clustering key @@ -642,7 +642,7 @@ schema_ptr aggregates() { schema_ptr scylla_aggregates() { static thread_local auto schema = [] { - schema_builder builder(generate_legacy_id(NAME, SCYLLA_AGGREGATES), NAME, SCYLLA_AGGREGATES, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, SCYLLA_AGGREGATES), NAME, SCYLLA_AGGREGATES, // partition key {{"keyspace_name", utf8_type}}, // clustering key @@ -669,7 +669,7 @@ schema_ptr scylla_aggregates() { schema_ptr scylla_table_schema_history() { static thread_local auto s = [] { - schema_builder builder(db::system_keyspace::NAME, SCYLLA_TABLE_SCHEMA_HISTORY, generate_legacy_id(db::system_keyspace::NAME, SCYLLA_TABLE_SCHEMA_HISTORY)); + schema_builder builder(this_smp_shard_count(), db::system_keyspace::NAME, SCYLLA_TABLE_SCHEMA_HISTORY, generate_legacy_id(db::system_keyspace::NAME, SCYLLA_TABLE_SCHEMA_HISTORY)); builder.with_column("cf_id", uuid_type, column_kind::partition_key); builder.with_column("schema_version", uuid_type, column_kind::clustering_key); builder.with_column("column_name", utf8_type, column_kind::clustering_key); @@ -2209,7 +2209,7 @@ schema_ptr create_table_from_mutations(const schema_ctxt& ctxt, schema_mutations auto ks_name = table_row.get_nonnull("keyspace_name"); auto cf_name = table_row.get_nonnull("table_name"); auto id = table_id(table_row.get_nonnull("id")); - schema_builder builder{ks_name, cf_name, id}; + schema_builder builder{this_smp_shard_count(), ks_name, cf_name, id}; auto cf = cf_type::standard; auto is_dense = false; @@ -2485,7 +2485,7 @@ static schema_builder prepare_view_schema_builder_from_mutations(const schema_ct auto cf_name = row.get_nonnull("view_name"); auto id = table_id(row.get_nonnull("id")); - schema_builder builder{ks_name, cf_name, id}; + schema_builder builder{this_smp_shard_count(), ks_name, cf_name, id}; prepare_builder_from_table_row(ctxt, builder, row); if (sm.scylla_tables()) { diff --git a/db/system_distributed_keyspace.cc b/db/system_distributed_keyspace.cc index de23c355f6..8ea4e884df 100644 --- a/db/system_distributed_keyspace.cc +++ b/db/system_distributed_keyspace.cc @@ -46,7 +46,7 @@ thread_local data_type cdc_streams_set_type = set_type_impl::get_instance(bytes_ schema_ptr view_build_status() { static thread_local auto schema = [] { auto id = generate_legacy_id(system_distributed_keyspace::NAME, system_distributed_keyspace::VIEW_BUILD_STATUS); - return schema_builder(system_distributed_keyspace::NAME, system_distributed_keyspace::VIEW_BUILD_STATUS, std::make_optional(id)) + return schema_builder(this_smp_shard_count(), system_distributed_keyspace::NAME, system_distributed_keyspace::VIEW_BUILD_STATUS, std::make_optional(id)) .with_column("keyspace_name", utf8_type, column_kind::partition_key) .with_column("view_name", utf8_type, column_kind::partition_key) .with_column("host_id", uuid_type, column_kind::clustering_key) @@ -62,7 +62,7 @@ schema_ptr view_build_status() { schema_ptr cdc_desc() { thread_local auto schema = [] { auto id = generate_legacy_id(system_distributed_keyspace::NAME, system_distributed_keyspace::CDC_DESC_V2); - return schema_builder(system_distributed_keyspace::NAME, system_distributed_keyspace::CDC_DESC_V2, {id}) + return schema_builder(this_smp_shard_count(), system_distributed_keyspace::NAME, system_distributed_keyspace::CDC_DESC_V2, {id}) /* The timestamp of this CDC generation. */ .with_column("time", timestamp_type, column_kind::partition_key) /* For convenience, the list of stream IDs in this generation is split into token ranges @@ -81,7 +81,7 @@ schema_ptr cdc_desc() { schema_ptr cdc_timestamps() { thread_local auto schema = [] { auto id = generate_legacy_id(system_distributed_keyspace::NAME, system_distributed_keyspace::CDC_TIMESTAMPS); - return schema_builder(system_distributed_keyspace::NAME, system_distributed_keyspace::CDC_TIMESTAMPS, {id}) + return schema_builder(this_smp_shard_count(), system_distributed_keyspace::NAME, system_distributed_keyspace::CDC_TIMESTAMPS, {id}) /* This is a single-partition table. The partition key is always "timestamps". */ .with_column("key", utf8_type, column_kind::partition_key) /* The timestamp of this CDC generation. */ @@ -99,7 +99,7 @@ static const sstring CDC_TIMESTAMPS_KEY = "timestamps"; schema_ptr snapshot_sstables() { static thread_local auto schema = [] { auto id = generate_legacy_id(system_distributed_keyspace::NAME, system_distributed_keyspace::SNAPSHOT_SSTABLES); - return schema_builder(system_distributed_keyspace::NAME, system_distributed_keyspace::SNAPSHOT_SSTABLES, std::make_optional(id)) + return schema_builder(this_smp_shard_count(), system_distributed_keyspace::NAME, system_distributed_keyspace::SNAPSHOT_SSTABLES, std::make_optional(id)) // Name of the snapshot .with_column("snapshot_name", utf8_type, column_kind::partition_key) // Keyspace where the snapshot was taken diff --git a/db/system_keyspace.cc b/db/system_keyspace.cc index c988c13061..3394a236ad 100644 --- a/db/system_keyspace.cc +++ b/db/system_keyspace.cc @@ -154,7 +154,7 @@ api::timestamp_type system_keyspace::schema_creation_timestamp() { schema_ptr system_keyspace::hints() { static thread_local auto hints = [] { - schema_builder builder(generate_legacy_id(NAME, HINTS), NAME, HINTS, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, HINTS), NAME, HINTS, // partition key {{"target_id", uuid_type}}, // clustering key @@ -178,7 +178,7 @@ schema_ptr system_keyspace::hints() { schema_ptr system_keyspace::batchlog() { static thread_local auto batchlog = [] { - schema_builder builder(generate_legacy_id(NAME, BATCHLOG), NAME, BATCHLOG, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, BATCHLOG), NAME, BATCHLOG, // partition key {{"id", uuid_type}}, // clustering key @@ -204,7 +204,7 @@ schema_ptr system_keyspace::batchlog() { schema_ptr system_keyspace::batchlog_v2() { static thread_local auto batchlog_v2 = [] { - schema_builder builder(generate_legacy_id(NAME, BATCHLOG_V2), NAME, BATCHLOG_V2, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, BATCHLOG_V2), NAME, BATCHLOG_V2, // partition key {{"version", int32_type}, {"stage", byte_type}, {"shard", int32_type}}, // clustering key @@ -229,7 +229,7 @@ schema_ptr system_keyspace::batchlog_v2() { /*static*/ schema_ptr system_keyspace::paxos() { static thread_local auto paxos = [] { // FIXME: switch to the new schema_builder interface (with_column(...), etc) - schema_builder builder(generate_legacy_id(NAME, PAXOS), NAME, PAXOS, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, PAXOS), NAME, PAXOS, // partition key {{"row_key", bytes_type}}, // byte representation of a row key that hashes to the same token as original // clustering key @@ -264,7 +264,7 @@ thread_local data_type cdc_generation_ts_id_type = tuple_type_impl::get_instance schema_ptr system_keyspace::topology() { static thread_local auto schema = [] { auto id = generate_legacy_id(NAME, TOPOLOGY); - return schema_builder(NAME, TOPOLOGY, std::optional(id)) + return schema_builder(this_smp_shard_count(), NAME, TOPOLOGY, std::optional(id)) .with_column("key", utf8_type, column_kind::partition_key) .with_column("host_id", uuid_type, column_kind::clustering_key) .with_column("datacenter", utf8_type) @@ -311,7 +311,7 @@ schema_ptr system_keyspace::topology() { schema_ptr system_keyspace::topology_requests() { static thread_local auto schema = [] { auto id = generate_legacy_id(NAME, TOPOLOGY_REQUESTS); - return schema_builder(NAME, TOPOLOGY_REQUESTS, std::optional(id)) + return schema_builder(this_smp_shard_count(), NAME, TOPOLOGY_REQUESTS, std::optional(id)) .with_column("id", timeuuid_type, column_kind::partition_key) .with_column("initiating_host", uuid_type) .with_column("request_type", utf8_type) @@ -341,7 +341,7 @@ extern thread_local data_type cdc_streams_set_type; schema_ptr system_keyspace::cdc_generations_v3() { thread_local auto schema = [] { auto id = generate_legacy_id(NAME, CDC_GENERATIONS_V3); - return schema_builder(NAME, CDC_GENERATIONS_V3, {id}) + return schema_builder(this_smp_shard_count(), NAME, CDC_GENERATIONS_V3, {id}) /* This is a single-partition table with key 'cdc_generations'. */ .with_column("key", utf8_type, column_kind::partition_key) /* The unique identifier of this generation. */ @@ -375,7 +375,7 @@ schema_ptr system_keyspace::cdc_generations_v3() { schema_ptr system_keyspace::cdc_streams_state() { thread_local auto schema = [] { auto id = generate_legacy_id(NAME, CDC_STREAMS_STATE); - return schema_builder(NAME, CDC_STREAMS_STATE, {id}) + return schema_builder(this_smp_shard_count(), NAME, CDC_STREAMS_STATE, {id}) .with_column("table_id", uuid_type, column_kind::partition_key) .with_column("last_token", long_type, column_kind::clustering_key) .with_column("stream_id", bytes_type) @@ -390,7 +390,7 @@ schema_ptr system_keyspace::cdc_streams_state() { schema_ptr system_keyspace::cdc_streams_history() { thread_local auto schema = [] { auto id = generate_legacy_id(NAME, CDC_STREAMS_HISTORY); - return schema_builder(NAME, CDC_STREAMS_HISTORY, {id}) + return schema_builder(this_smp_shard_count(), NAME, CDC_STREAMS_HISTORY, {id}) .with_column("table_id", uuid_type, column_kind::partition_key) .with_column("timestamp", timestamp_type, column_kind::clustering_key) .with_column("stream_state", byte_type, column_kind::clustering_key) @@ -444,7 +444,7 @@ schema_ptr system_keyspace::raft_groups_snapshot_config() { schema_ptr system_keyspace::repair_history() { static thread_local auto schema = [] { auto id = generate_legacy_id(NAME, REPAIR_HISTORY); - return schema_builder(NAME, REPAIR_HISTORY, std::optional(id)) + return schema_builder(this_smp_shard_count(), NAME, REPAIR_HISTORY, std::optional(id)) .with_column("table_uuid", uuid_type, column_kind::partition_key) // The time is repair start time .with_column("repair_time", timestamp_type, column_kind::clustering_key) @@ -464,7 +464,7 @@ schema_ptr system_keyspace::repair_history() { schema_ptr system_keyspace::repair_tasks() { static thread_local auto schema = [] { auto id = generate_legacy_id(NAME, REPAIR_TASKS); - return schema_builder(NAME, REPAIR_TASKS, std::optional(id)) + return schema_builder(this_smp_shard_count(), NAME, REPAIR_TASKS, std::optional(id)) .with_column("task_uuid", uuid_type, column_kind::partition_key) .with_column("operation", utf8_type, column_kind::clustering_key) // First and last token for of the tablet @@ -481,7 +481,7 @@ schema_ptr system_keyspace::repair_tasks() { schema_ptr system_keyspace::built_indexes() { static thread_local auto built_indexes = [] { - schema_builder builder(generate_legacy_id(NAME, BUILT_INDEXES), NAME, BUILT_INDEXES, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, BUILT_INDEXES), NAME, BUILT_INDEXES, // partition key {{"table_name", utf8_type}}, // table_name here is the name of the keyspace - don't be fooled // clustering key @@ -504,7 +504,7 @@ schema_ptr system_keyspace::built_indexes() { /*static*/ schema_ptr system_keyspace::local() { static thread_local auto local = [] { - schema_builder builder(generate_legacy_id(NAME, LOCAL), NAME, LOCAL, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, LOCAL), NAME, LOCAL, // partition key {{"key", utf8_type}}, // clustering key @@ -559,7 +559,7 @@ schema_ptr system_keyspace::built_indexes() { /*static*/ schema_ptr system_keyspace::peers() { static thread_local auto peers = [] { - schema_builder builder(generate_legacy_id(NAME, PEERS), NAME, PEERS, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, PEERS), NAME, PEERS, // partition key {{"peer", inet_addr_type}}, // clustering key @@ -592,7 +592,7 @@ schema_ptr system_keyspace::built_indexes() { /*static*/ schema_ptr system_keyspace::peer_events() { static thread_local auto peer_events = [] { - schema_builder builder(generate_legacy_id(NAME, PEER_EVENTS), NAME, PEER_EVENTS, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, PEER_EVENTS), NAME, PEER_EVENTS, // partition key {{"peer", inet_addr_type}}, // clustering key @@ -617,7 +617,7 @@ schema_ptr system_keyspace::built_indexes() { /*static*/ schema_ptr system_keyspace::range_xfers() { static thread_local auto range_xfers = [] { - schema_builder builder(generate_legacy_id(NAME, RANGE_XFERS), NAME, RANGE_XFERS, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, RANGE_XFERS), NAME, RANGE_XFERS, // partition key {{"token_bytes", bytes_type}}, // clustering key @@ -640,7 +640,7 @@ schema_ptr system_keyspace::built_indexes() { /*static*/ schema_ptr system_keyspace::compactions_in_progress() { static thread_local auto compactions_in_progress = [] { - schema_builder builder(generate_legacy_id(NAME, COMPACTIONS_IN_PROGRESS), NAME, COMPACTIONS_IN_PROGRESS, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, COMPACTIONS_IN_PROGRESS), NAME, COMPACTIONS_IN_PROGRESS, // partition key {{"id", uuid_type}}, // clustering key @@ -666,7 +666,7 @@ schema_ptr system_keyspace::built_indexes() { /*static*/ schema_ptr system_keyspace::compaction_history() { static thread_local auto compaction_history = [] { - schema_builder builder(generate_legacy_id(NAME, COMPACTION_HISTORY), NAME, COMPACTION_HISTORY, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, COMPACTION_HISTORY), NAME, COMPACTION_HISTORY, // partition key {{"id", uuid_type}}, // clustering key @@ -704,7 +704,7 @@ schema_ptr system_keyspace::built_indexes() { /*static*/ schema_ptr system_keyspace::sstable_activity() { static thread_local auto sstable_activity = [] { - schema_builder builder(generate_legacy_id(NAME, SSTABLE_ACTIVITY), NAME, SSTABLE_ACTIVITY, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, SSTABLE_ACTIVITY), NAME, SSTABLE_ACTIVITY, // partition key { {"keyspace_name", utf8_type}, @@ -733,7 +733,7 @@ schema_ptr system_keyspace::built_indexes() { schema_ptr system_keyspace::size_estimates() { static thread_local auto size_estimates = [] { - schema_builder builder(generate_legacy_id(NAME, SIZE_ESTIMATES), NAME, SIZE_ESTIMATES, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, SIZE_ESTIMATES), NAME, SIZE_ESTIMATES, // partition key {{"keyspace_name", utf8_type}}, // clustering key @@ -759,7 +759,7 @@ schema_ptr system_keyspace::size_estimates() { /*static*/ schema_ptr system_keyspace::large_partitions() { static thread_local auto large_partitions = [] { - schema_builder builder(generate_legacy_id(NAME, LARGE_PARTITIONS), NAME, LARGE_PARTITIONS, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, LARGE_PARTITIONS), NAME, LARGE_PARTITIONS, // partition key {{"keyspace_name", utf8_type}, {"table_name", utf8_type}}, // clustering key @@ -793,7 +793,7 @@ schema_ptr system_keyspace::size_estimates() { schema_ptr system_keyspace::large_rows() { static thread_local auto large_rows = [] { auto id = generate_legacy_id(NAME, LARGE_ROWS); - return schema_builder(NAME, LARGE_ROWS, std::optional(id)) + return schema_builder(this_smp_shard_count(), NAME, LARGE_ROWS, std::optional(id)) .with_column("keyspace_name", utf8_type, column_kind::partition_key) .with_column("table_name", utf8_type, column_kind::partition_key) .with_column("sstable_name", utf8_type, column_kind::clustering_key) @@ -814,7 +814,7 @@ schema_ptr system_keyspace::large_rows() { schema_ptr system_keyspace::large_cells() { static thread_local auto large_cells = [] { auto id = generate_legacy_id(NAME, LARGE_CELLS); - return schema_builder(NAME, LARGE_CELLS, id) + return schema_builder(this_smp_shard_count(), NAME, LARGE_CELLS, id) .with_column("keyspace_name", utf8_type, column_kind::partition_key) .with_column("table_name", utf8_type, column_kind::partition_key) .with_column("sstable_name", utf8_type, column_kind::clustering_key) @@ -838,7 +838,7 @@ schema_ptr system_keyspace::large_cells() { schema_ptr system_keyspace::corrupt_data() { static thread_local auto corrupt_data = [] { auto id = generate_legacy_id(NAME, CORRUPT_DATA); - return schema_builder(NAME, CORRUPT_DATA, id) + return schema_builder(this_smp_shard_count(), NAME, CORRUPT_DATA, id) // partition key .with_column("keyspace_name", utf8_type, column_kind::partition_key) .with_column("table_name", utf8_type, column_kind::partition_key) @@ -866,7 +866,7 @@ schema_ptr system_keyspace::corrupt_data() { /*static*/ schema_ptr system_keyspace::scylla_local() { static thread_local auto scylla_local = [] { - schema_builder builder(generate_legacy_id(NAME, SCYLLA_LOCAL), NAME, SCYLLA_LOCAL, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, SCYLLA_LOCAL), NAME, SCYLLA_LOCAL, // partition key {{"key", utf8_type}}, // clustering key @@ -890,7 +890,7 @@ schema_ptr system_keyspace::corrupt_data() { schema_ptr system_keyspace::batches() { static thread_local auto schema = [] { - schema_builder builder(generate_legacy_id(NAME, BATCHES), NAME, BATCHES, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, BATCHES), NAME, BATCHES, // partition key {{"id", timeuuid_type}}, // clustering key @@ -918,7 +918,7 @@ schema_ptr system_keyspace::batches() { schema_ptr system_keyspace::truncated() { static thread_local auto local = [] { - schema_builder builder(generate_legacy_id(NAME, TRUNCATED), NAME, TRUNCATED, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, TRUNCATED), NAME, TRUNCATED, // partition key {{"table_uuid", uuid_type}}, // clustering key @@ -948,7 +948,7 @@ thread_local data_type replay_position_type = tuple_type_impl::get_instance({lon schema_ptr system_keyspace::commitlog_cleanups() { static thread_local auto local = [] { - schema_builder builder(generate_legacy_id(NAME, COMMITLOG_CLEANUPS), NAME, COMMITLOG_CLEANUPS, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, COMMITLOG_CLEANUPS), NAME, COMMITLOG_CLEANUPS, // partition key {{"shard", int32_type}}, // clustering key @@ -975,7 +975,7 @@ schema_ptr system_keyspace::commitlog_cleanups() { schema_ptr system_keyspace::available_ranges() { static thread_local auto schema = [] { - schema_builder builder(generate_legacy_id(NAME, AVAILABLE_RANGES), NAME, AVAILABLE_RANGES, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, AVAILABLE_RANGES), NAME, AVAILABLE_RANGES, // partition key {{"keyspace_name", utf8_type}}, // clustering key @@ -998,7 +998,7 @@ schema_ptr system_keyspace::available_ranges() { schema_ptr system_keyspace::views_builds_in_progress() { static thread_local auto schema = [] { - schema_builder builder(generate_legacy_id(NAME, VIEWS_BUILDS_IN_PROGRESS), NAME, VIEWS_BUILDS_IN_PROGRESS, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, VIEWS_BUILDS_IN_PROGRESS), NAME, VIEWS_BUILDS_IN_PROGRESS, // partition key {{"keyspace_name", utf8_type}}, // clustering key @@ -1021,7 +1021,7 @@ schema_ptr system_keyspace::views_builds_in_progress() { schema_ptr system_keyspace::built_views() { static thread_local auto schema = [] { - schema_builder builder(generate_legacy_id(NAME, BUILT_VIEWS), NAME, BUILT_VIEWS, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, BUILT_VIEWS), NAME, BUILT_VIEWS, // partition key {{"keyspace_name", utf8_type}}, // clustering key @@ -1045,7 +1045,7 @@ schema_ptr system_keyspace::built_views() { schema_ptr system_keyspace::scylla_views_builds_in_progress() { static thread_local auto schema = [] { auto id = generate_legacy_id(NAME, SCYLLA_VIEWS_BUILDS_IN_PROGRESS); - return schema_builder(NAME, SCYLLA_VIEWS_BUILDS_IN_PROGRESS, std::make_optional(id)) + return schema_builder(this_smp_shard_count(), NAME, SCYLLA_VIEWS_BUILDS_IN_PROGRESS, std::make_optional(id)) .with_column("keyspace_name", utf8_type, column_kind::partition_key) .with_column("view_name", utf8_type, column_kind::clustering_key) .with_column("cpu_id", int32_type, column_kind::clustering_key) @@ -1060,7 +1060,7 @@ schema_ptr system_keyspace::scylla_views_builds_in_progress() { /*static*/ schema_ptr system_keyspace::cdc_local() { static thread_local auto cdc_local = [] { - schema_builder builder(generate_legacy_id(NAME, CDC_LOCAL), NAME, CDC_LOCAL, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, CDC_LOCAL), NAME, CDC_LOCAL, // partition key {{"key", utf8_type}}, // clustering key @@ -1097,7 +1097,7 @@ schema_ptr system_keyspace::scylla_views_builds_in_progress() { schema_ptr system_keyspace::group0_history() { static thread_local auto schema = [] { auto id = generate_legacy_id(NAME, GROUP0_HISTORY); - return schema_builder(NAME, GROUP0_HISTORY, id) + return schema_builder(this_smp_shard_count(), NAME, GROUP0_HISTORY, id) // this is a single-partition table with key 'history' .with_column("key", utf8_type, column_kind::partition_key) // group0 state timeuuid, descending order @@ -1115,7 +1115,7 @@ schema_ptr system_keyspace::group0_history() { schema_ptr system_keyspace::discovery() { static thread_local auto schema = [] { auto id = generate_legacy_id(NAME, DISCOVERY); - return schema_builder(NAME, DISCOVERY, id) + return schema_builder(this_smp_shard_count(), NAME, DISCOVERY, id) // This is a single-partition table with key 'peers' .with_column("key", utf8_type, column_kind::partition_key) // Peer ip address @@ -1133,7 +1133,7 @@ schema_ptr system_keyspace::discovery() { schema_ptr system_keyspace::broadcast_kv_store() { static thread_local auto schema = [] { auto id = generate_legacy_id(NAME, BROADCAST_KV_STORE); - return schema_builder(NAME, BROADCAST_KV_STORE, id) + return schema_builder(this_smp_shard_count(), NAME, BROADCAST_KV_STORE, id) .with_column("key", utf8_type, column_kind::partition_key) .with_column("value", utf8_type) .with_hash_version() @@ -1145,7 +1145,7 @@ schema_ptr system_keyspace::broadcast_kv_store() { schema_ptr system_keyspace::sstables_registry() { static thread_local auto schema = [] { auto id = generate_legacy_id(NAME, SSTABLES_REGISTRY); - return schema_builder(NAME, SSTABLES_REGISTRY, id) + return schema_builder(this_smp_shard_count(), NAME, SSTABLES_REGISTRY, id) .with_column("table_id", uuid_type, column_kind::partition_key) .with_column("node_owner", uuid_type, column_kind::partition_key) .with_column("generation", timeuuid_type, column_kind::clustering_key) @@ -1168,7 +1168,7 @@ schema_ptr system_keyspace::tablets() { schema_ptr system_keyspace::service_levels_v2() { static thread_local auto schema = [] { auto id = generate_legacy_id(NAME, SERVICE_LEVELS_V2); - return schema_builder(NAME, SERVICE_LEVELS_V2, id) + return schema_builder(this_smp_shard_count(), NAME, SERVICE_LEVELS_V2, id) .with_column("service_level", utf8_type, column_kind::partition_key) .with_column("timeout", duration_type) .with_column("workload_type", utf8_type) @@ -1182,7 +1182,7 @@ schema_ptr system_keyspace::service_levels_v2() { schema_ptr system_keyspace::view_build_status_v2() { static thread_local auto schema = [] { auto id = generate_legacy_id(NAME, VIEW_BUILD_STATUS_V2); - return schema_builder(NAME, VIEW_BUILD_STATUS_V2, id) + return schema_builder(this_smp_shard_count(), NAME, VIEW_BUILD_STATUS_V2, id) .with_column("keyspace_name", utf8_type, column_kind::partition_key) .with_column("view_name", utf8_type, column_kind::partition_key) .with_column("host_id", uuid_type, column_kind::clustering_key) @@ -1195,7 +1195,7 @@ schema_ptr system_keyspace::view_build_status_v2() { schema_ptr system_keyspace::roles() { static thread_local auto schema = [] { - schema_builder builder(generate_legacy_id(NAME, ROLES), NAME, ROLES, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, ROLES), NAME, ROLES, // partition key {{"role", utf8_type}}, // clustering key @@ -1222,7 +1222,7 @@ schema_ptr system_keyspace::roles() { schema_ptr system_keyspace::role_members() { static thread_local auto schema = [] { - schema_builder builder(generate_legacy_id(NAME, ROLE_MEMBERS), NAME, ROLE_MEMBERS, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, ROLE_MEMBERS), NAME, ROLE_MEMBERS, // partition key {{"role", utf8_type}}, // clustering key @@ -1244,7 +1244,7 @@ schema_ptr system_keyspace::role_members() { schema_ptr system_keyspace::role_attributes() { static thread_local auto schema = [] { - schema_builder builder(generate_legacy_id(NAME, ROLE_ATTRIBUTES), NAME, ROLE_ATTRIBUTES, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, ROLE_ATTRIBUTES), NAME, ROLE_ATTRIBUTES, // partition key {{"role", utf8_type}}, // clustering key @@ -1268,7 +1268,7 @@ schema_ptr system_keyspace::role_attributes() { schema_ptr system_keyspace::role_permissions() { static thread_local auto schema = [] { - schema_builder builder(generate_legacy_id(NAME, ROLE_PERMISSIONS), NAME, ROLE_PERMISSIONS, + schema_builder builder(this_smp_shard_count(), generate_legacy_id(NAME, ROLE_PERMISSIONS), NAME, ROLE_PERMISSIONS, // partition key {{"role", utf8_type}}, // clustering key @@ -1293,7 +1293,7 @@ schema_ptr system_keyspace::role_permissions() { schema_ptr system_keyspace::dicts() { static thread_local auto schema = [] { auto id = generate_legacy_id(NAME, DICTS); - return schema_builder(NAME, DICTS, std::make_optional(id)) + return schema_builder(this_smp_shard_count(), NAME, DICTS, std::make_optional(id)) .with_column("name", utf8_type, column_kind::partition_key) .with_column("timestamp", timestamp_type) .with_column("origin", uuid_type) @@ -1307,7 +1307,7 @@ schema_ptr system_keyspace::dicts() { schema_ptr system_keyspace::view_building_tasks() { static thread_local auto schema = [] { auto id = generate_legacy_id(NAME, VIEW_BUILDING_TASKS); - return schema_builder(NAME, VIEW_BUILDING_TASKS, std::make_optional(id)) + return schema_builder(this_smp_shard_count(), NAME, VIEW_BUILDING_TASKS, std::make_optional(id)) .with_column("key", utf8_type, column_kind::partition_key) .with_column("id", timeuuid_type, column_kind::clustering_key) .with_column("min_task_id", timeuuid_type, column_kind::static_column) @@ -1327,7 +1327,7 @@ schema_ptr system_keyspace::view_building_tasks() { schema_ptr system_keyspace::client_routes() { static thread_local auto schema = [] { auto id = generate_legacy_id(NAME, CLIENT_ROUTES); - return schema_builder(NAME, CLIENT_ROUTES, std::make_optional(id)) + return schema_builder(this_smp_shard_count(), NAME, CLIENT_ROUTES, std::make_optional(id)) .with_column("connection_id", utf8_type, column_kind::partition_key) .with_column("host_id", uuid_type, column_kind::clustering_key) .with_column("address", utf8_type) diff --git a/db/virtual_tables.cc b/db/virtual_tables.cc index 076aad9a6e..6bec1d6e8a 100644 --- a/db/virtual_tables.cc +++ b/db/virtual_tables.cc @@ -67,7 +67,7 @@ public: static schema_ptr build_schema() { auto id = generate_legacy_id(system_keyspace::NAME, "cluster_status"); - return schema_builder(system_keyspace::NAME, "cluster_status", std::make_optional(id)) + return schema_builder(this_smp_shard_count(), system_keyspace::NAME, "cluster_status", std::make_optional(id)) .with_column("peer", inet_addr_type, column_kind::partition_key) .with_column("dc", utf8_type) .with_column("rack", utf8_type) @@ -154,7 +154,7 @@ public: static schema_ptr build_schema() { auto id = generate_legacy_id(system_keyspace::NAME, "token_ring"); - return schema_builder(system_keyspace::NAME, "token_ring", std::make_optional(id)) + return schema_builder(this_smp_shard_count(), system_keyspace::NAME, "token_ring", std::make_optional(id)) .with_column("keyspace_name", utf8_type, column_kind::partition_key) .with_column("table_name", utf8_type, column_kind::clustering_key) .with_column("start_token", utf8_type, column_kind::clustering_key) @@ -255,7 +255,7 @@ public: static schema_ptr build_schema() { auto id = generate_legacy_id(system_keyspace::NAME, "snapshots"); - return schema_builder(system_keyspace::NAME, "snapshots", std::make_optional(id)) + return schema_builder(this_smp_shard_count(), system_keyspace::NAME, "snapshots", std::make_optional(id)) .with_column("keyspace_name", utf8_type, column_kind::partition_key) .with_column("table_name", utf8_type, column_kind::clustering_key) .with_column("snapshot_name", utf8_type, column_kind::clustering_key) @@ -348,7 +348,7 @@ public: static schema_ptr build_schema() { auto id = generate_legacy_id(system_keyspace::NAME, "protocol_servers"); - return schema_builder(system_keyspace::NAME, "protocol_servers", std::make_optional(id)) + return schema_builder(this_smp_shard_count(), system_keyspace::NAME, "protocol_servers", std::make_optional(id)) .with_column("name", utf8_type, column_kind::partition_key) .with_column("protocol", utf8_type) .with_column("protocol_version", utf8_type) @@ -476,7 +476,7 @@ public: static schema_ptr build_schema() { auto id = generate_legacy_id(system_keyspace::NAME, "runtime_info"); - return schema_builder(system_keyspace::NAME, "runtime_info", std::make_optional(id)) + return schema_builder(this_smp_shard_count(), system_keyspace::NAME, "runtime_info", std::make_optional(id)) .with_column("group", utf8_type, column_kind::partition_key) .with_column("item", utf8_type, column_kind::clustering_key) .with_column("value", utf8_type) @@ -616,7 +616,7 @@ public: static schema_ptr build_schema() { auto id = generate_legacy_id(system_keyspace::NAME, system_keyspace::VERSIONS); - return schema_builder(system_keyspace::NAME, system_keyspace::VERSIONS, std::make_optional(id)) + return schema_builder(this_smp_shard_count(), system_keyspace::NAME, system_keyspace::VERSIONS, std::make_optional(id)) .with_column("key", utf8_type, column_kind::partition_key) .with_column("version", utf8_type) .with_column("build_mode", utf8_type) @@ -642,7 +642,7 @@ class db_config_table final : public streaming_virtual_table { static schema_ptr build_schema() { auto id = generate_legacy_id(system_keyspace::NAME, "config"); - return schema_builder(system_keyspace::NAME, "config", std::make_optional(id)) + return schema_builder(this_smp_shard_count(), system_keyspace::NAME, "config", std::make_optional(id)) .with_column("name", utf8_type, column_kind::partition_key) .with_column("type", utf8_type) .with_column("source", utf8_type) @@ -744,7 +744,7 @@ class clients_table : public streaming_virtual_table { static schema_ptr build_schema() { auto id = generate_legacy_id(system_keyspace::NAME, "clients"); - return schema_builder(system_keyspace::NAME, "clients", std::make_optional(id)) + return schema_builder(this_smp_shard_count(), system_keyspace::NAME, "clients", std::make_optional(id)) .with_column("address", inet_addr_type, column_kind::partition_key) .with_column("port", int32_type, column_kind::clustering_key) .with_column("client_type", utf8_type, column_kind::clustering_key) @@ -981,7 +981,7 @@ public: private: static schema_ptr build_schema() { auto id = generate_legacy_id(system_keyspace::NAME, "raft_state"); - return schema_builder(system_keyspace::NAME, "raft_state", std::make_optional(id)) + return schema_builder(this_smp_shard_count(), system_keyspace::NAME, "raft_state", std::make_optional(id)) .with_column("group_id", timeuuid_type, column_kind::partition_key) .with_column("disposition", ascii_type, column_kind::clustering_key) // can be 'CURRENT` or `PREVIOUS' .with_column("server_id", uuid_type, column_kind::clustering_key) @@ -1180,7 +1180,7 @@ public: private: static schema_ptr build_schema() { auto id = generate_legacy_id(system_keyspace::NAME, "load_per_node"); - return schema_builder(system_keyspace::NAME, "load_per_node", std::make_optional(id)) + return schema_builder(this_smp_shard_count(), system_keyspace::NAME, "load_per_node", std::make_optional(id)) .with_column("node", uuid_type, column_kind::partition_key) .with_column("dc", utf8_type) .with_column("rack", utf8_type) @@ -1289,7 +1289,7 @@ public: private: static schema_ptr build_schema() { auto id = generate_legacy_id(system_keyspace::NAME, "tablet_sizes"); - return schema_builder(system_keyspace::NAME, "tablet_sizes", std::make_optional(id)) + return schema_builder(this_smp_shard_count(), system_keyspace::NAME, "tablet_sizes", std::make_optional(id)) .with_column("table_id", uuid_type, column_kind::partition_key) .with_column("last_token", long_type, column_kind::clustering_key) .with_column("replicas", map_type_impl::get_instance(uuid_type, long_type, false)) @@ -1354,7 +1354,7 @@ public: private: static schema_ptr build_schema() { auto id = generate_legacy_id(system_keyspace::NAME, system_keyspace::CDC_TIMESTAMPS); - return schema_builder(system_keyspace::NAME, system_keyspace::CDC_TIMESTAMPS, std::make_optional(id)) + return schema_builder(this_smp_shard_count(), system_keyspace::NAME, system_keyspace::CDC_TIMESTAMPS, std::make_optional(id)) .with_column("keyspace_name", utf8_type, column_kind::partition_key) .with_column("table_name", utf8_type, column_kind::partition_key) .with_column("timestamp", reversed_type_impl::get_instance(timestamp_type), column_kind::clustering_key) @@ -1437,7 +1437,7 @@ public: private: static schema_ptr build_schema() { auto id = generate_legacy_id(system_keyspace::NAME, system_keyspace::CDC_STREAMS); - return schema_builder(system_keyspace::NAME, system_keyspace::CDC_STREAMS, std::make_optional(id)) + return schema_builder(this_smp_shard_count(), system_keyspace::NAME, system_keyspace::CDC_STREAMS, std::make_optional(id)) .with_column("keyspace_name", utf8_type, column_kind::partition_key) .with_column("table_name", utf8_type, column_kind::partition_key) .with_column("timestamp", timestamp_type, column_kind::clustering_key) @@ -1559,7 +1559,7 @@ public: static schema_ptr build_schema() { auto id = generate_legacy_id(system_keyspace::NAME, system_keyspace::LARGE_PARTITIONS, 1); - schema_builder builder(system_keyspace::NAME, system_keyspace::LARGE_PARTITIONS, std::make_optional(id)); + schema_builder builder(this_smp_shard_count(), system_keyspace::NAME, system_keyspace::LARGE_PARTITIONS, std::make_optional(id)); builder.with_column("keyspace_name", utf8_type, column_kind::partition_key); builder.with_column("table_name", utf8_type, column_kind::partition_key); builder.with_column("sstable_name", utf8_type, column_kind::clustering_key); @@ -1746,7 +1746,7 @@ public: static schema_ptr build_schema() { auto id = generate_legacy_id(system_keyspace::NAME, system_keyspace::LARGE_ROWS, 1); - return schema_builder(system_keyspace::NAME, system_keyspace::LARGE_ROWS, std::make_optional(id)) + return schema_builder(this_smp_shard_count(), system_keyspace::NAME, system_keyspace::LARGE_ROWS, std::make_optional(id)) .with_column("keyspace_name", utf8_type, column_kind::partition_key) .with_column("table_name", utf8_type, column_kind::partition_key) .with_column("sstable_name", utf8_type, column_kind::clustering_key) @@ -1917,7 +1917,7 @@ public: static schema_ptr build_schema() { auto id = generate_legacy_id(system_keyspace::NAME, system_keyspace::LARGE_CELLS, 1); - return schema_builder(system_keyspace::NAME, system_keyspace::LARGE_CELLS, std::make_optional(id)) + return schema_builder(this_smp_shard_count(), system_keyspace::NAME, system_keyspace::LARGE_CELLS, std::make_optional(id)) .with_column("keyspace_name", utf8_type, column_kind::partition_key) .with_column("table_name", utf8_type, column_kind::partition_key) .with_column("sstable_name", utf8_type, column_kind::clustering_key) diff --git a/ent/encryption/replicated_key_provider.cc b/ent/encryption/replicated_key_provider.cc index 797c59ed57..abb692e470 100644 --- a/ent/encryption/replicated_key_provider.cc +++ b/ent/encryption/replicated_key_provider.cc @@ -366,7 +366,7 @@ future<> replicated_key_provider::validate() const { schema_ptr encrypted_keys_table() { static thread_local auto schema = [] { auto id = generate_legacy_id(replicated_key_provider_factory::KSNAME, TABLENAME); - return schema_builder(replicated_key_provider_factory::KSNAME, TABLENAME, std::make_optional(id)) + return schema_builder(this_smp_shard_count(), replicated_key_provider_factory::KSNAME, TABLENAME, std::make_optional(id)) .with_column("key_file", utf8_type, column_kind::partition_key) .with_column("cipher", utf8_type, column_kind::partition_key) .with_column("strength", int32_type, column_kind::clustering_key) diff --git a/replica/mutation_dump.cc b/replica/mutation_dump.cc index 58328407bf..809be61b34 100644 --- a/replica/mutation_dump.cc +++ b/replica/mutation_dump.cc @@ -554,7 +554,7 @@ make_partition_key_generator(sharded& db, schema_ptr schema, schema_ptr generate_output_schema_from_underlying_schema(schema_ptr underlying_schema) { const auto& ks = underlying_schema->ks_name(); const auto tbl = format("{}_$mutation_fragments", underlying_schema->cf_name()); - auto sb = schema_builder(ks, tbl, generate_legacy_id(ks, tbl)); + auto sb = schema_builder(this_smp_shard_count(), ks, tbl, generate_legacy_id(ks, tbl)); // partition key for (const auto& pk_col : underlying_schema->partition_key_columns()) { sb.with_column(pk_col.name(), pk_col.type, column_kind::partition_key); diff --git a/replica/tablets.cc b/replica/tablets.cc index aa7f1ddb14..1059b25590 100644 --- a/replica/tablets.cc +++ b/replica/tablets.cc @@ -69,7 +69,7 @@ schema_ptr make_tablets_schema() { // replica_set_type = frozen> auto id = generate_legacy_id(db::system_keyspace::NAME, db::system_keyspace::TABLETS); // Bump the schema version offset for tablet repair scheduler columns - auto builder = schema_builder(db::system_keyspace::NAME, db::system_keyspace::TABLETS, id); + auto builder = schema_builder(this_smp_shard_count(), db::system_keyspace::NAME, db::system_keyspace::TABLETS, id); builder .with_column("table_id", uuid_type, column_kind::partition_key) .with_column("tablet_count", int32_type, column_kind::static_column) @@ -106,7 +106,7 @@ schema_ptr make_tablets_schema() { schema_ptr make_raft_schema(sstring name, bool is_group0) { auto id = generate_legacy_id(db::system_keyspace::NAME, name); - auto builder = schema_builder(db::system_keyspace::NAME, name, std::optional(id)); + auto builder = schema_builder(this_smp_shard_count(), db::system_keyspace::NAME, name, std::optional(id)); if (!is_group0) { if (!strongly_consistent_tables_enabled) { on_internal_error(tablet_logger, "Can't create raft table for strongly consistent tablets when the feature is disabled"); @@ -144,7 +144,7 @@ schema_ptr make_raft_schema(sstring name, bool is_group0) { schema_ptr make_raft_snapshots_schema(sstring name, bool is_group0) { auto id = generate_legacy_id(db::system_keyspace::NAME, name); - auto builder = schema_builder(db::system_keyspace::NAME, name, std::optional(id)); + auto builder = schema_builder(this_smp_shard_count(), db::system_keyspace::NAME, name, std::optional(id)); if (!is_group0) { if (!strongly_consistent_tables_enabled) { on_internal_error(tablet_logger, "Can't create raft snapshots table for strongly consistent tablets when the feature is disabled"); @@ -174,7 +174,7 @@ schema_ptr make_raft_snapshots_schema(sstring name, bool is_group0) { schema_ptr make_raft_snapshot_config_schema(sstring name, bool is_group0) { auto id = generate_legacy_id(db::system_keyspace::NAME, name); - auto builder = schema_builder(db::system_keyspace::NAME, name, std::optional(id)); + auto builder = schema_builder(this_smp_shard_count(), db::system_keyspace::NAME, name, std::optional(id)); if (!is_group0) { if (!strongly_consistent_tables_enabled) { on_internal_error(tablet_logger, "Can't create raft snapshot config table for strongly consistent tablets when the feature is disabled"); diff --git a/schema/schema.cc b/schema/schema.cc index 9b77c7131e..54aa87673e 100644 --- a/schema/schema.cc +++ b/schema/schema.cc @@ -413,10 +413,10 @@ const column_mapping& schema::get_column_mapping() const { return _column_mapping; } -schema::raw_schema::raw_schema(table_id id) +schema::raw_schema::raw_schema(table_id id, unsigned shard_count) : _id(id) , _partitioner(::get_partitioner(default_partitioner_name)) - , _sharder(::get_sharder(smp::count, default_partitioner_ignore_msb)) + , _sharder(::get_sharder(shard_count, default_partitioner_ignore_msb)) { } schema::schema(private_tag, const raw_schema& raw, const schema_static_props& props, schema_ptr cdc_schema, std::optional> base) @@ -1348,9 +1348,9 @@ schema_builder& schema_builder::with_sharder(const dht::static_sharder& sharder) } -schema_builder::schema_builder(std::string_view ks_name, std::string_view cf_name, +schema_builder::schema_builder(unsigned shard_count, std::string_view ks_name, std::string_view cf_name, std::optional id, data_type rct) - : _raw(id ? *id : table_id(utils::UUID_gen::get_time_UUID())) + : _raw(id ? *id : table_id(utils::UUID_gen::get_time_UUID()), shard_count) { // Various schema-creation commands (creating tables, indexes, etc.) // usually place limits on which characters are allowed in keyspace or @@ -1404,6 +1404,7 @@ schema_builder::schema_builder(const schema::raw_schema& raw) } schema_builder::schema_builder( + unsigned shard_count, std::optional id, std::string_view ks_name, std::string_view cf_name, @@ -1413,7 +1414,7 @@ schema_builder::schema_builder( std::vector static_columns, data_type regular_column_name_type, sstring comment) - : schema_builder(ks_name, cf_name, std::move(id), std::move(regular_column_name_type)) { + : schema_builder(shard_count, ks_name, cf_name, std::move(id), std::move(regular_column_name_type)) { for (auto&& column : partition_key) { with_column(std::move(column.name), std::move(column.type), column_kind::partition_key); } diff --git a/schema/schema.hh b/schema/schema.hh index 1f127ba681..45bb2525cc 100644 --- a/schema/schema.hh +++ b/schema/schema.hh @@ -589,7 +589,7 @@ private: // More complex fields are derived from these inside rebuild(). // Contains only fields which can be safely default-copied. struct raw_schema { - raw_schema(table_id id); + raw_schema(table_id id, unsigned shard_count); table_id _id; sstring _ks_name; sstring _cf_name; diff --git a/schema/schema_builder.hh b/schema/schema_builder.hh index 7ee1eb8c22..c4f0eafe51 100644 --- a/schema/schema_builder.hh +++ b/schema/schema_builder.hh @@ -41,10 +41,11 @@ private: schema_builder(const schema::raw_schema&); static std::vector& schema_initializers(); public: - schema_builder(std::string_view ks_name, std::string_view cf_name, + schema_builder(unsigned shard_count, std::string_view ks_name, std::string_view cf_name, std::optional = { }, data_type regular_column_name_type = utf8_type); schema_builder( + unsigned shard_count, std::optional id, std::string_view ks_name, std::string_view cf_name, diff --git a/service/paxos/paxos_state.cc b/service/paxos/paxos_state.cc index 77db6d7a17..86da441e15 100644 --- a/service/paxos/paxos_state.cc +++ b/service/paxos/paxos_state.cc @@ -326,7 +326,7 @@ future<> paxos_store::stop() { } schema_ptr paxos_store::create_paxos_state_schema(const schema& s) { - schema_builder builder(std::nullopt, s.ks_name(), paxos_state_table_name(s.cf_name()), + schema_builder builder(this_smp_shard_count(), std::nullopt, s.ks_name(), paxos_state_table_name(s.cf_name()), // partition key {{"row_key", bytes_type}}, // byte representation of a row key that hashes to the same token as original // clustering key diff --git a/test/boost/bloom_filter_test.cc b/test/boost/bloom_filter_test.cc index 73837f4556..9953d07bd3 100644 --- a/test/boost/bloom_filter_test.cc +++ b/test/boost/bloom_filter_test.cc @@ -441,7 +441,7 @@ SEASTAR_TEST_CASE(test_rebuild_from_temporary_hashes) { return test_env::do_with_async([] (test_env& env) { const float bloom_filter_fp_chance = 0.01; const float approx_expected_filter_bytes_per_element = 1.25; - auto s = schema_builder("ks", "test_rebuild_from_temporary_hashes") + auto s = schema_builder(this_smp_shard_count(), "ks", "test_rebuild_from_temporary_hashes") .with_column("pk", long_type, column_kind::partition_key) .set_bloom_filter_fp_chance(bloom_filter_fp_chance) .build(); diff --git a/test/boost/broken_sstable_test.cc b/test/boost/broken_sstable_test.cc index bb1eb45625..383890d85e 100644 --- a/test/boost/broken_sstable_test.cc +++ b/test/boost/broken_sstable_test.cc @@ -51,14 +51,14 @@ static future<> broken_sst(sstring dir, sstables::generation_type::int_t generat static future<> broken_sst(sstring dir, sstables::generation_type::int_t generation, sstring msg, std::optional sst_name = std::nullopt) { // Using an empty schema for this function, which is only about loading // a malformed component and checking that it fails. - auto s = schema_builder("ks", "cf", {}, utf8_type).build(); + auto s = schema_builder(this_smp_shard_count(), "ks", "cf", {}, utf8_type).build(); return broken_sst(dir, generation, s, msg, sst_name); } SEASTAR_TEST_CASE(test_empty_index) { return sstables::test_env::do_with_async([&] (sstables::test_env& env) { sstables::scoped_no_abort_on_malformed_sstable_error no_abort; - auto s = schema_builder("test_ks", "test_table") + auto s = schema_builder(this_smp_shard_count(), "test_ks", "test_table") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key) .with_column("val", int32_type) @@ -71,7 +71,7 @@ SEASTAR_TEST_CASE(test_empty_index) { } SEASTAR_TEST_CASE(missing_column_in_schema) { - schema_ptr s = schema_builder("test_ks", "test_table") + schema_ptr s = schema_builder(this_smp_shard_count(), "test_ks", "test_table") .with_column("key1", utf8_type, column_kind::partition_key) .with_column("key2", utf8_type, column_kind::clustering_key) .with_column("key3", utf8_type, column_kind::clustering_key) @@ -83,7 +83,7 @@ SEASTAR_TEST_CASE(missing_column_in_schema) { } SEASTAR_TEST_CASE(incompatible_serialized_type) { - schema_ptr s = schema_builder("test_ks", "test_table") + schema_ptr s = schema_builder(this_smp_shard_count(), "test_ks", "test_table") .with_column("key1", utf8_type, column_kind::partition_key) .with_column("key2", utf8_type, column_kind::clustering_key) .with_column("key3", utf8_type, column_kind::clustering_key) @@ -98,7 +98,7 @@ SEASTAR_TEST_CASE(incompatible_serialized_type) { } SEASTAR_TEST_CASE(invalid_boundary) { - schema_ptr s = schema_builder("test_ks", "test_t") + schema_ptr s = schema_builder(this_smp_shard_count(), "test_ks", "test_t") .with_column("p", int32_type, column_kind::partition_key) .with_column("a", int32_type, column_kind::clustering_key) .with_column("b", int32_type, column_kind::clustering_key) @@ -112,7 +112,7 @@ SEASTAR_TEST_CASE(invalid_boundary) { } SEASTAR_TEST_CASE(mismatched_timestamp) { - schema_ptr s = schema_builder("test_ks", "test_table") + schema_ptr s = schema_builder(this_smp_shard_count(), "test_ks", "test_table") .with_column("key1", utf8_type, column_kind::partition_key) .with_column("key2", utf8_type, column_kind::clustering_key) .with_column("key3", utf8_type, column_kind::clustering_key) @@ -127,7 +127,7 @@ SEASTAR_TEST_CASE(mismatched_timestamp) { } SEASTAR_TEST_CASE(broken_open_tombstone) { - schema_ptr s = schema_builder("test_ks", "test_table") + schema_ptr s = schema_builder(this_smp_shard_count(), "test_ks", "test_table") .with_column("key1", utf8_type, column_kind::partition_key) .with_column("key2", utf8_type, column_kind::clustering_key) .with_column("key3", utf8_type, column_kind::clustering_key) @@ -143,7 +143,7 @@ SEASTAR_TEST_CASE(broken_open_tombstone) { } SEASTAR_TEST_CASE(broken_close_tombstone) { - schema_ptr s = schema_builder("test_ks", "test_table") + schema_ptr s = schema_builder(this_smp_shard_count(), "test_ks", "test_table") .with_column("key1", utf8_type, column_kind::partition_key) .with_column("key2", utf8_type, column_kind::clustering_key) .with_column("key3", utf8_type, column_kind::clustering_key) @@ -158,7 +158,7 @@ SEASTAR_TEST_CASE(broken_close_tombstone) { SEASTAR_TEST_CASE(broken_start_composite) { schema_ptr s = - schema_builder("test_ks", "test_table") + schema_builder(this_smp_shard_count(), "test_ks", "test_table") .with_column("test_key", utf8_type, column_kind::partition_key) .with_column("test_val", utf8_type, column_kind::clustering_key) .build(schema_builder::compact_storage::no); @@ -168,7 +168,7 @@ SEASTAR_TEST_CASE(broken_start_composite) { SEASTAR_TEST_CASE(broken_end_composite) { schema_ptr s = - schema_builder("test_ks", "test_table") + schema_builder(this_smp_shard_count(), "test_ks", "test_table") .with_column("test_key", utf8_type, column_kind::partition_key) .with_column("test_val", utf8_type, column_kind::clustering_key) .build(schema_builder::compact_storage::no); @@ -178,7 +178,7 @@ SEASTAR_TEST_CASE(broken_end_composite) { SEASTAR_TEST_CASE(static_mismatch) { schema_ptr s = - schema_builder("test_foo_bar_zed_baz_ks", "test_foo_bar_zed_baz_table") + schema_builder(this_smp_shard_count(), "test_foo_bar_zed_baz_ks", "test_foo_bar_zed_baz_table") .with_column("test_foo_bar_zed_baz_key", utf8_type, column_kind::partition_key) .with_column("test_foo_bar_zed_baz_val", utf8_type, column_kind::clustering_key) .with_column("test_foo_bar_zed_baz_static", utf8_type, column_kind::regular_column) @@ -190,7 +190,7 @@ SEASTAR_TEST_CASE(static_mismatch) { SEASTAR_TEST_CASE(static_with_clustering) { schema_ptr s = - schema_builder("test_foo_bar_zed_baz_ks", "test_foo_bar_zed_baz_table") + schema_builder(this_smp_shard_count(), "test_foo_bar_zed_baz_ks", "test_foo_bar_zed_baz_table") .with_column("test_foo_bar_zed_baz_key", utf8_type, column_kind::partition_key) .with_column("test_foo_bar_zed_baz_val", utf8_type, column_kind::clustering_key) .with_column("test_foo_bar_zed_baz_static", utf8_type, column_kind::static_column) diff --git a/test/boost/bti_index_test.cc b/test/boost/bti_index_test.cc index a2113bca9a..35c91dcf51 100644 --- a/test/boost/bti_index_test.cc +++ b/test/boost/bti_index_test.cc @@ -892,7 +892,7 @@ void test_index(const index_entry_dataset& dataset, std::function generate_rpvs(const schema& strin // Performs key conversion to BTI format for various keys, // and checks that this encoding doesn't change the ordering of keys. BOOST_AUTO_TEST_CASE(test_lazy_comparable_bytes_from_ring_position_preserves_order) { - auto s = schema_builder("ks", "t") + auto s = schema_builder(1, "ks", "t") .with_column("pk1", utf8_type, column_kind::partition_key) .with_column("pk2", utf8_type, column_kind::partition_key) .build(); @@ -88,7 +88,7 @@ BOOST_AUTO_TEST_CASE(test_lazy_comparable_bytes_from_ring_position_preserves_ord // 2.5 Checks that reading `enc` again gives a result consistent with the // modification and the trim. BOOST_AUTO_TEST_CASE(test_lazy_comparable_bytes_from_ring_position_trim) { - auto s = schema_builder("ks", "t") + auto s = schema_builder(1, "ks", "t") .with_column("pk1", utf8_type, column_kind::partition_key) .with_column("pk2", utf8_type, column_kind::partition_key) .build(); @@ -168,7 +168,7 @@ static std::generator generate_pipvs(const schema& s // Performs key conversion to BTI format for various keys, // and checks that this encoding doesn't change the ordering of keys. BOOST_AUTO_TEST_CASE(test_lazy_comparable_bytes_from_clustering_position_preserves_order) { - auto s = schema_builder("ks", "t") + auto s = schema_builder(1, "ks", "t") .with_column("pk", long_type, column_kind::partition_key) .with_column("ck1", utf8_type, column_kind::clustering_key) .with_column("ck2", utf8_type, column_kind::clustering_key) @@ -193,7 +193,7 @@ BOOST_AUTO_TEST_CASE(test_lazy_comparable_bytes_from_clustering_position_preserv // Just like test_lazy_comparable_bytes_from_ring_position_trim, // but for clustering positions. BOOST_AUTO_TEST_CASE(test_lazy_comparable_bytes_from_clustering_position_trim) { - auto s = schema_builder("ks", "t") + auto s = schema_builder(1, "ks", "t") .with_column("pk", long_type, column_kind::partition_key) .with_column("ck1", utf8_type, column_kind::clustering_key) .with_column("ck2", utf8_type, column_kind::clustering_key) diff --git a/test/boost/cache_mutation_reader_test.cc b/test/boost/cache_mutation_reader_test.cc index 171d6e7c60..f9a6a3d565 100644 --- a/test/boost/cache_mutation_reader_test.cc +++ b/test/boost/cache_mutation_reader_test.cc @@ -35,7 +35,7 @@ */ static schema_ptr make_schema() { - return schema_builder("ks", "cf") + return schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key) .with_column("v", int32_type) diff --git a/test/boost/cdc_test.cc b/test/boost/cdc_test.cc index e8c175a831..4231a27cf7 100644 --- a/test/boost/cdc_test.cc +++ b/test/boost/cdc_test.cc @@ -67,7 +67,7 @@ SEASTAR_THREAD_TEST_CASE(test_find_mutation_timestamp) { cquery_nofail(e, "CREATE TABLE ks.t (pk int, ck int, vstatic int static, vint int, " "vmap map, vfmap frozen>, vut ut, vfut frozen, primary key (pk, ck))"); - auto schema = schema_builder("ks", "t") + auto schema = schema_builder(this_smp_shard_count(), "ks", "t") .with_column("pk", int32_type, column_kind::partition_key) .with_column("vstatic", int32_type, column_kind::static_column) .with_column("ck", int32_type, column_kind::clustering_key) diff --git a/test/boost/cell_locker_test.cc b/test/boost/cell_locker_test.cc index be961e0edf..c5dfe412bb 100644 --- a/test/boost/cell_locker_test.cc +++ b/test/boost/cell_locker_test.cc @@ -18,7 +18,7 @@ using namespace std::literals::chrono_literals; static schema_ptr make_schema() { - return schema_builder("ks", "cf") + return schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("ck", bytes_type, column_kind::clustering_key) .with_column("s1", bytes_type, column_kind::static_column) @@ -32,7 +32,7 @@ static schema_ptr make_schema() static schema_ptr make_alternative_schema() { - return schema_builder("ks", "cf") + return schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("ck", bytes_type, column_kind::clustering_key) .with_column("s0", bytes_type, column_kind::static_column) @@ -48,7 +48,7 @@ static schema_ptr make_alternative_schema() static schema_ptr make_schema_disjoint_with_others() { - return schema_builder("ks", "cf") + return schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("ck", bytes_type, column_kind::clustering_key) .with_column("s8", bytes_type, column_kind::static_column) diff --git a/test/boost/compaction_group_test.cc b/test/boost/compaction_group_test.cc index a6828a30d1..0a5de30a4e 100644 --- a/test/boost/compaction_group_test.cc +++ b/test/boost/compaction_group_test.cc @@ -135,7 +135,7 @@ public: SEASTAR_TEST_CASE(basic_compaction_group_splitting_test) { return test_env::do_with_async([] (test_env& env) { - auto builder = schema_builder("tests", "compaction_group_splitting") + auto builder = schema_builder(this_smp_shard_count(), "tests", "compaction_group_splitting") .with_column("id", utf8_type, column_kind::partition_key) .with_column("cl", int32_type, column_kind::clustering_key) .with_column("value", int32_type); @@ -212,7 +212,7 @@ static mutation_reader sstable_reader(shared_sstable sst, schema_ptr s, reader_p SEASTAR_TEST_CASE(compactions_dont_cross_group_boundary_test) { return test_env::do_with_async([] (test_env& env) { - auto builder = schema_builder("tests", "compactions_dont_cross_group_boundary") + auto builder = schema_builder(this_smp_shard_count(), "tests", "compactions_dont_cross_group_boundary") .with_column("id", utf8_type, column_kind::partition_key) .with_column("cl", int32_type, column_kind::clustering_key) .with_column("value", int32_type); diff --git a/test/boost/compound_test.cc b/test/boost/compound_test.cc index 639da72aef..9ecac58596 100644 --- a/test/boost/compound_test.cc +++ b/test/boost/compound_test.cc @@ -184,11 +184,11 @@ SEASTAR_THREAD_TEST_CASE(test_conversion_to_legacy_form) { } SEASTAR_THREAD_TEST_CASE(test_conversion_to_legacy_form_same_token_singular) { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("c", int32_type, column_kind::partition_key) .with_column("v", int32_type) .build(); - auto s1 = schema_builder("ks", "cf") + auto s1 = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("c", byte_type, column_kind::partition_key) .with_column("v", int32_type) .build(); @@ -205,12 +205,12 @@ SEASTAR_THREAD_TEST_CASE(test_conversion_to_legacy_form_same_token_singular) { } SEASTAR_THREAD_TEST_CASE(test_conversion_to_legacy_form_same_token_two_components) { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("c1", int32_type, column_kind::partition_key) .with_column("c2", int32_type, column_kind::partition_key) .with_column("v", int32_type) .build(); - auto s1 = schema_builder("ks", "cf") + auto s1 = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("c", byte_type, column_kind::partition_key) .with_column("v", int32_type) .build(); @@ -299,7 +299,7 @@ SEASTAR_THREAD_TEST_CASE(test_enconding_of_singular_composite) { SEASTAR_THREAD_TEST_CASE(test_enconding_of_static_composite) { using components = std::vector; - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("ck", bytes_type, column_kind::clustering_key) .with_column("v", bytes_type, column_kind::regular_column) diff --git a/test/boost/counter_test.cc b/test/boost/counter_test.cc index 59995b4f5b..b4ea2ad184 100644 --- a/test/boost/counter_test.cc +++ b/test/boost/counter_test.cc @@ -146,7 +146,7 @@ SEASTAR_TEST_CASE(test_apply) { } schema_ptr get_schema() { - return schema_builder("ks", "cf") + return schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key) .with_column("s1", counter_type, column_kind::static_column) diff --git a/test/boost/cql_functions_test.cc b/test/boost/cql_functions_test.cc index 1692bdf618..1f7cc9dcc9 100644 --- a/test/boost/cql_functions_test.cc +++ b/test/boost/cql_functions_test.cc @@ -39,7 +39,7 @@ SEASTAR_TEST_CASE(test_functions) { return do_with_cql_env([] (cql_test_env& e) { return e.create_table([](std::string_view ks_name) { // CQL: create table cf (p1 varchar primary key, u uuid, tu timeuuid); - return *schema_builder(ks_name, "cf") + return *schema_builder(this_smp_shard_count(), ks_name, "cf") .with_column("p1", utf8_type, column_kind::partition_key) .with_column("c1", int32_type, column_kind::clustering_key) .with_column("tu", timeuuid_type) @@ -146,7 +146,7 @@ public: { const auto cf_name = table_name(); _e.create_table([column_type, cf_name] (std::string_view ks_name) { - return *schema_builder(ks_name, cf_name) + return *schema_builder(this_smp_shard_count(), ks_name, cf_name) .with_column("pk", utf8_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key) .with_column("value", column_type) diff --git a/test/boost/cql_query_large_test.cc b/test/boost/cql_query_large_test.cc index 88e2fe433d..4f170c5ae9 100644 --- a/test/boost/cql_query_large_test.cc +++ b/test/boost/cql_query_large_test.cc @@ -242,7 +242,7 @@ SEASTAR_TEST_CASE(test_insert_large_collection_values) { auto list_type = list_type_impl::get_instance(utf8_type, true); e.create_table([map_type, set_type, list_type] (std::string_view ks_name) { // CQL: CREATE TABLE tbl (pk text PRIMARY KEY, m map, s set, l list); - return *schema_builder(ks_name, "tbl") + return *schema_builder(this_smp_shard_count(), ks_name, "tbl") .with_column("pk", utf8_type, column_kind::partition_key) .with_column("m", map_type) .with_column("s", set_type) diff --git a/test/boost/cql_query_test.cc b/test/boost/cql_query_test.cc index 8e73367b97..fd439b9910 100644 --- a/test/boost/cql_query_test.cc +++ b/test/boost/cql_query_test.cc @@ -643,7 +643,7 @@ SEASTAR_TEST_CASE(test_select_statement) { return do_with_cql_env([] (cql_test_env& e) { return e.create_table([](std::string_view ks_name) { // CQL: create table cf (p1 varchar, c1 int, c2 int, r1 int, PRIMARY KEY (p1, c1, c2)); - return *schema_builder(ks_name, "cf") + return *schema_builder(this_smp_shard_count(), ks_name, "cf") .with_column("p1", utf8_type, column_kind::partition_key) .with_column("c1", int32_type, column_kind::clustering_key) .with_column("c2", int32_type, column_kind::clustering_key) @@ -735,7 +735,7 @@ SEASTAR_TEST_CASE(test_cassandra_stress_like_write_and_read) { }; return e.create_table([](std::string_view ks_name) { - return *schema_builder(ks_name, "cf") + return *schema_builder(this_smp_shard_count(), ks_name, "cf") .with_column("KEY", bytes_type, column_kind::partition_key) .with_column("C0", bytes_type) .with_column("C1", bytes_type) @@ -760,7 +760,7 @@ SEASTAR_TEST_CASE(test_cassandra_stress_like_write_and_read) { SEASTAR_TEST_CASE(test_range_queries) { return do_with_cql_env([] (cql_test_env& e) { return e.create_table([](std::string_view ks_name) { - return *schema_builder(ks_name, "cf") + return *schema_builder(this_smp_shard_count(), ks_name, "cf") .with_column("k", bytes_type, column_kind::partition_key) .with_column("c0", bytes_type, column_kind::clustering_key) .with_column("c1", bytes_type, column_kind::clustering_key) @@ -857,7 +857,7 @@ SEASTAR_TEST_CASE(test_range_queries) { SEASTAR_TEST_CASE(test_ordering_of_composites_with_variable_length_components) { return do_with_cql_env([] (cql_test_env& e) { return e.create_table([](std::string_view ks) { - return *schema_builder(ks, "cf") + return *schema_builder(this_smp_shard_count(), ks, "cf") .with_column("k", bytes_type, column_kind::partition_key) // We need more than one clustering column so that the single-element tuple format optimisation doesn't kick in .with_column("c0", bytes_type, column_kind::clustering_key) @@ -1205,7 +1205,7 @@ SEASTAR_TEST_CASE(test_deletion_scenarios) { return do_with_cql_env([] (cql_test_env& e) { return e.create_table([](std::string_view ks) { // CQL: create table cf (k bytes, c bytes, v bytes, primary key (k, c)); - return *schema_builder(ks, "cf") + return *schema_builder(this_smp_shard_count(), ks, "cf") .with_column("k", bytes_type, column_kind::partition_key) .with_column("c", bytes_type, column_kind::clustering_key) .with_column("v", bytes_type) @@ -1355,7 +1355,7 @@ SEASTAR_TEST_CASE(test_map_insert_update) { auto my_map_type = make_my_map_type(); return e.create_table([make_my_map_type] (std::string_view ks_name) { // CQL: create table cf (p1 varchar primary key, map1 map); - return *schema_builder(ks_name, "cf") + return *schema_builder(this_smp_shard_count(), ks_name, "cf") .with_column("p1", utf8_type, column_kind::partition_key) .with_column("map1", make_my_map_type()) .build(); @@ -1442,7 +1442,7 @@ SEASTAR_TEST_CASE(test_set_insert_update) { auto my_set_type = make_my_set_type(); return e.create_table([make_my_set_type](std::string_view ks_name) { // CQL: create table cf (p1 varchar primary key, set1 set); - return *schema_builder(ks_name, "cf") + return *schema_builder(this_smp_shard_count(), ks_name, "cf") .with_column("p1", utf8_type, column_kind::partition_key) .with_column("set1", make_my_set_type()) .build(); @@ -1680,7 +1680,7 @@ SEASTAR_TEST_CASE(test_tuples) { // this runs on all cores, so create a local tt for each core: auto tt = make_tt(); // CQL: "create table cf (id int primary key, t tuple); - return *schema_builder(ks_name, "cf") + return *schema_builder(this_smp_shard_count(), ks_name, "cf") .with_column("id", int32_type, column_kind::partition_key) .with_column("t", tt) .build(); @@ -1714,7 +1714,7 @@ SEASTAR_TEST_CASE(test_vectors) { // this runs on all cores, so create a local vt for each core: auto vt = make_vt(); // CQL: "create table cf (id int primary key, v vector); - return *schema_builder(ks_name, "cf") + return *schema_builder(this_smp_shard_count(), ks_name, "cf") .with_column("id", int32_type, column_kind::partition_key) .with_column("v", vt) .build(); @@ -2027,7 +2027,7 @@ SEASTAR_TEST_CASE(test_ttl) { auto make_my_list_type = [] { return list_type_impl::get_instance(utf8_type, true); }; auto my_list_type = make_my_list_type(); return e.create_table([make_my_list_type] (std::string_view ks_name) { - return *schema_builder(ks_name, "cf") + return *schema_builder(this_smp_shard_count(), ks_name, "cf") .with_column("p1", utf8_type, column_kind::partition_key) .with_column("r1", utf8_type) .with_column("r2", utf8_type) @@ -4137,7 +4137,7 @@ SEASTAR_TEST_CASE(test_view_with_two_regular_base_columns_in_key) { auto schema = e.local_db().find_schema("ks", "t"); // Create a CQL-illegal view with two regular base columns in the view key - schema_builder view_builder("ks", "tv"); + schema_builder view_builder(this_smp_shard_count(), "ks", "tv"); view_builder.with_column(to_bytes("v1"), int32_type, column_kind::partition_key) .with_column(to_bytes("v2"), int32_type, column_kind::clustering_key) .with_column(to_bytes("p"), int32_type, column_kind::clustering_key) diff --git a/test/boost/database_test.cc b/test/boost/database_test.cc index 8c77d048d8..39a4b81fae 100644 --- a/test/boost/database_test.cc +++ b/test/boost/database_test.cc @@ -1744,28 +1744,28 @@ SEASTAR_TEST_CASE(test_drop_quarantined_sstables) { } SEASTAR_THREAD_TEST_CASE(test_tombstone_gc_state_snapshot) { - auto table_gc_mode_timeout = schema_builder("test", "table_gc_mode_timeout") + auto table_gc_mode_timeout = schema_builder(this_smp_shard_count(), "test", "table_gc_mode_timeout") .with_column("pk", utf8_type, column_kind::partition_key) .with_tombstone_gc_options(tombstone_gc_options({ {"mode", "timeout"} })) .set_gc_grace_seconds(10) .build(); - auto table_gc_mode_disabled = schema_builder("test", "table_gc_mode_disabled") + auto table_gc_mode_disabled = schema_builder(this_smp_shard_count(), "test", "table_gc_mode_disabled") .with_column("pk", utf8_type, column_kind::partition_key) .with_tombstone_gc_options(tombstone_gc_options({ {"mode", "disabled"} })) .build(); - auto table_gc_mode_immediate = schema_builder("test", "table_gc_mode_immediate") + auto table_gc_mode_immediate = schema_builder(this_smp_shard_count(), "test", "table_gc_mode_immediate") .with_column("pk", utf8_type, column_kind::partition_key) .with_tombstone_gc_options(tombstone_gc_options({ {"mode", "immediate"} })) .build(); - auto table_gc_mode_repair1 = schema_builder("test", "table_gc_mode_repair1") + auto table_gc_mode_repair1 = schema_builder(this_smp_shard_count(), "test", "table_gc_mode_repair1") .with_column("pk", utf8_type, column_kind::partition_key) .with_tombstone_gc_options(tombstone_gc_options({ {"mode", "repair"}, {"propagation_delay_in_seconds", "188"} })) .build(); - auto table_gc_mode_repair2 = schema_builder("test", "table_gc_mode_repair2") + auto table_gc_mode_repair2 = schema_builder(this_smp_shard_count(), "test", "table_gc_mode_repair2") .with_column("pk", utf8_type, column_kind::partition_key) .with_tombstone_gc_options(tombstone_gc_options({ {"mode", "repair"}, {"propagation_delay_in_seconds", "288"} })) .build(); - auto table_gc_mode_repair3 = schema_builder("test", "table_gc_mode_repair3") + auto table_gc_mode_repair3 = schema_builder(this_smp_shard_count(), "test", "table_gc_mode_repair3") .with_column("pk", utf8_type, column_kind::partition_key) .with_tombstone_gc_options(tombstone_gc_options({ {"mode", "repair"}, {"propagation_delay_in_seconds", "388"} })) .build(); @@ -1775,7 +1775,7 @@ SEASTAR_THREAD_TEST_CASE(test_tombstone_gc_state_snapshot) { builder.set_is_group0_table(); } }); - auto table_gc_mode_group0 = schema_builder("test", "table_gc_mode_group0") + auto table_gc_mode_group0 = schema_builder(this_smp_shard_count(), "test", "table_gc_mode_group0") .with_column("pk", utf8_type, column_kind::partition_key) .build(); @@ -1836,12 +1836,12 @@ SEASTAR_THREAD_TEST_CASE(test_tombstone_gc_state_snapshot) { } SEASTAR_THREAD_TEST_CASE(test_tombstone_gc_state_snapshot_rf_one_tables) { - auto table_gc_mode_repair1 = schema_builder("test", "table_gc_mode_repair1") + auto table_gc_mode_repair1 = schema_builder(this_smp_shard_count(), "test", "table_gc_mode_repair1") .with_column("pk", utf8_type, column_kind::partition_key) .with_tombstone_gc_options(tombstone_gc_options({ {"mode", "repair"}, {"propagation_delay_in_seconds", "188"} })) .build(); - auto table_gc_mode_repair2 = schema_builder("test", "table_gc_mode_repair2") + auto table_gc_mode_repair2 = schema_builder(this_smp_shard_count(), "test", "table_gc_mode_repair2") .with_column("pk", utf8_type, column_kind::partition_key) .with_tombstone_gc_options(tombstone_gc_options({ {"mode", "repair"}, {"propagation_delay_in_seconds", "188"} })) .build(); @@ -2052,7 +2052,7 @@ SEASTAR_TEST_CASE(test_tombstone_gc_state_gc_mode) { shared_tombstone_gc_state shared_state; for (auto gc_mode : {tombstone_gc_mode::timeout, tombstone_gc_mode::disabled, tombstone_gc_mode::immediate, tombstone_gc_mode::repair}) { - auto schema = schema_builder("ks", "tbl") + auto schema = schema_builder(this_smp_shard_count(), "ks", "tbl") .with_column("pk", int32_type, column_kind::partition_key) .with_tombstone_gc_options(tombstone_gc_options({{"mode", fmt::to_string(gc_mode)}})) .build(); diff --git a/test/boost/database_test.hh b/test/boost/database_test.hh index 76c7a1dc14..fce3bf62ad 100644 --- a/test/boost/database_test.hh +++ b/test/boost/database_test.hh @@ -31,7 +31,7 @@ future<> do_with_some_data_in_thread(std::vector cf_names, std::functio do_with_cql_env_thread([cf_names = std::move(cf_names), func = std::move(func), create_mvs, num_keys] (cql_test_env& e) { for (const auto& cf_name : cf_names) { e.create_table([&cf_name] (std::string_view ks_name) { - return *schema_builder(ks_name, cf_name) + return *schema_builder(this_smp_shard_count(), ks_name, cf_name) .with_column("p1", utf8_type, column_kind::partition_key) .with_column("c1", int32_type, column_kind::clustering_key) .with_column("c2", int32_type, column_kind::clustering_key) diff --git a/test/boost/expr_test.cc b/test/boost/expr_test.cc index d87269ee6e..f2105c1eba 100644 --- a/test/boost/expr_test.cc +++ b/test/boost/expr_test.cc @@ -429,7 +429,7 @@ BOOST_AUTO_TEST_CASE(evaluate_constant_int) { // The schema corresponds to a table created by: // CREATE TABLE test_ks.test_cf (pk int, ck int, r int, s int static, primary key (pk, ck)); static schema_ptr make_simple_test_schema() { - return schema_builder("test_ks", "test_cf") + return schema_builder(1, "test_ks", "test_cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key) .with_column("r", int32_type, column_kind::regular_column) @@ -441,7 +441,7 @@ static schema_ptr make_simple_test_schema() { // The schema corresponds to a table created by: // CREATE TABLE test_ks.test_cf (pk1 int, pk2 int, pk3 int, ck int, r int, s int static, primary key (pk, ck)); static schema_ptr make_three_pk_schema() { - return schema_builder("test_ks", "test_cf") + return schema_builder(1, "test_ks", "test_cf") .with_column("pk1", int32_type, column_kind::partition_key) .with_column("pk2", int32_type, column_kind::partition_key) .with_column("pk3", int32_type, column_kind::partition_key) @@ -505,7 +505,7 @@ BOOST_AUTO_TEST_CASE(evaluate_static_column) { BOOST_AUTO_TEST_CASE(evaluate_column_value_does_not_perfrom_validation) { schema_ptr test_schema = - schema_builder("test_ks", "test_cf").with_column("pk", int32_type, column_kind::partition_key).build(); + schema_builder(1, "test_ks", "test_cf").with_column("pk", int32_type, column_kind::partition_key).build(); raw_value invalid_int_value = make_bool_raw(true); @@ -557,7 +557,7 @@ BOOST_AUTO_TEST_CASE(evaluate_two_bind_variables) { BOOST_AUTO_TEST_CASE(evaluate_bind_variable_performs_validation) { schema_ptr test_schema = - schema_builder("test_ks", "test_cf").with_column("pk", int32_type, column_kind::partition_key).build(); + schema_builder(1, "test_ks", "test_cf").with_column("pk", int32_type, column_kind::partition_key).build(); raw_value invalid_int_value = make_bool_raw(true); @@ -803,7 +803,7 @@ BOOST_AUTO_TEST_CASE(evaluate_usertype_constructor_with_empty) { // Evaluates value[subscript_value] static raw_value evaluate_subscripted(constant value, constant subscript_value) { // For now it's only possible to subscript columns, not values, so this is tested. - schema_ptr table_schema = schema_builder("test_ks", "test_cf") + schema_ptr table_schema = schema_builder(1, "test_ks", "test_cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("v", value.type, column_kind::regular_column) .build(); @@ -969,7 +969,7 @@ enum expected_invalid_or_valid { expected_valid, expected_invalid }; // Checks that trying to evaluate a bind variable with this value succeeds or fails. // This is used to test bind variable validation. static void check_bind_variable_evaluate(constant check_value, expected_invalid_or_valid expected_validity) { - schema_ptr test_schema = schema_builder("test_ks", "test_cf") + schema_ptr test_schema = schema_builder(1, "test_ks", "test_cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("r", check_value.type, column_kind::regular_column) .build(); @@ -1284,7 +1284,7 @@ BOOST_AUTO_TEST_CASE(prepare_column_value) { BOOST_AUTO_TEST_CASE(prepare_subscript_list) { schema_ptr table_schema = - schema_builder("test_ks", "test_cf") + schema_builder(1, "test_ks", "test_cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("r", list_type_impl::get_instance(boolean_type, true), column_kind::regular_column) .build(); @@ -1305,7 +1305,7 @@ BOOST_AUTO_TEST_CASE(prepare_subscript_list) { BOOST_AUTO_TEST_CASE(prepare_subscript_map) { schema_ptr table_schema = - schema_builder("test_ks", "test_cf") + schema_builder(1, "test_ks", "test_cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("r", map_type_impl::get_instance(boolean_type, utf8_type, true), column_kind::regular_column) .build(); @@ -1325,7 +1325,7 @@ BOOST_AUTO_TEST_CASE(prepare_subscript_map) { BOOST_AUTO_TEST_CASE(prepare_subscript_set) { schema_ptr table_schema = - schema_builder("test_ks", "test_cf") + schema_builder(1, "test_ks", "test_cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("r", set_type_impl::get_instance(boolean_type, true), column_kind::regular_column) .build(); @@ -1341,7 +1341,7 @@ BOOST_AUTO_TEST_CASE(prepare_subscript_set) { BOOST_AUTO_TEST_CASE(prepare_subscript_list_checks_type) { schema_ptr table_schema = - schema_builder("test_ks", "test_cf") + schema_builder(1, "test_ks", "test_cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("r", list_type_impl::get_instance(boolean_type, true), column_kind::regular_column) .build(); @@ -1357,7 +1357,7 @@ BOOST_AUTO_TEST_CASE(prepare_subscript_list_checks_type) { BOOST_AUTO_TEST_CASE(prepare_subscript_map_checks_type) { schema_ptr table_schema = - schema_builder("test_ks", "test_cf") + schema_builder(1, "test_ks", "test_cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("r", map_type_impl::get_instance(boolean_type, utf8_type, true), column_kind::regular_column) .build(); @@ -1372,7 +1372,7 @@ BOOST_AUTO_TEST_CASE(prepare_subscript_map_checks_type) { } BOOST_AUTO_TEST_CASE(prepare_token) { - schema_ptr table_schema = schema_builder("test_ks", "test_cf") + schema_ptr table_schema = schema_builder(1, "test_ks", "test_cf") .with_column("p1", int32_type, column_kind::partition_key) .with_column("p2", int32_type, column_kind::partition_key) .with_column("p3", int32_type, column_kind::partition_key) @@ -1397,7 +1397,7 @@ BOOST_AUTO_TEST_CASE(prepare_token) { } BOOST_AUTO_TEST_CASE(prepare_token_no_args) { - schema_ptr table_schema = schema_builder("test_ks", "test_cf") + schema_ptr table_schema = schema_builder(1, "test_ks", "test_cf") .with_column("p1", int32_type, column_kind::partition_key) .with_column("p2", int32_type, column_kind::partition_key) .with_column("p3", int32_type, column_kind::partition_key) @@ -1740,7 +1740,7 @@ BOOST_AUTO_TEST_CASE(prepare_tuple_constructor) { } BOOST_AUTO_TEST_CASE(prepare_tuple_constructor_of_columns) { - schema_ptr table_schema = schema_builder("test_ks", "test_cf") + schema_ptr table_schema = schema_builder(1, "test_ks", "test_cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("c1", int32_type, column_kind::clustering_key) .with_column("c2", utf8_type, column_kind::clustering_key) @@ -2948,7 +2948,7 @@ BOOST_AUTO_TEST_CASE(evaluate_binary_operator_not_in) { // Tests ` IN (123, ?, 789)` where the bind variable has value 456 BOOST_AUTO_TEST_CASE(evaluate_binary_operator_in_list_with_bind_variable) { schema_ptr table_schema = - schema_builder("test_ks", "test_cf").with_column("pk", int32_type, column_kind::partition_key).build(); + schema_builder(1, "test_ks", "test_cf").with_column("pk", int32_type, column_kind::partition_key).build(); expression in_list = collection_constructor{ .style = collection_constructor::style_type::list_or_vector, @@ -2971,7 +2971,7 @@ BOOST_AUTO_TEST_CASE(evaluate_binary_operator_in_list_with_bind_variable) { // Tests ` IN (123, ?, 789)` where the bind variable has value 456 BOOST_AUTO_TEST_CASE(evaluate_binary_operator_not_in_list_with_bind_variable) { schema_ptr table_schema = - schema_builder("test_ks", "test_cf").with_column("pk", int32_type, column_kind::partition_key).build(); + schema_builder(1, "test_ks", "test_cf").with_column("pk", int32_type, column_kind::partition_key).build(); expression in_list = collection_constructor{ .style = collection_constructor::style_type::list_or_vector, @@ -3525,7 +3525,7 @@ BOOST_AUTO_TEST_CASE(evaluate_column_mutation_attribute) { // Build a schema with a non-frozen map column, suitable for testing WRITETIME(m[k]) and TTL(m[k]). static schema_ptr make_map_test_schema() { - return schema_builder("test_ks", "test_cf") + return schema_builder(1, "test_ks", "test_cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key) .with_column("m", map_type_impl::get_instance(int32_type, int32_type, /*is_multi_cell=*/true), column_kind::regular_column) @@ -3763,7 +3763,7 @@ BOOST_AUTO_TEST_CASE(prepare_conjunction_and_of_ints_is_invalid) { // Prepare a conjunction with many elements: // 'true AND true AND b1 AND (false AND b2)' BOOST_AUTO_TEST_CASE(prepare_conjunction_many_elements) { - schema_ptr table_schema = schema_builder("test_ks", "test_cf") + schema_ptr table_schema = schema_builder(1, "test_ks", "test_cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("b1", boolean_type, column_kind::regular_column) .with_column("b2", boolean_type, column_kind::regular_column) @@ -4020,7 +4020,7 @@ std::array get_possible_comparison_orders() { // The same goes for reversed_type. BOOST_AUTO_TEST_CASE(prepare_binary_operator_eq_neq_lt_lte_gt_gte) { schema_ptr table_schema = - schema_builder("test_ks", "test_cf") + schema_builder(1, "test_ks", "test_cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("float_col", float_type, column_kind::regular_column) .with_column("reversed_float_col", reversed_type_impl::get_instance(float_type)) @@ -4120,7 +4120,7 @@ BOOST_AUTO_TEST_CASE(prepare_binary_operator_eq_neq_lt_lte_gt_gte) { // Test operations =, !=, <, <=, >, >= with a LHS column that has reversed type. // The prepared RHS should also have inherit the reversed type. BOOST_AUTO_TEST_CASE(prepare_binary_operator_eq_neq_lt_lte_gt_gte_reversed_type) { - schema_ptr table_schema = schema_builder("test_ks", "test_cf") + schema_ptr table_schema = schema_builder(1, "test_ks", "test_cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("reversed_float_col", reversed_type_impl::get_instance(float_type), column_kind::regular_column) @@ -4152,7 +4152,7 @@ BOOST_AUTO_TEST_CASE(prepare_binary_operator_eq_neq_lt_lte_gt_gte_reversed_type) // Test operations =, !=, <, <=, >, >= with a multi-column LHS. BOOST_AUTO_TEST_CASE(prepare_binary_operator_eq_neq_lt_lte_gt_gte_multi_column) { schema_ptr table_schema = - schema_builder("test_ks", "test_cf") + schema_builder(1, "test_ks", "test_cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("c1", float_type, column_kind::clustering_key) .with_column("c2", int32_type, column_kind::clustering_key) @@ -4205,7 +4205,7 @@ BOOST_AUTO_TEST_CASE(prepare_binary_operator_eq_neq_lt_lte_gt_gte_multi_column) // `float_col IN ()` BOOST_AUTO_TEST_CASE(prepare_binary_operator_float_col_in_empty_list) { - schema_ptr table_schema = schema_builder("test_ks", "test_cf") + schema_ptr table_schema = schema_builder(1, "test_ks", "test_cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("float_col", float_type, column_kind::regular_column) .build(); @@ -4229,7 +4229,7 @@ BOOST_AUTO_TEST_CASE(prepare_binary_operator_float_col_in_empty_list) { // `float_col IN (1, 2.3)` BOOST_AUTO_TEST_CASE(prepare_binary_operator_float_col_in_1_2_dot_3) { - schema_ptr table_schema = schema_builder("test_ks", "test_cf") + schema_ptr table_schema = schema_builder(1, "test_ks", "test_cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("float_col", float_type, column_kind::regular_column) .build(); @@ -4257,7 +4257,7 @@ BOOST_AUTO_TEST_CASE(prepare_binary_operator_float_col_in_1_2_dot_3) { // `float_col IN (1, 2, 3, 4)` BOOST_AUTO_TEST_CASE(prepare_binary_operator_float_col_in_1_2_3_4) { - schema_ptr table_schema = schema_builder("test_ks", "test_cf") + schema_ptr table_schema = schema_builder(1, "test_ks", "test_cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("float_col", float_type, column_kind::regular_column) .build(); @@ -4292,7 +4292,7 @@ BOOST_AUTO_TEST_CASE(prepare_binary_operator_float_col_in_1_2_3_4) { // reverse_float_col IN () BOOST_AUTO_TEST_CASE(prepare_binary_operato_reverse_float_col_in_empty_list) { schema_ptr table_schema = - schema_builder("test_ks", "test_cf") + schema_builder(1, "test_ks", "test_cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("reverse_float_col", reversed_type_impl::get_instance(float_type), column_kind::regular_column) .build(); @@ -4318,7 +4318,7 @@ BOOST_AUTO_TEST_CASE(prepare_binary_operato_reverse_float_col_in_empty_list) { // `reverse_float_col IN (1.2, 2.3)` BOOST_AUTO_TEST_CASE(prepare_binary_operator_float_col_in_1_dot_2_2_dot_3) { schema_ptr table_schema = - schema_builder("test_ks", "test_cf") + schema_builder(1, "test_ks", "test_cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("reverse_float_col", reversed_type_impl::get_instance(float_type), column_kind::regular_column) .build(); @@ -4347,7 +4347,7 @@ BOOST_AUTO_TEST_CASE(prepare_binary_operator_float_col_in_1_dot_2_2_dot_3) { // `(float_col, int_col, text_col, reverse_double_col) IN ()` BOOST_AUTO_TEST_CASE(prepare_binary_operator_multi_col_in_empty_list) { - schema_ptr table_schema = schema_builder("test_ks", "test_cf") + schema_ptr table_schema = schema_builder(1, "test_ks", "test_cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("float_col", float_type, column_kind::clustering_key) .with_column("int_col", int32_type, column_kind::clustering_key) @@ -4398,7 +4398,7 @@ BOOST_AUTO_TEST_CASE(prepare_binary_operator_multi_col_in_empty_list) { // `(float_col, int_col, text_col, reverse_double_col) IN ((1.2, 3, 'four', 8.9), (5, 6, 'seven', 10.11))` BOOST_AUTO_TEST_CASE(prepare_binary_operator_multi_col_in_values) { - schema_ptr table_schema = schema_builder("test_ks", "test_cf") + schema_ptr table_schema = schema_builder(1, "test_ks", "test_cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("float_col", float_type, column_kind::clustering_key) .with_column("int_col", int32_type, column_kind::clustering_key) @@ -4467,7 +4467,7 @@ BOOST_AUTO_TEST_CASE(prepare_binary_operator_multi_col_in_values) { BOOST_AUTO_TEST_CASE(prepare_binary_operator_contains) { schema_ptr table_schema = - schema_builder("test_ks", "test_cf") + schema_builder(1, "test_ks", "test_cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("float_list", list_type_impl::get_instance(float_type, true), column_kind::regular_column) .with_column("frozen_float_list", list_type_impl::get_instance(float_type, false), @@ -4515,7 +4515,7 @@ BOOST_AUTO_TEST_CASE(prepare_binary_operator_contains) { BOOST_AUTO_TEST_CASE(prepare_binary_operator_contains_key) { schema_ptr table_schema = - schema_builder("test_ks", "test_cf") + schema_builder(1, "test_ks", "test_cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("double_float_map", map_type_impl::get_instance(double_type, float_type, true), column_kind::regular_column) @@ -4554,7 +4554,7 @@ BOOST_AUTO_TEST_CASE(prepare_binary_operator_contains_key) { } BOOST_AUTO_TEST_CASE(prepare_binary_operator_like) { - schema_ptr table_schema = schema_builder("test_ks", "test_cf") + schema_ptr table_schema = schema_builder(1, "test_ks", "test_cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("text_col", utf8_type, column_kind::regular_column) .with_column("ascii_col", ascii_type, column_kind::regular_column) @@ -4584,7 +4584,7 @@ BOOST_AUTO_TEST_CASE(prepare_binary_operator_like) { } BOOST_AUTO_TEST_CASE(prepare_binary_operator_is_not_null) { - schema_ptr table_schema = schema_builder("test_ks", "test_cf") + schema_ptr table_schema = schema_builder(1, "test_ks", "test_cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("float_col", float_type, column_kind::regular_column) .build(); @@ -4608,7 +4608,7 @@ BOOST_AUTO_TEST_CASE(prepare_binary_operator_is_not_null) { // `float_col = NULL`, `float_col < NULL`, ... // The RHS should be prepared as a NULL constant with float type. BOOST_AUTO_TEST_CASE(prepare_binary_operator_with_null_rhs) { - schema_ptr table_schema = schema_builder("test_ks", "test_cf") + schema_ptr table_schema = schema_builder(1, "test_ks", "test_cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("float_col", float_type, column_kind::regular_column) .build(); @@ -5134,7 +5134,7 @@ BOOST_AUTO_TEST_CASE(evaluate_add_reversed_type) { // Schema with a DESC clustering key: equivalent to // CREATE TABLE test_ks.test_cf (pk int, ck int, PRIMARY KEY (pk, ck)) WITH CLUSTERING ORDER BY (ck DESC); schema_ptr test_schema = - schema_builder("test_ks", "test_cf") + schema_builder(1, "test_ks", "test_cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck", reversed_type_impl::get_instance(int32_type), column_kind::clustering_key) .build(); @@ -5286,7 +5286,7 @@ BOOST_AUTO_TEST_CASE(evaluate_sub_printer) { // Arithmetic SUB on a column with a reversed type (DESC clustering key) must work correctly. BOOST_AUTO_TEST_CASE(evaluate_sub_reversed_type) { schema_ptr test_schema = - schema_builder("test_ks", "test_cf") + schema_builder(1, "test_ks", "test_cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck", reversed_type_impl::get_instance(int32_type), column_kind::clustering_key) .build(); @@ -5407,7 +5407,7 @@ BOOST_AUTO_TEST_CASE(evaluate_neg_reversed_type) { // Schema with a DESC clustering key: equivalent to // CREATE TABLE test_ks.test_cf (pk int, ck int, PRIMARY KEY (pk, ck)) WITH CLUSTERING ORDER BY (ck DESC); schema_ptr test_schema = - schema_builder("test_ks", "test_cf") + schema_builder(1, "test_ks", "test_cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck", reversed_type_impl::get_instance(int32_type), column_kind::clustering_key) .build(); diff --git a/test/boost/frozen_mutation_test.cc b/test/boost/frozen_mutation_test.cc index 5f4db0cfa1..fb952986c1 100644 --- a/test/boost/frozen_mutation_test.cc +++ b/test/boost/frozen_mutation_test.cc @@ -30,7 +30,7 @@ #include "readers/mutation_fragment_v1_stream.hh" static schema_builder new_table() { - return { "some_keyspace", "some_table" }; + return { this_smp_shard_count(), "some_keyspace", "some_table" }; } static api::timestamp_type new_timestamp() { diff --git a/test/boost/group0_test.cc b/test/boost/group0_test.cc index 51667921ef..58f25a5dbc 100644 --- a/test/boost/group0_test.cc +++ b/test/boost/group0_test.cc @@ -353,11 +353,11 @@ SEASTAR_TEST_CASE(test_group0_tables_use_schema_commitlog) { } }); - auto test_group0_tables_use_schema_commitlog1 = schema_builder("test", "test_group0_tables_use_schema_commitlog1") + auto test_group0_tables_use_schema_commitlog1 = schema_builder(this_smp_shard_count(), "test", "test_group0_tables_use_schema_commitlog1") .with_column("pk", utf8_type, column_kind::partition_key) .build(); - auto test_group0_tables_use_schema_commitlog2 = schema_builder("test", "test_group0_tables_use_schema_commitlog2") + auto test_group0_tables_use_schema_commitlog2 = schema_builder(this_smp_shard_count(), "test", "test_group0_tables_use_schema_commitlog2") .with_column("pk", utf8_type, column_kind::partition_key) .build(); diff --git a/test/boost/incremental_compaction_test.cc b/test/boost/incremental_compaction_test.cc index 6573a769a9..96b65a28e5 100644 --- a/test/boost/incremental_compaction_test.cc +++ b/test/boost/incremental_compaction_test.cc @@ -69,7 +69,7 @@ static std::unique_ptr make_strategy_control_for_t SEASTAR_TEST_CASE(incremental_compaction_test) { return sstables::test_env::do_with_async([&] (sstables::test_env& env) { - auto builder = schema_builder("tests", "incremental_compaction_test") + auto builder = schema_builder(this_smp_shard_count(), "tests", "incremental_compaction_test") .with_column("id", utf8_type, column_kind::partition_key) .with_column("value", int32_type) .with_partitioner("org.apache.cassandra.dht.Murmur3Partitioner") @@ -197,7 +197,7 @@ SEASTAR_TEST_CASE(incremental_compaction_test) { } SEASTAR_THREAD_TEST_CASE(incremental_compaction_sag_test) { - auto builder = schema_builder("tests", "incremental_compaction_test") + auto builder = schema_builder(this_smp_shard_count(), "tests", "incremental_compaction_test") .with_column("id", utf8_type, column_kind::partition_key) .with_column("value", int32_type); auto s = builder.build(); @@ -296,7 +296,7 @@ SEASTAR_THREAD_TEST_CASE(incremental_compaction_sag_test) { SEASTAR_TEST_CASE(basic_garbage_collection_test) { return test_env::do_with_async([] (test_env& env) { auto tmp = tmpdir(); - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("p1", utf8_type, column_kind::partition_key) .with_column("c1", utf8_type, column_kind::clustering_key) .with_column("r1", utf8_type) @@ -407,7 +407,7 @@ SEASTAR_TEST_CASE(ics_reshape_test) { static constexpr unsigned disjoint_sstable_count = 256; return test_env::do_with_async([] (test_env& env) { - auto builder = schema_builder("tests", "ics_reshape_test") + auto builder = schema_builder(this_smp_shard_count(), "tests", "ics_reshape_test") .with_column("id", utf8_type, column_kind::partition_key) .with_column("cl", ::timestamp_type, column_kind::clustering_key) .with_column("value", int32_type); @@ -500,7 +500,7 @@ SEASTAR_TEST_CASE(ics_reshape_test) { SEASTAR_TEST_CASE(gc_tombstone_with_grace_seconds_test) { return test_env::do_with_async([](test_env &env) { auto gc_grace_seconds = 5; - auto schema = schema_builder("tests", "gc_tombstone_with_grace_seconds_test") + auto schema = schema_builder(this_smp_shard_count(), "tests", "gc_tombstone_with_grace_seconds_test") .with_column("id", utf8_type, column_kind::partition_key) .with_column("value", byte_type) .set_gc_grace_seconds(gc_grace_seconds).build(); @@ -535,7 +535,7 @@ SEASTAR_TEST_CASE(gc_sstable_incremental_release_test) { scoped_logger_level compaction_log_level("compaction", seastar::log_level::debug); - auto schema = schema_builder("ks", "gc_incremental_release_test") + auto schema = schema_builder(this_smp_shard_count(), "ks", "gc_incremental_release_test") .with_column("pk", utf8_type, column_kind::partition_key) .with_column("data", utf8_type) .with_tombstone_gc_options(tombstone_gc_options{tombstone_gc_mode::immediate}) @@ -619,7 +619,7 @@ SEASTAR_TEST_CASE(gc_sstable_no_premature_release_with_overlapping_inputs_test) return test_env::do_with_async([](test_env& env) { scoped_logger_level compaction_log_level("compaction", seastar::log_level::debug); - auto schema = schema_builder("ks", "gc_no_premature_release_test") + auto schema = schema_builder(this_smp_shard_count(), "ks", "gc_no_premature_release_test") .with_column("pk", utf8_type, column_kind::partition_key) .with_column("data", utf8_type) .with_tombstone_gc_options(tombstone_gc_options{tombstone_gc_mode::immediate}) diff --git a/test/boost/keys_test.cc b/test/boost/keys_test.cc index 5afd94494c..f141ed26d6 100644 --- a/test/boost/keys_test.cc +++ b/test/boost/keys_test.cc @@ -19,7 +19,7 @@ #include "idl/keys.dist.impl.hh" BOOST_AUTO_TEST_CASE(test_key_is_prefixed_by) { - auto s_ptr = schema_builder("", "") + auto s_ptr = schema_builder(1, "", "") .with_column("c1", bytes_type, column_kind::partition_key) .with_column("c2", bytes_type, column_kind::clustering_key) .with_column("c3", bytes_type, column_kind::clustering_key) @@ -41,7 +41,7 @@ BOOST_AUTO_TEST_CASE(test_key_is_prefixed_by) { } BOOST_AUTO_TEST_CASE(test_key_component_iterator) { - auto s_ptr = schema_builder("", "") + auto s_ptr = schema_builder(1, "", "") .with_column("c1", bytes_type, column_kind::partition_key) .with_column("c2", bytes_type, column_kind::clustering_key) .with_column("c3", bytes_type, column_kind::clustering_key) @@ -70,7 +70,7 @@ BOOST_AUTO_TEST_CASE(test_key_component_iterator) { } BOOST_AUTO_TEST_CASE(test_legacy_ordering_for_non_composite_key) { - auto s_ptr = schema_builder("", "") + auto s_ptr = schema_builder(1, "", "") .with_column("c1", bytes_type, column_kind::partition_key) .build(); const schema& s = *s_ptr; @@ -91,7 +91,7 @@ BOOST_AUTO_TEST_CASE(test_legacy_ordering_for_non_composite_key) { } BOOST_AUTO_TEST_CASE(test_legacy_ordering_for_composite_keys) { - auto s_ptr = schema_builder("", "") + auto s_ptr = schema_builder(1, "", "") .with_column("c1", bytes_type, column_kind::partition_key) .with_column("c2", bytes_type, column_kind::partition_key) .build(); @@ -119,7 +119,7 @@ BOOST_AUTO_TEST_CASE(test_legacy_ordering_for_composite_keys) { } BOOST_AUTO_TEST_CASE(test_conversions_between_view_and_wrapper) { - auto s_ptr = schema_builder("", "") + auto s_ptr = schema_builder(1, "", "") .with_column("c1", bytes_type, column_kind::partition_key) .build(); const schema& s = *s_ptr; @@ -147,7 +147,7 @@ T reserialize(const T& v) { } BOOST_AUTO_TEST_CASE(test_serialization) { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(1, "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("v", bytes_type) .build(); @@ -160,7 +160,7 @@ BOOST_AUTO_TEST_CASE(test_serialization) { BOOST_AUTO_TEST_CASE(test_from_nodetool_style_string_single_partition_key) { - auto s1 = schema_builder("", "") + auto s1 = schema_builder(1, "", "") .with_column("c1", utf8_type, column_kind::partition_key) .with_column("c2", bytes_type, column_kind::clustering_key) .with_column("c3", bytes_type, column_kind::clustering_key) @@ -178,7 +178,7 @@ BOOST_AUTO_TEST_CASE(test_from_nodetool_style_string_single_partition_key) { } BOOST_AUTO_TEST_CASE(test_from_nodetool_style_string_composite_partition_key) { - auto s2 = schema_builder("", "") + auto s2 = schema_builder(1, "", "") .with_column("c1", utf8_type, column_kind::partition_key) .with_column("c2", utf8_type, column_kind::partition_key) .with_column("c3", bytes_type, column_kind::clustering_key) diff --git a/test/boost/memtable_test.cc b/test/boost/memtable_test.cc index 017f684959..dcb669b1f5 100644 --- a/test/boost/memtable_test.cc +++ b/test/boost/memtable_test.cc @@ -239,7 +239,7 @@ SEASTAR_TEST_CASE(test_memtable_flush_reader) { SEASTAR_TEST_CASE(test_adding_a_column_during_reading_doesnt_affect_read_result) { return seastar::async([] { - auto common_builder = schema_builder("ks", "cf") + auto common_builder = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key); auto s1 = common_builder @@ -290,7 +290,7 @@ SEASTAR_TEST_CASE(test_adding_a_column_during_reading_doesnt_affect_read_result) SEASTAR_TEST_CASE(test_unspooled_dirty_accounting_on_flush) { return seastar::async([] { - schema_ptr s = schema_builder("ks", "cf") + schema_ptr s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("col", bytes_type, column_kind::regular_column) .build(); @@ -356,7 +356,7 @@ SEASTAR_TEST_CASE(test_unspooled_dirty_accounting_on_flush) { // Reproducer for #1753 SEASTAR_TEST_CASE(test_partition_version_consistency_after_lsa_compaction_happens) { return seastar::async([] { - schema_ptr s = schema_builder("ks", "cf") + schema_ptr s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("ck", bytes_type, column_kind::clustering_key) .with_column("col", bytes_type, column_kind::regular_column) @@ -425,7 +425,7 @@ SEASTAR_TEST_CASE(test_partition_version_consistency_after_lsa_compaction_happen // Reproducer for #1746 SEASTAR_TEST_CASE(test_segment_migration_during_flush) { return seastar::async([] { - schema_ptr s = schema_builder("ks", "cf") + schema_ptr s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("ck", bytes_type, column_kind::clustering_key) .with_column("col", bytes_type, column_kind::regular_column) @@ -473,7 +473,7 @@ SEASTAR_TEST_CASE(test_segment_migration_during_flush) { // Reproducer for #2854 SEASTAR_TEST_CASE(test_fast_forward_to_after_memtable_is_flushed) { return seastar::async([] { - schema_ptr s = schema_builder("ks", "cf") + schema_ptr s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("col", bytes_type, column_kind::regular_column) .build(); @@ -801,7 +801,7 @@ SEASTAR_THREAD_TEST_CASE(test_range_tombstones_are_compacted_with_data) { SEASTAR_TEST_CASE(test_hash_is_cached) { return seastar::async([] { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("v", bytes_type, column_kind::regular_column) .build(); @@ -1081,7 +1081,7 @@ SEASTAR_TEST_CASE(sstable_compaction_does_not_resurrect_data) { sstring ks_name = "ks"; sstring table_name = "table_name"; - schema_ptr s = schema_builder(ks_name, table_name) + schema_ptr s = schema_builder(this_smp_shard_count(), ks_name, table_name) .with_column(to_bytes("pk"), int32_type, column_kind::partition_key) .with_column(to_bytes("ck"), int32_type, column_kind::clustering_key) .with_column(to_bytes("id"), int32_type) diff --git a/test/boost/mutation_fragment_test.cc b/test/boost/mutation_fragment_test.cc index 194c7b40b3..05f0853a62 100644 --- a/test/boost/mutation_fragment_test.cc +++ b/test/boost/mutation_fragment_test.cc @@ -77,7 +77,7 @@ SEASTAR_TEST_CASE(test_mutation_merger_conforms_to_mutation_source) { SEASTAR_TEST_CASE(test_range_tombstones_stream) { return seastar::async([] { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck1", int32_type, column_kind::clustering_key) .with_column("ck2", int32_type, column_kind::clustering_key) @@ -199,7 +199,7 @@ position_in_partition position_after_prefixed(const clustering_key& ck) { SEASTAR_TEST_CASE(test_ordering_of_position_in_partition_and_composite_view) { return seastar::async([] { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck1", int32_type, column_kind::clustering_key) .with_column("ck2", int32_type, column_kind::clustering_key) @@ -261,7 +261,7 @@ SEASTAR_TEST_CASE(test_ordering_of_position_in_partition_and_composite_view) { SEASTAR_TEST_CASE(test_ordering_of_position_in_partition_and_composite_view_in_a_dense_table) { return seastar::async([] { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck1", int32_type, column_kind::clustering_key) .with_column("ck2", int32_type, column_kind::clustering_key) diff --git a/test/boost/mutation_query_test.cc b/test/boost/mutation_query_test.cc index 993b8b1812..8efa3c1fe8 100644 --- a/test/boost/mutation_query_test.cc +++ b/test/boost/mutation_query_test.cc @@ -35,7 +35,7 @@ using namespace std::literals::chrono_literals; static schema_ptr make_schema() { - return schema_builder("ks", "cf") + return schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("ck", bytes_type, column_kind::clustering_key) .with_column("s1", bytes_type, column_kind::static_column) @@ -402,7 +402,7 @@ SEASTAR_TEST_CASE(test_query_when_partition_tombstone_covers_live_cells) { SEASTAR_TEST_CASE(test_partitions_with_only_expired_tombstones_are_dropped) { return seastar::async([] { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("v", bytes_type, column_kind::regular_column) .set_gc_grace_seconds(0) diff --git a/test/boost/mutation_reader_test.cc b/test/boost/mutation_reader_test.cc index 3e9a922383..7c92eae413 100644 --- a/test/boost/mutation_reader_test.cc +++ b/test/boost/mutation_reader_test.cc @@ -73,7 +73,7 @@ BOOST_AUTO_TEST_SUITE(mutation_reader_test) namespace test_label = boost::unit_test; static schema_ptr make_schema() { - return schema_builder("ks", "cf") + return schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("v", bytes_type, column_kind::regular_column) .build(); @@ -1370,7 +1370,7 @@ SEASTAR_TEST_CASE(test_trim_clustering_row_ranges_to) { } }; - const auto schema = schema_builder("ks", get_name()) + const auto schema = schema_builder(this_smp_shard_count(), "ks", get_name()) .with_column("p0", int32_type, column_kind::partition_key) .with_column("c0", int32_type, column_kind::clustering_key) .with_column("c1", int32_type, column_kind::clustering_key) @@ -3751,7 +3751,7 @@ struct clustering_order_merger_test_generator { {} static schema_ptr make_schema() { - return schema_builder("ks", "t") + return schema_builder(this_smp_shard_count(), "ks", "t") .with_column("pk", utf8_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key) .with_column("v", int32_type, column_kind::regular_column) diff --git a/test/boost/mutation_test.cc b/test/boost/mutation_test.cc index e32c209aa8..c4fab7117f 100644 --- a/test/boost/mutation_test.cc +++ b/test/boost/mutation_test.cc @@ -117,7 +117,7 @@ SEASTAR_TEST_CASE(test_mutation_is_applied) { return seastar::async([] { tests::reader_concurrency_semaphore_wrapper semaphore; - auto s = schema_builder(some_keyspace, some_column_family) + auto s = schema_builder(this_smp_shard_count(), some_keyspace, some_column_family) .with_column("p1", utf8_type, column_kind::partition_key) .with_column("c1", int32_type, column_kind::clustering_key) .with_column("r1", int32_type) @@ -145,7 +145,7 @@ SEASTAR_TEST_CASE(test_mutation_is_applied) { } SEASTAR_TEST_CASE(test_multi_level_row_tombstones) { - auto s = schema_builder(some_keyspace, some_column_family) + auto s = schema_builder(this_smp_shard_count(), some_keyspace, some_column_family) .with_column("p1", utf8_type, column_kind::partition_key) .with_column("c1", int32_type, column_kind::clustering_key) .with_column("c2", int32_type, column_kind::clustering_key) @@ -183,7 +183,7 @@ SEASTAR_TEST_CASE(test_multi_level_row_tombstones) { } SEASTAR_TEST_CASE(test_row_tombstone_updates) { - auto s = schema_builder(some_keyspace, some_column_family) + auto s = schema_builder(this_smp_shard_count(), some_keyspace, some_column_family) .with_column("p1", utf8_type, column_kind::partition_key) .with_column("c1", int32_type, column_kind::clustering_key) .with_column("c2", int32_type, column_kind::clustering_key) @@ -365,7 +365,7 @@ SEASTAR_TEST_CASE(test_map_mutations) { tests::reader_concurrency_semaphore_wrapper semaphore; auto my_map_type = map_type_impl::get_instance(int32_type, utf8_type, true); - auto s = schema_builder(some_keyspace, some_column_family) + auto s = schema_builder(this_smp_shard_count(), some_keyspace, some_column_family) .with_column("p1", utf8_type, column_kind::partition_key) .with_column("c1", int32_type, column_kind::clustering_key) .with_column("s1", my_map_type, column_kind::static_column) @@ -404,7 +404,7 @@ SEASTAR_TEST_CASE(test_set_mutations) { tests::reader_concurrency_semaphore_wrapper semaphore; auto my_set_type = set_type_impl::get_instance(int32_type, true); - auto s = schema_builder(some_keyspace, some_column_family) + auto s = schema_builder(this_smp_shard_count(), some_keyspace, some_column_family) .with_column("p1", utf8_type, column_kind::partition_key) .with_column("c1", int32_type, column_kind::clustering_key) .with_column("s1", my_set_type, column_kind::static_column) @@ -443,7 +443,7 @@ SEASTAR_TEST_CASE(test_list_mutations) { tests::reader_concurrency_semaphore_wrapper semaphore; auto my_list_type = list_type_impl::get_instance(int32_type, true); - auto s = schema_builder(some_keyspace, some_column_family) + auto s = schema_builder(this_smp_shard_count(), some_keyspace, some_column_family) .with_column("p1", utf8_type, column_kind::partition_key) .with_column("c1", int32_type, column_kind::clustering_key) .with_column("s1", my_list_type, column_kind::static_column) @@ -487,7 +487,7 @@ SEASTAR_THREAD_TEST_CASE(test_udt_mutations) { {int32_type, utf8_type, long_type, utf8_type}, true); - auto s = schema_builder(some_keyspace, some_column_family) + auto s = schema_builder(this_smp_shard_count(), some_keyspace, some_column_family) .with_column("p1", utf8_type, column_kind::partition_key) .with_column("c1", int32_type, column_kind::clustering_key) .with_column("s1", ut, column_kind::static_column) @@ -553,7 +553,7 @@ SEASTAR_THREAD_TEST_CASE(test_large_collection_allocation) { const auto value_type = utf8_type; const auto collection_type = map_type_impl::get_instance(key_type, value_type, true); - auto schema = schema_builder("test", "test_large_collection_allocation") + auto schema = schema_builder(this_smp_shard_count(), "test", "test_large_collection_allocation") .with_column("pk", int32_type, column_kind::partition_key) .with_column("v", collection_type) .build(); @@ -646,7 +646,7 @@ SEASTAR_THREAD_TEST_CASE(test_large_collection_serialization_exception_safety) { SEASTAR_TEST_CASE(test_multiple_memtables_one_partition) { return sstables::test_env::do_with_async([] (sstables::test_env& env) { - auto s = schema_builder(some_keyspace, some_column_family) + auto s = schema_builder(this_smp_shard_count(), some_keyspace, some_column_family) .with_column("p1", utf8_type, column_kind::partition_key) .with_column("c1", int32_type, column_kind::clustering_key) .with_column("r1", int32_type) @@ -697,7 +697,7 @@ SEASTAR_TEST_CASE(test_multiple_memtables_one_partition) { SEASTAR_TEST_CASE(test_flush_in_the_middle_of_a_scan) { return sstables::test_env::do_with_async([] (sstables::test_env& env) { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("v", bytes_type) .build(); @@ -781,7 +781,7 @@ SEASTAR_TEST_CASE(test_flush_in_the_middle_of_a_scan) { SEASTAR_TEST_CASE(test_multiple_memtables_multiple_partitions) { return sstables::test_env::do_with_async([] (sstables::test_env& env) { - auto s = schema_builder(some_keyspace, some_column_family) + auto s = schema_builder(this_smp_shard_count(), some_keyspace, some_column_family) .with_column("p1", int32_type, column_kind::partition_key) .with_column("c1", int32_type, column_kind::clustering_key) .with_column("r1", int32_type) @@ -957,7 +957,7 @@ static query::partition_slice make_full_slice(const schema& s) { SEASTAR_TEST_CASE(test_querying_of_mutation) { return seastar::async([] { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("v", bytes_type, column_kind::regular_column) .build(); @@ -983,7 +983,7 @@ SEASTAR_TEST_CASE(test_querying_of_mutation) { SEASTAR_TEST_CASE(test_partition_with_no_live_data_is_absent_in_data_query_results) { return seastar::async([] { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("sc1", bytes_type, column_kind::static_column) .with_column("ck", bytes_type, column_kind::clustering_key) @@ -1006,7 +1006,7 @@ SEASTAR_TEST_CASE(test_partition_with_no_live_data_is_absent_in_data_query_resul SEASTAR_TEST_CASE(test_partition_with_live_data_in_static_row_is_present_in_the_results_even_if_static_row_was_not_queried) { return seastar::async([] { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("sc1", bytes_type, column_kind::static_column) .with_column("ck", bytes_type, column_kind::clustering_key) @@ -1032,7 +1032,7 @@ SEASTAR_TEST_CASE(test_partition_with_live_data_in_static_row_is_present_in_the_ SEASTAR_TEST_CASE(test_query_result_with_one_regular_column_missing) { return seastar::async([] { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("ck", bytes_type, column_kind::clustering_key) .with_column("v1", bytes_type, column_kind::regular_column) @@ -1058,7 +1058,7 @@ SEASTAR_TEST_CASE(test_query_result_with_one_regular_column_missing) { SEASTAR_TEST_CASE(test_row_counting) { return seastar::async([] { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("sc1", bytes_type, column_kind::static_column) .with_column("ck", bytes_type, column_kind::clustering_key) @@ -1108,7 +1108,7 @@ SEASTAR_TEST_CASE(test_row_counting) { } SEASTAR_TEST_CASE(test_tombstone_apply) { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("v", bytes_type, column_kind::regular_column) .build(); @@ -1132,7 +1132,7 @@ SEASTAR_TEST_CASE(test_tombstone_apply) { } SEASTAR_TEST_CASE(test_marker_apply) { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("ck", bytes_type, column_kind::clustering_key) .with_column("v", bytes_type, column_kind::regular_column) @@ -1381,7 +1381,7 @@ SEASTAR_TEST_CASE(test_mutation_diff) { mutation_application_stats app_stats; auto my_set_type = set_type_impl::get_instance(int32_type, true); - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("sc1", bytes_type, column_kind::static_column) .with_column("ck", bytes_type, column_kind::clustering_key) @@ -1485,7 +1485,7 @@ SEASTAR_TEST_CASE(test_large_blobs) { return seastar::async([] { tests::reader_concurrency_semaphore_wrapper semaphore; - auto s = schema_builder(some_keyspace, some_column_family) + auto s = schema_builder(this_smp_shard_count(), some_keyspace, some_column_family) .with_column("p1", utf8_type, column_kind::partition_key) .with_column("s1", bytes_type, column_kind::static_column) .build(); @@ -1634,7 +1634,7 @@ SEASTAR_TEST_CASE(test_mutation_upgrade_of_equal_mutations) { SEASTAR_TEST_CASE(test_mutation_upgrade) { return seastar::async([] { auto make_builder = [] { - return schema_builder("ks", "cf") + return schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("ck", bytes_type, column_kind::clustering_key); }; @@ -1733,7 +1733,7 @@ SEASTAR_TEST_CASE(test_mutation_upgrade) { SEASTAR_THREAD_TEST_CASE(test_mutation_upgrade_type_change) { auto make_builder = [] { - return schema_builder("ks", "cf") + return schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("ck", bytes_type, column_kind::clustering_key); }; @@ -1808,7 +1808,7 @@ SEASTAR_THREAD_TEST_CASE(test_row_marker_expiry) { } SEASTAR_THREAD_TEST_CASE(test_querying_expired_rows) { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("ck", bytes_type, column_kind::clustering_key) .build(); @@ -1857,7 +1857,7 @@ SEASTAR_THREAD_TEST_CASE(test_querying_expired_rows) { SEASTAR_TEST_CASE(test_querying_expired_cells) { return seastar::async([] { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("ck", bytes_type, column_kind::clustering_key) .with_column("s1", bytes_type, column_kind::static_column) @@ -1946,7 +1946,7 @@ SEASTAR_TEST_CASE(test_querying_expired_cells) { } SEASTAR_TEST_CASE(test_tombstone_purge) { - auto builder = schema_builder("tests", "tombstone_purge") + auto builder = schema_builder(this_smp_shard_count(), "tests", "tombstone_purge") .with_column("id", utf8_type, column_kind::partition_key) .with_column("value", int32_type); builder.set_gc_grace_seconds(0); @@ -1970,7 +1970,7 @@ SEASTAR_TEST_CASE(test_tombstone_purge) { } SEASTAR_TEST_CASE(test_slicing_mutation) { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key) .with_column("v", int32_type) @@ -2047,7 +2047,7 @@ SEASTAR_TEST_CASE(test_slicing_mutation) { SEASTAR_TEST_CASE(test_trim_rows) { return seastar::async([] { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key) .with_column("v", int32_type) @@ -2105,7 +2105,7 @@ SEASTAR_TEST_CASE(test_trim_rows) { SEASTAR_TEST_CASE(test_collection_cell_diff) { return seastar::async([] { - auto s = schema_builder(some_keyspace, some_column_family) + auto s = schema_builder(this_smp_shard_count(), some_keyspace, some_column_family) .with_column("p", utf8_type, column_kind::partition_key) .with_column("v", list_type_impl::get_instance(bytes_type, true)) .build(); @@ -2776,7 +2776,7 @@ SEASTAR_THREAD_TEST_CASE(test_cell_external_memory_usage) { // after all MVCC versions are merged. // Overaccounting leads to assertion failure in ~flush_memory_accounter. SEASTAR_THREAD_TEST_CASE(test_row_size_is_immune_to_application_order) { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", utf8_type, column_kind::partition_key) .with_column("v1", utf8_type) .with_column("v2", utf8_type) @@ -3145,7 +3145,7 @@ SEASTAR_THREAD_TEST_CASE(test_compaction_data_stream_split) { // Reproducer for #4567: "appending_hash ignores cells after first null" SEASTAR_THREAD_TEST_CASE(test_appending_hash_row_4567) { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("ck", bytes_type, column_kind::clustering_key) .with_column("r1", bytes_type) @@ -3343,7 +3343,7 @@ SEASTAR_THREAD_TEST_CASE(test_mutation_rebuilder_v2_flush) { SEASTAR_TEST_CASE(mutation_with_dummy_clustering_row_is_consumed_monotonically) { return seastar::async([] { tests::reader_concurrency_semaphore_wrapper semaphore; - schema_ptr s = schema_builder{"ks", "cf"} + schema_ptr s = schema_builder{this_smp_shard_count(), "ks", "cf"} .with_column("pk", bytes_type, column_kind::partition_key) .with_column("ck1", bytes_type, column_kind::clustering_key) .build(); @@ -3419,7 +3419,7 @@ SEASTAR_THREAD_TEST_CASE(test_position_in_partition_order_with_prefix_keys) { using pip = position_in_partition; using pipv = position_in_partition_view; - schema_ptr s = schema_builder("ks", "cf") + schema_ptr s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", utf8_type, column_kind::partition_key) .with_column("ck1", utf8_type, column_kind::clustering_key) .with_column("ck2", utf8_type, column_kind::clustering_key) @@ -3971,7 +3971,7 @@ SEASTAR_TEST_CASE(test_tracing_format) { SEASTAR_TEST_CASE(test_compact_and_expire_cell_stats) { const auto collection_type = map_type_impl::get_instance(int32_type, int32_type, true); - auto schema = schema_builder("test", "test_compact_and_expire_cell_stats") + auto schema = schema_builder(this_smp_shard_count(), "test", "test_compact_and_expire_cell_stats") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key) .with_column("static_atomic", int32_type, column_kind::static_column) diff --git a/test/boost/mvcc_test.cc b/test/boost/mvcc_test.cc index 9594d54d42..fb67c15429 100644 --- a/test/boost/mvcc_test.cc +++ b/test/boost/mvcc_test.cc @@ -2178,7 +2178,7 @@ SEASTAR_TEST_CASE(test_gentle_schema_upgrades) { auto ts_drop = api::new_timestamp(); auto ts2 = api::new_timestamp(); - auto s1 = schema_builder("ks", "cf") + auto s1 = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", utf8_type, column_kind::partition_key) .with_column("ck", utf8_type, column_kind::clustering_key) .with_column("s1", utf8_type, column_kind::static_column) diff --git a/test/boost/network_topology_strategy_test.cc b/test/boost/network_topology_strategy_test.cc index 4c3536bcb6..e6ad3bde55 100644 --- a/test/boost/network_topology_strategy_test.cc +++ b/test/boost/network_topology_strategy_test.cc @@ -490,7 +490,7 @@ SEASTAR_THREAD_TEST_CASE(NetworkTopologyStrategy_tablets_test) { auto tmptr = stm.get(); const auto& topo = tmptr->get_topology(); - auto s = schema_builder("ks", "tb") + auto s = schema_builder(this_smp_shard_count(), "ks", "tb") .with_column("pk", utf8_type, column_kind::partition_key) .with_column("v", utf8_type) .build(); @@ -585,7 +585,7 @@ static void test_random_balancing(sharded& snitch, gms::inet_address auto tmptr = stm.get(); const auto& topo = tmptr->get_topology(); - auto s = schema_builder("ks", "tb") + auto s = schema_builder(this_smp_shard_count(), "ks", "tb") .with_column("pk", utf8_type, column_kind::partition_key) .with_column("v", utf8_type) .build(); @@ -1433,12 +1433,12 @@ SEASTAR_THREAD_TEST_CASE(tablets_simple_rack_aware_view_pairing_test) { } }).get(); - auto base_schema = schema_builder("ks", "base") + auto base_schema = schema_builder(this_smp_shard_count(), "ks", "base") .with_column("k", utf8_type, column_kind::partition_key) .with_column("v", utf8_type) .build(); - auto view_schema = schema_builder("ks", "view") + auto view_schema = schema_builder(this_smp_shard_count(), "ks", "view") .with_column("v", utf8_type, column_kind::partition_key) .with_column("k", utf8_type) .build(); diff --git a/test/boost/nonwrapping_interval_test.cc b/test/boost/nonwrapping_interval_test.cc index 13df3299ed..d039689413 100644 --- a/test/boost/nonwrapping_interval_test.cc +++ b/test/boost/nonwrapping_interval_test.cc @@ -32,7 +32,7 @@ bool includes_token(const schema& s, const dht::partition_range& r, const dht::t BOOST_AUTO_TEST_CASE(test_range_with_positions_within_the_same_token) { using bound = dht::partition_range::bound; - auto s = schema_builder("ks", "cf") + auto s = schema_builder(1, "ks", "cf") .with_column("key", bytes_type, column_kind::partition_key) .with_column("v", bytes_type) .build(); diff --git a/test/boost/partitioner_test.cc b/test/boost/partitioner_test.cc index a69874d3f2..b328de935e 100644 --- a/test/boost/partitioner_test.cc +++ b/test/boost/partitioner_test.cc @@ -109,7 +109,7 @@ SEASTAR_THREAD_TEST_CASE(test_token_ordering) { } SEASTAR_THREAD_TEST_CASE(test_decorated_key_is_compatible_with_origin) { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("c1", int32_type, column_kind::partition_key) .with_column("c2", int32_type, column_kind::partition_key) .with_column("v", int32_type) @@ -148,7 +148,7 @@ SEASTAR_THREAD_TEST_CASE(test_token_wraparound_2) { } SEASTAR_THREAD_TEST_CASE(test_ring_position_is_comparable_with_decorated_key) { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("v", int32_type) .build(); @@ -287,7 +287,7 @@ void test_sharding(const dht::sharder& sharder, unsigned shards, std::vector func_to_test) { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("c1", int32_type, column_kind::partition_key) .with_column("c2", int32_type, column_kind::partition_key) .with_column("v", int32_type) @@ -541,7 +541,7 @@ SEASTAR_THREAD_TEST_CASE(test_split_range_single_shard) { static void test_something_with_some_interesting_ranges_and_sharder_with_token_range(std::function func_to_test) { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("c1", int32_type, column_kind::partition_key) .with_column("c2", int32_type, column_kind::partition_key) .with_column("v", int32_type) diff --git a/test/boost/querier_cache_test.cc b/test/boost/querier_cache_test.cc index d171a50ac5..4e01fdec9b 100644 --- a/test/boost/querier_cache_test.cc +++ b/test/boost/querier_cache_test.cc @@ -776,7 +776,7 @@ SEASTAR_THREAD_TEST_CASE(test_unique_inactive_read_handle) { reader_concurrency_semaphore sem2(reader_concurrency_semaphore::no_limits{}, "", reader_concurrency_semaphore::register_metrics::no); // to see the message for an unnamed semaphore auto stop_sem2 = deferred_stop(sem2); - auto schema = schema_builder("ks", "cf") + auto schema = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("v", int32_type) .build(); diff --git a/test/boost/range_tombstone_list_test.cc b/test/boost/range_tombstone_list_test.cc index 934381e9a0..674f3ab946 100644 --- a/test/boost/range_tombstone_list_test.cc +++ b/test/boost/range_tombstone_list_test.cc @@ -19,7 +19,7 @@ #include -static thread_local schema_ptr s = schema_builder("ks", "cf") +static thread_local schema_ptr s = schema_builder(1, "ks", "cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck1", int32_type, column_kind::clustering_key) .with_column("ck2", int32_type, column_kind::clustering_key) diff --git a/test/boost/reader_concurrency_semaphore_test.cc b/test/boost/reader_concurrency_semaphore_test.cc index 17eb2111ec..518c4ff2ef 100644 --- a/test/boost/reader_concurrency_semaphore_test.cc +++ b/test/boost/reader_concurrency_semaphore_test.cc @@ -597,7 +597,7 @@ SEASTAR_THREAD_TEST_CASE(reader_concurrency_semaphore_dump_reader_diganostics) { const auto nr_tables = tests::random::get_int(2, 4); std::vector schemas; for (unsigned i = 0; i < nr_tables; ++i) { - schemas.emplace_back(schema_builder("ks", fmt::format("tbl{}", i)) + schemas.emplace_back(schema_builder(this_smp_shard_count(), "ks", fmt::format("tbl{}", i)) .with_column("pk", int32_type, column_kind::partition_key) .with_column("v", int32_type, column_kind::regular_column).build()); } diff --git a/test/boost/row_cache_test.cc b/test/boost/row_cache_test.cc index efd8e032ac..f661269803 100644 --- a/test/boost/row_cache_test.cc +++ b/test/boost/row_cache_test.cc @@ -49,7 +49,7 @@ using namespace std::chrono_literals; static schema_ptr make_schema() { - return schema_builder("ks", "cf") + return schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("v", bytes_type, column_kind::regular_column) .build(); @@ -352,7 +352,7 @@ static void require_no_token_duplicates(const utils::chunked_vector& p SEASTAR_TEST_CASE(test_cache_delegates_to_underlying_only_once_multiple_mutations) { return seastar::async([] { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("key", bytes_type, column_kind::partition_key) .with_column("v", bytes_type) .build(); @@ -969,7 +969,7 @@ void test_sliced_read_row_presence(mutation_reader reader, schema_ptr s, std::de SEASTAR_TEST_CASE(test_single_partition_update) { return seastar::async([] { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key) .with_column("v", int32_type) @@ -1753,7 +1753,7 @@ SEASTAR_TEST_CASE(test_mvcc) { SEASTAR_TEST_CASE(test_slicing_mutation_reader) { return seastar::async([] { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key) .with_column("v", int32_type) @@ -3241,7 +3241,7 @@ SEASTAR_TEST_CASE(test_continuity_is_populated_when_read_overlaps_with_older_ver SEASTAR_TEST_CASE(test_continuity_population_with_multicolumn_clustering_key) { return seastar::async([] { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck1", int32_type, column_kind::clustering_key) .with_column("ck2", int32_type, column_kind::clustering_key) @@ -4285,7 +4285,7 @@ SEASTAR_TEST_CASE(row_cache_is_populated_using_compacting_sstable_reader) { sstring ks_name = "ks"; sstring table_name = "table_name"; - schema_ptr s = schema_builder(ks_name, table_name) + schema_ptr s = schema_builder(this_smp_shard_count(), ks_name, table_name) .with_column(to_bytes("pk"), int32_type, column_kind::partition_key) .with_column(to_bytes("ck"), int32_type, column_kind::clustering_key) .with_column(to_bytes("id"), int32_type) @@ -4462,7 +4462,7 @@ SEASTAR_TEST_CASE(test_partition_entry_evicted_with_dummy_rows_unlinked_in_oldes SEASTAR_TEST_CASE(test_reading_of_nonfull_keys) { return seastar::async([] { - schema_ptr s = schema_builder("ks", "cf") + schema_ptr s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", utf8_type, column_kind::partition_key) .with_column("ck1", utf8_type, column_kind::clustering_key) .with_column("ck2", utf8_type, column_kind::clustering_key) @@ -4623,7 +4623,7 @@ SEASTAR_THREAD_TEST_CASE(test_digest_read_during_schema_upgrade) { // If the old row was processed with the new schema, // the test would fail because one of the row's columns would // have no definition. - auto s1 = schema_builder("ks", "cf") + auto s1 = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", utf8_type, column_kind::partition_key) .with_column("ck", utf8_type, column_kind::clustering_key) .with_column("v1", utf8_type, column_kind::regular_column) @@ -4680,7 +4680,7 @@ SEASTAR_THREAD_TEST_CASE(test_digest_read_during_schema_upgrade) { SEASTAR_TEST_CASE(test_cache_compacts_expired_tombstones_on_read) { return seastar::async([] { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key) .with_column("v", int32_type) @@ -4983,7 +4983,7 @@ SEASTAR_THREAD_TEST_CASE(test_preempt_cache_update) { // Reproducer for scylladb/scylladb#18045. SEASTAR_THREAD_TEST_CASE(test_reproduce_18045) { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key) .with_column("v", int32_type) diff --git a/test/boost/schema_change_test.cc b/test/boost/schema_change_test.cc index ca6d739076..6cfce04e49 100644 --- a/test/boost/schema_change_test.cc +++ b/test/boost/schema_change_test.cc @@ -35,7 +35,7 @@ BOOST_AUTO_TEST_SUITE(schema_change_test) SEASTAR_TEST_CASE(test_new_schema_with_no_structural_change_is_propagated) { return do_with_cql_env([](cql_test_env& e) { return seastar::async([&] { - auto partial = schema_builder("tests", "table") + auto partial = schema_builder(this_smp_shard_count(), "tests", "table") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("v1", bytes_type); @@ -71,7 +71,7 @@ SEASTAR_TEST_CASE(test_new_schema_with_no_structural_change_is_propagated) { SEASTAR_TEST_CASE(test_schema_is_updated_in_keyspace) { return do_with_cql_env([](cql_test_env& e) { return seastar::async([&] { - auto builder = schema_builder("tests", "table") + auto builder = schema_builder(this_smp_shard_count(), "tests", "table") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("v1", bytes_type); @@ -226,7 +226,7 @@ SEASTAR_TEST_CASE(test_combined_column_add_and_drop) { e.execute_cql("create keyspace tests with replication = { 'class' : 'NetworkTopologyStrategy', 'replication_factor' : 1 };").get(); - auto s1 = schema_builder("ks", "table1") + auto s1 = schema_builder(this_smp_shard_count(), "ks", "table1") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("v1", bytes_type) .build(); @@ -239,7 +239,7 @@ SEASTAR_TEST_CASE(test_combined_column_add_and_drop) { auto&& keyspace = e.db().local().find_keyspace(s1->ks_name()).metadata(); - auto s2 = schema_builder("ks", "table1", std::make_optional(s1->id())) + auto s2 = schema_builder(this_smp_shard_count(), "ks", "table1", std::make_optional(s1->id())) .with_column("pk", bytes_type, column_kind::partition_key) .without_column("v1", bytes_type, api::new_timestamp()) .build(); @@ -254,12 +254,12 @@ SEASTAR_TEST_CASE(test_combined_column_add_and_drop) { // Add a new v1 and drop it { - auto s3 = schema_builder("ks", "table1", std::make_optional(s1->id())) + auto s3 = schema_builder(this_smp_shard_count(), "ks", "table1", std::make_optional(s1->id())) .with_column("pk", bytes_type, column_kind::partition_key) .with_column("v1", list_type_impl::get_instance(int32_type, true)) .build(); - auto s4 = schema_builder("ks", "table1", std::make_optional(s1->id())) + auto s4 = schema_builder(this_smp_shard_count(), "ks", "table1", std::make_optional(s1->id())) .with_column("pk", bytes_type, column_kind::partition_key) .without_column("v1", list_type_impl::get_instance(int32_type, true), api::new_timestamp()) .build(); @@ -285,7 +285,7 @@ SEASTAR_TEST_CASE(test_merging_does_not_alter_tables_which_didnt_change) { auto&& keyspace = e.db().local().find_keyspace("ks").metadata(); - auto s0 = schema_builder("ks", "table1") + auto s0 = schema_builder(this_smp_shard_count(), "ks", "table1") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("v1", bytes_type) .build(); @@ -333,7 +333,7 @@ SEASTAR_TEST_CASE(test_merging_creates_a_table_even_if_keyspace_was_recreated) { auto&& keyspace = e.db().local().find_keyspace("ks").metadata(); - auto s0 = schema_builder("ks", "table1") + auto s0 = schema_builder(this_smp_shard_count(), "ks", "table1") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("v1", bytes_type) .build(); @@ -622,7 +622,7 @@ SEASTAR_TEST_CASE(test_schema_tables_use_null_sharder) { } SEASTAR_TEST_CASE(test_schema_make_reversed) { - auto schema = schema_builder("ks", get_name()) + auto schema = schema_builder(this_smp_shard_count(), "ks", get_name()) .with_column("pk", bytes_type, column_kind::partition_key) .with_column("ck", bytes_type, column_kind::clustering_key) .with_column("v1", bytes_type) @@ -646,7 +646,7 @@ SEASTAR_TEST_CASE(test_schema_make_reversed) { SEASTAR_TEST_CASE(test_schema_get_reversed) { return do_with_cql_env([] (cql_test_env& e) { - auto schema = schema_builder("ks", get_name()) + auto schema = schema_builder(this_smp_shard_count(), "ks", get_name()) .with_column("pk", bytes_type, column_kind::partition_key) .with_column("ck", bytes_type, column_kind::clustering_key) .with_column("v1", bytes_type) diff --git a/test/boost/schema_loader_test.cc b/test/boost/schema_loader_test.cc index 949b1faa34..773f93af81 100644 --- a/test/boost/schema_loader_test.cc +++ b/test/boost/schema_loader_test.cc @@ -423,7 +423,7 @@ SEASTAR_TEST_CASE(test_load_schema_from_sstable_interesting_schema) { const auto udt_type = user_type_impl::get_instance(ks, "udt", {"f1", "f2"}, {int32_type, frozen_string_list}, true); const auto frozen_udt_type = user_type_impl::get_instance(ks, "frozen_udt", {"f1", "f2"}, {int32_type, frozen_string_list}, false); - auto schema = schema_builder(ks, "interesting_table") + auto schema = schema_builder(this_smp_shard_count(), ks, "interesting_table") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck", reversed_type_impl::get_instance(int32_type), column_kind::clustering_key) .with_column("list", string_list, column_kind::regular_column) diff --git a/test/boost/schema_registry_test.cc b/test/boost/schema_registry_test.cc index 1bb5ad4363..ba6fd3a79e 100644 --- a/test/boost/schema_registry_test.cc +++ b/test/boost/schema_registry_test.cc @@ -36,7 +36,7 @@ static bytes random_column_name() { } static schema_ptr random_schema() { - return schema_builder("ks", "cf") + return schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column(random_column_name(), bytes_type) .build(); @@ -58,7 +58,7 @@ SEASTAR_THREAD_TEST_CASE(test_load_with_non_nantive_type) { dummy_init dummy; auto my_list_type = list_type_impl::get_instance(utf8_type, true); - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("val", my_list_type) .build(); @@ -70,11 +70,11 @@ SEASTAR_THREAD_TEST_CASE(test_load_with_non_nantive_type) { SEASTAR_THREAD_TEST_CASE(test_load_with_cdc_schema) { dummy_init dummy; - auto s_cdc = schema_builder("ks", "cdc_cf") + auto s_cdc = schema_builder(this_smp_shard_count(), "ks", "cdc_cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("val", bytes_type) .build(); - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("val", bytes_type) .with_cdc_schema(s_cdc) @@ -89,11 +89,11 @@ SEASTAR_THREAD_TEST_CASE(test_load_with_cdc_schema) { SEASTAR_THREAD_TEST_CASE(test_learn_schema_with_cdc) { dummy_init dummy; - auto s_cdc = schema_builder("ks", "cdc_cf") + auto s_cdc = schema_builder(this_smp_shard_count(), "ks", "cdc_cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("val", bytes_type) .build(); - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("val", bytes_type) .with_cdc_schema(s_cdc) @@ -107,11 +107,11 @@ SEASTAR_THREAD_TEST_CASE(test_learn_schema_with_cdc) { SEASTAR_THREAD_TEST_CASE(test_learn_loaded_schema_with_cdc) { dummy_init dummy; - auto s_cdc = schema_builder("ks", "cdc_cf") + auto s_cdc = schema_builder(this_smp_shard_count(), "ks", "cdc_cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("val", bytes_type) .build(); - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("val", bytes_type) .with_cdc_schema(s_cdc) @@ -155,7 +155,7 @@ SEASTAR_TEST_CASE(test_async_loading) { SEASTAR_THREAD_TEST_CASE(test_table_is_attached) { do_with_cql_env_thread([] (cql_test_env& e) { - auto s0 = schema_builder("ks", "cf") + auto s0 = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("v1", bytes_type) .build(); @@ -262,7 +262,7 @@ SEASTAR_THREAD_TEST_CASE(test_table_is_attached) { SEASTAR_THREAD_TEST_CASE(test_schema_is_recovered_after_dying) { dummy_init dummy; - auto base_schema = schema_builder("ks", "cf") + auto base_schema = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("v", int32_type) .build(); @@ -275,12 +275,12 @@ SEASTAR_THREAD_TEST_CASE(test_schema_is_recovered_after_dying) { SEASTAR_THREAD_TEST_CASE(test_view_info_is_recovered_after_dying) { dummy_init dummy; - auto base_schema = schema_builder("ks", "cf") + auto base_schema = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("v", int32_type) .build(); - schema_builder view_builder("ks", "cf_view"); - auto view_schema = schema_builder("ks", "cf_view") + schema_builder view_builder(this_smp_shard_count(), "ks", "cf_view"); + auto view_schema = schema_builder(this_smp_shard_count(), "ks", "cf_view") .with_column("v", int32_type, column_kind::partition_key) .with_column("pk", int32_type) .with_view_info(base_schema, false, "pk IS NOT NULL AND v IS NOT NULL") @@ -295,7 +295,7 @@ SEASTAR_THREAD_TEST_CASE(test_merge_schema_with_large_collection_of_mutations) { do_with_cql_env_thread([] (cql_test_env& e) { utils::chunked_vector mutations; for (auto i : std::views::iota(0, 1000)) { - auto s0 = schema_builder("ks", fmt::format("cf_{}", i)) + auto s0 = schema_builder(this_smp_shard_count(), "ks", fmt::format("cf_{}", i)) .with_column("pk", bytes_type, column_kind::partition_key) .with_column("v1", bytes_type) .build(); diff --git a/test/boost/sstable_3_x_test.cc b/test/boost/sstable_3_x_test.cc index 36e3e0e15f..d49e0ae071 100644 --- a/test/boost/sstable_3_x_test.cc +++ b/test/boost/sstable_3_x_test.cc @@ -156,7 +156,7 @@ static thread_local const sstring UNCOMPRESSED_FILTERING_AND_FORWARDING_PATH = "test/resource/sstables/3.x/uncompressed/filtering_and_forwarding"; static schema_ptr make_uncompressed_filtering_and_forwarding_schema() { - return schema_builder("test_ks", "test_table") + return schema_builder(this_smp_shard_count(), "test_ks", "test_table") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key) .with_column("s", int32_type, column_kind::static_column) @@ -407,7 +407,7 @@ static thread_local const sstring UNCOMPRESSED_SKIP_USING_INDEX_ROWS_PATH = "test/resource/sstables/3.x/uncompressed/skip_using_index_rows"; static schema_ptr make_uncompressed_skip_using_index_rows_schema() { - return schema_builder("test_ks", "test_table") + return schema_builder(this_smp_shard_count(), "test_ks", "test_table") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key) .with_column("st", int32_type, column_kind::static_column) @@ -653,7 +653,7 @@ static thread_local const sstring UNCOMPRESSED_FILTERING_AND_FORWARDING_RANGE_TO "test/resource/sstables/3.x/uncompressed/filtering_and_forwarding_range_tombstones"; static schema_ptr make_uncompressed_filtering_and_forwarding_range_tombstones_schema() { - return schema_builder("test_ks", "test_table") + return schema_builder(this_smp_shard_count(), "test_ks", "test_table") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck1", int32_type, column_kind::clustering_key) .with_column("ck2", int32_type, column_kind::clustering_key) @@ -944,7 +944,7 @@ static thread_local const sstring UNCOMPRESSED_SLICING_INTERLEAVED_ROWS_AND_RTS_ "test/resource/sstables/3.x/uncompressed/slicing_interleaved_rows_and_rts"; static schema_ptr make_uncompressed_slicing_interleaved_rows_and_rts_schema() { - return schema_builder("test_ks", "test_table") + return schema_builder(this_smp_shard_count(), "test_ks", "test_table") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck1", int32_type, column_kind::clustering_key) .with_column("ck2", int32_type, column_kind::clustering_key) @@ -1128,7 +1128,7 @@ static thread_local const sstring UNCOMPRESSED_STATIC_ROW_PATH = "test/resource/sstables/3.x/uncompressed/static_row"; static schema_ptr make_uncompressed_static_row_schema() { - return schema_builder("test_ks", "test_table") + return schema_builder(this_smp_shard_count(), "test_ks", "test_table") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key) .with_column("s", int32_type, column_kind::static_column) @@ -1212,7 +1212,7 @@ SEASTAR_TEST_CASE(test_uncompressed_random_partitioner) { const sstring uncompressed_random_partitioner_path = "test/resource/sstables/3.x/uncompressed/random_partitioner"; const schema_ptr uncompressed_random_partitioner_schema = - schema_builder("test_ks", "test_table") + schema_builder(this_smp_shard_count(), "test_ks", "test_table") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key) .with_column("v", int32_type) @@ -1257,7 +1257,7 @@ static thread_local const sstring UNCOMPRESSED_COMPOUND_STATIC_ROW_PATH = "test/resource/sstables/3.x/uncompressed/compound_static_row"; static schema_ptr make_uncompressed_compound_static_row_schema() { - return schema_builder("test_ks", "test_table") + return schema_builder(this_smp_shard_count(), "test_ks", "test_table") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key) .with_column("s_int", int32_type, column_kind::static_column) @@ -1354,7 +1354,7 @@ static thread_local const sstring UNCOMPRESSED_PARTITION_KEY_ONLY_PATH = "test/resource/sstables/3.x/uncompressed/partition_key_only"; static schema_ptr make_uncompressed_partition_key_only_schema() { - return schema_builder("test_ks", "test_table") + return schema_builder(this_smp_shard_count(), "test_ks", "test_table") .with_column("pk", int32_type, column_kind::partition_key) .set_compressor_params(compression_parameters::no_compression()) .build(); @@ -1417,7 +1417,7 @@ static thread_local const sstring UNCOMPRESSED_PARTITION_KEY_WITH_VALUE_PATH = "test/resource/sstables/3.x/uncompressed/partition_key_with_value"; static schema_ptr make_uncompressed_partition_key_with_value_schema() { - return schema_builder("test_ks", "test_table") + return schema_builder(this_smp_shard_count(), "test_ks", "test_table") .with_column("pk", int32_type, column_kind::partition_key) .with_column("val", int32_type) .set_compressor_params(compression_parameters::no_compression()) @@ -1485,7 +1485,7 @@ static thread_local const sstring UNCOMPRESSED_COUNTERS_PATH = "test/resource/sstables/3.x/uncompressed/counters"; static thread_local const schema_ptr UNCOMPRESSED_COUNTERS_SCHEMA = - schema_builder("test_ks", "test_table") + schema_builder(this_smp_shard_count(), "test_ks", "test_table") .with_column("pk", int32_type, column_kind::partition_key) .with_column("val", counter_type) .set_compressor_params(compression_parameters::no_compression()) @@ -1604,7 +1604,7 @@ static const sstring ZSTD_PARTITION_KEY_WITH_VALUES_OF_DIFFERENT_TYPES_PATH = "test/resource/sstables/3.x/zstd/partition_key_with_values_of_different_types"; static schema_builder make_partition_key_with_values_of_different_types_schema_builder() { - return schema_builder("test_ks", "test_table") + return schema_builder(this_smp_shard_count(), "test_ks", "test_table") .with_column("pk", int32_type, column_kind::partition_key) .with_column("bool_val", boolean_type) .with_column("double_val", double_type) @@ -1760,7 +1760,7 @@ static thread_local const sstring ZSTD_MULTIPLE_CHUNKS_PATH = "test/resource/sstables/3.x/zstd/multiple_chunks"; static schema_ptr make_zstd_multiple_chunks_schema() { - return schema_builder("test_ks", "test_table") + return schema_builder(this_smp_shard_count(), "test_ks", "test_table") .with_column("val1", int32_type, column_kind::partition_key) .with_column("val2", int32_type, column_kind::clustering_key) .set_compressor_params(compression_parameters{std::map{ @@ -1832,7 +1832,7 @@ static thread_local const sstring UNCOMPRESSED_SUBSET_OF_COLUMNS_PATH = "test/resource/sstables/3.x/uncompressed/subset_of_columns"; static schema_ptr make_uncompressed_subset_of_columns_schema() { - return schema_builder("test_ks", "test_table") + return schema_builder(this_smp_shard_count(), "test_ks", "test_table") .with_column("pk", int32_type, column_kind::partition_key) .with_column("bool_val", boolean_type) .with_column("double_val", double_type) @@ -2009,7 +2009,7 @@ static thread_local const sstring UNCOMPRESSED_LARGE_SUBSET_OF_COLUMNS_SPARSE_PA "test/resource/sstables/3.x/uncompressed/large_subset_of_columns_sparse"; static schema_ptr make_uncompressed_large_subset_of_columns_sparse_schema() { - return schema_builder("test_ks", "test_table") + return schema_builder(this_smp_shard_count(), "test_ks", "test_table") .with_column("pk", int32_type, column_kind::partition_key) .with_column("val1", int32_type) .with_column("val2", int32_type) @@ -2227,7 +2227,7 @@ static thread_local const sstring UNCOMPRESSED_LARGE_SUBSET_OF_COLUMNS_DENSE_PAT "test/resource/sstables/3.x/uncompressed/large_subset_of_columns_dense"; static schema_ptr make_uncompressed_large_subset_of_columns_dense_schema() { - return schema_builder("test_ks", "test_table") + return schema_builder(this_smp_shard_count(), "test_ks", "test_table") .with_column("pk", int32_type, column_kind::partition_key) .with_column("val1", int32_type) .with_column("val2", int32_type) @@ -2398,7 +2398,7 @@ SEASTAR_TEST_CASE(test_uncompressed_large_subset_of_columns_dense_read) { static thread_local const sstring UNCOMPRESSED_DELETED_CELLS_PATH = "test/resource/sstables/3.x/uncompressed/deleted_cells"; static schema_ptr make_uncompressed_deleted_cells_schema() { - return schema_builder("test_ks", "test_table") + return schema_builder(this_smp_shard_count(), "test_ks", "test_table") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key) .with_column("val", int32_type) @@ -2486,7 +2486,7 @@ SEASTAR_TEST_CASE(test_uncompressed_deleted_cells_read) { static thread_local const sstring UNCOMPRESSED_RANGE_TOMBSTONES_SIMPLE_PATH = "test/resource/sstables/3.x/uncompressed/range_tombstones_simple"; static schema_ptr make_uncompressed_range_tombstones_simple_schema() { - return schema_builder("test_ks", "test_table") + return schema_builder(this_smp_shard_count(), "test_ks", "test_table") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key) .with_column("val", int32_type) @@ -2555,7 +2555,7 @@ SEASTAR_TEST_CASE(test_uncompressed_range_tombstones_simple_read) { static thread_local const sstring UNCOMPRESSED_RANGE_TOMBSTONES_PARTIAL_PATH = "test/resource/sstables/3.x/uncompressed/range_tombstones_partial"; static schema_ptr make_uncompressed_range_tombstones_partial_schema() { - return schema_builder("test_ks", "test_table") + return schema_builder(this_smp_shard_count(), "test_ks", "test_table") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck1", int32_type, column_kind::clustering_key) .with_column("ck2", int32_type, column_kind::clustering_key) @@ -2618,7 +2618,7 @@ SEASTAR_TEST_CASE(test_uncompressed_range_tombstones_partial_read) { static thread_local const sstring UNCOMPRESSED_SIMPLE_PATH = "test/resource/sstables/3.x/uncompressed/simple"; static schema_ptr make_uncompressed_simple_schema() { - return schema_builder("test_ks", "test_table") + return schema_builder(this_smp_shard_count(), "test_ks", "test_table") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key) .with_column("val", int32_type) @@ -2758,7 +2758,7 @@ SEASTAR_TEST_CASE(test_uncompressed_simple_read) { static thread_local const sstring UNCOMPRESSED_COMPOUND_CK_PATH = "test/resource/sstables/3.x/uncompressed/compound_ck"; static schema_ptr make_uncompressed_compound_ck_schema() { - return schema_builder("test_ks", "test_table") + return schema_builder(this_smp_shard_count(), "test_ks", "test_table") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck_int", int32_type, column_kind::clustering_key) .with_column("ck_text", utf8_type, column_kind::clustering_key) @@ -2861,7 +2861,7 @@ static thread_local const sstring UNCOMPRESSED_COLLECTIONS_PATH = "test/resource/sstables/3.x/uncompressed/collections"; static schema_ptr make_uncompressed_collections_schema() { - return schema_builder("test_ks", "test_table") + return schema_builder(this_smp_shard_count(), "test_ks", "test_table") .with_column("pk", int32_type, column_kind::partition_key) .with_column("set_val", set_type_impl::get_instance(int32_type, true)) .with_column("list_val", list_type_impl::get_instance(utf8_type, true)) @@ -3019,7 +3019,7 @@ SEASTAR_TEST_CASE(compact_deleted_row) { BOOST_REQUIRE(smp::count == 1); sstring table_name = "compact_deleted_row"; // CREATE TABLE test_deleted_row (pk text, ck text, rc1 text, rc2 text, PRIMARY KEY (pk, ck)) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", utf8_type, column_kind::partition_key); builder.with_column("ck", utf8_type, column_kind::clustering_key); builder.with_column("rc1", utf8_type); @@ -3090,7 +3090,7 @@ SEASTAR_TEST_CASE(compact_deleted_cell) { BOOST_REQUIRE(smp::count == 1); sstring table_name = "compact_deleted_cell"; // CREATE TABLE compact_deleted_cell (pk text, ck text, rc text, PRIMARY KEY (pk, ck)) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", utf8_type, column_kind::partition_key); builder.with_column("ck", utf8_type, column_kind::clustering_key); builder.with_column("rc", utf8_type); @@ -3374,7 +3374,7 @@ SEASTAR_TEST_CASE(test_write_static_row) { return test_env::do_with_async([] (test_env& env) { sstring table_name = "static_row"; // CREATE TABLE static_row (pk text, ck int, st1 int static, st2 text static, PRIMARY KEY (pk, ck)) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", utf8_type, column_kind::partition_key); builder.with_column("ck", int32_type, column_kind::clustering_key); builder.with_column("st1", int32_type, column_kind::static_column); @@ -3396,7 +3396,7 @@ SEASTAR_TEST_CASE(test_write_composite_partition_key) { return test_env::do_with_async([] (test_env& env) { sstring table_name = "composite_partition_key"; // CREATE TABLE composite_partition_key (a int , b text, c boolean, d int, e text, f int, g text, PRIMARY KEY ((a, b, c), d, e)) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("a", int32_type, column_kind::partition_key); builder.with_column("b", utf8_type, column_kind::partition_key); builder.with_column("c", boolean_type, column_kind::partition_key); @@ -3423,7 +3423,7 @@ SEASTAR_TEST_CASE(test_write_composite_clustering_key) { return test_env::do_with_async([] (test_env& env) { sstring table_name = "composite_clustering_key"; // CREATE TABLE composite_clustering_key (a int , b text, c int, d text, e int, f text, PRIMARY KEY (a, b, c, d)) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("a", int32_type, column_kind::partition_key); builder.with_column("b", utf8_type, column_kind::clustering_key); builder.with_column("c", int32_type, column_kind::clustering_key); @@ -3449,7 +3449,7 @@ SEASTAR_TEST_CASE(test_write_wide_partitions) { return test_env::do_with_async([] (test_env& env) { sstring table_name = "wide_partitions"; // CREATE TABLE wide_partitions (pk text, ck text, st text, rc text, PRIMARY KEY (pk, ck) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", utf8_type, column_kind::partition_key); builder.with_column("ck", utf8_type, column_kind::clustering_key); builder.with_column("st", utf8_type, column_kind::static_column); @@ -3492,7 +3492,7 @@ SEASTAR_TEST_CASE(test_write_ttled_row) { return test_env::do_with_async([] (test_env& env) { sstring table_name = "ttled_row"; // CREATE TABLE ttled_row (pk int, ck int, rc int, PRIMARY KEY (pk, ck)) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", int32_type, column_kind::partition_key); builder.with_column("ck", int32_type, column_kind::clustering_key); builder.with_column("rc", int32_type); @@ -3523,7 +3523,7 @@ SEASTAR_TEST_CASE(test_write_ttled_column) { return test_env::do_with_async([] (test_env& env) { sstring table_name = "ttled_column"; // CREATE TABLE ttled_column (pk text, rc int, PRIMARY KEY (pk)) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", utf8_type, column_kind::partition_key); builder.with_column("rc", int32_type); builder.set_compressor_params(compression_parameters::no_compression()); @@ -3551,7 +3551,7 @@ SEASTAR_TEST_CASE(test_write_deleted_column) { return test_env::do_with_async([] (test_env& env) { sstring table_name = "deleted_column"; // CREATE TABLE deleted_column (pk int, rc int, PRIMARY KEY (pk)) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", int32_type, column_kind::partition_key); builder.with_column("rc", int32_type); builder.set_compressor_params(compression_parameters::no_compression()); @@ -3575,7 +3575,7 @@ SEASTAR_TEST_CASE(test_write_deleted_row) { return test_env::do_with_async([] (test_env& env) { sstring table_name = "deleted_row"; // CREATE TABLE deleted_row (pk int, ck int, PRIMARY KEY (pk, ck)) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", int32_type, column_kind::partition_key); builder.with_column("ck", int32_type, column_kind::clustering_key); builder.set_compressor_params(compression_parameters::no_compression()); @@ -3597,7 +3597,7 @@ SEASTAR_TEST_CASE(test_write_collection_wide_update) { sstring table_name = "collection_wide_update"; auto set_of_ints_type = set_type_impl::get_instance(int32_type, true); // CREATE TABLE collection_wide_update (pk int, col set, PRIMARY KEY (pk)) with compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", int32_type, column_kind::partition_key); builder.with_column("col", set_of_ints_type); builder.set_compressor_params(compression_parameters::no_compression()); @@ -3625,7 +3625,7 @@ SEASTAR_TEST_CASE(test_write_collection_incremental_update) { sstring table_name = "collection_incremental_update"; auto set_of_ints_type = set_type_impl::get_instance(int32_type, true); // CREATE TABLE collection_incremental_update (pk int, col set, PRIMARY KEY (pk)) with compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", int32_type, column_kind::partition_key); builder.with_column("col", set_of_ints_type); builder.set_compressor_params(compression_parameters::no_compression()); @@ -3648,7 +3648,7 @@ SEASTAR_TEST_CASE(test_write_multiple_partitions) { return test_env::do_with_async([] (test_env& env) { sstring table_name = "multiple_partitions"; // CREATE TABLE multiple_partitions (pk int, rc1 int, rc2 int, rc3 int, PRIMARY KEY (pk)) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", int32_type, column_kind::partition_key); builder.with_column("rc1", int32_type); builder.with_column("rc2", int32_type); @@ -3678,7 +3678,7 @@ SEASTAR_TEST_CASE(test_write_multiple_partitions) { static future<> test_write_many_partitions(sstring table_name, tombstone partition_tomb, compression_parameters cp) { return test_env::do_with_async([table_name, partition_tomb, cp] (test_env& env) { // CREATE TABLE (pk int, PRIMARY KEY (pk)) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", int32_type, column_kind::partition_key); builder.set_compressor_params(cp); schema_ptr s = builder.build(schema_builder::compact_storage::no); @@ -3750,7 +3750,7 @@ SEASTAR_TEST_CASE(test_write_multiple_rows) { return test_env::do_with_async([] (test_env& env) { sstring table_name = "multiple_rows"; // CREATE TABLE multiple_rows (pk int, ck int, rc1 int, rc2 int, rc3 int, PRIMARY KEY (pk, ck)) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", int32_type, column_kind::partition_key); builder.with_column("ck", int32_type, column_kind::clustering_key); builder.with_column("rc1", int32_type); @@ -3783,7 +3783,7 @@ SEASTAR_TEST_CASE(test_write_missing_columns_large_set) { return test_env::do_with_async([] (test_env& env) { sstring table_name = "missing_columns_large_set"; // CREATE TABLE missing_columns_large_set (pk int, ck int, rc1 int, ..., rc64 int, PRIMARY KEY (pk, ck)) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", int32_type, column_kind::partition_key); builder.with_column("ck", int32_type, column_kind::clustering_key); for (auto idx: std::views::iota(1, 65)) { @@ -3824,7 +3824,7 @@ SEASTAR_TEST_CASE(test_write_empty_counter) { return test_env::do_with_async([] (test_env& env) { sstring table_name = "empty_counter"; // CREATE TABLE empty_counter (pk text, ck text, val counter, PRIMARY KEY (pk, ck)) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", utf8_type, column_kind::partition_key); builder.with_column("ck", utf8_type, column_kind::clustering_key); builder.with_column("val", counter_type); @@ -3848,7 +3848,7 @@ SEASTAR_TEST_CASE(test_write_counter_table) { return test_env::do_with_async([] (test_env& env) { sstring table_name = "counter_table"; // CREATE TABLE counter_table (pk text, ck text, rc1 counter, rc2 counter, PRIMARY KEY (pk, ck)) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", utf8_type, column_kind::partition_key); builder.with_column("ck", utf8_type, column_kind::clustering_key); builder.with_column("rc1", counter_type); @@ -3899,7 +3899,7 @@ SEASTAR_TEST_CASE(test_write_different_types) { // smallintval smallint, timeval time, tsval timestamp, timeuuidval timeuuid, // tinyintval tinyint, uuidval uuid, varcharval varchar, varintval varint, // durationval duration, PRIMARY KEY (pk)) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", utf8_type, column_kind::partition_key); builder.with_column("asciival", ascii_type); builder.with_column("bigintval", long_type); @@ -3963,7 +3963,7 @@ SEASTAR_TEST_CASE(test_write_empty_clustering_values) { return test_env::do_with_async([] (test_env& env) { sstring table_name = "empty_clustering_values"; // CREATE TABLE empty_clustering_values (pk int, ck1 text, ck2 int, ck3 text, rc int, PRIMARY KEY (pk, ck1, ck2, ck3)) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", int32_type, column_kind::partition_key); builder.with_column("ck1", utf8_type, column_kind::clustering_key); builder.with_column("ck2", int32_type, column_kind::clustering_key); @@ -3988,7 +3988,7 @@ SEASTAR_TEST_CASE(test_write_large_clustering_key) { return test_env::do_with_async([] (test_env& env) { sstring table_name = "large_clustering_key"; // CREATE TABLE large_clustering_key (pk int, ck1 text, ck2 text, ..., ck35 text, rc int, PRIMARY KEY (pk, ck1, ck2, ..., ck35)) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", int32_type, column_kind::partition_key); for (auto idx: std::views::iota(1, 36)) { builder.with_column(to_bytes(format("ck{}", idx)), utf8_type, column_kind::clustering_key); @@ -4020,7 +4020,7 @@ SEASTAR_TEST_CASE(test_write_compact_table) { return test_env::do_with_async([] (test_env& env) { sstring table_name = "compact_table"; // CREATE TABLE compact_table (pk int, ck1 int, ck2 int, rc int, PRIMARY KEY (pk, ck1, ck2)) WITH compression = {'sstable_compression': ''} AND COMPACT STORAGE; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", int32_type, column_kind::partition_key); builder.with_column("ck1", int32_type, column_kind::clustering_key); builder.with_column("ck2", int32_type, column_kind::clustering_key); @@ -4048,7 +4048,7 @@ SEASTAR_TEST_CASE(test_write_user_defined_type_table) { sstring table_name = "user_defined_type_table"; // CREATE TABLE user_defined_type_table (pk int, rc frozen , PRIMARY KEY (pk)) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", int32_type, column_kind::partition_key); builder.with_column("rc", ut); builder.set_compressor_params(compression_parameters::no_compression()); @@ -4071,7 +4071,7 @@ SEASTAR_TEST_CASE(test_write_simple_range_tombstone) { return test_env::do_with_async([] (test_env& env) { sstring table_name = "simple_range_tombstone"; // CREATE TABLE simple_range_tombstone (pk int, ck1 text, ck2 text, rc text, PRIMARY KEY (pk, ck1, ck2)) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", int32_type, column_kind::partition_key); builder.with_column("ck1", utf8_type, column_kind::clustering_key); builder.with_column("ck2", utf8_type, column_kind::clustering_key); @@ -4096,7 +4096,7 @@ SEASTAR_TEST_CASE(test_write_adjacent_range_tombstones) { return test_env::do_with_async([] (test_env& env) { sstring table_name = "adjacent_range_tombstones"; // CREATE TABLE adjacent_range_tombstones (pk text, ck1 text, ck2 text, ck3 text, PRIMARY KEY (pk, ck1, ck2, ck3)) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", utf8_type, column_kind::partition_key); builder.with_column("ck1", utf8_type, column_kind::clustering_key); builder.with_column("ck2", utf8_type, column_kind::clustering_key); @@ -4137,7 +4137,7 @@ SEASTAR_TEST_CASE(test_write_non_adjacent_range_tombstones) { return test_env::do_with_async([] (test_env& env) { sstring table_name = "non_adjacent_range_tombstones"; // CREATE TABLE non_adjacent_range_tombstones (pk text, ck1 text, ck2 text, ck3 text, PRIMARY KEY (pk, ck1, ck2, ck3)) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", utf8_type, column_kind::partition_key); builder.with_column("ck1", utf8_type, column_kind::clustering_key); builder.with_column("ck2", utf8_type, column_kind::clustering_key); @@ -4176,7 +4176,7 @@ SEASTAR_TEST_CASE(test_write_mixed_rows_and_range_tombstones) { return test_env::do_with_async([] (test_env& env) { sstring table_name = "mixed_rows_and_range_tombstones"; // CREATE TABLE mixed_rows_and_range_tombstones (pk text, ck1 text, ck2 text, PRIMARY KEY (pk, ck1, ck2)) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", utf8_type, column_kind::partition_key); builder.with_column("ck1", utf8_type, column_kind::clustering_key); builder.with_column("ck2", utf8_type, column_kind::clustering_key); @@ -4248,7 +4248,7 @@ SEASTAR_TEST_CASE(test_write_many_range_tombstones) { sstring table_name = "many_range_tombstones"; // CREATE TABLE many_range_tombstones (pk text, ck1 text, ck2 text, PRIMARY KEY (pk, ck1, ck2) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", utf8_type, column_kind::partition_key); builder.with_column("ck1", utf8_type, column_kind::clustering_key); builder.with_column("ck2", utf8_type, column_kind::clustering_key); @@ -4278,7 +4278,7 @@ SEASTAR_TEST_CASE(test_write_adjacent_range_tombstones_with_rows) { return test_env::do_with_async([] (test_env& env) { sstring table_name = "adjacent_range_tombstones_with_rows"; // CREATE TABLE adjacent_range_tombstones_with_rows (pk text, ck1 text, ck2 text, ck3 text, PRIMARY KEY (pk, ck1, ck2, ck3)) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", utf8_type, column_kind::partition_key); builder.with_column("ck1", utf8_type, column_kind::clustering_key); builder.with_column("ck2", utf8_type, column_kind::clustering_key); @@ -4331,7 +4331,7 @@ SEASTAR_TEST_CASE(test_write_range_tombstone_same_start_with_row) { return test_env::do_with_async([] (test_env& env) { sstring table_name = "range_tombstone_same_start_with_row"; // CREATE TABLE range_tombstone_same_start_with_row (pk int, ck1 text, ck2 text, PRIMARY KEY (pk, ck1, ck2)) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", int32_type, column_kind::partition_key); builder.with_column("ck1", utf8_type, column_kind::clustering_key); builder.with_column("ck2", utf8_type, column_kind::clustering_key); @@ -4366,7 +4366,7 @@ SEASTAR_TEST_CASE(test_write_range_tombstone_same_end_with_row) { return test_env::do_with_async([] (test_env& env) { sstring table_name = "range_tombstone_same_end_with_row"; // CREATE TABLE range_tombstone_same_end_with_row (pk int, ck1 text, ck2 text, PRIMARY KEY (pk, ck1, ck2)) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", int32_type, column_kind::partition_key); builder.with_column("ck1", utf8_type, column_kind::clustering_key); builder.with_column("ck2", utf8_type, column_kind::clustering_key); @@ -4401,7 +4401,7 @@ SEASTAR_TEST_CASE(test_write_overlapped_start_range_tombstones) { return test_env::do_with_async([] (test_env& env) { sstring table_name = "overlapped_start_range_tombstones"; // CREATE TABLE overlapped_start_range_tombstones (pk int, ck1 text, ck2 text, PRIMARY KEY (pk, ck1, ck2)) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", int32_type, column_kind::partition_key); builder.with_column("ck1", utf8_type, column_kind::clustering_key); builder.with_column("ck2", utf8_type, column_kind::clustering_key); @@ -4450,7 +4450,7 @@ SEASTAR_TEST_CASE(test_write_two_non_adjacent_range_tombstones) { return test_env::do_with_async([] (test_env& env) { sstring table_name = "two_non_adjacent_range_tombstones"; // CREATE TABLE two_non_adjacent_range_tombstones (pk int, ck1 text, ck2 text, PRIMARY KEY (pk, ck1, ck2)) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", int32_type, column_kind::partition_key); builder.with_column("ck1", utf8_type, column_kind::clustering_key); builder.with_column("ck2", utf8_type, column_kind::clustering_key); @@ -4494,7 +4494,7 @@ SEASTAR_TEST_CASE(test_write_overlapped_range_tombstones) { return test_env::do_with_async([] (test_env& env) { sstring table_name = "overlapped_range_tombstones"; // CREATE TABLE overlapped_range_tombstones (pk text, ck1 text, ck2 text, ck3 text, PRIMARY KEY (pk, ck1, ck2, ck3)) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", utf8_type, column_kind::partition_key); builder.with_column("ck1", utf8_type, column_kind::clustering_key); builder.with_column("ck2", utf8_type, column_kind::clustering_key); @@ -4553,7 +4553,7 @@ shared_sstable make_test_sstable(test_env& env, schema_ptr schema, const sstring SEASTAR_TEST_CASE(test_read_empty_index) { return test_env::do_with_async([] (test_env& env) { sstring table_name = "empty_index"; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", utf8_type, column_kind::partition_key); builder.set_compressor_params(compression_parameters::no_compression()); schema_ptr s = builder.build(schema_builder::compact_storage::no); @@ -4570,7 +4570,7 @@ SEASTAR_TEST_CASE(test_read_rows_only_index) { return test_env::do_with_async([] (test_env& env) { sstring table_name = "rows_only_index"; // CREATE TABLE rows_only_index (pk text, ck text, st text, rc text, PRIMARY KEY (pk, ck) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", utf8_type, column_kind::partition_key); builder.with_column("ck", utf8_type, column_kind::clustering_key); builder.with_column("st", utf8_type, column_kind::static_column); @@ -4590,7 +4590,7 @@ SEASTAR_TEST_CASE(test_read_range_tombstones_only_index) { return test_env::do_with_async([] (test_env& env) { sstring table_name = "range_tombstones_only_index"; // CREATE TABLE range_tombstones_only_index (pk text, ck1 text, ck2 text, PRIMARY KEY (pk, ck1, ck2) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", utf8_type, column_kind::partition_key); builder.with_column("ck1", utf8_type, column_kind::clustering_key); builder.with_column("ck2", utf8_type, column_kind::clustering_key); @@ -4617,7 +4617,7 @@ SEASTAR_TEST_CASE(test_read_range_tombstone_boundaries_index) { return test_env::do_with_async([] (test_env& env) { sstring table_name = "range_tombstone_boundaries_index"; // CREATE TABLE range_tombstone_boundaries_index (pk text, ck1 text, ck2 text, PRIMARY KEY (pk, ck1, ck2) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", utf8_type, column_kind::partition_key); builder.with_column("ck1", utf8_type, column_kind::clustering_key); builder.with_column("ck2", utf8_type, column_kind::clustering_key); @@ -4632,7 +4632,7 @@ SEASTAR_TEST_CASE(test_read_range_tombstone_boundaries_index) { SEASTAR_TEST_CASE(test_read_table_empty_clustering_key) { return test_env::do_with_async([] (test_env& env) { // CREATE TABLE empty_clustering_key (pk int, v int, PRIMARY KEY (pk)) with compression = {'sstable_compression': ''}; - schema_builder builder("sst3", "empty_clustering_key"); + schema_builder builder(this_smp_shard_count(), "sst3", "empty_clustering_key"); builder.with_column("pk", int32_type, column_kind::partition_key); builder.with_column("v", int32_type); builder.set_compressor_params(compression_parameters::no_compression()); @@ -4663,7 +4663,7 @@ SEASTAR_TEST_CASE(test_complex_column_zero_subcolumns_read) { const sstring path = "test/resource/sstables/3.x/uncompressed/complex_column_zero_subcolumns"; - schema_ptr s = schema_builder("test_ks", "test_table") + schema_ptr s = schema_builder(this_smp_shard_count(), "test_ks", "test_table") .with_column("id", uuid_type, column_kind::partition_key) .with_column("bytes_in", long_type) .with_column("bytes_out", long_type) @@ -4716,7 +4716,7 @@ SEASTAR_TEST_CASE(test_uncompressed_read_two_rows_fast_forwarding) { static const sstring path = "test/resource/sstables/3.x/uncompressed/read_two_rows_fast_forwarding"; static thread_local const schema_ptr s = - schema_builder("test_ks", "two_rows_fast_forwarding") + schema_builder(this_smp_shard_count(), "test_ks", "two_rows_fast_forwarding") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key) .with_column("rc", int32_type) @@ -4769,7 +4769,7 @@ SEASTAR_TEST_CASE(test_dead_row_marker) { gc_clock::time_point tp = gc_clock::time_point{} + gc_clock::duration{1543494402}; sstring table_name = "dead_row_marker"; // CREATE TABLE dead_row_marker (pk int, ck int, st int static, rc int , PRIMARY KEY (pk, ck)) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", int32_type, column_kind::partition_key); builder.with_column("ck", int32_type, column_kind::clustering_key); builder.with_column("st", int32_type, column_kind::static_column); @@ -4802,7 +4802,7 @@ SEASTAR_TEST_CASE(test_shadowable_deletion) { * UPDATE cf SET v = 1 WHERE p = 1; */ sstring table_name = "shadowable_deletion"; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", int32_type, column_kind::partition_key); builder.with_column("ck", int32_type, column_kind::clustering_key); builder.set_compressor_params(compression_parameters::no_compression()); @@ -4841,7 +4841,7 @@ SEASTAR_TEST_CASE(test_regular_and_shadowable_deletion) { * UPDATE cf USING TIMESTAMP 1540230874370003 SET v = 1 WHERE p = 1 AND c = 1; */ sstring table_name = "regular_and_shadowable_deletion"; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("v", int32_type, column_kind::partition_key); builder.with_column("p", int32_type, column_kind::clustering_key); builder.with_column("c", int32_type, column_kind::clustering_key); @@ -4880,7 +4880,7 @@ SEASTAR_TEST_CASE(test_write_static_row_with_missing_columns) { return test_env::do_with_async([] (test_env& env) { sstring table_name = "static_row_with_missing_columns"; // CREATE TABLE static_row (pk int, ck int, st1 int static, st2 int static, rc int, PRIMARY KEY (pk, ck)) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", int32_type, column_kind::partition_key); builder.with_column("ck", int32_type, column_kind::clustering_key); builder.with_column("st1", int32_type, column_kind::static_column); @@ -4907,7 +4907,7 @@ SEASTAR_TEST_CASE(test_write_interleaved_atomic_and_collection_columns) { // CREATE TABLE interleaved_atomic_and_collection_columns ( pk int, ck int, rc1 int, rc2 set, rc3 int, rc4 set, // rc5 int, rc6 set, PRIMARY KEY (pk, ck)) WITH compression = {'sstable_compression': ''}; auto set_of_ints_type = set_type_impl::get_instance(int32_type, true); - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", int32_type, column_kind::partition_key); builder.with_column("ck", int32_type, column_kind::clustering_key); builder.with_column("rc1", int32_type); @@ -4947,7 +4947,7 @@ SEASTAR_TEST_CASE(test_write_static_interleaved_atomic_and_collection_columns) { // st2 set static, st3 int static, st4 set static, st5 int static, st6 set static, // PRIMARY KEY (pk, ck)) WITH compression = {'sstable_compression': ''}; auto set_of_ints_type = set_type_impl::get_instance(int32_type, true); - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", int32_type, column_kind::partition_key); builder.with_column("ck", int32_type, column_kind::clustering_key); builder.with_column("st1", int32_type, column_kind::static_column); @@ -4984,7 +4984,7 @@ SEASTAR_TEST_CASE(test_write_empty_static_row) { return test_env::do_with_async([] (test_env& env) { sstring table_name = "empty_static_row"; // CREATE TABLE empty_static_row (pk int, ck int, st int static, rc int, PRIMARY KEY (pk, ck)) WITH compression = {'sstable_compression': ''}; - schema_builder builder("sst3", table_name); + schema_builder builder(this_smp_shard_count(), "sst3", table_name); builder.with_column("pk", int32_type, column_kind::partition_key); builder.with_column("ck", int32_type, column_kind::clustering_key); builder.with_column("st", int32_type, column_kind::static_column); @@ -5022,7 +5022,7 @@ SEASTAR_TEST_CASE(test_read_missing_summary) { return test_env::do_with_async([] (test_env& env) { const sstring path = "test/resource/sstables/3.x/uncompressed/read_missing_summary"; const schema_ptr s = - schema_builder("test_ks", "test_table") + schema_builder(this_smp_shard_count(), "test_ks", "test_table") .with_column("pk", utf8_type, column_kind::partition_key) .with_column("ck", utf8_type, column_kind::clustering_key) .with_column("rc", utf8_type) @@ -5038,7 +5038,7 @@ SEASTAR_TEST_CASE(test_sstable_reader_on_unknown_column) { return test_env::do_with_async([] (test_env& env) { api::timestamp_type write_timestamp = 1525385507816568; auto get_builder = [&] (bool has_missing_column) { - auto builder = schema_builder("ks", "cf") + auto builder = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key); if (!has_missing_column) { @@ -5753,7 +5753,7 @@ SEASTAR_TEST_CASE(test_legacy_udt_in_collection_table) { auto l_type = list_type_impl::get_instance(ut, true); auto fl_type = list_type_impl::get_instance(ut, false); - auto s = schema_builder("ks", "t") + auto s = schema_builder(this_smp_shard_count(), "ks", "t") .with_column("pk", int32_type, column_kind::partition_key) .with_column("m", m_type) .with_column("fm", fm_type) @@ -5866,7 +5866,7 @@ SEASTAR_TEST_CASE(test_compression_premature_eof) { // Before the fixes, it would have resulted in an SCYLLA_ASSERT violation. SEASTAR_TEST_CASE(test_alter_bloom_fp_chance_during_write) { return test_env::do_with_async([] (test_env& env) { - auto s1 = schema_builder("ks", "t") + auto s1 = schema_builder(this_smp_shard_count(), "ks", "t") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("v", utf8_type, column_kind::regular_column) .set_bloom_filter_fp_chance(1.0) @@ -5903,7 +5903,7 @@ SEASTAR_TEST_CASE(test_alter_bloom_fp_chance_during_write) { // Before the fixes, it would result in a "compress is not supported" error. SEASTAR_TEST_CASE(test_alter_compression_during_write) { return test_env::do_with_async([] (test_env& env) { - auto s1 = schema_builder("ks", "t") + auto s1 = schema_builder(this_smp_shard_count(), "ks", "t") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("v", utf8_type, column_kind::regular_column) .set_compressor_params(std::map{ diff --git a/test/boost/sstable_compaction_test.cc b/test/boost/sstable_compaction_test.cc index a49373e2bb..ce407ac5ff 100644 --- a/test/boost/sstable_compaction_test.cc +++ b/test/boost/sstable_compaction_test.cc @@ -173,7 +173,7 @@ static void corrupt_sstable(sstables::shared_sstable sst, component_type type = void compaction_manager_basic(test_env& env) { BOOST_REQUIRE(smp::count == 1); - auto s = schema_builder(some_keyspace, some_column_family) + auto s = schema_builder(this_smp_shard_count(), some_keyspace, some_column_family) .with_column("p1", utf8_type, column_kind::partition_key) .with_column("c1", utf8_type, column_kind::clustering_key) .with_column("r1", int32_type) @@ -247,7 +247,7 @@ void compact(test_env& env) { // height int, // PRIMARY KEY (name) //); - auto builder = schema_builder("tests", "compaction") + auto builder = schema_builder(this_smp_shard_count(), "tests", "compaction") .with_column("name", utf8_type, column_kind::partition_key) .with_column("age", int32_type) .with_column("height", int32_type); @@ -379,7 +379,7 @@ static future compact_sstables(test_env& env, std::vect BOOST_REQUIRE(smp::count == 1); return seastar::async( [&env, sstables = std::move(sstables_to_compact), create_sstables, min_sstable_size, strategy] () mutable { - schema_builder builder(some_keyspace, some_column_family); + schema_builder builder(this_smp_shard_count(), some_keyspace, some_column_family); builder.with_column("p1", utf8_type, column_kind::partition_key); builder.with_column("c1", utf8_type, column_kind::clustering_key); builder.with_column("r1", utf8_type); @@ -469,7 +469,7 @@ static future compact_sstables(test_env& env, std::vect static future<> check_compacted_sstables(test_env& env, compact_sstables_result res) { return seastar::async([&env, res = std::move(res)] { - auto s = schema_builder(some_keyspace, some_column_family) + auto s = schema_builder(this_smp_shard_count(), some_keyspace, some_column_family) .with_column("p1", utf8_type, column_kind::partition_key) .with_column("c1", utf8_type, column_kind::clustering_key) .with_column("r1", utf8_type) @@ -1209,7 +1209,7 @@ SEASTAR_FIXTURE_TEST_CASE(leveled_invariant_fix_gcs, gcs_fixture, *tests::check_ } void leveled_stcs_on_L0_fn(test_env& env) { - schema_builder builder(some_keyspace, some_column_family); + schema_builder builder(this_smp_shard_count(), some_keyspace, some_column_family); builder.with_column("p1", utf8_type, column_kind::partition_key); builder.set_min_compaction_threshold(4); auto s = builder.build(schema_builder::compact_storage::no); @@ -1355,7 +1355,7 @@ future<> tombstone_purge(test_env& env) { BOOST_REQUIRE(smp::count == 1); // In a column family with gc_grace_seconds set to 0, check that a tombstone // is purged after compaction. - auto builder = schema_builder("tests", "tombstone_purge") + auto builder = schema_builder(this_smp_shard_count(), "tests", "tombstone_purge") .with_column("id", utf8_type, column_kind::partition_key) .with_column("value", int32_type); builder.set_gc_grace_seconds(0); @@ -1657,7 +1657,7 @@ future<> mv_tombstone_purge(test_env& env) { BOOST_REQUIRE(smp::count == 1); // In a column family with gc_grace_seconds set to 0, check that a tombstone // is purged after compaction. - auto builder = schema_builder("tests", "tombstone_purge") + auto builder = schema_builder(this_smp_shard_count(), "tests", "tombstone_purge") .with_column("id", utf8_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key) .with_column("value", int32_type); @@ -1763,7 +1763,7 @@ SEASTAR_FIXTURE_TEST_CASE(mv_tombstone_purge_gcs_test, gcs_fixture, *tests::chec future<> sstable_rewrite(test_env& env) { BOOST_REQUIRE(smp::count == 1); - auto s = schema_builder(some_keyspace, some_column_family) + auto s = schema_builder(this_smp_shard_count(), some_keyspace, some_column_family) .with_column("p1", utf8_type, column_kind::partition_key) .with_column("c1", utf8_type, column_kind::clustering_key) .with_column("r1", utf8_type) @@ -1823,7 +1823,7 @@ future<> sstable_max_local_deletion_time_2(test_env& env) { // Create sstable B with tombstone for column in sstable A with TTL 1000. // Compact them and expect that maximum deletion time is that of column with TTL 100. for (auto version : writable_sstable_versions) { - schema_builder builder(some_keyspace, some_column_family); + schema_builder builder(this_smp_shard_count(), some_keyspace, some_column_family); builder.with_column("p1", utf8_type, column_kind::partition_key); builder.with_column("c1", utf8_type, column_kind::clustering_key); builder.with_column("r1", utf8_type); @@ -1943,7 +1943,7 @@ SEASTAR_FIXTURE_TEST_CASE(get_fully_expired_sstables_gcs_test, gcs_fixture, *tes } void compaction_with_fully_expired_table_fn(test_env& env) { - auto builder = schema_builder("la", "cf") + auto builder = schema_builder(this_smp_shard_count(), "la", "cf") .with_column("pk", utf8_type, column_kind::partition_key) .with_column("ck1", utf8_type, column_kind::clustering_key) .with_column("r1", int32_type); @@ -2017,7 +2017,7 @@ void time_window_strategy_ts_resolution_check_fn(test_env& env) { auto ts_in_ms = std::chrono::milliseconds(ts); auto ts_in_us = std::chrono::duration_cast(ts_in_ms); - auto s = schema_builder("tests", "time_window_strategy") + auto s = schema_builder(this_smp_shard_count(), "tests", "time_window_strategy") .with_column("id", utf8_type, column_kind::partition_key) .with_column("value", int32_type).build(); @@ -2066,7 +2066,7 @@ SEASTAR_FIXTURE_TEST_CASE(time_window_strategy_ts_resolution_check_gcs, gcs_fixt void time_window_strategy_correctness_fn(test_env& env) { using namespace std::chrono; - auto builder = schema_builder("tests", "time_window_strategy") + auto builder = schema_builder(this_smp_shard_count(), "tests", "time_window_strategy") .with_column("id", utf8_type, column_kind::partition_key) .with_column("value", int32_type); builder.set_compaction_strategy(compaction::compaction_strategy_type::time_window); @@ -2177,7 +2177,7 @@ SEASTAR_FIXTURE_TEST_CASE(time_window_strategy_correctness_gcs_test, gcs_fixture // the past windows that were already previously compacted into a single SSTable. void time_window_strategy_size_tiered_behavior_correctness_fn(test_env& env) { using namespace std::chrono; - auto builder = schema_builder("tests", "time_window_strategy") + auto builder = schema_builder(this_smp_shard_count(), "tests", "time_window_strategy") .with_column("id", utf8_type, column_kind::partition_key) .with_column("value", int32_type); builder.set_compaction_strategy(compaction::compaction_strategy_type::time_window); @@ -2286,7 +2286,7 @@ static void check_min_max_column_names(const sstable_ptr& sst, std::vector min_max_clustering_key_2(test_env& env) { for (const auto version : writable_sstable_versions) { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", utf8_type, column_kind::partition_key) .with_column("ck1", utf8_type, column_kind::clustering_key) .with_column("r1", int32_type) @@ -2379,7 +2379,7 @@ SEASTAR_FIXTURE_TEST_CASE(size_tiered_beyond_max_threshold_gcs_test, gcs_fixture void sstable_expired_data_ratio(test_env& env) { auto make_schema = [&] (std::string_view cf, compaction::compaction_strategy_type cst) { - auto builder = schema_builder("tests", cf) + auto builder = schema_builder(this_smp_shard_count(), "tests", cf) .with_column("p1", utf8_type, column_kind::partition_key) .with_column("c1", utf8_type, column_kind::clustering_key) .with_column("r1", utf8_type); @@ -2513,7 +2513,7 @@ SEASTAR_FIXTURE_TEST_CASE(sstable_expired_data_ratio_gcs_test, gcs_fixture, *tes } void compaction_correctness_with_partitioned_sstable_set_fn(test_env& env) { - auto builder = schema_builder("tests", "tombstone_purge") + auto builder = schema_builder(this_smp_shard_count(), "tests", "tombstone_purge") .with_column("id", utf8_type, column_kind::partition_key) .with_column("value", int32_type); builder.set_gc_grace_seconds(0); @@ -2632,7 +2632,7 @@ SEASTAR_FIXTURE_TEST_CASE(compaction_correctness_with_partitioned_sstable_set_gc void sstable_cleanup_correctness_fn(cql_test_env& cql_env, test_env& env) { auto& db = cql_env.local_db(); auto ks_name = "ks"; // single_node_cql_env::ks_name - auto s = schema_builder(ks_name, "correcness_test") + auto s = schema_builder(this_smp_shard_count(), ks_name, "correcness_test") .with_column("id", utf8_type, column_kind::partition_key) .with_column("value", int32_type).build(); @@ -3201,7 +3201,7 @@ SEASTAR_THREAD_TEST_CASE(sstable_scrub_validate_mode_test_multiple_instances_unc // {'chunk_length_in_kb': '4', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'} for the compressed case. static schema_builder make_cassandra_schema_builder() { - return schema_builder("test_ks", "test_table") + return schema_builder(this_smp_shard_count(), "test_ks", "test_table") .with_column("pk", int32_type, column_kind::partition_key) .with_column("bool_val", boolean_type) .with_column("double_val", double_type) @@ -3297,7 +3297,7 @@ SEASTAR_THREAD_TEST_CASE(sstable_scrub_validate_mode_test_corrupted_file_digest_ void sstable_validate_fn(test_env& env) { for (const auto sst_version : {sstable_version_types::me, sstable_version_types::ms}) { - auto schema = schema_builder("ks", testing::seastar_test::get_name()) + auto schema = schema_builder(this_smp_shard_count(), "ks", testing::seastar_test::get_name()) .with_column("pk", utf8_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key) .with_column("s", int32_type, column_kind::static_column) @@ -3851,7 +3851,7 @@ SEASTAR_THREAD_TEST_CASE(test_scrub_segregate_stack) { } SEASTAR_THREAD_TEST_CASE(sstable_scrub_reader_test) { - auto schema = schema_builder("ks", get_name()) + auto schema = schema_builder(this_smp_shard_count(), "ks", get_name()) .with_column("pk", utf8_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key) .with_column("s", int32_type, column_kind::static_column) @@ -3991,7 +3991,7 @@ SEASTAR_FIXTURE_TEST_CASE(scrubbed_sstable_removal_test_gcs, gcs_fixture, *tests // Test to verify that `scrub --validate` is not affected by a concurrent regular compaction void compact_uncompressed_sstable_during_scrub_validate_fn(test_env& env) { - auto s = schema_builder("unlinked_sstable_scrub_test", "t1") + auto s = schema_builder(this_smp_shard_count(), "unlinked_sstable_scrub_test", "t1") .with_column("pk", utf8_type, column_kind::partition_key) .with_column("ck", utf8_type, column_kind::clustering_key) .with_column("v", utf8_type) @@ -4063,7 +4063,7 @@ SEASTAR_FIXTURE_TEST_CASE(compact_uncompressed_sstable_during_scrub_validate_tes } void sstable_run_based_compaction_fn(test_env& env) { - auto builder = schema_builder("tests", "sstable_run_based_compaction_test") + auto builder = schema_builder(this_smp_shard_count(), "tests", "sstable_run_based_compaction_test") .with_column("id", utf8_type, column_kind::partition_key) .with_column("value", int32_type); auto s = builder.build(); @@ -4196,7 +4196,7 @@ SEASTAR_FIXTURE_TEST_CASE(sstable_run_based_compaction_test_gcs, gcs_fixture, *t } void compaction_strategy_aware_major_compaction_fn(test_env& env) { - auto s = schema_builder("tests", "compaction_strategy_aware_major_compaction_test") + auto s = schema_builder(this_smp_shard_count(), "tests", "compaction_strategy_aware_major_compaction_test") .with_column("id", utf8_type, column_kind::partition_key) .with_column("value", int32_type).build(); @@ -4246,7 +4246,7 @@ SEASTAR_FIXTURE_TEST_CASE(compaction_strategy_aware_major_compaction_test_gcs, g } void backlog_tracker_correctness_after_changing_compaction_strategy_fn(test_env& env) { - auto builder = schema_builder("tests", "backlog_tracker_correctness_after_changing_compaction_strategy") + auto builder = schema_builder(this_smp_shard_count(), "tests", "backlog_tracker_correctness_after_changing_compaction_strategy") .with_column("id", utf8_type, column_kind::partition_key) .with_column("value", int32_type); auto s = builder.build(); @@ -4314,7 +4314,7 @@ SEASTAR_FIXTURE_TEST_CASE(backlog_tracker_correctness_after_changing_compaction_ void partial_sstable_run_filtered_out_fn(test_env& env) { BOOST_REQUIRE(smp::count == 1); - auto s = schema_builder("tests", "partial_sstable_run_filtered_out_test") + auto s = schema_builder(this_smp_shard_count(), "tests", "partial_sstable_run_filtered_out_test") .with_column("id", utf8_type, column_kind::partition_key) .with_column("value", int32_type).build(); @@ -4367,7 +4367,7 @@ SEASTAR_FIXTURE_TEST_CASE(partial_sstable_run_filtered_out_test_gcs, gcs_fixture // from the regular compaction's input sstable. void purged_tombstone_consumer_sstable_fn(test_env& env) { BOOST_REQUIRE(smp::count == 1); - auto builder = schema_builder("tests", "purged_tombstone_consumer_sstable_test") + auto builder = schema_builder(this_smp_shard_count(), "tests", "purged_tombstone_consumer_sstable_test") .with_column("id", utf8_type, column_kind::partition_key) .with_column("value", int32_type); builder.set_gc_grace_seconds(0); @@ -4530,7 +4530,7 @@ SEASTAR_FIXTURE_TEST_CASE(purged_tombstone_consumer_sstable_test_gcs, gcs_fixtur void incremental_compaction_data_resurrection_fn(test_env& env) { // In a column family with gc_grace_seconds set to 0, check that a tombstone // is purged after compaction. - auto builder = schema_builder("tests", "incremental_compaction_data_resurrection_test") + auto builder = schema_builder(this_smp_shard_count(), "tests", "incremental_compaction_data_resurrection_test") .with_column("id", utf8_type, column_kind::partition_key) .with_column("value", int32_type); builder.set_gc_grace_seconds(0); @@ -4662,7 +4662,7 @@ void twcs_major_compaction_fn(test_env& env) { // are compacted to the same SSTable. // In a column family with gc_grace_seconds set to 0, check that a tombstone // is purged after compaction. - auto builder = schema_builder("tests", "twcs_major") + auto builder = schema_builder(this_smp_shard_count(), "tests", "twcs_major") .with_column("id", utf8_type, column_kind::partition_key) .with_column("cl", int32_type, column_kind::clustering_key) .with_column("value", int32_type); @@ -4724,7 +4724,7 @@ SEASTAR_FIXTURE_TEST_CASE(twcs_major_compaction_test_gcs, gcs_fixture, *tests::c } void autocompaction_control_fn(test_env& env) { - auto s = schema_builder(some_keyspace, some_column_family) + auto s = schema_builder(this_smp_shard_count(), some_keyspace, some_column_family) .with_column("id", utf8_type, column_kind::partition_key) .with_column("value", int32_type) .build(); @@ -4797,7 +4797,7 @@ SEASTAR_FIXTURE_TEST_CASE(autocompaction_control_test_gcs, gcs_fixture, *tests:: // void test_bug_6472_fn(test_env& env) { - auto builder = schema_builder("tests", "test_bug_6472") + auto builder = schema_builder(this_smp_shard_count(), "tests", "test_bug_6472") .with_column("id", utf8_type, column_kind::partition_key) .with_column("cl", int32_type, column_kind::clustering_key) .with_column("value", int32_type); @@ -4872,7 +4872,7 @@ SEASTAR_FIXTURE_TEST_CASE(test_bug_6472_gcs, gcs_fixture, *tests::check_run_test } void sstable_needs_cleanup_fn(test_env& env) { - auto s = schema_builder(some_keyspace, some_column_family).with_column("p1", utf8_type, column_kind::partition_key).build(); + auto s = schema_builder(this_smp_shard_count(), some_keyspace, some_column_family).with_column("p1", utf8_type, column_kind::partition_key).build(); const auto keys = tests::generate_partition_keys(10, s); auto sst_gen = [&env, s] (const dht::decorated_key& first, const dht::decorated_key& last) mutable { @@ -4918,7 +4918,7 @@ SEASTAR_FIXTURE_TEST_CASE(sstable_needs_cleanup_gcs_test, gcs_fixture, *tests::c } void test_twcs_partition_estimate_fn(test_env& env) { - auto builder = schema_builder("tests", "test_bug_6472") + auto builder = schema_builder(this_smp_shard_count(), "tests", "test_bug_6472") .with_column("id", utf8_type, column_kind::partition_key) .with_column("cl", int32_type, column_kind::clustering_key) .with_column("value", int32_type); @@ -5105,7 +5105,7 @@ SEASTAR_FIXTURE_TEST_CASE(lcs_reshape_gcs_test, gcs_fixture, *tests::check_run_t future<> test_twcs_interposer_on_memtable_flush(bool split_during_flush, test_env_config cfg = {}) { return test_env::do_with_async([split_during_flush] (test_env& env) { - auto builder = schema_builder("tests", "test_twcs_interposer_on_flush") + auto builder = schema_builder(this_smp_shard_count(), "tests", "test_twcs_interposer_on_flush") .with_column("id", utf8_type, column_kind::partition_key) .with_column("cl", int32_type, column_kind::clustering_key) .with_column("value", int32_type); @@ -5177,7 +5177,7 @@ SEASTAR_FIXTURE_TEST_CASE(test_twcs_interposer_on_memtable_flush_no_split_gcs, g } void test_twcs_compaction_across_buckets_fn(test_env& env) { - auto builder = schema_builder("tests", "test_twcs_compaction_across_buckets") + auto builder = schema_builder(this_smp_shard_count(), "tests", "test_twcs_compaction_across_buckets") .with_column("id", utf8_type, column_kind::partition_key) .with_column("cl", int32_type, column_kind::clustering_key) .with_column("value", int32_type); @@ -5292,7 +5292,7 @@ SEASTAR_FIXTURE_TEST_CASE(test_offstrategy_sstable_compaction_gcs, gcs_fixture, } void twcs_reshape_with_disjoint_set_fn(test_env& env, unsigned disjoint_sstable_count = 256) { - auto builder = schema_builder("tests", "twcs_reshape_test") + auto builder = schema_builder(this_smp_shard_count(), "tests", "twcs_reshape_test") .with_column("id", utf8_type, column_kind::partition_key) .with_column("cl", ::timestamp_type, column_kind::clustering_key) .with_column("value", int32_type); @@ -5493,7 +5493,7 @@ SEASTAR_FIXTURE_TEST_CASE(twcs_reshape_with_disjoint_set_gcs_test, gcs_fixture, } void stcs_reshape_overlapping_fn(test_env& env, unsigned disjoint_sstable_count = 256) { - auto builder = schema_builder("tests", "stcs_reshape_test") + auto builder = schema_builder(this_smp_shard_count(), "tests", "stcs_reshape_test") .with_column("id", utf8_type, column_kind::partition_key) .with_column("cl", ::timestamp_type, column_kind::clustering_key) .with_column("value", int32_type); @@ -5555,7 +5555,7 @@ SEASTAR_FIXTURE_TEST_CASE(stcs_reshape_overlapping_gcs_test, gcs_fixture, *tests // Regression test for #8432 void test_twcs_single_key_reader_filtering_fn(test_env& env) { - auto builder = schema_builder("tests", "twcs_single_key_reader_filtering") + auto builder = schema_builder(this_smp_shard_count(), "tests", "twcs_single_key_reader_filtering") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key) .with_column("v", int32_type); @@ -5633,7 +5633,7 @@ void max_ongoing_compaction_fn(test_env& env) { BOOST_REQUIRE(smp::count == 1); auto make_schema = [] (auto idx) { - auto builder = schema_builder("tests", std::to_string(idx)) + auto builder = schema_builder(this_smp_shard_count(), "tests", std::to_string(idx)) .with_column("id", utf8_type, column_kind::partition_key) .with_column("cl", int32_type, column_kind::clustering_key) .with_column("value", int32_type); @@ -5767,7 +5767,7 @@ SEASTAR_FIXTURE_TEST_CASE(max_ongoing_compaction_test_gcs, gcs_fixture, *tests:: } void compound_sstable_set_incremental_selector_fn(test_env& env) { - auto s = schema_builder(some_keyspace, some_column_family).with_column("p1", utf8_type, column_kind::partition_key).build(); + auto s = schema_builder(this_smp_shard_count(), some_keyspace, some_column_family).with_column("p1", utf8_type, column_kind::partition_key).build(); auto cs = compaction::make_compaction_strategy(compaction::compaction_strategy_type::leveled, s->compaction_strategy_options()); const auto keys = tests::generate_partition_keys(8, s); @@ -5891,7 +5891,7 @@ SEASTAR_FIXTURE_TEST_CASE(compound_sstable_set_incremental_selector_gcs_test, gc } void twcs_single_key_reader_through_compound_set_fn(test_env& env) { - auto builder = schema_builder("tests", "single_key_reader_through_compound_set_test") + auto builder = schema_builder(this_smp_shard_count(), "tests", "single_key_reader_through_compound_set_test") .with_column("id", utf8_type, column_kind::partition_key) .with_column("cl", ::timestamp_type, column_kind::clustering_key) .with_column("value", int32_type); @@ -6026,7 +6026,7 @@ SEASTAR_FIXTURE_TEST_CASE(basic_ics_controller_correctness_gcs_test, gcs_fixture } void test_major_does_not_miss_data_in_memtable_fn(test_env& env) { - auto builder = schema_builder("tests", "test_major_does_not_miss_data_in_memtable") + auto builder = schema_builder(this_smp_shard_count(), "tests", "test_major_does_not_miss_data_in_memtable") .with_column("id", utf8_type, column_kind::partition_key) .with_column("cl", int32_type, column_kind::clustering_key) .with_column("value", int32_type); @@ -6256,7 +6256,7 @@ void test_compaction_strategy_cleanup_method_fn(test_env& env, size_t all_files std::map strategy_options = {}, const api::timestamp_clock::duration step_base = 0ms, unsigned sstable_level = 0) { - auto builder = schema_builder("tests", "test_compaction_strategy_cleanup_method") + auto builder = schema_builder(this_smp_shard_count(), "tests", "test_compaction_strategy_cleanup_method") .with_column("id", utf8_type, column_kind::partition_key) .with_column("cl", int32_type, column_kind::clustering_key) .with_column("value", int32_type); @@ -6353,7 +6353,7 @@ SEASTAR_FIXTURE_TEST_CASE(test_compaction_strategy_cleanup_method_gcs, gcs_fixtu } void test_large_partition_splitting_on_compaction_fn(test_env& env) { - auto builder = schema_builder("tests", "test_large_partition_splitting_on_compaction") + auto builder = schema_builder(this_smp_shard_count(), "tests", "test_large_partition_splitting_on_compaction") .with_column("id", utf8_type, column_kind::partition_key) .with_column("cl", int32_type, column_kind::clustering_key) .with_column("value", int32_type); @@ -6605,7 +6605,7 @@ SEASTAR_FIXTURE_TEST_CASE(test_print_shared_sstables_vector_gcs, gcs_fixture, *t } void tombstone_gc_disabled_fn(test_env& env) { - auto builder = schema_builder("tests", "tombstone_purge") + auto builder = schema_builder(this_smp_shard_count(), "tests", "tombstone_purge") .with_column("id", utf8_type, column_kind::partition_key) .with_column("value", int32_type); builder.set_gc_grace_seconds(0); @@ -6710,7 +6710,7 @@ SEASTAR_FIXTURE_TEST_CASE(tombstone_gc_disabled_test_gcs, gcs_fixture, *tests::c // against uncompacting sstable, during compaction. void compaction_optimization_to_avoid_bloom_filter_checks_fn(test_env& env) { - auto builder = schema_builder("tests", "tombstone_purge") + auto builder = schema_builder(this_smp_shard_count(), "tests", "tombstone_purge") .with_column("id", utf8_type, column_kind::partition_key) .with_column("value", int32_type); builder.set_gc_grace_seconds(10000); @@ -6773,7 +6773,7 @@ SEASTAR_FIXTURE_TEST_CASE(compaction_optimization_to_avoid_bloom_filter_checks_g static future<> run_incremental_compaction_test(sstables::offstrategy offstrategy, std::function(table_for_tests&, compaction::owned_ranges_ptr)> run_compaction, test_env_config cfg = {}) { return test_env::do_with_async([run_compaction = std::move(run_compaction), offstrategy] (test_env& env) { - auto builder = schema_builder("tests", "test") + auto builder = schema_builder(this_smp_shard_count(), "tests", "test") .with_column("id", utf8_type, column_kind::partition_key) .with_column("value", int32_type); builder.set_gc_grace_seconds(10000); @@ -6928,7 +6928,7 @@ SEASTAR_FIXTURE_TEST_CASE(offstrategy_incremental_compaction_gcs_test, gcs_fixtu } void cleanup_during_offstrategy_incremental_compaction_fn(test_env& env) { - auto builder = schema_builder("tests", "test") + auto builder = schema_builder(this_smp_shard_count(), "tests", "test") .with_column("id", utf8_type, column_kind::partition_key) .with_column("value", int32_type); builder.set_gc_grace_seconds(10000); @@ -7115,7 +7115,7 @@ SEASTAR_FIXTURE_TEST_CASE(test_sstables_excluding_staging_correctness_gs, gcs_fi // Reproducer for https://github.com/scylladb/scylladb/issues/15726. void produces_optimal_filter_by_estimating_correctly_partitions_per_sstable_fn(test_env& env) { - auto builder = schema_builder("tests", "test") + auto builder = schema_builder(this_smp_shard_count(), "tests", "test") .with_column("id", utf8_type, column_kind::partition_key) .with_column("value", int32_type); builder.set_compressor_params(compression_parameters::no_compression()); @@ -7179,7 +7179,7 @@ SEASTAR_FIXTURE_TEST_CASE(produces_optimal_filter_by_estimating_correctly_partit } void splitting_compaction_fn(test_env& env) { - auto builder = schema_builder("tests", "twcs_splitting") + auto builder = schema_builder(this_smp_shard_count(), "tests", "twcs_splitting") .with_column("id", utf8_type, column_kind::partition_key) .with_column("cl", int32_type, column_kind::clustering_key) .with_column("value", int32_type); @@ -7296,7 +7296,7 @@ SEASTAR_FIXTURE_TEST_CASE(splitting_compaction_test_gcs, gcs_fixture, *tests::ch void unsealed_sstable_compaction_fn(test_env& env) { BOOST_REQUIRE(smp::count == 1); - auto s = schema_builder("tests", "unsealed_sstable_compaction_test") + auto s = schema_builder(this_smp_shard_count(), "tests", "unsealed_sstable_compaction_test") .with_column("id", utf8_type, column_kind::partition_key) .with_column("value", int32_type).build(); diff --git a/test/boost/sstable_datafile_test.cc b/test/boost/sstable_datafile_test.cc index bdddf60a5b..afcdc8ad9a 100644 --- a/test/boost/sstable_datafile_test.cc +++ b/test/boost/sstable_datafile_test.cc @@ -87,7 +87,7 @@ static void assert_sstable_set_size(const sstable_set& s, size_t expected_size) SEASTAR_TEST_CASE(datafile_generation_09) { // Test that generated sstable components can be successfully loaded. return test_env::do_with_async([] (test_env& env) { - auto s = schema_builder(some_keyspace, some_column_family) + auto s = schema_builder(this_smp_shard_count(), some_keyspace, some_column_family) .with_column("p1", utf8_type, column_kind::partition_key) .with_column("c1", utf8_type, column_kind::clustering_key) .with_column("r1", int32_type) @@ -378,7 +378,7 @@ SEASTAR_TEST_CASE(datafile_generation_39) { SEASTAR_TEST_CASE(datafile_generation_41) { return test_env::do_with_async([] (test_env& env) { - auto s = schema_builder(some_keyspace, some_column_family) + auto s = schema_builder(this_smp_shard_count(), some_keyspace, some_column_family) .with_column("p1", utf8_type, column_kind::partition_key) .with_column("c1", utf8_type, column_kind::clustering_key) .with_column("r1", int32_type) @@ -404,7 +404,7 @@ SEASTAR_TEST_CASE(datafile_generation_41) { SEASTAR_TEST_CASE(datafile_generation_47) { // Tests the problem in which the sstable row parser would hang. return test_env::do_with_async([] (test_env& env) { - auto s = schema_builder(some_keyspace, some_column_family) + auto s = schema_builder(this_smp_shard_count(), some_keyspace, some_column_family) .with_column("p1", utf8_type, column_kind::partition_key) .with_column("c1", utf8_type, column_kind::clustering_key) .with_column("r1", utf8_type) @@ -426,7 +426,7 @@ SEASTAR_TEST_CASE(datafile_generation_47) { SEASTAR_TEST_CASE(test_counter_write) { return test_env::do_with_async([] (test_env& env) { - auto s = schema_builder(some_keyspace, some_column_family) + auto s = schema_builder(this_smp_shard_count(), some_keyspace, some_column_family) .with_column("p1", utf8_type, column_kind::partition_key) .with_column("c1", utf8_type, column_kind::clustering_key) .with_column("r1", counter_type) @@ -481,7 +481,7 @@ SEASTAR_TEST_CASE(check_read_indexes) { return make_ready_future<>(); } return seastar::async([&env, version] { - auto builder = schema_builder("test", "summary_test") + auto builder = schema_builder(this_smp_shard_count(), "test", "summary_test") .with_column("a", int32_type, column_kind::partition_key); builder.set_min_index_interval(256); auto s = builder.build(); @@ -515,7 +515,7 @@ SEASTAR_TEST_CASE(check_multi_schema) { for_each_sstable_version([&env] (const sstables::sstable::version_types version) { return seastar::async([&env, version] { auto set_of_ints_type = set_type_impl::get_instance(int32_type, true); - auto builder = schema_builder("test", "test_multi_schema") + auto builder = schema_builder(this_smp_shard_count(), "test", "test_multi_schema") .with_column("a", int32_type, column_kind::partition_key) .with_column("c", set_of_ints_type) .with_column("d", int32_type) @@ -611,7 +611,7 @@ SEASTAR_TEST_CASE(test_sliced_mutation_reads) { return test_env::do_with_async([] (test_env& env) { for (auto version : all_sstable_versions) { auto set_of_ints_type = set_type_impl::get_instance(int32_type, true); - auto builder = schema_builder("ks", "sliced_mutation_reads_test") + auto builder = schema_builder(this_smp_shard_count(), "ks", "sliced_mutation_reads_test") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key) .with_column("v1", int32_type) @@ -701,7 +701,7 @@ SEASTAR_TEST_CASE(test_wrong_range_tombstone_order) { return test_env::do_with_async([] (test_env& env) { for (const auto version : all_sstable_versions) { - auto s = schema_builder("ks", "wrong_range_tombstone_order") + auto s = schema_builder(this_smp_shard_count(), "ks", "wrong_range_tombstone_order") .with(schema_builder::compact_storage::yes) .with_column("p", int32_type, column_kind::partition_key) .with_column("a", int32_type, column_kind::clustering_key) @@ -770,7 +770,7 @@ SEASTAR_TEST_CASE(test_counter_read) { return test_env::do_with_async([] (test_env& env) { for (const auto version : all_sstable_versions) { - auto s = schema_builder("ks", "counter_test") + auto s = schema_builder(this_smp_shard_count(), "ks", "counter_test") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key) .with_column("c1", counter_type) @@ -842,7 +842,7 @@ SEASTAR_TEST_CASE(test_counter_read) { SEASTAR_TEST_CASE(test_sstable_max_local_deletion_time) { return test_env::do_with_async([] (test_env& env) { for (const auto version : writable_sstable_versions) { - schema_builder builder(some_keyspace, some_column_family); + schema_builder builder(this_smp_shard_count(), some_keyspace, some_column_family); builder.with_column("p1", utf8_type, column_kind::partition_key); builder.with_column("c1", utf8_type, column_kind::clustering_key); builder.with_column("r1", utf8_type); @@ -895,7 +895,7 @@ SEASTAR_TEST_CASE(test_promoted_index_read) { return test_env::do_with_async([] (test_env& env) { for (const auto version : all_sstable_versions) { - auto s = schema_builder("ks", "promoted_index_read") + auto s = schema_builder(this_smp_shard_count(), "ks", "promoted_index_read") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck1", int32_type, column_kind::clustering_key) .with_column("ck2", int32_type, column_kind::clustering_key) @@ -979,7 +979,7 @@ SEASTAR_TEST_CASE(min_max_clustering_key_test) { return test_env::do_with_async([] (test_env& env) { for (auto version : writable_sstable_versions) { { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", utf8_type, column_kind::partition_key) .with_column("ck1", utf8_type, column_kind::clustering_key) .with_column("ck2", utf8_type, column_kind::clustering_key) @@ -989,7 +989,7 @@ SEASTAR_TEST_CASE(min_max_clustering_key_test) { {"a", "c"}}, {"a", "b"}, {"a", "c"}, version); } { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with(schema_builder::compact_storage::yes) .with_column("pk", utf8_type, column_kind::partition_key) .with_column("ck1", utf8_type, column_kind::clustering_key) @@ -1000,7 +1000,7 @@ SEASTAR_TEST_CASE(min_max_clustering_key_test) { {"a", "c"}}, {"a", "b"}, {"a", "c"}, version); } { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", utf8_type, column_kind::partition_key) .with_column("ck1", utf8_type, column_kind::clustering_key) .with_column("ck2", utf8_type, column_kind::clustering_key) @@ -1010,7 +1010,7 @@ SEASTAR_TEST_CASE(min_max_clustering_key_test) { test_min_max_clustering_key(env, s, {"key1"}, {{"b", "a"}, {"a", "c"}}, {"a", "c"}, {"b", "a"}, version); } { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with(schema_builder::compact_storage::yes) .with_column("pk", utf8_type, column_kind::partition_key) .with_column("ck1", utf8_type, column_kind::clustering_key) @@ -1021,7 +1021,7 @@ SEASTAR_TEST_CASE(min_max_clustering_key_test) { test_min_max_clustering_key(env, s, {"key1"}, {{"b", "a"}, {"a", "c"}}, {"a", "c"}, {"b", "a"}, version); } { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", utf8_type, column_kind::partition_key) .with_column("ck1", utf8_type, column_kind::clustering_key) .with_column("ck2", reversed_type_impl::get_instance(utf8_type), column_kind::clustering_key) @@ -1031,7 +1031,7 @@ SEASTAR_TEST_CASE(min_max_clustering_key_test) { test_min_max_clustering_key(env, s, {"key1"}, {{"a", "a"}, {"a", "z"}}, {"a", "z"}, {"a", "a"}, version); } { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", utf8_type, column_kind::partition_key) .with_column("ck1", utf8_type, column_kind::clustering_key) .with_column("ck2", reversed_type_impl::get_instance(utf8_type), column_kind::clustering_key) @@ -1041,7 +1041,7 @@ SEASTAR_TEST_CASE(min_max_clustering_key_test) { test_min_max_clustering_key(env, s, {"key1"}, {{"b", "z"}, {"a", "a"}}, {"a", "a"}, {"b", "z"}, version); } { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", utf8_type, column_kind::partition_key) .with_column("ck1", utf8_type, column_kind::clustering_key) .with_column("r1", int32_type) @@ -1050,7 +1050,7 @@ SEASTAR_TEST_CASE(min_max_clustering_key_test) { {"z"}}, {"a"}, {"z"}, version); } { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", utf8_type, column_kind::partition_key) .with_column("ck1", utf8_type, column_kind::clustering_key) .with_column("r1", int32_type) @@ -1059,7 +1059,7 @@ SEASTAR_TEST_CASE(min_max_clustering_key_test) { {"z"}}, {"a"}, {"z"}, version, true); } { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", utf8_type, column_kind::partition_key) .with_column("r1", int32_type) .build(); @@ -1067,7 +1067,7 @@ SEASTAR_TEST_CASE(min_max_clustering_key_test) { } if (version >= sstable_version_types::mc) { { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with(schema_builder::compact_storage::yes) .with_column("pk", utf8_type, column_kind::partition_key) .with_column("ck1", utf8_type, column_kind::clustering_key) @@ -1085,7 +1085,7 @@ SEASTAR_TEST_CASE(min_max_clustering_key_test) { SEASTAR_TEST_CASE(sstable_tombstone_metadata_check) { return test_env::do_with_async([] (test_env& env) { for (const auto version : writable_sstable_versions) { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", utf8_type, column_kind::partition_key) .with_column("ck1", utf8_type, column_kind::clustering_key) .with_column("r1", int32_type) @@ -1252,7 +1252,7 @@ SEASTAR_TEST_CASE(sstable_tombstone_metadata_check) { SEASTAR_TEST_CASE(sstable_composite_tombstone_metadata_check) { return test_env::do_with_async([] (test_env& env) { for (const auto version : writable_sstable_versions) { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", utf8_type, column_kind::partition_key) .with_column("ck1", utf8_type, column_kind::clustering_key) .with_column("ck2", utf8_type, column_kind::clustering_key) @@ -1412,7 +1412,7 @@ SEASTAR_TEST_CASE(sstable_composite_tombstone_metadata_check) { SEASTAR_TEST_CASE(sstable_composite_reverse_tombstone_metadata_check) { return test_env::do_with_async([] (test_env& env) { for (const auto version : writable_sstable_versions) { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", utf8_type, column_kind::partition_key) .with_column("ck1", utf8_type, column_kind::clustering_key) .with_column("ck2", reversed_type_impl::get_instance(utf8_type), column_kind::clustering_key) @@ -1572,7 +1572,7 @@ SEASTAR_TEST_CASE(sstable_composite_reverse_tombstone_metadata_check) { SEASTAR_TEST_CASE(test_partition_skipping) { return test_env::do_with_async([] (test_env& env) { for (const auto version : all_sstable_versions) { - auto s = schema_builder("ks", "test_skipping_partitions") + auto s = schema_builder(this_smp_shard_count(), "ks", "test_skipping_partitions") .with_column("pk", int32_type, column_kind::partition_key) .with_column("v", int32_type) .build(); @@ -1833,7 +1833,7 @@ SEASTAR_TEST_CASE(test_unknown_component) { SEASTAR_TEST_CASE(sstable_set_incremental_selector) { return test_env::do_with_async([] (test_env& env) { - auto s = schema_builder(some_keyspace, some_column_family).with_column("p1", utf8_type, column_kind::partition_key).build(); + auto s = schema_builder(this_smp_shard_count(), some_keyspace, some_column_family).with_column("p1", utf8_type, column_kind::partition_key).build(); auto cs = compaction::make_compaction_strategy(compaction::compaction_strategy_type::leveled, s->compaction_strategy_options()); const auto decorated_keys = tests::generate_partition_keys(8, s); @@ -1906,7 +1906,7 @@ SEASTAR_TEST_CASE(sstable_set_incremental_selector) { SEASTAR_TEST_CASE(sstable_set_erase) { return test_env::do_with_async([] (test_env& env) { - auto s = schema_builder(some_keyspace, some_column_family).with_column("p1", utf8_type, column_kind::partition_key).build(); + auto s = schema_builder(this_smp_shard_count(), some_keyspace, some_column_family).with_column("p1", utf8_type, column_kind::partition_key).build(); const auto key = tests::generate_partition_key(s).key(); // check that sstable_set::erase is capable of working properly when a non-existing element is given. @@ -1963,7 +1963,7 @@ SEASTAR_TEST_CASE(sstable_set_erase) { SEASTAR_TEST_CASE(sstable_tombstone_histogram_test) { return test_env::do_with_async([] (test_env& env) { for (auto version : writable_sstable_versions) { - auto builder = schema_builder("tests", "tombstone_histogram_test") + auto builder = schema_builder(this_smp_shard_count(), "tests", "tombstone_histogram_test") .with_column("id", utf8_type, column_kind::partition_key) .with_column("value", int32_type); auto s = builder.build(); @@ -2001,7 +2001,7 @@ SEASTAR_TEST_CASE(sstable_tombstone_histogram_test) { SEASTAR_TEST_CASE(sstable_bad_tombstone_histogram_test) { return test_env::do_with_async([] (test_env& env) { - auto builder = schema_builder("tests", "tombstone_histogram_test") + auto builder = schema_builder(this_smp_shard_count(), "tests", "tombstone_histogram_test") .with_column("id", utf8_type, column_kind::partition_key) .with_column("value", int32_type); auto s = builder.build(); @@ -2015,7 +2015,7 @@ SEASTAR_TEST_CASE(sstable_bad_tombstone_histogram_test) { SEASTAR_TEST_CASE(sstable_owner_shards) { return test_env::do_with_async([] (test_env& env) { - auto builder = schema_builder("tests", "test") + auto builder = schema_builder(this_smp_shard_count(), "tests", "test") .with_column("id", utf8_type, column_kind::partition_key) .with_column("value", int32_type); auto s = builder.build(); @@ -2077,7 +2077,7 @@ SEASTAR_TEST_CASE(sstable_owner_shards) { SEASTAR_TEST_CASE(test_summary_entry_spanning_more_keys_than_min_interval) { return test_env::do_with_async([] (test_env& env) { - auto s = schema_builder(some_keyspace, some_column_family) + auto s = schema_builder(this_smp_shard_count(), some_keyspace, some_column_family) .with_column("p1", int32_type, column_kind::partition_key) .with_column("c1", utf8_type, column_kind::clustering_key) .with_column("r1", int32_type) @@ -2136,7 +2136,7 @@ SEASTAR_TEST_CASE(test_wrong_counter_shard_order) { // on a three-node Scylla 1.7.4 cluster. return test_env::do_with_async([] (test_env& env) { for (const auto version : all_sstable_versions) { - auto s = schema_builder("scylla_bench", "test_counters") + auto s = schema_builder(this_smp_shard_count(), "scylla_bench", "test_counters") .with_column("pk", long_type, column_kind::partition_key) .with_column("ck", long_type, column_kind::clustering_key) .with_column("c1", counter_type) @@ -2222,7 +2222,7 @@ SEASTAR_TEST_CASE(test_broken_promoted_index_is_skipped) { // newer sstable formats. continue; } - auto s = schema_builder("ks", "test") + auto s = schema_builder(this_smp_shard_count(), "ks", "test") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key) .with_column("v", int32_type) @@ -2255,7 +2255,7 @@ SEASTAR_TEST_CASE(test_old_format_non_compound_range_tombstone_is_read) { return test_env::do_with_async([] (test_env& env) { for (const auto version : all_sstable_versions) { if (version < sstable_version_types::mc) { // Applies only to formats older than 'm' - auto s = schema_builder("ks", "test") + auto s = schema_builder(this_smp_shard_count(), "ks", "test") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key) .with_column("v", int32_type) @@ -2283,7 +2283,7 @@ SEASTAR_TEST_CASE(test_old_format_non_compound_range_tombstone_is_read) { SEASTAR_TEST_CASE(summary_rebuild_sanity) { return test_env::do_with_async([] (test_env& env) { - auto builder = schema_builder("tests", "test") + auto builder = schema_builder(this_smp_shard_count(), "tests", "test") .with_column("id", utf8_type, column_kind::partition_key) .with_column("value", utf8_type); builder.set_compressor_params(compression_parameters::no_compression()); @@ -2323,7 +2323,7 @@ SEASTAR_TEST_CASE(summary_rebuild_sanity) { SEASTAR_TEST_CASE(sstable_partition_estimation_sanity_test) { return test_env::do_with_async([] (test_env& env) { - auto builder = schema_builder("tests", "test") + auto builder = schema_builder(this_smp_shard_count(), "tests", "test") .with_column("id", utf8_type, column_kind::partition_key) .with_column("value", utf8_type); builder.set_compressor_params(compression_parameters::no_compression()); @@ -2376,7 +2376,7 @@ SEASTAR_TEST_CASE(sstable_timestamp_metadata_correcness_with_negative) { BOOST_REQUIRE(smp::count == 1); return test_env::do_with_async([] (test_env& env) { for (auto version : writable_sstable_versions) { - auto s = schema_builder("tests", "ts_correcness_test") + auto s = schema_builder(this_smp_shard_count(), "tests", "ts_correcness_test") .with_column("id", utf8_type, column_kind::partition_key) .with_column("value", int32_type).build(); @@ -2403,7 +2403,7 @@ SEASTAR_TEST_CASE(sstable_timestamp_metadata_correcness_with_negative) { SEASTAR_TEST_CASE(sstable_run_identifier_correctness) { BOOST_REQUIRE(smp::count == 1); return test_env::do_with_async([] (test_env& env) { - auto s = schema_builder("tests", "ts_correcness_test") + auto s = schema_builder(this_smp_shard_count(), "tests", "ts_correcness_test") .with_column("id", utf8_type, column_kind::partition_key) .with_column("value", int32_type).build(); @@ -2507,7 +2507,7 @@ SEASTAR_TEST_CASE(sstable_run_clustering_disjoint_invariant_test) { SEASTAR_TEST_CASE(test_reads_cassandra_static_compact) { return test_env::do_with_async([] (test_env& env) { // CREATE COLUMNFAMILY cf (key varchar PRIMARY KEY, c2 text, c1 text) WITH COMPACT STORAGE ; - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", utf8_type, column_kind::partition_key) .with_column("c1", utf8_type) .with_column("c2", utf8_type) @@ -2540,7 +2540,7 @@ SEASTAR_TEST_CASE(basic_interval_map_testing_for_sstable_set) { interval_map_type map; - auto builder = schema_builder("tests", "test") + auto builder = schema_builder(this_smp_shard_count(), "tests", "test") .with_column("id", utf8_type, column_kind::partition_key) .with_column("value", int32_type); auto s = builder.build(); @@ -2707,7 +2707,7 @@ SEASTAR_TEST_CASE(test_sstable_origin) { SEASTAR_TEST_CASE(compound_sstable_set_basic_test) { return test_env::do_with_async([] (test_env& env) { - auto s = schema_builder(some_keyspace, some_column_family).with_column("p1", utf8_type, column_kind::partition_key).build(); + auto s = schema_builder(this_smp_shard_count(), some_keyspace, some_column_family).with_column("p1", utf8_type, column_kind::partition_key).build(); auto cs = compaction::make_compaction_strategy(compaction::compaction_strategy_type::size_tiered, s->compaction_strategy_options()); lw_shared_ptr set1 = make_lw_shared(env.make_sstable_set(cs, s)); @@ -3426,7 +3426,7 @@ SEASTAR_TEST_CASE(test_non_full_and_empty_row_keys) { SEASTAR_TEST_CASE(test_stats_metadata_error_includes_filename) { return test_env::do_with_async([] (test_env& env) { for (const auto version : writable_sstable_versions) { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", utf8_type, column_kind::partition_key) .with_column("v", int32_type) .build(); diff --git a/test/boost/sstable_directory_test.cc b/test/boost/sstable_directory_test.cc index 659ef2ad86..20165c6baa 100644 --- a/test/boost/sstable_directory_test.cc +++ b/test/boost/sstable_directory_test.cc @@ -49,7 +49,7 @@ public: schema_ptr test_table_schema() { static thread_local auto s = [] { - schema_builder builder("ks", "cf", generate_legacy_id("ks", "cf"), bytes_type); + schema_builder builder(this_smp_shard_count(), "ks", "cf", generate_legacy_id("ks", "cf"), bytes_type); builder.with_column("p", bytes_type, column_kind::partition_key); builder.with_column("c", int32_type); return builder.build(schema_builder::compact_storage::no); diff --git a/test/boost/sstable_mutation_test.cc b/test/boost/sstable_mutation_test.cc index 00977697e4..467faf3ae5 100644 --- a/test/boost/sstable_mutation_test.cc +++ b/test/boost/sstable_mutation_test.cc @@ -355,7 +355,7 @@ mutation_source make_sstable_mutation_source(sstables::test_env& env, schema_ptr SEASTAR_TEST_CASE(test_sstable_can_write_and_read_range_tombstone) { return test_env::do_with_async([] (test_env& env) { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("p1", utf8_type, column_kind::partition_key) .with_column("c1", int32_type, column_kind::clustering_key) .with_column("r1", int32_type) @@ -476,7 +476,7 @@ SEASTAR_TEST_CASE(broken_ranges_collection) { static schema_ptr tombstone_overlap_schema() { static thread_local auto s = [] { - schema_builder builder("try1", "tab", generate_legacy_id("try1", "tab")); + schema_builder builder(this_smp_shard_count(), "try1", "tab", generate_legacy_id("try1", "tab")); builder.with_column("pk", utf8_type, column_kind::partition_key); builder.with_column("ck1", utf8_type, column_kind::clustering_key); builder.with_column("ck2", utf8_type, column_kind::clustering_key); @@ -616,7 +616,7 @@ SEASTAR_TEST_CASE(range_tombstone_reading) { // ["aaa:bbb:!","aaa:!",1459438519943668,"t",1459438519]]} static schema_ptr tombstone_overlap_schema2() { static thread_local auto s = [] { - schema_builder builder("try1", "tab2", generate_legacy_id("try1", "tab2")); + schema_builder builder(this_smp_shard_count(), "try1", "tab2", generate_legacy_id("try1", "tab2")); builder.with_column("pk", utf8_type, column_kind::partition_key); builder.with_column("ck1", utf8_type, column_kind::clustering_key); builder.with_column("ck2", utf8_type, column_kind::clustering_key); @@ -686,7 +686,7 @@ SEASTAR_TEST_CASE(tombstone_in_tombstone2) { // Reproducer for #4783 static schema_ptr buffer_overflow_schema() { static thread_local auto s = [] { - schema_builder builder("test_ks", "test_tab", generate_legacy_id("test_ks", "test_tab")); + schema_builder builder(this_smp_shard_count(), "test_ks", "test_tab", generate_legacy_id("test_ks", "test_tab")); builder.with_column("pk", int32_type, column_kind::partition_key); builder.with_column("ck1", int32_type, column_kind::clustering_key); builder.with_column("ck2", int32_type, column_kind::clustering_key); @@ -736,7 +736,7 @@ SEASTAR_TEST_CASE(buffer_overflow) { SEASTAR_TEST_CASE(test_non_compound_table_row_is_not_marked_as_static) { return test_env::do_with_async([] (test_env& env) { for (const auto version : writable_sstable_versions) { - schema_builder builder("ks", "cf"); + schema_builder builder(this_smp_shard_count(), "ks", "cf"); builder.with_column("p", utf8_type, column_kind::partition_key); builder.with_column("c", int32_type, column_kind::clustering_key); builder.with_column("v", int32_type); @@ -761,7 +761,7 @@ SEASTAR_TEST_CASE(test_non_compound_table_row_is_not_marked_as_static) { SEASTAR_TEST_CASE(test_has_partition_key) { return test_env::do_with_async([] (test_env& env) { for (const auto version : writable_sstable_versions) { - schema_builder builder("ks", "cf"); + schema_builder builder(this_smp_shard_count(), "ks", "cf"); builder.with_column("p", utf8_type, column_kind::partition_key); builder.with_column("c", int32_type, column_kind::clustering_key); builder.with_column("v", int32_type); @@ -795,7 +795,7 @@ static std::unique_ptr get_index_reader(shared_sstable ss SEASTAR_TEST_CASE(test_promoted_index_blocks_are_monotonic) { return test_env::do_with_async([] (test_env& env) { - schema_builder builder("ks", "cf"); + schema_builder builder(this_smp_shard_count(), "ks", "cf"); builder.with_column("p", utf8_type, column_kind::partition_key); builder.with_column("c1", int32_type, column_kind::clustering_key); builder.with_column("c2", int32_type, column_kind::clustering_key); @@ -837,7 +837,7 @@ SEASTAR_TEST_CASE(test_promoted_index_blocks_are_monotonic) { SEASTAR_TEST_CASE(test_promoted_index_blocks_are_monotonic_with_auto_scaling) { return test_env::do_with_async([] (test_env& env) { - schema_builder builder("ks", "cf"); + schema_builder builder(this_smp_shard_count(), "ks", "cf"); builder.with_column("p", utf8_type, column_kind::partition_key); builder.with_column("c1", int32_type, column_kind::clustering_key); builder.with_column("c2", int32_type, column_kind::clustering_key); @@ -873,7 +873,7 @@ SEASTAR_TEST_CASE(test_promoted_index_blocks_are_monotonic_with_auto_scaling) { SEASTAR_TEST_CASE(test_promoted_index_blocks_are_monotonic_compound_dense) { return test_env::do_with_async([] (test_env& env) { for (const auto version : writable_sstable_versions) { - schema_builder builder("ks", "cf"); + schema_builder builder(this_smp_shard_count(), "ks", "cf"); builder.with_column("p", utf8_type, column_kind::partition_key); builder.with_column("c1", int32_type, column_kind::clustering_key); builder.with_column("c2", int32_type, column_kind::clustering_key); @@ -926,7 +926,7 @@ SEASTAR_TEST_CASE(test_promoted_index_blocks_are_monotonic_compound_dense) { SEASTAR_TEST_CASE(test_promoted_index_blocks_are_monotonic_non_compound_dense) { return test_env::do_with_async([] (test_env& env) { for (const auto version : writable_sstable_versions) { - schema_builder builder("ks", "cf"); + schema_builder builder(this_smp_shard_count(), "ks", "cf"); builder.with_column("p", utf8_type, column_kind::partition_key); builder.with_column("c1", int32_type, column_kind::clustering_key); builder.with_column("v", int32_type); @@ -978,7 +978,7 @@ SEASTAR_TEST_CASE(test_promoted_index_repeats_open_tombstones) { int id = 0; for (auto& compact : { schema_builder::compact_storage::no, schema_builder::compact_storage::yes }) { const auto generation = id++; - schema_builder builder("ks", format("cf{:d}", generation)); + schema_builder builder(this_smp_shard_count(), "ks", format("cf{:d}", generation)); builder.with_column("p", utf8_type, column_kind::partition_key); builder.with_column("c1", bytes_type, column_kind::clustering_key); builder.with_column("v", int32_type); @@ -1018,7 +1018,7 @@ SEASTAR_TEST_CASE(test_promoted_index_repeats_open_tombstones) { SEASTAR_TEST_CASE(test_range_tombstones_are_correctly_seralized_for_non_compound_dense_schemas) { return test_env::do_with_async([] (test_env& env) { for (const auto version : writable_sstable_versions) { - schema_builder builder("ks", "cf"); + schema_builder builder(this_smp_shard_count(), "ks", "cf"); builder.with_column("p", utf8_type, column_kind::partition_key); builder.with_column("c", int32_type, column_kind::clustering_key); builder.with_column("v", int32_type); @@ -1052,7 +1052,7 @@ SEASTAR_TEST_CASE(test_range_tombstones_are_correctly_seralized_for_non_compound SEASTAR_TEST_CASE(test_promoted_index_is_absent_for_schemas_without_clustering_key) { return test_env::do_with_async([] (test_env& env) { for (const auto version : writable_sstable_versions) { - schema_builder builder("ks", "cf"); + schema_builder builder(this_smp_shard_count(), "ks", "cf"); builder.with_column("p", utf8_type, column_kind::partition_key); builder.with_column("v", int32_type); auto s = builder.build(schema_builder::compact_storage::yes); @@ -1155,7 +1155,7 @@ SEASTAR_TEST_CASE(test_no_index_reads_when_rows_fall_into_range_boundaries) { SEASTAR_TEST_CASE(test_key_count_estimation) { return test_env::do_with_async([] (test_env& env) { for (const auto version : writable_sstable_versions) { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("v", int32_type) .build(); @@ -1398,7 +1398,7 @@ SEASTAR_THREAD_TEST_CASE(test_merging_encoding_stats) { // Reproducer for #4206 SEASTAR_TEST_CASE(test_counter_header_size) { return test_env::do_with_async([] (test_env& env) { - auto s = schema_builder("ks", "counter_test") + auto s = schema_builder(this_smp_shard_count(), "ks", "counter_test") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key) .with_column("c1", counter_type) @@ -1435,7 +1435,7 @@ SEASTAR_TEST_CASE(test_counter_header_size) { SEASTAR_TEST_CASE(test_static_compact_tables_are_read) { return test_env::do_with_async([] (test_env& env) { for (const auto version : writable_sstable_versions) { - auto s = schema_builder("ks", "test") + auto s = schema_builder(this_smp_shard_count(), "ks", "test") .with_column("pk", int32_type, column_kind::partition_key) .with_column("v1", int32_type) .with_column("v2", int32_type) @@ -1491,7 +1491,7 @@ SEASTAR_TEST_CASE(writer_handles_subsequent_range_tombstone_changes_without_tomb // after_all_prefixed. This leads to incorrect order of mutations. return test_env::do_with_async([] (test_env& env) { for ([[maybe_unused]] const auto version : writable_sstable_versions) { - schema_ptr s = schema_builder("ks", "cf") + schema_ptr s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("ck1", bytes_type, column_kind::clustering_key) .with_column("ck2", bytes_type, column_kind::clustering_key) diff --git a/test/boost/sstable_resharding_test.cc b/test/boost/sstable_resharding_test.cc index d00f8c0920..66e58ea7b0 100644 --- a/test/boost/sstable_resharding_test.cc +++ b/test/boost/sstable_resharding_test.cc @@ -25,7 +25,7 @@ using namespace sstables; static schema_builder get_schema_builder() { - return schema_builder("tests", "sstable_resharding_test") + return schema_builder(this_smp_shard_count(), "tests", "sstable_resharding_test") .with_column("id", utf8_type, column_kind::partition_key) .with_column("value", int32_type); } diff --git a/test/boost/sstable_test.cc b/test/boost/sstable_test.cc index bc06baeef5..5ecd84ef4a 100644 --- a/test/boost/sstable_test.cc +++ b/test/boost/sstable_test.cc @@ -58,7 +58,7 @@ SEASTAR_TEST_CASE(uncompressed_data) { } static auto make_schema_for_compressed_sstable() { - return schema_builder("ks", "cf").with_column("pk", utf8_type, column_kind::partition_key).build(); + return schema_builder(this_smp_shard_count(), "ks", "cf").with_column("pk", utf8_type, column_kind::partition_key).build(); } SEASTAR_TEST_CASE(compressed_data) { @@ -453,7 +453,7 @@ SEASTAR_TEST_CASE(statistics_rewrite) { static schema_ptr large_partition_schema() { static thread_local auto s = [] { - schema_builder builder("try1", "data", generate_legacy_id("try1", "data")); + schema_builder builder(this_smp_shard_count(), "try1", "data", generate_legacy_id("try1", "data")); builder.with_column("t1", utf8_type, column_kind::partition_key); builder.with_column("t2", utf8_type, column_kind::clustering_key); builder.with_column("t3", utf8_type); @@ -768,7 +768,7 @@ SEASTAR_TEST_CASE(test_skipping_in_compressed_stream) { // should correctly compare empty keys. The fact we did this incorrectly was // noticed while fixing #9375, and a separate issue on it is #10178. BOOST_AUTO_TEST_CASE(test_empty_key_view_comparison) { - auto s_ptr = schema_builder("", "") + auto s_ptr = schema_builder(1, "", "") .with_column("p", bytes_type, column_kind::partition_key) .build(); const schema& s = *s_ptr; diff --git a/test/boost/sstable_test.hh b/test/boost/sstable_test.hh index 34d5154694..b25eeede6b 100644 --- a/test/boost/sstable_test.hh +++ b/test/boost/sstable_test.hh @@ -70,7 +70,7 @@ inline sstring get_test_dir(const sstring& name, const schema_ptr s) inline schema_ptr composite_schema() { static thread_local auto s = [] { - schema_builder builder("tests", "composite"); + schema_builder builder(this_smp_shard_count(), "tests", "composite"); // partition key builder.with_column("name", bytes_type, column_kind::partition_key); builder.with_column("col1", bytes_type, column_kind::partition_key); @@ -83,7 +83,7 @@ inline schema_ptr composite_schema() { inline schema_ptr set_schema() { static thread_local auto s = [] { auto my_set_type = set_type_impl::get_instance(bytes_type, false); - schema_builder builder("tests", "set_pk"); + schema_builder builder(this_smp_shard_count(), "tests", "set_pk"); builder.with_column("ss", my_set_type, column_kind::partition_key); builder.with_column("ns", utf8_type); builder.set_comment("Table with a set as pkeys"); @@ -95,7 +95,7 @@ inline schema_ptr set_schema() { inline schema_ptr map_schema() { static thread_local auto s = [] { auto my_map_type = map_type_impl::get_instance(bytes_type, bytes_type, false); - schema_builder builder("tests", "map_pk"); + schema_builder builder(this_smp_shard_count(), "tests", "map_pk"); // partition key builder.with_column("ss", my_map_type, column_kind::partition_key); builder.with_column("ns", utf8_type); @@ -108,7 +108,7 @@ inline schema_ptr map_schema() { inline schema_ptr list_schema() { static thread_local auto s = [] { auto my_list_type = list_type_impl::get_instance(bytes_type, false); - schema_builder builder("tests", "list_pk"); + schema_builder builder(this_smp_shard_count(), "tests", "list_pk"); // partition key builder.with_column("ss", my_list_type, column_kind::partition_key); builder.with_column("ns", utf8_type); @@ -120,7 +120,7 @@ inline schema_ptr list_schema() { inline schema_ptr uncompressed_schema(int32_t min_index_interval = 0) { auto uncompressed = [=] { - schema_builder builder("ks", "uncompressed", generate_legacy_id("ks", "uncompressed")); + schema_builder builder(this_smp_shard_count(), "ks", "uncompressed", generate_legacy_id("ks", "uncompressed")); // partition key builder.with_column("name", utf8_type, column_kind::partition_key); builder.with_column("col1", utf8_type); @@ -147,7 +147,7 @@ inline schema_ptr complex_schema() { auto my_fset_type = set_type_impl::get_instance(bytes_type, false); auto my_set_static_type = set_type_impl::get_instance(bytes_type, true); - schema_builder builder("tests", "complex_schema", {}, bytes_type); + schema_builder builder(this_smp_shard_count(), "tests", "complex_schema", {}, bytes_type); builder.with_column("key", bytes_type, column_kind::partition_key); builder.with_column("clust1", bytes_type, column_kind::clustering_key); builder.with_column("clust2", bytes_type, column_kind::clustering_key); @@ -166,7 +166,7 @@ inline schema_ptr complex_schema() { inline schema_ptr columns_schema() { static thread_local auto columns = [] { - schema_builder builder("name", "columns", generate_legacy_id("name", "columns")); + schema_builder builder(this_smp_shard_count(), "name", "columns", generate_legacy_id("name", "columns")); builder.with_column("keyspace_name", utf8_type, column_kind::partition_key); builder.with_column("columnfamily_name", utf8_type, column_kind::clustering_key); builder.with_column("column_name", utf8_type, column_kind::clustering_key); @@ -184,7 +184,7 @@ inline schema_ptr columns_schema() { inline schema_ptr compact_simple_dense_schema() { static thread_local auto s = [] { - schema_builder builder("tests", "compact_simple_dense"); + schema_builder builder(this_smp_shard_count(), "tests", "compact_simple_dense"); builder.with_column("ks", bytes_type, column_kind::partition_key); builder.with_column("cl1", bytes_type, column_kind::clustering_key); builder.with_column("cl2", bytes_type); @@ -196,7 +196,7 @@ inline schema_ptr compact_simple_dense_schema() { inline schema_ptr compact_dense_schema() { static thread_local auto s = [] { - schema_builder builder("tests", "compact_simple_dense"); + schema_builder builder(this_smp_shard_count(), "tests", "compact_simple_dense"); builder.with_column("ks", bytes_type, column_kind::partition_key); builder.with_column("cl1", bytes_type, column_kind::clustering_key); builder.with_column("cl2", bytes_type, column_kind::clustering_key); @@ -209,7 +209,7 @@ inline schema_ptr compact_dense_schema() { inline schema_ptr compact_sparse_schema() { static thread_local auto s = [] { - schema_builder builder("tests", "compact_sparse"); + schema_builder builder(this_smp_shard_count(), "tests", "compact_sparse"); builder.with_column("ks", bytes_type, column_kind::partition_key); builder.with_column("cl1", bytes_type); builder.with_column("cl2", bytes_type); @@ -225,7 +225,7 @@ inline schema_ptr compact_sparse_schema() { // sure we are testing the exact some one we have in our test dir. inline schema_ptr peers_schema() { static thread_local auto peers = [] { - schema_builder builder("system", "peers", generate_legacy_id("system", "peers")); + schema_builder builder(this_smp_shard_count(), "system", "peers", generate_legacy_id("system", "peers")); builder.with_column("peer", inet_addr_type, column_kind::partition_key); builder.with_column("data_center", utf8_type); builder.with_column("host_id", uuid_type); diff --git a/test/boost/storage_proxy_test.cc b/test/boost/storage_proxy_test.cc index e36a2acade..6b50f19244 100644 --- a/test/boost/storage_proxy_test.cc +++ b/test/boost/storage_proxy_test.cc @@ -39,7 +39,7 @@ static std::vector make_ring(schema_ptr s, int n_keys) { SEASTAR_TEST_CASE(test_get_restricted_ranges) { return do_with_cql_env_thread([](cql_test_env& e) { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("v", bytes_type, column_kind::regular_column) .build(); diff --git a/test/boost/tablets_test.cc b/test/boost/tablets_test.cc index 035f5836a4..637b18d546 100644 --- a/test/boost/tablets_test.cc +++ b/test/boost/tablets_test.cc @@ -119,7 +119,7 @@ future add_table(cql_test_env& e, sstring test_ks_name = "", std::map< if (!test_ks_name.empty()) { ks_name = test_ks_name; } - auto builder = schema_builder(ks_name, id.to_sstring(), id) + auto builder = schema_builder(this_smp_shard_count(), ks_name, id.to_sstring(), id) .with_column("p1", utf8_type, column_kind::partition_key) .with_column("r1", int32_type); if (!tablet_options.empty()) { @@ -693,13 +693,13 @@ SEASTAR_THREAD_TEST_CASE(test_invalid_colocated_tables) { auto ks_name = add_keyspace(e, {{topo.dc(), 1}}, 1); auto ksm = e.local_db().find_keyspace(ks_name).metadata(); - const auto t = schema_builder("ks", "t") + const auto t = schema_builder(this_smp_shard_count(), "ks", "t") .with_column("pk", int32_type, column_kind::partition_key) .build(); - const auto t_paxos = schema_builder("ks", "t$paxos") + const auto t_paxos = schema_builder(this_smp_shard_count(), "ks", "t$paxos") .with_column("pk", int32_type, column_kind::partition_key) .build(); - const auto t_paxos_paxos = schema_builder("ks", "t$paxos$paxos") + const auto t_paxos_paxos = schema_builder(this_smp_shard_count(), "ks", "t$paxos$paxos") .with_column("pk", int32_type, column_kind::partition_key) .build(); @@ -6232,7 +6232,7 @@ static void execute_tablet_for_new_rf_test(calculate_tablet_replicas_for_new_rf_ auto tablet_aware_ptr = ars_ptr->maybe_as_tablet_aware(); BOOST_REQUIRE(tablet_aware_ptr); - auto s = schema_builder("ks", "tb") + auto s = schema_builder(this_smp_shard_count(), "ks", "tb") .with_column("pk", utf8_type, column_kind::partition_key) .with_column("v", utf8_type) .build(); diff --git a/test/boost/view_build_test.cc b/test/boost/view_build_test.cc index 3bbdc56be5..b9c9b7fb21 100644 --- a/test/boost/view_build_test.cc +++ b/test/boost/view_build_test.cc @@ -45,7 +45,7 @@ using namespace std::literals::chrono_literals; schema_ptr test_table_schema() { static thread_local auto s = [] { - schema_builder builder("try1", "data", generate_legacy_id("try1", "data")); + schema_builder builder(this_smp_shard_count(), "try1", "data", generate_legacy_id("try1", "data")); builder.with_column("p", utf8_type, column_kind::partition_key); builder.with_column("c", utf8_type, column_kind::clustering_key); builder.with_column("v", utf8_type); @@ -792,7 +792,7 @@ SEASTAR_THREAD_TEST_CASE(test_view_update_generator_buffering) { reader_concurrency_semaphore sem(reader_concurrency_semaphore::for_tests{}, get_name(), 1, replica::new_reader_base_cost); auto stop_sem = deferred_stop(sem); - auto schema = schema_builder("ks", "cf") + auto schema = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key) .with_column("v", bytes_type) diff --git a/test/boost/virtual_table_test.cc b/test/boost/virtual_table_test.cc index 2f119f9662..1bcd578eda 100644 --- a/test/boost/virtual_table_test.cc +++ b/test/boost/virtual_table_test.cc @@ -26,7 +26,7 @@ public: static schema_ptr build_schema() { auto id = generate_legacy_id(system_keyspace::NAME, "test"); - return schema_builder(system_keyspace::NAME, "test", std::make_optional(id)) + return schema_builder(this_smp_shard_count(), system_keyspace::NAME, "test", std::make_optional(id)) .with_column("pk", int32_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key) .with_column("v", int32_type) diff --git a/test/boost/wrapping_interval_test.cc b/test/boost/wrapping_interval_test.cc index fe65b5c0f0..252213624e 100644 --- a/test/boost/wrapping_interval_test.cc +++ b/test/boost/wrapping_interval_test.cc @@ -38,7 +38,7 @@ bool includes_token(const schema& s, const dht::partition_range& r, const dht::t } BOOST_AUTO_TEST_CASE(test_range_with_positions_within_the_same_token) { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(1, "ks", "cf") .with_column("key", bytes_type, column_kind::partition_key) .with_column("v", bytes_type) .build(); diff --git a/test/lib/data_model.cc b/test/lib/data_model.cc index 522b24984b..870e544a82 100644 --- a/test/lib/data_model.cc +++ b/test/lib/data_model.cc @@ -250,7 +250,7 @@ void table_description::alter_column_type(std::vector& columns, const ss } schema_ptr table_description::build_schema() const { - auto sb = schema_builder("ks", "cf"); + auto sb = schema_builder(this_smp_shard_count(), "ks", "cf"); for (auto&& [ name, type ] : _partition_key) { sb.with_column(utf8_type->decompose(name), type, column_kind::partition_key); } diff --git a/test/lib/mutation_source_test.cc b/test/lib/mutation_source_test.cc index 4744ac16be..aabf3c6575 100644 --- a/test/lib/mutation_source_test.cc +++ b/test/lib/mutation_source_test.cc @@ -814,7 +814,7 @@ static void test_streamed_mutation_forwarding_across_range_tombstones(tests::rea static void test_range_queries(tests::reader_concurrency_semaphore_wrapper& semaphore, populate_fn_ex populate) { testlog.info(__PRETTY_FUNCTION__); - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("key", bytes_type, column_kind::partition_key) .with_column("v", bytes_type) .build(); @@ -1010,7 +1010,7 @@ static void test_time_window_clustering_slicing(tests::reader_concurrency_semaph static void test_clustering_slices(tests::reader_concurrency_semaphore_wrapper& semaphore, populate_fn_ex populate) { testlog.info(__PRETTY_FUNCTION__); - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("key", bytes_type, column_kind::partition_key) .with_column("c1", int32_type, column_kind::clustering_key) .with_column("c2", int32_type, column_kind::clustering_key) @@ -1791,7 +1791,7 @@ static mutation_sets generate_mutation_sets() { mutation_sets result; { - auto common_schema = schema_builder("ks", "test") + auto common_schema = schema_builder(this_smp_shard_count(), "ks", "test") .with_column("pk_col", bytes_type, column_kind::partition_key) .with_column("ck_col_1", bytes_type, column_kind::clustering_key) .with_column("ck_col_2", bytes_type, column_kind::clustering_key) @@ -2045,7 +2045,7 @@ private: } schema_ptr do_make_schema(data_type type, const char* ks_name, const char* cf_name) { - auto builder = schema_builder(ks_name, cf_name) + auto builder = schema_builder(this_smp_shard_count(), ks_name, cf_name) .with_column("pk", bytes_type, column_kind::partition_key) .with_column("ck1", bytes_type, column_kind::clustering_key) .with_column("ck2", bytes_type, column_kind::clustering_key); diff --git a/test/lib/random_schema.cc b/test/lib/random_schema.cc index c90a0ab95e..6b12a1066d 100644 --- a/test/lib/random_schema.cc +++ b/test/lib/random_schema.cc @@ -834,7 +834,7 @@ namespace { schema_ptr build_random_schema(uint32_t seed, random_schema_specification& spec) { auto engine = std::mt19937{seed}; - auto builder = schema_builder(spec.keyspace_name(), spec.table_name(engine)); + auto builder = schema_builder(this_smp_shard_count(), spec.keyspace_name(), spec.table_name(engine)); auto pk_columns = spec.partition_key_columns(engine); SCYLLA_ASSERT(!pk_columns.empty()); // Let's not pull in boost::test here diff --git a/test/lib/simple_schema.hh b/test/lib/simple_schema.hh index 4f06effe95..5197d9aea3 100644 --- a/test/lib/simple_schema.hh +++ b/test/lib/simple_schema.hh @@ -67,7 +67,7 @@ private: : _ws(ws) , _wc(wc) { - auto sb = schema_builder(ks_name, cf_name) + auto sb = schema_builder(this_smp_shard_count(), ks_name, cf_name) .with_column("pk", utf8_type, column_kind::partition_key) .with_column("ck", utf8_type, column_kind::clustering_key) .with_column("s1", utf8_type, ws ? column_kind::static_column : column_kind::regular_column) diff --git a/test/lib/test_services.cc b/test/lib/test_services.cc index 1f3e776fbe..fb8a106116 100644 --- a/test/lib/test_services.cc +++ b/test/lib/test_services.cc @@ -146,7 +146,7 @@ table_for_tests::data::data() table_for_tests::data::~data() {} schema_ptr table_for_tests::make_default_schema() { - return schema_builder(some_keyspace, some_column_family) + return schema_builder(this_smp_shard_count(), some_keyspace, some_column_family) .with_column(utf8_type->decompose("p1"), utf8_type, column_kind::partition_key) .build(); } diff --git a/test/manual/enormous_table_scan_test.cc b/test/manual/enormous_table_scan_test.cc index ae1046c684..50b936d955 100644 --- a/test/manual/enormous_table_scan_test.cc +++ b/test/manual/enormous_table_scan_test.cc @@ -195,7 +195,7 @@ static bool has_more_pages(::shared_ptr SEASTAR_TEST_CASE(scan_enormous_table_test) { return do_with_cql_env_thread([] (cql_test_env& e) { e.create_table([](std::string_view ks_name) { - return *schema_builder(ks_name, "enormous_table") + return *schema_builder(this_smp_shard_count(), ks_name, "enormous_table") .with_column("pk", long_type, column_kind::partition_key) .with_column("ck", long_type, column_kind::clustering_key) .set_comment("a very big table (4.5 billion entries, one partition)") @@ -227,7 +227,7 @@ SEASTAR_TEST_CASE(scan_enormous_table_test) { SEASTAR_TEST_CASE(count_enormous_table_test) { return do_with_cql_env_thread([] (cql_test_env& e) { e.create_table([](std::string_view ks_name) { - return *schema_builder(ks_name, "enormous_table") + return *schema_builder(this_smp_shard_count(), ks_name, "enormous_table") .with_column("pk", long_type, column_kind::partition_key) .with_column("ck", long_type, column_kind::clustering_key) .set_comment("a very big table (4.5 billion entries, one partition)") diff --git a/test/manual/row_locker_test.cc b/test/manual/row_locker_test.cc index 1f049c5898..a35e3ca7f4 100644 --- a/test/manual/row_locker_test.cc +++ b/test/manual/row_locker_test.cc @@ -18,7 +18,7 @@ static row_locker::stats row_locker_stats; static schema_ptr make_schema() { - return schema_builder("ks", "cf") + return schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("ck", bytes_type, column_kind::clustering_key) .with_column("s", bytes_type, column_kind::static_column) @@ -164,7 +164,7 @@ SEASTAR_TEST_CASE(test_nonblock_many) { static schema_ptr make_alternative_schema() { - return schema_builder("ks", "cf") + return schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("ck", bytes_type, column_kind::clustering_key) .with_column("s0", bytes_type, column_kind::static_column) diff --git a/test/perf/memory_footprint_test.cc b/test/perf/memory_footprint_test.cc index 742f75f78a..1a6dfcbaac 100644 --- a/test/perf/memory_footprint_test.cc +++ b/test/perf/memory_footprint_test.cc @@ -95,7 +95,7 @@ public: thread_local int size_calculator::nest::level = 0; static schema_ptr cassandra_stress_schema() { - return schema_builder("ks", "cf") + return schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("KEY", bytes_type, column_kind::partition_key) .with_column("C0", bytes_type) .with_column("C1", bytes_type) @@ -144,7 +144,7 @@ struct mutation_settings { }; static schema_ptr make_schema(const mutation_settings& settings) { - auto builder = schema_builder("ks", "cf") + auto builder = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("ck", bytes_type, column_kind::clustering_key); diff --git a/test/perf/perf_bti_key_translation.cc b/test/perf/perf_bti_key_translation.cc index 9cb3b54acf..0fc7fb18f7 100644 --- a/test/perf/perf_bti_key_translation.cc +++ b/test/perf/perf_bti_key_translation.cc @@ -19,7 +19,7 @@ struct lcb_mismatch_test { std::vector keys; lcb_mismatch_test() { int n_columns = 16; - auto builder = schema_builder("ks", "t") + auto builder = schema_builder(this_smp_shard_count(), "ks", "t") .with_column("pk", int32_type, column_kind::partition_key); for (int i = 0; i <= n_columns; ++i) { builder.with_column(bytes(fmt::format("c{}", i).c_str()), int32_type, column_kind::clustering_key); diff --git a/test/perf/perf_mutation.cc b/test/perf/perf_mutation.cc index fa17a3c7cf..d7ba655933 100644 --- a/test/perf/perf_mutation.cc +++ b/test/perf/perf_mutation.cc @@ -24,7 +24,7 @@ int main(int argc, char* argv[]) { ("column-count", bpo::value()->default_value(1), "column count"); return app.run_deprecated(argc, argv, [&] { size_t column_count = app.configuration()["column-count"].as(); - auto builder = schema_builder("ks", "cf") + auto builder = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("p1", utf8_type, column_kind::partition_key) .with_column("c1", int32_type, column_kind::clustering_key); diff --git a/test/perf/perf_row_cache_reads.cc b/test/perf/perf_row_cache_reads.cc index 2be0e0ae03..11bdee4268 100644 --- a/test/perf/perf_row_cache_reads.cc +++ b/test/perf/perf_row_cache_reads.cc @@ -54,7 +54,7 @@ static const auto MB = 1024 * 1024; void test_scans_with_dummy_entries() { std::cout << __FUNCTION__<< std::endl; - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", uuid_type, column_kind::partition_key) .with_column("st", bytes_type, column_kind::static_column) .with_column("ck", reversed_type_impl::get_instance(uuid_type), column_kind::clustering_key) diff --git a/test/perf/perf_row_cache_update.cc b/test/perf/perf_row_cache_update.cc index c5fdc34ff6..9e0632b4e0 100644 --- a/test/perf/perf_row_cache_update.cc +++ b/test/perf/perf_row_cache_update.cc @@ -142,7 +142,7 @@ void run_test(const sstring& name, schema_ptr s, MutationGenerator&& gen, std::f } static void test_small_partitions() { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", uuid_type, column_kind::partition_key) .with_column("v1", bytes_type, column_kind::regular_column) .with_column("v2", bytes_type, column_kind::regular_column) @@ -162,7 +162,7 @@ static void test_small_partitions() { } static void test_partition_with_lots_of_small_rows() { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", uuid_type, column_kind::partition_key) .with_column("ck", reversed_type_impl::get_instance(int32_type), column_kind::clustering_key) .with_column("v1", bytes_type, column_kind::regular_column) @@ -186,7 +186,7 @@ static void test_partition_with_lots_of_small_rows() { } static void test_partition_with_lots_of_small_rows_covered_by_tombstone() { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", uuid_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key) .with_column("v1", bytes_type, column_kind::regular_column) @@ -223,7 +223,7 @@ static void test_partition_with_lots_of_small_rows_covered_by_tombstone() { } static void test_partition_with_few_small_rows() { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", uuid_type, column_kind::partition_key) .with_column("ck", reversed_type_impl::get_instance(int32_type), column_kind::clustering_key) .with_column("v1", bytes_type, column_kind::regular_column) @@ -249,7 +249,7 @@ static void test_partition_with_few_small_rows() { } static void test_partition_with_lots_of_range_tombstones() { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", uuid_type, column_kind::partition_key) .with_column("ck", reversed_type_impl::get_instance(int32_type), column_kind::clustering_key) .with_column("v1", bytes_type, column_kind::regular_column) @@ -274,7 +274,7 @@ static void test_partition_with_lots_of_range_tombstones() { // This test case stresses handling of overlapping range tombstones static void test_partition_with_lots_of_range_tombstones_with_residuals() { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", uuid_type, column_kind::partition_key) .with_column("ck", int32_type, column_kind::clustering_key) .with_column("v1", bytes_type, column_kind::regular_column) diff --git a/test/perf/perf_simple_query.cc b/test/perf/perf_simple_query.cc index dbef6f0d06..6409ec08ad 100644 --- a/test/perf/perf_simple_query.cc +++ b/test/perf/perf_simple_query.cc @@ -230,7 +230,7 @@ static std::vector test_counter_update(cql_test_env& env, test_conf } static schema_ptr make_counter_schema(std::string_view ks_name) { - return schema_builder(ks_name, "cf") + return schema_builder(this_smp_shard_count(), ks_name, "cf") .with_column("KEY", bytes_type, column_kind::partition_key) .with_column("C0", counter_type) .with_column("C1", counter_type) @@ -246,7 +246,7 @@ static std::vector do_cql_test(cql_test_env& env, test_config& cfg) if (cfg.counters) { return *make_counter_schema(ks_name); } - auto sb = schema_builder(ks_name, "cf") + auto sb = schema_builder(this_smp_shard_count(), ks_name, "cf") .with_column("KEY", bytes_type, column_kind::partition_key) .with_column("C0", bytes_type) .with_column("C1", bytes_type) diff --git a/test/perf/perf_sstable.hh b/test/perf/perf_sstable.hh index 1b867de4d4..da03908ad3 100644 --- a/test/perf/perf_sstable.hh +++ b/test/perf/perf_sstable.hh @@ -130,7 +130,7 @@ private: std::vector _sst; schema_ptr create_schema(compaction::compaction_strategy_type type) { - schema_builder builder("ks", "perf-test", generate_legacy_id("ks", "perf-test")); + schema_builder builder(this_smp_shard_count(), "ks", "perf-test", generate_legacy_id("ks", "perf-test")); builder.with_column("name", utf8_type, column_kind::partition_key); for (unsigned i = 0; i < _cfg.num_columns; ++i) { builder.with_column(to_bytes(format("column{:04d}", i)), utf8_type); diff --git a/test/perf/perf_tablets.cc b/test/perf/perf_tablets.cc index 3636a4e80a..a4662786f3 100644 --- a/test/perf/perf_tablets.cc +++ b/test/perf/perf_tablets.cc @@ -47,7 +47,7 @@ static future add_table(cql_test_env& e) { auto id = table_id(utils::UUID_gen::get_time_UUID()); co_await e.create_table([id] (std::string_view ks_name) { - return *schema_builder(ks_name, id.to_sstring(), id) + return *schema_builder(this_smp_shard_count(), ks_name, id.to_sstring(), id) .with_column("p1", utf8_type, column_kind::partition_key) .with_column("r1", int32_type) .build(); diff --git a/test/perf/tablet_load_balancing.cc b/test/perf/tablet_load_balancing.cc index fac4635142..8a0f5a2a91 100644 --- a/test/perf/tablet_load_balancing.cc +++ b/test/perf/tablet_load_balancing.cc @@ -59,7 +59,7 @@ future add_table(cql_test_env& e, sstring test_ks_name = "") { if (!test_ks_name.empty()) { ks_name = test_ks_name; } - return *schema_builder(ks_name, id.to_sstring(), id) + return *schema_builder(this_smp_shard_count(), ks_name, id.to_sstring(), id) .with_column("p1", utf8_type, column_kind::partition_key) .with_column("r1", int32_type) .build(); diff --git a/test/unit/row_cache_alloc_stress_test.cc b/test/unit/row_cache_alloc_stress_test.cc index 28181ddbd7..156594b11c 100644 --- a/test/unit/row_cache_alloc_stress_test.cc +++ b/test/unit/row_cache_alloc_stress_test.cc @@ -51,7 +51,7 @@ int main(int argc, char** argv) { // able to populate cache with large mutations This test works only // with seastar's allocator. return seastar::async([] { - auto s = schema_builder("ks", "cf") + auto s = schema_builder(this_smp_shard_count(), "ks", "cf") .with_column("pk", bytes_type, column_kind::partition_key) .with_column("ck", bytes_type, column_kind::clustering_key) .with_column("v", bytes_type, column_kind::regular_column) diff --git a/tools/schema_loader.cc b/tools/schema_loader.cc index c81f18b476..d8584b8df0 100644 --- a/tools/schema_loader.cc +++ b/tools/schema_loader.cc @@ -509,7 +509,7 @@ schema_ptr load_schema_from_statistics(sstring keyspace, sstring table, const ss const auto& serialization_header = sstable->get_serialization_header(); const auto& compression = sstable->get_compression(); - auto builder = schema_builder(keyspace, table); + auto builder = schema_builder(this_smp_shard_count(), keyspace, table); // partition key { @@ -574,7 +574,7 @@ schema_ptr load_schema_from_scylla_metadata(const sstables::shared_sstable& ssta const auto& scylla_metadata = *sstable->get_scylla_metadata(); const auto& sstable_schema = *scylla_metadata.data.get(); - auto builder = schema_builder(disk_string_to_string(sstable_schema.keyspace_name), disk_string_to_string(sstable_schema.table_name)); + auto builder = schema_builder(this_smp_shard_count(), disk_string_to_string(sstable_schema.keyspace_name), disk_string_to_string(sstable_schema.table_name)); builder.set_uuid(sstable_schema.id); builder.with_version(sstable_schema.version); @@ -613,7 +613,7 @@ schema_ptr do_load_schema_from_sstable(const db::config& dbcfg, std::filesystem: [host_id = locator::host_id::create_random_id()] { return host_id; }, *scf, abort, dbcfg.extensions().sstable_file_io_extensions()); auto close_sst_man = deferred_close(sst_man); - schema_ptr bootstrap_schema = schema_builder(keyspace, table).with_column("pk", int32_type, column_kind::partition_key).build(); + schema_ptr bootstrap_schema = schema_builder(this_smp_shard_count(), keyspace, table).with_column("pk", int32_type, column_kind::partition_key).build(); auto ed_result = sstables::parse_path(sstable_path, keyspace, table); if (!ed_result) { diff --git a/tools/scylla-sstable.cc b/tools/scylla-sstable.cc index 5259dbc652..ec25305063 100644 --- a/tools/scylla-sstable.cc +++ b/tools/scylla-sstable.cc @@ -1686,7 +1686,7 @@ future create_table_in_cql_env(cql_test_env& env, schema_ptr ss // // This will help avoid conflicts when querying sstables of system-tables // and allows cql_test_env to work with a simple config (no EAR setup). - auto builder = schema_builder(keyspace_name, sstable_schema->cf_name()); + auto builder = schema_builder(this_smp_shard_count(), keyspace_name, sstable_schema->cf_name()); for (const auto& col_kind : {column_kind::partition_key, column_kind::clustering_key, column_kind::static_column, column_kind::regular_column}) { for (const auto& col : sstable_schema->columns(col_kind)) { builder.with_column(col.name(), col.type, col_kind, col.view_virtual()); diff --git a/tools/scylla-types.cc b/tools/scylla-types.cc index f4d94dc8cb..a213544ed6 100644 --- a/tools/scylla-types.cc +++ b/tools/scylla-types.cc @@ -182,7 +182,7 @@ void validate_handler(type_variant type, std::vector values, const bpo::v } schema_ptr build_dummy_partition_key_schema(const compound_type& type) { - schema_builder builder("ks", "dummy"); + schema_builder builder(this_smp_shard_count(), "ks", "dummy"); unsigned i = 0; for (const auto& t : type.types()) { const auto col_name = format("pk{}", i);