Details
-
Sub-task
-
Status: Resolved
-
Normal
-
Resolution: Fixed
-
None
-
None
Description
The way we handle schema changes currently is inherently racy.
All of our SchemaAlteringStatement s perform validation on a schema state that's won't necessarily be there when the statement gets executed and mutates schema.
We should make all the *Metadata classes (KeyspaceMetadata, TableMetadata, ColumnMetadata, immutable, and local schema persistently snapshottable, with a single top-level AtomicReference to the current snapshot. Have DDL statements perform validation and transformation on the same state.
In pseudo-code, think
public interface DDLStatement { /** * Validates that the DDL statement can be applied to the provided schema snapshot. * * @param schema snapshot of schema before executing CREATE KEYSPACE */ void validate(SchemaSnapshot schema); /** * Applies the DDL statement to the provided schema snapshot. * Implies that validate() has already been called on the provided snapshot. * * @param schema snapshot of schema before executing the statement * @return snapshot of schema as it would be after executing the statement */ SchemaSnapshot transform(SchemaSnapshot schema); }
Attachments
Issue Links
- incorporates
-
CASSANDRA-9665 Improve handling of UDF and UDA metadata
- Resolved
-
CASSANDRA-9712 Refactor CFMetaData
- Open
-
CASSANDRA-9677 Refactor KSMetaData
- Resolved
- is duplicated by
-
CASSANDRA-9449 Running ALTER TABLE cql statement asynchronously results in failure
- Resolved
-
CASSANDRA-10250 Executing lots of schema alters concurrently can lead to dropped alters
- Resolved
-
CASSANDRA-13061 C* driver hangs forever in case of concurrent CREATE TABLE IF NOT EXISTS
- Resolved
- is related to
-
CASSANDRA-13164 eclipse-warnings on CASSANDRA-9425
- Resolved