Skip to content

Commit c24bc3b

Browse files
nyhdenesb
authored andcommitted
alternator: do not use tablets on new Alternator tables
A few months ago, in merge d3c1be9, we decided that if Scylla has the experimental "tablets" feature enabled, new Alternator tables should use this feature by default - exactly like this is the default for new CQL tables. Sadly, it was now decided to reverse this decision: We do not yet trust enough LWT on tablets, and since Alternator often (if not always) relies on LWT, we want Alternator tables to continue to use vnodes - not tablets. The fix is trivial - just changing the default. No test needed to change because anyway, all Alternator tests work correctly on Scylla with the tablets experimental feature disabled. I added a new test to enshrine the fact that Alternator does not use tablets. An unfortunate result of this patch will be that Alternator tables created on versions with this patch (e.g., Scylla 6.0) will not use tablets and will continue to not use tablets even if Scylla is upgraded (currently, the use of tablets is decided at table creation time, and there is no way to "upgrade" a vnode-based table to be tablet based). This patch should be reverted as soon as LWT support matures on tablets. Signed-off-by: Nadav Har'El <[email protected]> Closes #18157
1 parent 1c1004d commit c24bc3b

2 files changed

Lines changed: 22 additions & 12 deletions

File tree

alternator/executor.cc

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4559,23 +4559,25 @@ static lw_shared_ptr<keyspace_metadata> create_keyspace_metadata(std::string_vie
45594559
}
45604560
auto opts = get_network_topology_options(sp, gossiper, rf);
45614561

4562-
// If the "tablets" experimental feature is available, we enable tablets
4563-
// by default on all Alternator tables. However, some Alternator features
4564-
// are not yet available with tablets (Streams #16313 and TTL #16567) so
4565-
// we allow disabling tablets at table-creation by supplying the following
4566-
// tags with any non-numeric value (e.g., empty string or the word "none").
4567-
// Supplying it with an integer value allows overriding the default choice
4568-
// of initial_tablets (setting the value to 0 asks for the default choice).
4562+
// Even if the "tablets" experimental feature is available, we currently
4563+
// do not enable tablets by default on Alternator tables because LWT is
4564+
// not yet fully supported with tablets.
4565+
// The user can override the choice of whether or not to use tablets at
4566+
// table-creation time by supplying the following tag with a numeric value
4567+
// (setting the value to 0 means enabling tablets with automatic selection
4568+
// of the best number of tablets).
4569+
// Setting this tag to any non-numeric value (e.g., an empty string or the
4570+
// word "none") will ask to disable tablets.
45694571
// If we make this tag a permanent feature, it will get a "system:" prefix -
45704572
// until then we give it the "experimental:" prefix to not commit to it.
45714573
static constexpr auto INITIAL_TABLETS_TAG_KEY = "experimental:initial_tablets";
4574+
// initial_tablets currently defaults to unset, so tablets will not be
4575+
// used by default on new Alternator tables. Change this initialization
4576+
// to 0 enable tablets by default, with automatic number of tablets.
45724577
std::optional<unsigned> initial_tablets;
45734578
if (sp.get_db().local().get_config().check_experimental(db::experimental_features_t::feature::TABLETS)) {
45744579
auto it = tags_map.find(INITIAL_TABLETS_TAG_KEY);
4575-
if (it == tags_map.end()) {
4576-
// No tag - ask to choose a reasonable default number of tablets
4577-
initial_tablets = 0;
4578-
} else {
4580+
if (it != tags_map.end()) {
45794581
// Tag set. If it's a valid number, use it. If not - e.g., it's
45804582
// empty or a word like "none", disable tablets by setting
45814583
// initial_tablets to a disengaged optional.

test/alternator/test_table.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,4 +683,12 @@ def test_delete_table_description_with_si(dynamodb):
683683
assert got_delete['TableName'] == table.name
684684
for i in ['KeySchema', 'AttributeDefinitions', 'GlobalSecondaryIndexes', 'LocalSecondaryIndexes']:
685685
assert i in got_describe
686-
assert not i in got_delete
686+
assert not i in got_delete
687+
688+
# Currently, because of incomplete LWT support, Alternator tables do not use
689+
# tablets by default - even if the tablets experimental feature is enabled.
690+
# This test enshrines this fact - that an Alternator table doesn't use tablets.
691+
# This is a temporary test: When we reverse this decision and tablets go back
692+
# to being used by default on Alternator tables, this test should be deleted.
693+
def test_alternator_doesnt_use_tablets(dynamodb, has_tablets):
694+
assert not has_tablets

0 commit comments

Comments
 (0)