[
https://issues.apache.org/jira/browse/CASSANDRA-9449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14572651#comment-14572651
]
Aleksey Yeschenko commented on CASSANDRA-9449:
----------------------------------------------
Yep. Internal {{CFMetaData}} state gets corrupted because of the inherent
raciness. Ultimately, all DDL statements' execution, including
{{AlterTableStatement}}'s, should be linearized. It would be a relatively
significant change for the 2.1 branch, and for 2.2 branch, for that matter.
CASSANDRA-9425 is the ultimate fix. For now, just try to avoid simultaneous
modifications of the same table.
> Running ALTER TABLE cql statement asynchronously results in failure
> -------------------------------------------------------------------
>
> Key: CASSANDRA-9449
> URL: https://issues.apache.org/jira/browse/CASSANDRA-9449
> Project: Cassandra
> Issue Type: Bug
> Environment: Singe cluster environment
> Reporter: Paul Praet
>
> When running 'ALTER TABLE' cql statements asynchronously, we notice that
> often certain columns are missing, causing subsequent queries to fail.
> The code snippet below can be used to reproduce the problem.
> cassandra is a com.datastax.driver.core.Session reference.
> We construct the table synchronously and then alter it (adding five columns)
> with the cassandra async API. We synchronize to ensure the table is properly
> altered before continuing. Preparing the statement at the bottom of the code
> snippet often fails:
> {noformat} com.datastax.driver.core.exceptions.InvalidQueryException: Unknown
> identifier columnf {noformat}
> {code}
> @Test
> public void testCassandraAsyncAlterTable() throws Exception {
> ResultSet rs = cassandra.execute("CREATE TABLE device ( columnA text,
> columnB text, columnC timestamp, PRIMARY KEY ((columnA, columnB)));");
> List<ResultSetFuture> futures = new ArrayList<>();
> futures.add(cassandra.executeAsync("ALTER TABLE device ADD columnD
> text;"));
> futures.add(cassandra.executeAsync("ALTER TABLE device ADD columnE
> text;"));
> futures.add(cassandra.executeAsync("ALTER TABLE device ADD columnF
> text;"));
> futures.add(cassandra.executeAsync("ALTER TABLE device ADD columnG
> text;"));
> futures.add(cassandra.executeAsync("ALTER TABLE device ADD columnH
> text;"));
> for(ResultSetFuture resultfuture : futures){ resultfuture.get(); }
>
> /* discard the result; only interested to see if it works or not */
> cassandra.prepare("INSERT INTO device (columnA, columnB,
> columnC,columnD,columnE,columnF,columnG,columnH) VALUES (?,?,?,?,?,?,?,?);");
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)