-
Notifications
You must be signed in to change notification settings - Fork 21
CNDB-15582: CNDB-15362: Replace SASI by a dummy implementation (#2013) #2074
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
base: main-5.0
Are you sure you want to change the base?
Conversation
Checklist before you submit for review
|
src/java/org/apache/cassandra/cql3/restrictions/StatementRestrictions.java
Outdated
Show resolved
Hide resolved
e1b7575 to
88d284d
Compare
|
opened a discussion about SASI removal in CC4/CC5 and how it impacts Cassandra upgrades to HCD. otherwise this PR is ready for review, and tests look good. |
e945b88 to
218a291
Compare
|
Note the change from The SASIIndex code has been removed, rather than noop dummied out. And if |
236c15e to
2b18c72
Compare
JeremiahDJordan
left a comment
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.
This way is fine to me as well. A couple suggested updates to the log messages.
Can we add tests run with the property set and unset trying to create SASI indexes and checking for the correct errors (or non-error).
Also, ideally we have an upgrade test that shows startup failing with the custom index in the schema, and not failing with the property set.
src/java/org/apache/cassandra/cql3/statements/schema/CreateIndexStatement.java
Outdated
Show resolved
Hide resolved
src/java/org/apache/cassandra/cql3/statements/schema/CreateIndexStatement.java
Outdated
Show resolved
Hide resolved
Absolutely (and that was my intent, sorry for not being clear about that :) |
2b18c72 to
e28ec60
Compare
|
squash commit updated. just upgrade test remaining. |
e28ec60 to
103a972
Compare
|
upgrade test added in |
test/distributed/org/apache/cassandra/distributed/upgrade/IndexUnknownIgnoreTest.java
Outdated
Show resolved
Hide resolved
JeremiahDJordan
left a comment
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.
LGTM. I would let @adelapena give it a look at well.
There's a separate problem here that's impacting all I don't know where/how CC runs the jvm-dtest-upgrade testsuite, but when doing it like then I'll put this in as a separate ticket and pr. (EDIT: https://github.com/riptano/cndb/issues/15885 ) |
adelapena
left a comment
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.
The alternative way to deal with SASI removal works for me.
I would however add a more specific message than Unable to find custom indexer class 'org.apache.cassandra.index.sasi.SASIIndex', and would probably explicitly mention that SASI has been removed if the class is SASI, rather than acting as if we don't know what SASI is.
I think we also need to emit a client warning when a client tries to create a SASI index and it gets ignored, so users and client applications don't miss it. I would add the original SASIIndexText from CNDB-15362 and modify it to test the behaviour of creating, querying and dropping a SASI index with the two possible values of the new INDEX_UNKNOWN_IGNORE flag.
src/java/org/apache/cassandra/config/CassandraRelevantProperties.java
Outdated
Show resolved
Hide resolved
test/distributed/org/apache/cassandra/distributed/upgrade/IndexUnknownIgnoreTest.java
Show resolved
Hide resolved
test/distributed/org/apache/cassandra/distributed/upgrade/IndexUnknownIgnoreTest.java
Show resolved
Hide resolved
test/distributed/org/apache/cassandra/distributed/upgrade/IndexUnknownIgnoreTest.java
Outdated
Show resolved
Hide resolved
test/distributed/org/apache/cassandra/distributed/upgrade/IndexUnknownIgnoreTest.java
Outdated
Show resolved
Hide resolved
test/distributed/org/apache/cassandra/distributed/upgrade/IndexUnknownIgnoreTest.java
Outdated
Show resolved
Hide resolved
| if (isUnknownCustomIndexCreateStatement(className) && INDEX_UNKNOWN_IGNORE.getBoolean()) | ||
| { | ||
| logger.error("Cannot find index type {}, but '{}' is true so ignoring index {} creation", | ||
| className, INDEX_UNKNOWN_IGNORE.getKey(), indexName); | ||
| return schema; | ||
| } |
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.
A CQL client trying to create a SASI index will get a generic error. I think it would be better to check if the class name is SASI and throw a specific message about SASI removal.
More importantly, if the flag to ignore unknown errors is set, a CQL client won't receive any warning about the statement being ignored. I think we should throw a client warning too so clients get notified.
We should add a test extending CQLTester to verify the behaviour of attempting creating SASI indexes in both cases (ignored and rejected).
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.
We should add a test extending CQLTester to verify the behaviour of attempting creating SASI indexes in both cases (ignored and rejected).
already exists in CreateIndexStatementTest
I think we should throw a client warning too so clients get notified.
done.
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 don't think this conversation is resolved. My first suggestion about this was to throw a specific message about SASI removal.
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.
Is that really needed?
It should be obvious, given the operator has had to already set the flag (to load a schema that's otherwise causing errors). That SASI has been removed really is intuitive enough at that point IMO. This is not going to be an error message that the operator suddenly comes across.
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.
also note, this will be properly documented in the HCD docs.
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 added the proposed change to applying the ignore flag only to restoring cql schemas in commit: 3e34934
SQUASH – don't apply INDEX_UNKNOWN_IGNORE flag to upgrades
ignoring unknown custom indexes (e.g. upgrades) found in system_schema.indexes will not remove them from system_schema.indexes
being able to restore system_schema tables across major versions or products is by default not supported, and if we want to support this we should do it in a separate ticket and for all and any unknown custom indexes.keep the ability to ignore unknown custom indexes when applying a schema (i.e. cql DDL statements).
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.
Blocking the node startup and requesting to downgrade and drop the index in the old version, without a workaround
My preference would be that we allow the upgrade to continue, and the user can drop the index after upgrading. Failing startup is often painful all around for everyone, including our support team, when the end user can't figure out in the tons of logs we spit out which one is telling them why startup failed.
I think just ignoring the index without loading it, and not having a way for the user to drop it, is no good.
@adelapena 's suggestion to use a dummy implementation when the flag is set seems reasonable to be, it would mean the index could load such that it could then be later dropped.
and to repeat: we should align the code and the UX to how we have handled removing dse custom indexes.
I agree we should treat all the removed custom indexes the same. But I am perfectly happy to change how the dse ones are handled as well to make it match what we decide is the right thing for SASI removal.
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 think just ignoring the index without loading it, and not having a way for the user to drop it, is no good.
In what situation would this be now ?
We don't support loading system_schema data across major versions or products. This is likely going to break anyway (for other system_schema incompatibilities/changes)?
I don't see a situation where unexpectedly bringing down a cluster during an upgrade is acceptable, because a index is unexpectedly now doing full table scans– so long as there are ways to get nodes started…
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'll add the dummy implementation for when the ignore flag is used and we hit an index in system_schema .index
But FTR, I'm not sold this is a valid operator scenario, and if it is only because we've failed to document and guardrail how HCD/MC is used (and what backups cross-version and product are 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.
the last commit is replaced accordingly.
SQUASH – INDEX_UNKNOWN_IGNORE on upgrades uses NoopIndexignoring unknown custom indexes (e.g. upgrades) found in system_schema.indexes will not remove them from system_schema.indexes
while being able to restore system_schema tables across major versions or products is by default not supported, we want a safety catch to get nodes up and running first so to be able to drop the unknown index afterwards.the use of INDEX_UNKNOWN_IGNORE in SecondaryIndexManager (when reading system_schema.index) is different to CreateIndexStatement (executing cql
CREATE INDEX…) is that it will create the index but of type NoopIndex, rather than silently ignore its creation.
I've created the dummy impl separately, in NoopIndex. This makes future rebases simpler. It is used in SecondaryIndexManager for any unidentified custom index when -Dcassandra.index.unknown_custom_class.ignore=true (INDEX_UNKNOWN_IGNORE) has also be set.
I don't believe the custom index class not matching the instantiated class is an issue, letting tests run first.
SASI has never been supported, so it's mostly dead code. This would allow us to get rid of code that we are still partially maintaining, spending resources on CI, build, etc. This has already be done in DSE 6.9: riptano/bdp@358767f Rebase notes: - previously a dummy noop impl existed, now it's altogether removed. this means the operator must first adjust the schema (drop the index) before running a node on this version. this provides clearer UX about the subsequent lack of behaviour. a node won't even start (StartupChecks) if sasi_indexes_enabled is true.
…schema (or create index statement) - fails-fast by default: tells the operator there's no index and things are not going to work, or work in unexpected ways (that could impact cluster availability), - permits an override so the custom index in a schema can be silently ignored, using a sys property -Dcassandra.index.unknown_custom_class.ignore=true , - this is also a similar approach to how we handle the unknown dse index classes
b1d1b2d to
e43d956
Compare
|
A curious effect of ignoring old/unknown indexes is that I think there will still be an entry for them in Can we add a check on the upgrade test to see what the system schema table contains ( |
A dse custom index currently (in This changed in this PR when we added the flag to ignore. (And yes, I think now the right thing to do is: the ignore flag should only apply to explicit DDL, not to upgrades (and what's in system_schema.indexes already). If we have users that want indexes to randomly work during an upgrade we can tackle that later IMHO. |
c32e02c to
de782c7
Compare
ffc7aa5 to
3e61c19
Compare
ignoring unknown custom indexes (e.g. upgrades) found in system_schema.indexes will not remove them from system_schema.indexes while being able to restore system_schema tables across major versions or products is by default not supported, we want a safety catch to get nodes up and running first so to be able to drop the unknown index afterwards. the use of INDEX_UNKNOWN_IGNORE in SecondaryIndexManager (when reading system_schema.index) is different to CreateIndexStatement (executing cql `CREATE INDEX…`) is that it will create the index but of type NoopIndex, rather than silently ignore its creation.
3e61c19 to
360d4a5
Compare
adelapena
left a comment
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.
Overall looks good to me. I have left only a few minor suggestions. I think the only loose end would be deciding the default value of cassandra.index.unknown_custom_class.ignore.
| INDEX_SUMMARY_EXPECTED_KEY_SIZE("cassandra.index_summary_expected_key_size", "64"), | ||
| /** Set to true for `create custom index` cql statements on unknown index classes to be ignored rather than error, | ||
| * and for existing entries in `system_schema.index` of unknown index classes to silently use the NoopIndex. */ | ||
| INDEX_UNKNOWN_IGNORE("cassandra.index.unknown_custom_class.ignore"), |
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.
@JeremiahDJordan what do you think should be the default for this? Fail the node startup and reject index creation queries on SASI by default, or ignoring them?
test/distributed/org/apache/cassandra/distributed/upgrade/IndexUnknownIgnoreTest.java
Show resolved
Hide resolved
49e81bd to
91e8633
Compare
|


https://github.com/riptano/cndb/issues/15582
Port into main-5.0 commit bc9628b