-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cql: reject ALTER tablets KS with repl opts #18772
Conversation
If we have any tests for ALTER KEYSPACE, won't this break these tests when we run these tests with tablets enabled? |
@bhalevy this change will, of course, fail many tests, what to do about them - just disable? Seems to me that if our tests test the default configuration, and by default tablets will be enabled and ALTER won't be supported, and tests have to pass, the ones that will fail because of this change have to be disabled, at least by marking them with xfail pytag. |
We don't want to skip them - we want to continue running them, but without tablets. @denesb and I already did this to many tests in cql-pytest and dtest, as we are unfortunately seeing more and more features being rejected in tablets but we still need to continue testing them. |
🔴 CI State: FAILURE✅ - Build Failed Tests (81/31150):
Build Details:
|
Yes, I did that for LWT as well (see #18103) |
@bhalevy , there are about 60 occurrences of a code like
|
@yarongilor it depends if they change the replication factor, or if the keyspace uses tablets (system keyspace do not use tablets) For example, in test_alter_keyspace_then_table_with_udt:
attempts to change rf for a user keyspace and therefore is should be skipped for tablets. audit_test.verify_keyspace is borderline, since it uses:
to change
So disabling it would depend on how fine-grained validation we'll so for rejecting the ALTER KEYSPACE. Some cases are already skipped, for example
|
e43c97c
to
a37a428
Compare
@ptrsmrn there is something I don't understand... You said that "the full support for ALTER KEYSPACE" is not available for tablets. But... there are dozens of ALTER KEYSPACE in tests. Are really all of them not supported? Isn't there just a specific type of ALTER KEYSPACE which we don't support? Can't we forbid just the specific changes that we don't support, and allow the rest, and break fewer tests and cause a smaller mess? By the way, if ALTER KEYSPACE is broken with tablets, we need an issue about it. Not this issue, about rejecting ALTER KEYSPACE - we need an issue explaining exactly what's broken and why. And this issue should refer to that issue. CC @bhalevy |
@nyh there's #16129 about the support for replication factor changes (not ALTER KEYSPACE as a whole). |
So if that were the only bug, only that should be disallowed, not ALTER KEYSPACE as a whole.
My request wasn't to open an issue to disallow things (this is what this issue is about), but to open an issue for specific cases that work incorrectly, that will need to be eventually fixed. When we understand which cases don't work correctly (an understanding that currently I don't possess), we can go back to this issue and decide what we should temporarily forbid. But clearly the end-game won't be to "temporarily forbid" these things, but to implement some, and permanently forbid other things that don't make sense (if there is such a thing, I don't know...). |
nothing that I know of, other than the
Currently, we simply allow to set/unset
disabling tablets for an existing keyspace is probably going to be permanently disallowed, unless we're convinced that we must support it. |
🔴 CI State: FAILURE✅ - Build Failed Tests (81/30559):
Build Details:
|
Right, I don't see this option stored anywhere in the schema (shown below). Moreover, one can pass (seemingly conflicting) combination of
Besides that, |
I'm also confused why ALTER is not reflected in
EDIT: |
That's weird, we have a test for that
|
I guess it's because you don't specify the lw_shared_ptr<data_dictionary::keyspace_metadata> ks_prop_defs::as_ks_metadata_update(lw_shared_ptr<data_dictionary::keyspace_metadata> old, const locator::token_metadata& tm, const gms::feature_service& feat) {
std::map<sstring, sstring> options;
const auto& old_options = old->strategy_options();
auto sc = get_replication_strategy_class();
std::optional<unsigned> initial_tablets;
if (sc) {
initial_tablets = get_initial_tablets(*sc, old->initial_tablets().has_value());
options = prepare_options(*sc, tm, get_replication_options(), initial_tablets, old_options);
} else {
sc = old->strategy_name();
options = old_options;
initial_tablets = old->initial_tablets();
}
return data_dictionary::keyspace_metadata::new_keyspace(old->name(), *sc, options, initial_tablets, get_boolean(KW_DURABLE_WRITES, true), get_storage_options());
} takes the |
Yeah, this test is a bit different, when specifying any replication options, it works, but if they are skipped, it doesn't:
|
@xemul can you please open an issue about that? |
22d4b9a
to
7fe4692
Compare
a12b154
to
eaa95bb
Compare
test/cql-pytest/cassandra_tests/validation/operations/alter_test.py
Outdated
Show resolved
Hide resolved
test/cql-pytest/cassandra_tests/validation/operations/alter_test.py
Outdated
Show resolved
Hide resolved
} | ||
if (ks.get_replication_strategy().uses_tablets() && !_attrs->get_replication_options().empty()) { | ||
throw exceptions::invalid_request_exception("Changing replication options via ALTER KEYSPACE statement is not yet supported for keyspaces with tablets."); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume that recently promoted #18899 is prerequisite to this restriction, isn't it?
Maybe it's worth moving this one lower, after the
auto new_ks = _attrs->as_ks_metadata_update(ks.metadata(), *qp.proxy().get_token_metadata_ptr(), qp.proxy().features());
is done, and then later we can relax the restriction to be
if (ks.uses_tablets() && new_ks->strategy_options().options != ks.strategy_options().options) {
throw invalid_request_exception("Changing replication options is not supported");
}
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ptrsmrn , you put 👍 and resolved the issue, but the code remained as it was before my suggestion, so I'm totally confused
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xemul sorry, I just want to move quick, maybe I'm too quick and cut corners:
I assume that recently promoted #18899 is prerequisite to this restriction, isn't it?
Yes, it's a prerequisite.
As for the 2nd part of your comment, I assumed it's only about refactoring, and since I didn't want to refactor the code, build, test, push, re-run the CI (not to waste time), I ignored it.
@nyh @xemul rejecting ALTER should be merged only to 6.0 (per #16723 (comment)), hence I changed the merge-to branch to |
eaa95bb
to
a099526
Compare
a099526
to
d399a86
Compare
🟢 CI State: SUCCESS✅ - Build Build Details:
|
🟢 CI State: SUCCESS✅ - Build Build Details:
|
The full support for ALTERing a tablets-enabled KEYSPACE is not yet implemented, and we don't want to only change the schema without changing any tablets, so the statement has to be explicitly rejected for cases that won't work, so every time any replication option is provided. Fixes: scylladb#18795 References: scylladb#16129
d399a86
to
264f4fc
Compare
@nyh @xemul sorry for the confusion, we'll follow a regular procedure here, so rejecting ALTER tablets KS is going to be merged to master and then backported to 6.0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I'm fine with this patch, but I'm lost on where/why we want to merge it. We want it in master? Did @mykaul approve?
I don't need to approve. If I need to - yes, I approve. |
Ok. This patch, like sadly a few before it, is removing a feature that Scylla 5.4 used to have from 6.0. Yes, a user could work around this but will need some forethought (to create a table without tablets). It's not just a technical decision of whether the patch has correct code and appropriate tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've a comment about the replication options restrictions here
@xemul I'm assuming #16723 would have to be extended with a revert of this patch. |
Too late, I already queued it. Presumably this PR now needs to be extended with a revert of this patch? 🥴 |
Closing (without merging) per #16723 (comment), so it accidentally doesn't get merged. Can be reopened if needed. |
The full support for ALTERing a tablets-enabled KEYSPACE is not yet
implemented, and we don't want to only change the schema without changing
any tablets, so the statement has to be explicitly rejected for cases
that won't work, so every time any replication option is provided.
Fixes: #18795
References: #16129