http://git-wip-us.apache.org/repos/asf/cassandra/blob/07fbd8ee/test/unit/org/apache/cassandra/cql3/validation/operations/UpdateTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/cql3/validation/operations/UpdateTest.java b/test/unit/org/apache/cassandra/cql3/validation/operations/UpdateTest.java index af6c4f9..973531b 100644 --- a/test/unit/org/apache/cassandra/cql3/validation/operations/UpdateTest.java +++ b/test/unit/org/apache/cassandra/cql3/validation/operations/UpdateTest.java @@ -71,125 +71,113 @@ public class UpdateTest extends CQLTester private void testUpdate(boolean forceFlush) throws Throwable { - for (String compactOption : new String[] {"", " WITH COMPACT STORAGE" }) - { - createTable("CREATE TABLE %s (partitionKey int," + + createTable("CREATE TABLE %s (partitionKey int," + "clustering_1 int," + "value int," + - " PRIMARY KEY (partitionKey, clustering_1))" + compactOption); - - execute("INSERT INTO %s (partitionKey, clustering_1, value) VALUES (0, 0, 0)"); - execute("INSERT INTO %s (partitionKey, clustering_1, value) VALUES (0, 1, 1)"); - execute("INSERT INTO %s (partitionKey, clustering_1, value) VALUES (0, 2, 2)"); - execute("INSERT INTO %s (partitionKey, clustering_1, value) VALUES (0, 3, 3)"); - execute("INSERT INTO %s (partitionKey, clustering_1, value) VALUES (1, 0, 4)"); - - flush(forceFlush); - - execute("UPDATE %s SET value = ? WHERE partitionKey = ? AND clustering_1 = ?", 7, 0, 1); - flush(forceFlush); - assertRows(execute("SELECT value FROM %s WHERE partitionKey = ? AND clustering_1 = ?", - 0, 1), - row(7)); - - execute("UPDATE %s SET value = ? WHERE partitionKey = ? AND (clustering_1) = (?)", 8, 0, 2); - flush(forceFlush); - assertRows(execute("SELECT value FROM %s WHERE partitionKey = ? AND clustering_1 = ?", - 0, 2), - row(8)); - - execute("UPDATE %s SET value = ? WHERE partitionKey IN (?, ?) AND clustering_1 = ?", 9, 0, 1, 0); - flush(forceFlush); - assertRows(execute("SELECT * FROM %s WHERE partitionKey IN (?, ?) AND clustering_1 = ?", - 0, 1, 0), - row(0, 0, 9), - row(1, 0, 9)); - - execute("UPDATE %s SET value = ? WHERE partitionKey IN ? AND clustering_1 = ?", 19, Arrays.asList(0, 1), 0); - flush(forceFlush); - assertRows(execute("SELECT * FROM %s WHERE partitionKey IN ? AND clustering_1 = ?", - Arrays.asList(0, 1), 0), - row(0, 0, 19), - row(1, 0, 19)); - - execute("UPDATE %s SET value = ? WHERE partitionKey = ? AND clustering_1 IN (?, ?)", 10, 0, 1, 0); - flush(forceFlush); - assertRows(execute("SELECT * FROM %s WHERE partitionKey = ? AND clustering_1 IN (?, ?)", - 0, 1, 0), - row(0, 0, 10), - row(0, 1, 10)); - - execute("UPDATE %s SET value = ? WHERE partitionKey = ? AND (clustering_1) IN ((?), (?))", 20, 0, 0, 1); - flush(forceFlush); - assertRows(execute("SELECT * FROM %s WHERE partitionKey = ? AND (clustering_1) IN ((?), (?))", - 0, 0, 1), - row(0, 0, 20), - row(0, 1, 20)); - - execute("UPDATE %s SET value = ? WHERE partitionKey = ? AND clustering_1 = ?", null, 0, 0); - flush(forceFlush); - - if (isEmpty(compactOption)) - { - assertRows(execute("SELECT * FROM %s WHERE partitionKey = ? AND (clustering_1) IN ((?), (?))", - 0, 0, 1), - row(0, 0, null), - row(0, 1, 20)); - } - else - { - assertRows(execute("SELECT * FROM %s WHERE partitionKey = ? AND (clustering_1) IN ((?), (?))", - 0, 0, 1), - row(0, 1, 20)); - } - - // test invalid queries - - // missing primary key element - assertInvalidMessage("Some partition key parts are missing: partitionkey", - "UPDATE %s SET value = ? WHERE clustering_1 = ? ", 7, 1); - - assertInvalidMessage("Some clustering keys are missing: clustering_1", - "UPDATE %s SET value = ? WHERE partitionKey = ?", 7, 0); - - assertInvalidMessage("Some clustering keys are missing: clustering_1", - "UPDATE %s SET value = ? WHERE partitionKey = ?", 7, 0); - - // token function - assertInvalidMessage("The token function cannot be used in WHERE clauses for UPDATE statements", - "UPDATE %s SET value = ? WHERE token(partitionKey) = token(?) AND clustering_1 = ?", - 7, 0, 1); - - // multiple time the same value - assertInvalidSyntax("UPDATE %s SET value = ?, value = ? WHERE partitionKey = ? AND clustering_1 = ?", 7, 0, 1); - - // multiple time same primary key element in WHERE clause - assertInvalidMessage("clustering_1 cannot be restricted by more than one relation if it includes an Equal", - "UPDATE %s SET value = ? WHERE partitionKey = ? AND clustering_1 = ? AND clustering_1 = ?", 7, 0, 1, 1); - - // unknown identifiers - assertInvalidMessage("Undefined column name value1", - "UPDATE %s SET value1 = ? WHERE partitionKey = ? AND clustering_1 = ?", 7, 0, 1); - - assertInvalidMessage("Undefined column name partitionkey1", - "UPDATE %s SET value = ? WHERE partitionKey1 = ? AND clustering_1 = ?", 7, 0, 1); - - assertInvalidMessage("Undefined column name clustering_3", - "UPDATE %s SET value = ? WHERE partitionKey = ? AND clustering_3 = ?", 7, 0, 1); - - // Invalid operator in the where clause - assertInvalidMessage("Only EQ and IN relation are supported on the partition key (unless you use the token() function)", - "UPDATE %s SET value = ? WHERE partitionKey > ? AND clustering_1 = ?", 7, 0, 1); - - assertInvalidMessage("Cannot use CONTAINS on non-collection column partitionkey", - "UPDATE %s SET value = ? WHERE partitionKey CONTAINS ? AND clustering_1 = ?", 7, 0, 1); - - assertInvalidMessage("Non PRIMARY KEY columns found in where clause: value", - "UPDATE %s SET value = ? WHERE partitionKey = ? AND clustering_1 = ? AND value = ?", 7, 0, 1, 3); - - assertInvalidMessage("Slice restrictions are not supported on the clustering columns in UPDATE statements", - "UPDATE %s SET value = ? WHERE partitionKey = ? AND clustering_1 > ?", 7, 0, 1); - } + " PRIMARY KEY (partitionKey, clustering_1))"); + + execute("INSERT INTO %s (partitionKey, clustering_1, value) VALUES (0, 0, 0)"); + execute("INSERT INTO %s (partitionKey, clustering_1, value) VALUES (0, 1, 1)"); + execute("INSERT INTO %s (partitionKey, clustering_1, value) VALUES (0, 2, 2)"); + execute("INSERT INTO %s (partitionKey, clustering_1, value) VALUES (0, 3, 3)"); + execute("INSERT INTO %s (partitionKey, clustering_1, value) VALUES (1, 0, 4)"); + + flush(forceFlush); + + execute("UPDATE %s SET value = ? WHERE partitionKey = ? AND clustering_1 = ?", 7, 0, 1); + flush(forceFlush); + assertRows(execute("SELECT value FROM %s WHERE partitionKey = ? AND clustering_1 = ?", + 0, 1), + row(7)); + + execute("UPDATE %s SET value = ? WHERE partitionKey = ? AND (clustering_1) = (?)", 8, 0, 2); + flush(forceFlush); + assertRows(execute("SELECT value FROM %s WHERE partitionKey = ? AND clustering_1 = ?", + 0, 2), + row(8)); + + execute("UPDATE %s SET value = ? WHERE partitionKey IN (?, ?) AND clustering_1 = ?", 9, 0, 1, 0); + flush(forceFlush); + assertRows(execute("SELECT * FROM %s WHERE partitionKey IN (?, ?) AND clustering_1 = ?", + 0, 1, 0), + row(0, 0, 9), + row(1, 0, 9)); + + execute("UPDATE %s SET value = ? WHERE partitionKey IN ? AND clustering_1 = ?", 19, Arrays.asList(0, 1), 0); + flush(forceFlush); + assertRows(execute("SELECT * FROM %s WHERE partitionKey IN ? AND clustering_1 = ?", + Arrays.asList(0, 1), 0), + row(0, 0, 19), + row(1, 0, 19)); + + execute("UPDATE %s SET value = ? WHERE partitionKey = ? AND clustering_1 IN (?, ?)", 10, 0, 1, 0); + flush(forceFlush); + assertRows(execute("SELECT * FROM %s WHERE partitionKey = ? AND clustering_1 IN (?, ?)", + 0, 1, 0), + row(0, 0, 10), + row(0, 1, 10)); + + execute("UPDATE %s SET value = ? WHERE partitionKey = ? AND (clustering_1) IN ((?), (?))", 20, 0, 0, 1); + flush(forceFlush); + assertRows(execute("SELECT * FROM %s WHERE partitionKey = ? AND (clustering_1) IN ((?), (?))", + 0, 0, 1), + row(0, 0, 20), + row(0, 1, 20)); + + execute("UPDATE %s SET value = ? WHERE partitionKey = ? AND clustering_1 = ?", null, 0, 0); + flush(forceFlush); + + assertRows(execute("SELECT * FROM %s WHERE partitionKey = ? AND (clustering_1) IN ((?), (?))", + 0, 0, 1), + row(0, 0, null), + row(0, 1, 20)); + + // test invalid queries + + // missing primary key element + assertInvalidMessage("Some partition key parts are missing: partitionkey", + "UPDATE %s SET value = ? WHERE clustering_1 = ? ", 7, 1); + + assertInvalidMessage("Some clustering keys are missing: clustering_1", + "UPDATE %s SET value = ? WHERE partitionKey = ?", 7, 0); + + assertInvalidMessage("Some clustering keys are missing: clustering_1", + "UPDATE %s SET value = ? WHERE partitionKey = ?", 7, 0); + + // token function + assertInvalidMessage("The token function cannot be used in WHERE clauses for UPDATE statements", + "UPDATE %s SET value = ? WHERE token(partitionKey) = token(?) AND clustering_1 = ?", + 7, 0, 1); + + // multiple time the same value + assertInvalidSyntax("UPDATE %s SET value = ?, value = ? WHERE partitionKey = ? AND clustering_1 = ?", 7, 0, 1); + + // multiple time same primary key element in WHERE clause + assertInvalidMessage("clustering_1 cannot be restricted by more than one relation if it includes an Equal", + "UPDATE %s SET value = ? WHERE partitionKey = ? AND clustering_1 = ? AND clustering_1 = ?", 7, 0, 1, 1); + + // unknown identifiers + assertInvalidMessage("Undefined column name value1", + "UPDATE %s SET value1 = ? WHERE partitionKey = ? AND clustering_1 = ?", 7, 0, 1); + + assertInvalidMessage("Undefined column name partitionkey1", + "UPDATE %s SET value = ? WHERE partitionKey1 = ? AND clustering_1 = ?", 7, 0, 1); + + assertInvalidMessage("Undefined column name clustering_3", + "UPDATE %s SET value = ? WHERE partitionKey = ? AND clustering_3 = ?", 7, 0, 1); + + // Invalid operator in the where clause + assertInvalidMessage("Only EQ and IN relation are supported on the partition key (unless you use the token() function)", + "UPDATE %s SET value = ? WHERE partitionKey > ? AND clustering_1 = ?", 7, 0, 1); + + assertInvalidMessage("Cannot use CONTAINS on non-collection column partitionkey", + "UPDATE %s SET value = ? WHERE partitionKey CONTAINS ? AND clustering_1 = ?", 7, 0, 1); + + assertInvalidMessage("Non PRIMARY KEY columns found in where clause: value", + "UPDATE %s SET value = ? WHERE partitionKey = ? AND clustering_1 = ? AND value = ?", 7, 0, 1, 3); + + assertInvalidMessage("Slice restrictions are not supported on the clustering columns in UPDATE statements", + "UPDATE %s SET value = ? WHERE partitionKey = ? AND clustering_1 > ?", 7, 0, 1); } @Test @@ -244,142 +232,127 @@ public class UpdateTest extends CQLTester private void testUpdateWithTwoClusteringColumns(boolean forceFlush) throws Throwable { - for (String compactOption : new String[] { "", " WITH COMPACT STORAGE" }) - { - createTable("CREATE TABLE %s (partitionKey int," + + createTable("CREATE TABLE %s (partitionKey int," + "clustering_1 int," + "clustering_2 int," + "value int," + - " PRIMARY KEY (partitionKey, clustering_1, clustering_2))" + compactOption); - - execute("INSERT INTO %s (partitionKey, clustering_1, clustering_2, value) VALUES (0, 0, 0, 0)"); - execute("INSERT INTO %s (partitionKey, clustering_1, clustering_2, value) VALUES (0, 0, 1, 1)"); - execute("INSERT INTO %s (partitionKey, clustering_1, clustering_2, value) VALUES (0, 0, 2, 2)"); - execute("INSERT INTO %s (partitionKey, clustering_1, clustering_2, value) VALUES (0, 0, 3, 3)"); - execute("INSERT INTO %s (partitionKey, clustering_1, clustering_2, value) VALUES (0, 1, 1, 4)"); - execute("INSERT INTO %s (partitionKey, clustering_1, clustering_2, value) VALUES (0, 1, 2, 5)"); - execute("INSERT INTO %s (partitionKey, clustering_1, clustering_2, value) VALUES (1, 0, 0, 6)"); - flush(forceFlush); - - execute("UPDATE %s SET value = ? WHERE partitionKey = ? AND clustering_1 = ? AND clustering_2 = ?", 7, 0, 1, 1); - flush(forceFlush); - assertRows(execute("SELECT value FROM %s WHERE partitionKey = ? AND clustering_1 = ? AND clustering_2 = ?", - 0, 1, 1), - row(7)); - - execute("UPDATE %s SET value = ? WHERE partitionKey = ? AND (clustering_1, clustering_2) = (?, ?)", 8, 0, 1, 2); - flush(forceFlush); - assertRows(execute("SELECT value FROM %s WHERE partitionKey = ? AND clustering_1 = ? AND clustering_2 = ?", - 0, 1, 2), - row(8)); - - execute("UPDATE %s SET value = ? WHERE partitionKey IN (?, ?) AND clustering_1 = ? AND clustering_2 = ?", 9, 0, 1, 0, 0); - flush(forceFlush); - assertRows(execute("SELECT * FROM %s WHERE partitionKey IN (?, ?) AND clustering_1 = ? AND clustering_2 = ?", - 0, 1, 0, 0), - row(0, 0, 0, 9), - row(1, 0, 0, 9)); - - execute("UPDATE %s SET value = ? WHERE partitionKey IN ? AND clustering_1 = ? AND clustering_2 = ?", 9, Arrays.asList(0, 1), 0, 0); - flush(forceFlush); - assertRows(execute("SELECT * FROM %s WHERE partitionKey IN ? AND clustering_1 = ? AND clustering_2 = ?", - Arrays.asList(0, 1), 0, 0), - row(0, 0, 0, 9), - row(1, 0, 0, 9)); - - execute("UPDATE %s SET value = ? WHERE partitionKey = ? AND clustering_1 = ? AND clustering_2 IN (?, ?)", 12, 0, 1, 1, 2); - flush(forceFlush); - assertRows(execute("SELECT * FROM %s WHERE partitionKey = ? AND clustering_1 = ? AND clustering_2 IN (?, ?)", - 0, 1, 1, 2), - row(0, 1, 1, 12), - row(0, 1, 2, 12)); - - execute("UPDATE %s SET value = ? WHERE partitionKey = ? AND clustering_1 IN (?, ?) AND clustering_2 IN (?, ?)", 10, 0, 1, 0, 1, 2); - flush(forceFlush); - assertRows(execute("SELECT * FROM %s WHERE partitionKey = ? AND clustering_1 IN (?, ?) AND clustering_2 IN (?, ?)", - 0, 1, 0, 1, 2), - row(0, 0, 1, 10), - row(0, 0, 2, 10), - row(0, 1, 1, 10), - row(0, 1, 2, 10)); - - execute("UPDATE %s SET value = ? WHERE partitionKey = ? AND (clustering_1, clustering_2) IN ((?, ?), (?, ?))", 20, 0, 0, 2, 1, 2); - flush(forceFlush); - assertRows(execute("SELECT * FROM %s WHERE partitionKey = ? AND (clustering_1, clustering_2) IN ((?, ?), (?, ?))", - 0, 0, 2, 1, 2), - row(0, 0, 2, 20), - row(0, 1, 2, 20)); - - execute("UPDATE %s SET value = ? WHERE partitionKey = ? AND clustering_1 = ? AND clustering_2 = ?", null, 0, 0, 2); - flush(forceFlush); - - if (isEmpty(compactOption)) - { - assertRows(execute("SELECT * FROM %s WHERE partitionKey = ? AND (clustering_1, clustering_2) IN ((?, ?), (?, ?))", - 0, 0, 2, 1, 2), - row(0, 0, 2, null), - row(0, 1, 2, 20)); - } - else - { - assertRows(execute("SELECT * FROM %s WHERE partitionKey = ? AND (clustering_1, clustering_2) IN ((?, ?), (?, ?))", - 0, 0, 2, 1, 2), - row(0, 1, 2, 20)); - } - - // test invalid queries - - // missing primary key element - assertInvalidMessage("Some partition key parts are missing: partitionkey", - "UPDATE %s SET value = ? WHERE clustering_1 = ? AND clustering_2 = ?", 7, 1, 1); - - String errorMsg = isEmpty(compactOption) ? "Some clustering keys are missing: clustering_1" - : "PRIMARY KEY column \"clustering_2\" cannot be restricted as preceding column \"clustering_1\" is not restricted"; - - assertInvalidMessage(errorMsg, - "UPDATE %s SET value = ? WHERE partitionKey = ? AND clustering_2 = ?", 7, 0, 1); - - assertInvalidMessage("Some clustering keys are missing: clustering_1, clustering_2", - "UPDATE %s SET value = ? WHERE partitionKey = ?", 7, 0); - - // token function - assertInvalidMessage("The token function cannot be used in WHERE clauses for UPDATE statements", - "UPDATE %s SET value = ? WHERE token(partitionKey) = token(?) AND clustering_1 = ? AND clustering_2 = ?", - 7, 0, 1, 1); - - // multiple time the same value - assertInvalidSyntax("UPDATE %s SET value = ?, value = ? WHERE partitionKey = ? AND clustering_1 = ? AND clustering_2 = ?", 7, 0, 1, 1); - - // multiple time same primary key element in WHERE clause - assertInvalidMessage("clustering_1 cannot be restricted by more than one relation if it includes an Equal", - "UPDATE %s SET value = ? WHERE partitionKey = ? AND clustering_1 = ? AND clustering_2 = ? AND clustering_1 = ?", 7, 0, 1, 1, 1); - - // unknown identifiers - assertInvalidMessage("Undefined column name value1", - "UPDATE %s SET value1 = ? WHERE partitionKey = ? AND clustering_1 = ? AND clustering_2 = ?", 7, 0, 1, 1); - - assertInvalidMessage("Undefined column name partitionkey1", - "UPDATE %s SET value = ? WHERE partitionKey1 = ? AND clustering_1 = ? AND clustering_2 = ?", 7, 0, 1, 1); - - assertInvalidMessage("Undefined column name clustering_3", - "UPDATE %s SET value = ? WHERE partitionKey = ? AND clustering_1 = ? AND clustering_3 = ?", 7, 0, 1, 1); - - // Invalid operator in the where clause - assertInvalidMessage("Only EQ and IN relation are supported on the partition key (unless you use the token() function)", - "UPDATE %s SET value = ? WHERE partitionKey > ? AND clustering_1 = ? AND clustering_2 = ?", 7, 0, 1, 1); - - assertInvalidMessage("Cannot use CONTAINS on non-collection column partitionkey", - "UPDATE %s SET value = ? WHERE partitionKey CONTAINS ? AND clustering_1 = ? AND clustering_2 = ?", 7, 0, 1, 1); - - assertInvalidMessage("Non PRIMARY KEY columns found in where clause: value", - "UPDATE %s SET value = ? WHERE partitionKey = ? AND clustering_1 = ? AND clustering_2 = ? AND value = ?", 7, 0, 1, 1, 3); - - assertInvalidMessage("Slice restrictions are not supported on the clustering columns in UPDATE statements", - "UPDATE %s SET value = ? WHERE partitionKey = ? AND clustering_1 > ?", 7, 0, 1); - - assertInvalidMessage("Slice restrictions are not supported on the clustering columns in UPDATE statements", - "UPDATE %s SET value = ? WHERE partitionKey = ? AND (clustering_1, clustering_2) > (?, ?)", 7, 0, 1, 1); - } + " PRIMARY KEY (partitionKey, clustering_1, clustering_2))"); + + execute("INSERT INTO %s (partitionKey, clustering_1, clustering_2, value) VALUES (0, 0, 0, 0)"); + execute("INSERT INTO %s (partitionKey, clustering_1, clustering_2, value) VALUES (0, 0, 1, 1)"); + execute("INSERT INTO %s (partitionKey, clustering_1, clustering_2, value) VALUES (0, 0, 2, 2)"); + execute("INSERT INTO %s (partitionKey, clustering_1, clustering_2, value) VALUES (0, 0, 3, 3)"); + execute("INSERT INTO %s (partitionKey, clustering_1, clustering_2, value) VALUES (0, 1, 1, 4)"); + execute("INSERT INTO %s (partitionKey, clustering_1, clustering_2, value) VALUES (0, 1, 2, 5)"); + execute("INSERT INTO %s (partitionKey, clustering_1, clustering_2, value) VALUES (1, 0, 0, 6)"); + flush(forceFlush); + + execute("UPDATE %s SET value = ? WHERE partitionKey = ? AND clustering_1 = ? AND clustering_2 = ?", 7, 0, 1, 1); + flush(forceFlush); + assertRows(execute("SELECT value FROM %s WHERE partitionKey = ? AND clustering_1 = ? AND clustering_2 = ?", + 0, 1, 1), + row(7)); + + execute("UPDATE %s SET value = ? WHERE partitionKey = ? AND (clustering_1, clustering_2) = (?, ?)", 8, 0, 1, 2); + flush(forceFlush); + assertRows(execute("SELECT value FROM %s WHERE partitionKey = ? AND clustering_1 = ? AND clustering_2 = ?", + 0, 1, 2), + row(8)); + + execute("UPDATE %s SET value = ? WHERE partitionKey IN (?, ?) AND clustering_1 = ? AND clustering_2 = ?", 9, 0, 1, 0, 0); + flush(forceFlush); + assertRows(execute("SELECT * FROM %s WHERE partitionKey IN (?, ?) AND clustering_1 = ? AND clustering_2 = ?", + 0, 1, 0, 0), + row(0, 0, 0, 9), + row(1, 0, 0, 9)); + + execute("UPDATE %s SET value = ? WHERE partitionKey IN ? AND clustering_1 = ? AND clustering_2 = ?", 9, Arrays.asList(0, 1), 0, 0); + flush(forceFlush); + assertRows(execute("SELECT * FROM %s WHERE partitionKey IN ? AND clustering_1 = ? AND clustering_2 = ?", + Arrays.asList(0, 1), 0, 0), + row(0, 0, 0, 9), + row(1, 0, 0, 9)); + + execute("UPDATE %s SET value = ? WHERE partitionKey = ? AND clustering_1 = ? AND clustering_2 IN (?, ?)", 12, 0, 1, 1, 2); + flush(forceFlush); + assertRows(execute("SELECT * FROM %s WHERE partitionKey = ? AND clustering_1 = ? AND clustering_2 IN (?, ?)", + 0, 1, 1, 2), + row(0, 1, 1, 12), + row(0, 1, 2, 12)); + + execute("UPDATE %s SET value = ? WHERE partitionKey = ? AND clustering_1 IN (?, ?) AND clustering_2 IN (?, ?)", 10, 0, 1, 0, 1, 2); + flush(forceFlush); + assertRows(execute("SELECT * FROM %s WHERE partitionKey = ? AND clustering_1 IN (?, ?) AND clustering_2 IN (?, ?)", + 0, 1, 0, 1, 2), + row(0, 0, 1, 10), + row(0, 0, 2, 10), + row(0, 1, 1, 10), + row(0, 1, 2, 10)); + + execute("UPDATE %s SET value = ? WHERE partitionKey = ? AND (clustering_1, clustering_2) IN ((?, ?), (?, ?))", 20, 0, 0, 2, 1, 2); + flush(forceFlush); + assertRows(execute("SELECT * FROM %s WHERE partitionKey = ? AND (clustering_1, clustering_2) IN ((?, ?), (?, ?))", + 0, 0, 2, 1, 2), + row(0, 0, 2, 20), + row(0, 1, 2, 20)); + + execute("UPDATE %s SET value = ? WHERE partitionKey = ? AND clustering_1 = ? AND clustering_2 = ?", null, 0, 0, 2); + flush(forceFlush); + + assertRows(execute("SELECT * FROM %s WHERE partitionKey = ? AND (clustering_1, clustering_2) IN ((?, ?), (?, ?))", + 0, 0, 2, 1, 2), + row(0, 0, 2, null), + row(0, 1, 2, 20)); + + // test invalid queries + + // missing primary key element + assertInvalidMessage("Some partition key parts are missing: partitionkey", + "UPDATE %s SET value = ? WHERE clustering_1 = ? AND clustering_2 = ?", 7, 1, 1); + + assertInvalidMessage("Some clustering keys are missing: clustering_1", + "UPDATE %s SET value = ? WHERE partitionKey = ? AND clustering_2 = ?", 7, 0, 1); + + assertInvalidMessage("Some clustering keys are missing: clustering_1, clustering_2", + "UPDATE %s SET value = ? WHERE partitionKey = ?", 7, 0); + + // token function + assertInvalidMessage("The token function cannot be used in WHERE clauses for UPDATE statements", + "UPDATE %s SET value = ? WHERE token(partitionKey) = token(?) AND clustering_1 = ? AND clustering_2 = ?", + 7, 0, 1, 1); + + // multiple time the same value + assertInvalidSyntax("UPDATE %s SET value = ?, value = ? WHERE partitionKey = ? AND clustering_1 = ? AND clustering_2 = ?", 7, 0, 1, 1); + + // multiple time same primary key element in WHERE clause + assertInvalidMessage("clustering_1 cannot be restricted by more than one relation if it includes an Equal", + "UPDATE %s SET value = ? WHERE partitionKey = ? AND clustering_1 = ? AND clustering_2 = ? AND clustering_1 = ?", 7, 0, 1, 1, 1); + + // unknown identifiers + assertInvalidMessage("Undefined column name value1", + "UPDATE %s SET value1 = ? WHERE partitionKey = ? AND clustering_1 = ? AND clustering_2 = ?", 7, 0, 1, 1); + + assertInvalidMessage("Undefined column name partitionkey1", + "UPDATE %s SET value = ? WHERE partitionKey1 = ? AND clustering_1 = ? AND clustering_2 = ?", 7, 0, 1, 1); + + assertInvalidMessage("Undefined column name clustering_3", + "UPDATE %s SET value = ? WHERE partitionKey = ? AND clustering_1 = ? AND clustering_3 = ?", 7, 0, 1, 1); + + // Invalid operator in the where clause + assertInvalidMessage("Only EQ and IN relation are supported on the partition key (unless you use the token() function)", + "UPDATE %s SET value = ? WHERE partitionKey > ? AND clustering_1 = ? AND clustering_2 = ?", 7, 0, 1, 1); + + assertInvalidMessage("Cannot use CONTAINS on non-collection column partitionkey", + "UPDATE %s SET value = ? WHERE partitionKey CONTAINS ? AND clustering_1 = ? AND clustering_2 = ?", 7, 0, 1, 1); + + assertInvalidMessage("Non PRIMARY KEY columns found in where clause: value", + "UPDATE %s SET value = ? WHERE partitionKey = ? AND clustering_1 = ? AND clustering_2 = ? AND value = ?", 7, 0, 1, 1, 3); + + assertInvalidMessage("Slice restrictions are not supported on the clustering columns in UPDATE statements", + "UPDATE %s SET value = ? WHERE partitionKey = ? AND clustering_1 > ?", 7, 0, 1); + + assertInvalidMessage("Slice restrictions are not supported on the clustering columns in UPDATE statements", + "UPDATE %s SET value = ? WHERE partitionKey = ? AND (clustering_1, clustering_2) > (?, ?)", 7, 0, 1, 1); } @Test @@ -391,49 +364,46 @@ public class UpdateTest extends CQLTester public void testUpdateWithMultiplePartitionKeyComponents(boolean forceFlush) throws Throwable { - for (String compactOption : new String[] { "", " WITH COMPACT STORAGE" }) - { - createTable("CREATE TABLE %s (partitionKey_1 int," + + createTable("CREATE TABLE %s (partitionKey_1 int," + "partitionKey_2 int," + "clustering_1 int," + "clustering_2 int," + "value int," + - " PRIMARY KEY ((partitionKey_1, partitionKey_2), clustering_1, clustering_2))" + compactOption); - - execute("INSERT INTO %s (partitionKey_1, partitionKey_2, clustering_1, clustering_2, value) VALUES (0, 0, 0, 0, 0)"); - execute("INSERT INTO %s (partitionKey_1, partitionKey_2, clustering_1, clustering_2, value) VALUES (0, 1, 0, 1, 1)"); - execute("INSERT INTO %s (partitionKey_1, partitionKey_2, clustering_1, clustering_2, value) VALUES (0, 1, 1, 1, 2)"); - execute("INSERT INTO %s (partitionKey_1, partitionKey_2, clustering_1, clustering_2, value) VALUES (1, 0, 0, 1, 3)"); - execute("INSERT INTO %s (partitionKey_1, partitionKey_2, clustering_1, clustering_2, value) VALUES (1, 1, 0, 1, 3)"); - flush(forceFlush); - - execute("UPDATE %s SET value = ? WHERE partitionKey_1 = ? AND partitionKey_2 = ? AND clustering_1 = ? AND clustering_2 = ?", 7, 0, 0, 0, 0); - flush(forceFlush); - assertRows(execute("SELECT value FROM %s WHERE partitionKey_1 = ? AND partitionKey_2 = ? AND clustering_1 = ? AND clustering_2 = ?", - 0, 0, 0, 0), - row(7)); - - execute("UPDATE %s SET value = ? WHERE partitionKey_1 IN (?, ?) AND partitionKey_2 = ? AND clustering_1 = ? AND clustering_2 = ?", 9, 0, 1, 1, 0, 1); - flush(forceFlush); - assertRows(execute("SELECT * FROM %s WHERE partitionKey_1 IN (?, ?) AND partitionKey_2 = ? AND clustering_1 = ? AND clustering_2 = ?", - 0, 1, 1, 0, 1), - row(0, 1, 0, 1, 9), - row(1, 1, 0, 1, 9)); - - execute("UPDATE %s SET value = ? WHERE partitionKey_1 IN (?, ?) AND partitionKey_2 IN (?, ?) AND clustering_1 = ? AND clustering_2 = ?", 10, 0, 1, 0, 1, 0, 1); - flush(forceFlush); - assertRows(execute("SELECT * FROM %s"), - row(0, 0, 0, 0, 7), - row(0, 0, 0, 1, 10), - row(0, 1, 0, 1, 10), - row(0, 1, 1, 1, 2), - row(1, 0, 0, 1, 10), - row(1, 1, 0, 1, 10)); - - // missing primary key element - assertInvalidMessage("Some partition key parts are missing: partitionkey_2", - "UPDATE %s SET value = ? WHERE partitionKey_1 = ? AND clustering_1 = ? AND clustering_2 = ?", 7, 1, 1); - } + " PRIMARY KEY ((partitionKey_1, partitionKey_2), clustering_1, clustering_2))"); + + execute("INSERT INTO %s (partitionKey_1, partitionKey_2, clustering_1, clustering_2, value) VALUES (0, 0, 0, 0, 0)"); + execute("INSERT INTO %s (partitionKey_1, partitionKey_2, clustering_1, clustering_2, value) VALUES (0, 1, 0, 1, 1)"); + execute("INSERT INTO %s (partitionKey_1, partitionKey_2, clustering_1, clustering_2, value) VALUES (0, 1, 1, 1, 2)"); + execute("INSERT INTO %s (partitionKey_1, partitionKey_2, clustering_1, clustering_2, value) VALUES (1, 0, 0, 1, 3)"); + execute("INSERT INTO %s (partitionKey_1, partitionKey_2, clustering_1, clustering_2, value) VALUES (1, 1, 0, 1, 3)"); + flush(forceFlush); + + execute("UPDATE %s SET value = ? WHERE partitionKey_1 = ? AND partitionKey_2 = ? AND clustering_1 = ? AND clustering_2 = ?", 7, 0, 0, 0, 0); + flush(forceFlush); + assertRows(execute("SELECT value FROM %s WHERE partitionKey_1 = ? AND partitionKey_2 = ? AND clustering_1 = ? AND clustering_2 = ?", + 0, 0, 0, 0), + row(7)); + + execute("UPDATE %s SET value = ? WHERE partitionKey_1 IN (?, ?) AND partitionKey_2 = ? AND clustering_1 = ? AND clustering_2 = ?", 9, 0, 1, 1, 0, 1); + flush(forceFlush); + assertRows(execute("SELECT * FROM %s WHERE partitionKey_1 IN (?, ?) AND partitionKey_2 = ? AND clustering_1 = ? AND clustering_2 = ?", + 0, 1, 1, 0, 1), + row(0, 1, 0, 1, 9), + row(1, 1, 0, 1, 9)); + + execute("UPDATE %s SET value = ? WHERE partitionKey_1 IN (?, ?) AND partitionKey_2 IN (?, ?) AND clustering_1 = ? AND clustering_2 = ?", 10, 0, 1, 0, 1, 0, 1); + flush(forceFlush); + assertRows(execute("SELECT * FROM %s"), + row(0, 0, 0, 0, 7), + row(0, 0, 0, 1, 10), + row(0, 1, 0, 1, 10), + row(0, 1, 1, 1, 2), + row(1, 0, 0, 1, 10), + row(1, 1, 0, 1, 10)); + + // missing primary key element + assertInvalidMessage("Some partition key parts are missing: partitionkey_2", + "UPDATE %s SET value = ? WHERE partitionKey_1 = ? AND clustering_1 = ? AND clustering_2 = ?", 7, 1, 1); } @Test
http://git-wip-us.apache.org/repos/asf/cassandra/blob/07fbd8ee/test/unit/org/apache/cassandra/db/ColumnFamilyStoreCQLHelperTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/ColumnFamilyStoreCQLHelperTest.java b/test/unit/org/apache/cassandra/db/ColumnFamilyStoreCQLHelperTest.java index 6d680ce..453ab06 100644 --- a/test/unit/org/apache/cassandra/db/ColumnFamilyStoreCQLHelperTest.java +++ b/test/unit/org/apache/cassandra/db/ColumnFamilyStoreCQLHelperTest.java @@ -234,71 +234,6 @@ public class ColumnFamilyStoreCQLHelperTest extends CQLTester } @Test - public void testCfmCompactStorageCQL() - { - String keyspace = "cql_test_keyspace_compact"; - String table = "test_table_compact"; - - TableMetadata.Builder metadata = - TableMetadata.builder(keyspace, table) - .isDense(true) - .addPartitionKeyColumn("pk1", IntegerType.instance) - .addPartitionKeyColumn("pk2", AsciiType.instance) - .addClusteringColumn("ck1", ReversedType.getInstance(IntegerType.instance)) - .addClusteringColumn("ck2", IntegerType.instance) - .addRegularColumn("reg", IntegerType.instance); - - SchemaLoader.createKeyspace(keyspace, KeyspaceParams.simple(1), metadata); - - ColumnFamilyStore cfs = Keyspace.open(keyspace).getColumnFamilyStore(table); - - assertTrue(ColumnFamilyStoreCQLHelper.getTableMetadataAsCQL(cfs.metadata(), true).startsWith( - "CREATE TABLE IF NOT EXISTS cql_test_keyspace_compact.test_table_compact (\n" + - "\tpk1 varint,\n" + - "\tpk2 ascii,\n" + - "\tck1 varint,\n" + - "\tck2 varint,\n" + - "\treg varint,\n" + - "\tPRIMARY KEY ((pk1, pk2), ck1, ck2))\n" + - "\tWITH ID = " + cfs.metadata.id + "\n" + - "\tAND COMPACT STORAGE\n" + - "\tAND CLUSTERING ORDER BY (ck1 DESC, ck2 ASC)")); - } - - @Test - public void testCfmCounterCQL() - { - String keyspace = "cql_test_keyspace_counter"; - String table = "test_table_counter"; - - TableMetadata.Builder metadata = - TableMetadata.builder(keyspace, table) - .isDense(true) - .isCounter(true) - .addPartitionKeyColumn("pk1", IntegerType.instance) - .addPartitionKeyColumn("pk2", AsciiType.instance) - .addClusteringColumn("ck1", ReversedType.getInstance(IntegerType.instance)) - .addClusteringColumn("ck2", IntegerType.instance) - .addRegularColumn("cnt", CounterColumnType.instance); - - SchemaLoader.createKeyspace(keyspace, KeyspaceParams.simple(1), metadata); - - ColumnFamilyStore cfs = Keyspace.open(keyspace).getColumnFamilyStore(table); - - assertTrue(ColumnFamilyStoreCQLHelper.getTableMetadataAsCQL(cfs.metadata(), true).startsWith( - "CREATE TABLE IF NOT EXISTS cql_test_keyspace_counter.test_table_counter (\n" + - "\tpk1 varint,\n" + - "\tpk2 ascii,\n" + - "\tck1 varint,\n" + - "\tck2 varint,\n" + - "\tcnt counter,\n" + - "\tPRIMARY KEY ((pk1, pk2), ck1, ck2))\n" + - "\tWITH ID = " + cfs.metadata.id + "\n" + - "\tAND COMPACT STORAGE\n" + - "\tAND CLUSTERING ORDER BY (ck1 DESC, ck2 ASC)")); - } - - @Test public void testCfmOptionsCQL() { String keyspace = "cql_test_keyspace_options"; @@ -508,165 +443,4 @@ public class ColumnFamilyStoreCQLHelperTest extends CQLTester schemaChange("DROP TYPE " + keyspace() + "." + typeA); validate.run(); } - - @Test - public void testDenseTable() throws Throwable - { - String tableName = createTable("CREATE TABLE IF NOT EXISTS %s (" + - "pk1 varint PRIMARY KEY," + - "reg1 int)" + - " WITH COMPACT STORAGE"); - - ColumnFamilyStore cfs = Keyspace.open(keyspace()).getColumnFamilyStore(tableName); - - assertTrue(ColumnFamilyStoreCQLHelper.getTableMetadataAsCQL(cfs.metadata(), true).startsWith( - "CREATE TABLE IF NOT EXISTS " + keyspace() + "." + tableName + " (\n" + - "\tpk1 varint PRIMARY KEY,\n" + - "\treg1 int)\n" + - "\tWITH ID = " + cfs.metadata.id + "\n" + - "\tAND COMPACT STORAGE")); - } - - @Test - public void testStaticCompactTable() throws Throwable - { - String tableName = createTable("CREATE TABLE IF NOT EXISTS %s (" + - "pk1 varint PRIMARY KEY," + - "reg1 int," + - "reg2 int)" + - " WITH COMPACT STORAGE"); - - ColumnFamilyStore cfs = Keyspace.open(keyspace()).getColumnFamilyStore(tableName); - - assertTrue(ColumnFamilyStoreCQLHelper.getTableMetadataAsCQL(cfs.metadata(), true).startsWith( - "CREATE TABLE IF NOT EXISTS " + keyspace() + "." + tableName + " (\n" + - "\tpk1 varint PRIMARY KEY,\n" + - "\treg1 int,\n" + - "\treg2 int)\n" + - "\tWITH ID = " + cfs.metadata.id + "\n" + - "\tAND COMPACT STORAGE")); - } - - @Test - public void testStaticCompactWithCounters() throws Throwable - { - String tableName = createTable("CREATE TABLE IF NOT EXISTS %s (" + - "pk1 varint PRIMARY KEY," + - "reg1 counter," + - "reg2 counter)" + - " WITH COMPACT STORAGE"); - - - ColumnFamilyStore cfs = Keyspace.open(keyspace()).getColumnFamilyStore(tableName); - - assertTrue(ColumnFamilyStoreCQLHelper.getTableMetadataAsCQL(cfs.metadata(), true).startsWith( - "CREATE TABLE IF NOT EXISTS " + keyspace() + "." + tableName + " (\n" + - "\tpk1 varint PRIMARY KEY,\n" + - "\treg1 counter,\n" + - "\treg2 counter)\n" + - "\tWITH ID = " + cfs.metadata.id + "\n" + - "\tAND COMPACT STORAGE")); - } - - @Test - public void testDenseCompactTableWithoutRegulars() throws Throwable - { - String tableName = createTable("CREATE TABLE IF NOT EXISTS %s (" + - "pk1 varint," + - "ck1 int," + - "PRIMARY KEY (pk1, ck1))" + - " WITH COMPACT STORAGE"); - - ColumnFamilyStore cfs = Keyspace.open(keyspace()).getColumnFamilyStore(tableName); - - assertTrue(ColumnFamilyStoreCQLHelper.getTableMetadataAsCQL(cfs.metadata(), true).startsWith( - "CREATE TABLE IF NOT EXISTS " + keyspace() + "." + tableName + " (\n" + - "\tpk1 varint,\n" + - "\tck1 int,\n" + - "\tPRIMARY KEY (pk1, ck1))\n" + - "\tWITH ID = " + cfs.metadata.id + "\n" + - "\tAND COMPACT STORAGE")); - } - - @Test - public void testCompactDynamic() throws Throwable - { - String tableName = createTable("CREATE TABLE IF NOT EXISTS %s (" + - "pk1 varint," + - "ck1 int," + - "reg int," + - "PRIMARY KEY (pk1, ck1))" + - " WITH COMPACT STORAGE"); - - ColumnFamilyStore cfs = Keyspace.open(keyspace()).getColumnFamilyStore(tableName); - - assertTrue(ColumnFamilyStoreCQLHelper.getTableMetadataAsCQL(cfs.metadata(), true).startsWith( - "CREATE TABLE IF NOT EXISTS " + keyspace() + "." + tableName + " (\n" + - "\tpk1 varint,\n" + - "\tck1 int,\n" + - "\treg int,\n" + - "\tPRIMARY KEY (pk1, ck1))\n" + - "\tWITH ID = " + cfs.metadata.id + "\n" + - "\tAND COMPACT STORAGE")); - } - - @Test - public void testDynamicComposite() throws Throwable - { - Map<Byte, AbstractType<?>> aliases = new HashMap<>(); - aliases.put((byte)'a', BytesType.instance); - aliases.put((byte)'b', BytesType.instance); - aliases.put((byte)'c', BytesType.instance); - - String DYNAMIC_COMPOSITE = "dynamic_composite"; - AbstractType<?> dynamicComposite = DynamicCompositeType.getInstance(aliases); - - SchemaLoader.createKeyspace(DYNAMIC_COMPOSITE, - KeyspaceParams.simple(1), - SchemaLoader.denseCFMD(DYNAMIC_COMPOSITE, DYNAMIC_COMPOSITE, dynamicComposite)); - - ColumnFamilyStore cfs = Keyspace.open(DYNAMIC_COMPOSITE).getColumnFamilyStore(DYNAMIC_COMPOSITE); - - assertTrue(ColumnFamilyStoreCQLHelper.getTableMetadataAsCQL(cfs.metadata(), true).startsWith( - "CREATE TABLE IF NOT EXISTS " + DYNAMIC_COMPOSITE + "." + DYNAMIC_COMPOSITE + " (\n" + - "\tkey ascii,\n" + - "\tcols 'org.apache.cassandra.db.marshal.DynamicCompositeType(a=>org.apache.cassandra.db.marshal.BytesType,b=>org.apache.cassandra.db.marshal.BytesType,c=>org.apache.cassandra.db.marshal.BytesType)',\n" + - "\tval ascii,\n" + - "\tPRIMARY KEY (key, cols))\n" + - "\tWITH ID = " + cfs.metadata.id + "\n" + - "\tAND COMPACT STORAGE")); - } - - @Test - public void superColumnFamilyTest() throws Throwable - { - final String KEYSPACE = "thrift_compact_table_with_supercolumns_test"; - final String TABLE = "test_table_1"; - - TableMetadata.Builder table = - TableMetadata.builder(KEYSPACE, TABLE) - .isSuper(true) - .addPartitionKeyColumn("pk", BytesType.instance) - .addClusteringColumn("c1", AsciiType.instance) - .addClusteringColumn("c2", AsciiType.instance) - .addRegularColumn("", MapType.getInstance(Int32Type.instance, AsciiType.instance, true)); - - SchemaLoader.createKeyspace(KEYSPACE, KeyspaceParams.simple(1), table); - - ColumnFamilyStore cfs = Keyspace.open(KEYSPACE).getColumnFamilyStore(TABLE); - - assertTrue(ColumnFamilyStoreCQLHelper.getTableMetadataAsCQL(cfs.metadata(), true).startsWith( - "/*\n" + - "Warning: Table " + KEYSPACE + "." + TABLE + " omitted because it has constructs not compatible with CQL (was created via legacy API).\n\n" + - "Approximate structure, for reference:\n" + - "(this should not be used to reproduce this schema)\n\n" + - "CREATE TABLE IF NOT EXISTS " + KEYSPACE + "." + TABLE + " (\n" + - "\tpk blob,\n" + - "\tc1 ascii,\n" + - "\tc2 ascii,\n" + - "\t\"\" map<int, ascii>,\n" + - "\tPRIMARY KEY (pk, c1, c2))\n" + - "\tWITH ID = " + cfs.metadata.id + "\n" + - "\tAND COMPACT STORAGE")); - } } http://git-wip-us.apache.org/repos/asf/cassandra/blob/07fbd8ee/test/unit/org/apache/cassandra/db/ScrubTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/ScrubTest.java b/test/unit/org/apache/cassandra/db/ScrubTest.java index 490431a..24eb0d0 100644 --- a/test/unit/org/apache/cassandra/db/ScrubTest.java +++ b/test/unit/org/apache/cassandra/db/ScrubTest.java @@ -520,33 +520,6 @@ public class ScrubTest CompactionManager.instance.performScrub(cfs2, false, false, 2); } - /** - * For CASSANDRA-6892 too, check that for a compact table with one cluster column, we can insert whatever - * we want as value for the clustering column, including something that would conflict with a CQL column definition. - */ - @Test - public void testValidationCompactStorage() throws Exception - { - QueryProcessor.process(String.format("CREATE TABLE \"%s\".test_compact_dynamic_columns (a int, b text, c text, PRIMARY KEY (a, b)) WITH COMPACT STORAGE", KEYSPACE), ConsistencyLevel.ONE); - - Keyspace keyspace = Keyspace.open(KEYSPACE); - ColumnFamilyStore cfs = keyspace.getColumnFamilyStore("test_compact_dynamic_columns"); - - QueryProcessor.executeInternal(String.format("INSERT INTO \"%s\".test_compact_dynamic_columns (a, b, c) VALUES (0, 'a', 'foo')", KEYSPACE)); - QueryProcessor.executeInternal(String.format("INSERT INTO \"%s\".test_compact_dynamic_columns (a, b, c) VALUES (0, 'b', 'bar')", KEYSPACE)); - QueryProcessor.executeInternal(String.format("INSERT INTO \"%s\".test_compact_dynamic_columns (a, b, c) VALUES (0, 'c', 'boo')", KEYSPACE)); - cfs.forceBlockingFlush(); - CompactionManager.instance.performScrub(cfs, true, true, 2); - - // Scrub is silent, but it will remove broken records. So reading everything back to make sure nothing to "scrubbed away" - UntypedResultSet rs = QueryProcessor.executeInternal(String.format("SELECT * FROM \"%s\".test_compact_dynamic_columns", KEYSPACE)); - assertEquals(3, rs.size()); - - Iterator<UntypedResultSet.Row> iter = rs.iterator(); - assertEquals("foo", iter.next().getString("c")); - assertEquals("bar", iter.next().getString("c")); - assertEquals("boo", iter.next().getString("c")); - } @Test /* CASSANDRA-5174 */ public void testScrubKeysIndex_preserveOrder() throws IOException, ExecutionException, InterruptedException http://git-wip-us.apache.org/repos/asf/cassandra/blob/07fbd8ee/test/unit/org/apache/cassandra/db/partition/PartitionUpdateTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/partition/PartitionUpdateTest.java b/test/unit/org/apache/cassandra/db/partition/PartitionUpdateTest.java index fdd34f1..0f83dac 100644 --- a/test/unit/org/apache/cassandra/db/partition/PartitionUpdateTest.java +++ b/test/unit/org/apache/cassandra/db/partition/PartitionUpdateTest.java @@ -47,18 +47,4 @@ public class PartitionUpdateTest extends CQLTester builder.newRow(1).add("a", 1); Assert.assertEquals(2, builder.build().operationCount()); } - - @Test - public void testOperationCountWithCompactTable() - { - createTable("CREATE TABLE %s (key text PRIMARY KEY, a int) WITH COMPACT STORAGE"); - TableMetadata cfm = currentTableMetadata(); - - PartitionUpdate update = new RowUpdateBuilder(cfm, FBUtilities.timestampMicros(), "key0").add("a", 1) - .buildUpdate(); - Assert.assertEquals(1, update.operationCount()); - - update = new RowUpdateBuilder(cfm, FBUtilities.timestampMicros(), "key0").buildUpdate(); - Assert.assertEquals(0, update.operationCount()); - } } http://git-wip-us.apache.org/repos/asf/cassandra/blob/07fbd8ee/test/unit/org/apache/cassandra/index/SecondaryIndexManagerTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/index/SecondaryIndexManagerTest.java b/test/unit/org/apache/cassandra/index/SecondaryIndexManagerTest.java index 9af7072..ac3e5b2 100644 --- a/test/unit/org/apache/cassandra/index/SecondaryIndexManagerTest.java +++ b/test/unit/org/apache/cassandra/index/SecondaryIndexManagerTest.java @@ -553,7 +553,7 @@ public class SecondaryIndexManagerTest extends CQLTester private void assertMarkedAsBuilt(String indexName) throws Throwable { - assertRows(execute(builtIndexesQuery), row(KEYSPACE, indexName)); + assertRows(execute(builtIndexesQuery), row(KEYSPACE, indexName, null)); } private void assertNotMarkedAsBuilt() throws Throwable http://git-wip-us.apache.org/repos/asf/cassandra/blob/07fbd8ee/test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java b/test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java index c0ca2ba..24480f5 100644 --- a/test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java +++ b/test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java @@ -325,21 +325,6 @@ public class CassandraIndexTest extends CQLTester } @Test - public void indexOnRegularColumnWithCompactStorage() throws Throwable - { - new TestScript().tableDefinition("CREATE TABLE %s (k int, v int, PRIMARY KEY (k)) WITH COMPACT STORAGE;") - .target("v") - .withFirstRow(row(0, 0)) - .withSecondRow(row(1,1)) - .missingIndexMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE) - .firstQueryExpression("v=0") - .secondQueryExpression("v=1") - .updateExpression("SET v=2") - .postUpdateQueryExpression("v=2") - .run(); - } - - @Test public void indexOnStaticColumn() throws Throwable { Object[] row1 = row("k0", "c0", "s0"); @@ -512,7 +497,7 @@ public class CassandraIndexTest extends CQLTester waitForIndex(KEYSPACE, tableName, indexName); // check that there are no other rows in the built indexes table assertRows(execute(String.format("SELECT * FROM %s.\"%s\"", SchemaConstants.SYSTEM_KEYSPACE_NAME, SystemKeyspace.BUILT_INDEXES)), - row(KEYSPACE, indexName)); + row(KEYSPACE, indexName, null)); // rebuild the index and verify the built status table getCurrentColumnFamilyStore().rebuildSecondaryIndex(indexName); @@ -520,7 +505,7 @@ public class CassandraIndexTest extends CQLTester // check that there are no other rows in the built indexes table assertRows(execute(String.format("SELECT * FROM %s.\"%s\"", SchemaConstants.SYSTEM_KEYSPACE_NAME, SystemKeyspace.BUILT_INDEXES)), - row(KEYSPACE, indexName)); + row(KEYSPACE, indexName, null )); } http://git-wip-us.apache.org/repos/asf/cassandra/blob/07fbd8ee/test/unit/org/apache/cassandra/io/sstable/LegacySSTableTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/io/sstable/LegacySSTableTest.java b/test/unit/org/apache/cassandra/io/sstable/LegacySSTableTest.java index 8cbf006..4892184 100644 --- a/test/unit/org/apache/cassandra/io/sstable/LegacySSTableTest.java +++ b/test/unit/org/apache/cassandra/io/sstable/LegacySSTableTest.java @@ -196,19 +196,16 @@ public class LegacySSTableTest private void streamLegacyTables(String legacyVersion) throws Exception { - for (int compact = 0; compact <= 1; compact++) - { - logger.info("Streaming legacy version {}{}", legacyVersion, getCompactNameSuffix(compact)); - streamLegacyTable("legacy_%s_simple%s", legacyVersion, getCompactNameSuffix(compact)); - streamLegacyTable("legacy_%s_simple_counter%s", legacyVersion, getCompactNameSuffix(compact)); - streamLegacyTable("legacy_%s_clust%s", legacyVersion, getCompactNameSuffix(compact)); - streamLegacyTable("legacy_%s_clust_counter%s", legacyVersion, getCompactNameSuffix(compact)); - } + logger.info("Streaming legacy version {}", legacyVersion); + streamLegacyTable("legacy_%s_simple", legacyVersion); + streamLegacyTable("legacy_%s_simple_counter", legacyVersion); + streamLegacyTable("legacy_%s_clust", legacyVersion); + streamLegacyTable("legacy_%s_clust_counter", legacyVersion); } - private void streamLegacyTable(String tablePattern, String legacyVersion, String compactNameSuffix) throws Exception + private void streamLegacyTable(String tablePattern, String legacyVersion) throws Exception { - String table = String.format(tablePattern, legacyVersion, compactNameSuffix); + String table = String.format(tablePattern, legacyVersion); SSTableReader sstable = SSTableReader.open(getDescriptor(legacyVersion, table)); IPartitioner p = sstable.getPartitioner(); List<Range<Token>> ranges = new ArrayList<>(); @@ -224,38 +221,29 @@ public class LegacySSTableTest private static void truncateLegacyTables(String legacyVersion) throws Exception { - for (int compact = 0; compact <= 1; compact++) - { - logger.info("Truncating legacy version {}{}", legacyVersion, getCompactNameSuffix(compact)); - Keyspace.open("legacy_tables").getColumnFamilyStore(String.format("legacy_%s_simple%s", legacyVersion, getCompactNameSuffix(compact))).truncateBlocking(); - Keyspace.open("legacy_tables").getColumnFamilyStore(String.format("legacy_%s_simple_counter%s", legacyVersion, getCompactNameSuffix(compact))).truncateBlocking(); - Keyspace.open("legacy_tables").getColumnFamilyStore(String.format("legacy_%s_clust%s", legacyVersion, getCompactNameSuffix(compact))).truncateBlocking(); - Keyspace.open("legacy_tables").getColumnFamilyStore(String.format("legacy_%s_clust_counter%s", legacyVersion, getCompactNameSuffix(compact))).truncateBlocking(); - } + logger.info("Truncating legacy version {}", legacyVersion); + Keyspace.open("legacy_tables").getColumnFamilyStore(String.format("legacy_%s_simple", legacyVersion)).truncateBlocking(); + Keyspace.open("legacy_tables").getColumnFamilyStore(String.format("legacy_%s_simple_counter", legacyVersion)).truncateBlocking(); + Keyspace.open("legacy_tables").getColumnFamilyStore(String.format("legacy_%s_clust", legacyVersion)).truncateBlocking(); + Keyspace.open("legacy_tables").getColumnFamilyStore(String.format("legacy_%s_clust_counter", legacyVersion)).truncateBlocking(); } private static void compactLegacyTables(String legacyVersion) throws Exception { - for (int compact = 0; compact <= 1; compact++) - { - logger.info("Compacting legacy version {}{}", legacyVersion, getCompactNameSuffix(compact)); - Keyspace.open("legacy_tables").getColumnFamilyStore(String.format("legacy_%s_simple%s", legacyVersion, getCompactNameSuffix(compact))).forceMajorCompaction(); - Keyspace.open("legacy_tables").getColumnFamilyStore(String.format("legacy_%s_simple_counter%s", legacyVersion, getCompactNameSuffix(compact))).forceMajorCompaction(); - Keyspace.open("legacy_tables").getColumnFamilyStore(String.format("legacy_%s_clust%s", legacyVersion, getCompactNameSuffix(compact))).forceMajorCompaction(); - Keyspace.open("legacy_tables").getColumnFamilyStore(String.format("legacy_%s_clust_counter%s", legacyVersion, getCompactNameSuffix(compact))).forceMajorCompaction(); - } + logger.info("Compacting legacy version {}", legacyVersion); + Keyspace.open("legacy_tables").getColumnFamilyStore(String.format("legacy_%s_simple", legacyVersion)).forceMajorCompaction(); + Keyspace.open("legacy_tables").getColumnFamilyStore(String.format("legacy_%s_simple_counter", legacyVersion)).forceMajorCompaction(); + Keyspace.open("legacy_tables").getColumnFamilyStore(String.format("legacy_%s_clust", legacyVersion)).forceMajorCompaction(); + Keyspace.open("legacy_tables").getColumnFamilyStore(String.format("legacy_%s_clust_counter", legacyVersion)).forceMajorCompaction(); } private static void loadLegacyTables(String legacyVersion) throws Exception { - for (int compact = 0; compact <= 1; compact++) - { - logger.info("Preparing legacy version {}{}", legacyVersion, getCompactNameSuffix(compact)); - loadLegacyTable("legacy_%s_simple%s", legacyVersion, getCompactNameSuffix(compact)); - loadLegacyTable("legacy_%s_simple_counter%s", legacyVersion, getCompactNameSuffix(compact)); - loadLegacyTable("legacy_%s_clust%s", legacyVersion, getCompactNameSuffix(compact)); - loadLegacyTable("legacy_%s_clust_counter%s", legacyVersion, getCompactNameSuffix(compact)); - } + logger.info("Preparing legacy version {}", legacyVersion); + loadLegacyTable("legacy_%s_simple", legacyVersion); + loadLegacyTable("legacy_%s_simple_counter", legacyVersion); + loadLegacyTable("legacy_%s_clust", legacyVersion); + loadLegacyTable("legacy_%s_clust_counter", legacyVersion); } private static void verifyCache(String legacyVersion, long startCount) throws InterruptedException, java.util.concurrent.ExecutionException @@ -274,68 +262,65 @@ public class LegacySSTableTest private static void verifyReads(String legacyVersion) { - for (int compact = 0; compact <= 1; compact++) + for (int ck = 0; ck < 50; ck++) { - for (int ck = 0; ck < 50; ck++) + String ckValue = Integer.toString(ck) + longString; + for (int pk = 0; pk < 5; pk++) { - String ckValue = Integer.toString(ck) + longString; - for (int pk = 0; pk < 5; pk++) + logger.debug("for pk={} ck={}", pk, ck); + + String pkValue = Integer.toString(pk); + UntypedResultSet rs; + if (ck == 0) { - logger.debug("for pk={} ck={}", pk, ck); - - String pkValue = Integer.toString(pk); - UntypedResultSet rs; - if (ck == 0) - { - readSimpleTable(legacyVersion, getCompactNameSuffix(compact), pkValue); - readSimpleCounterTable(legacyVersion, getCompactNameSuffix(compact), pkValue); - } - - readClusteringTable(legacyVersion, getCompactNameSuffix(compact), ck, ckValue, pkValue); - readClusteringCounterTable(legacyVersion, getCompactNameSuffix(compact), ckValue, pkValue); + readSimpleTable(legacyVersion, pkValue); + readSimpleCounterTable(legacyVersion, pkValue); } + + readClusteringTable(legacyVersion, ck, ckValue, pkValue); + readClusteringCounterTable(legacyVersion, ckValue, pkValue); } } } - private static void readClusteringCounterTable(String legacyVersion, String compactSuffix, String ckValue, String pkValue) + private static void readClusteringCounterTable(String legacyVersion, String ckValue, String pkValue) { - logger.debug("Read legacy_{}_clust_counter{}", legacyVersion, compactSuffix); + logger.debug("Read legacy_{}_clust_counter", legacyVersion); UntypedResultSet rs; - rs = QueryProcessor.executeInternal(String.format("SELECT val FROM legacy_tables.legacy_%s_clust_counter%s WHERE pk=? AND ck=?", legacyVersion, compactSuffix), pkValue, ckValue); + rs = QueryProcessor.executeInternal(String.format("SELECT val FROM legacy_tables.legacy_%s_clust_counter WHERE pk=? AND ck=?", legacyVersion), pkValue, ckValue); Assert.assertNotNull(rs); Assert.assertEquals(1, rs.size()); Assert.assertEquals(1L, rs.one().getLong("val")); } - private static void readClusteringTable(String legacyVersion, String compactSuffix, int ck, String ckValue, String pkValue) + private static void readClusteringTable(String legacyVersion, int ck, String ckValue, String pkValue) { - logger.debug("Read legacy_{}_clust{}", legacyVersion, compactSuffix); + logger.debug("Read legacy_{}_clust", legacyVersion); UntypedResultSet rs; - rs = QueryProcessor.executeInternal(String.format("SELECT val FROM legacy_tables.legacy_%s_clust%s WHERE pk=? AND ck=?", legacyVersion, compactSuffix), pkValue, ckValue); + rs = QueryProcessor.executeInternal(String.format("SELECT val FROM legacy_tables.legacy_%s_clust WHERE pk=? AND ck=?", legacyVersion), pkValue, ckValue); assertLegacyClustRows(1, rs); String ckValue2 = Integer.toString(ck < 10 ? 40 : ck - 1) + longString; String ckValue3 = Integer.toString(ck > 39 ? 10 : ck + 1) + longString; - rs = QueryProcessor.executeInternal(String.format("SELECT val FROM legacy_tables.legacy_%s_clust%s WHERE pk=? AND ck IN (?, ?, ?)", legacyVersion, compactSuffix), pkValue, ckValue, ckValue2, ckValue3); + rs = QueryProcessor.executeInternal(String.format("SELECT val FROM legacy_tables.legacy_%s_clust WHERE pk=? AND ck IN (?, ?, ?)", legacyVersion), pkValue, ckValue, ckValue2, ckValue3); assertLegacyClustRows(3, rs); } - private static void readSimpleCounterTable(String legacyVersion, String compactSuffix, String pkValue) + private static void readSimpleCounterTable(String legacyVersion, String pkValue) { - logger.debug("Read legacy_{}_simple_counter{}", legacyVersion, compactSuffix); + logger.debug("Read legacy_{}_simple_counter", legacyVersion); UntypedResultSet rs; - rs = QueryProcessor.executeInternal(String.format("SELECT val FROM legacy_tables.legacy_%s_simple_counter%s WHERE pk=?", legacyVersion, compactSuffix), pkValue); + rs = QueryProcessor.executeInternal(String.format("SELECT val FROM legacy_tables.legacy_%s_simple_counter WHERE pk=?", legacyVersion), pkValue); Assert.assertNotNull(rs); Assert.assertEquals(1, rs.size()); Assert.assertEquals(1L, rs.one().getLong("val")); } - private static void readSimpleTable(String legacyVersion, String compactSuffix, String pkValue) + private static void readSimpleTable(String legacyVersion, String pkValue) { - logger.debug("Read simple: legacy_{}_simple{}", legacyVersion, compactSuffix); + logger.debug("Read simple: legacy_{}_simple", legacyVersion); UntypedResultSet rs; - rs = QueryProcessor.executeInternal(String.format("SELECT val FROM legacy_tables.legacy_%s_simple%s WHERE pk=?", legacyVersion, compactSuffix), pkValue); + rs = QueryProcessor.executeInternal(String.format("SELECT val FROM legacy_tables.legacy_%s_simple WHERE pk=?", legacyVersion), pkValue); Assert.assertNotNull(rs); Assert.assertEquals(1, rs.size()); Assert.assertEquals("foo bar baz", rs.one().getString("val")); @@ -348,31 +333,18 @@ public class LegacySSTableTest private static void createTables(String legacyVersion) { - for (int i=0; i<=1; i++) - { - String compactSuffix = getCompactNameSuffix(i); - String tableSuffix = i == 0? "" : " WITH COMPACT STORAGE"; - QueryProcessor.executeInternal(String.format("CREATE TABLE legacy_tables.legacy_%s_simple%s (pk text PRIMARY KEY, val text)%s", legacyVersion, compactSuffix, tableSuffix)); - QueryProcessor.executeInternal(String.format("CREATE TABLE legacy_tables.legacy_%s_simple_counter%s (pk text PRIMARY KEY, val counter)%s", legacyVersion, compactSuffix, tableSuffix)); - QueryProcessor.executeInternal(String.format("CREATE TABLE legacy_tables.legacy_%s_clust%s (pk text, ck text, val text, PRIMARY KEY (pk, ck))%s", legacyVersion, compactSuffix, tableSuffix)); - QueryProcessor.executeInternal(String.format("CREATE TABLE legacy_tables.legacy_%s_clust_counter%s (pk text, ck text, val counter, PRIMARY KEY (pk, ck))%s", legacyVersion, compactSuffix, tableSuffix)); - } - } - - private static String getCompactNameSuffix(int i) - { - return i == 0? "" : "_compact"; + QueryProcessor.executeInternal(String.format("CREATE TABLE legacy_tables.legacy_%s_simple (pk text PRIMARY KEY, val text)", legacyVersion)); + QueryProcessor.executeInternal(String.format("CREATE TABLE legacy_tables.legacy_%s_simple_counter (pk text PRIMARY KEY, val counter)", legacyVersion)); + QueryProcessor.executeInternal(String.format("CREATE TABLE legacy_tables.legacy_%s_clust (pk text, ck text, val text, PRIMARY KEY (pk, ck))", legacyVersion)); + QueryProcessor.executeInternal(String.format("CREATE TABLE legacy_tables.legacy_%s_clust_counter (pk text, ck text, val counter, PRIMARY KEY (pk, ck))", legacyVersion)); } private static void truncateTables(String legacyVersion) { - for (int compact = 0; compact <= 1; compact++) - { - QueryProcessor.executeInternal(String.format("TRUNCATE legacy_tables.legacy_%s_simple%s", legacyVersion, getCompactNameSuffix(compact))); - QueryProcessor.executeInternal(String.format("TRUNCATE legacy_tables.legacy_%s_simple_counter%s", legacyVersion, getCompactNameSuffix(compact))); - QueryProcessor.executeInternal(String.format("TRUNCATE legacy_tables.legacy_%s_clust%s", legacyVersion, getCompactNameSuffix(compact))); - QueryProcessor.executeInternal(String.format("TRUNCATE legacy_tables.legacy_%s_clust_counter%s", legacyVersion, getCompactNameSuffix(compact))); - } + QueryProcessor.executeInternal(String.format("TRUNCATE legacy_tables.legacy_%s_simple", legacyVersion)); + QueryProcessor.executeInternal(String.format("TRUNCATE legacy_tables.legacy_%s_simple_counter", legacyVersion)); + QueryProcessor.executeInternal(String.format("TRUNCATE legacy_tables.legacy_%s_clust", legacyVersion)); + QueryProcessor.executeInternal(String.format("TRUNCATE legacy_tables.legacy_%s_clust_counter", legacyVersion)); CacheService.instance.invalidateCounterCache(); CacheService.instance.invalidateKeyCache(); } @@ -390,9 +362,9 @@ public class LegacySSTableTest } } - private static void loadLegacyTable(String tablePattern, String legacyVersion, String compactSuffix) throws IOException + private static void loadLegacyTable(String tablePattern, String legacyVersion) throws IOException { - String table = String.format(tablePattern, legacyVersion, compactSuffix); + String table = String.format(tablePattern, legacyVersion); logger.info("Loading legacy table {}", table); @@ -427,28 +399,24 @@ public class LegacySSTableTest } String randomString = sb.toString(); - for (int compact = 0; compact <= 1; compact++) + for (int pk = 0; pk < 5; pk++) { - for (int pk = 0; pk < 5; pk++) - { - String valPk = Integer.toString(pk); - QueryProcessor.executeInternal(String.format("INSERT INTO legacy_tables.legacy_%s_simple%s (pk, val) VALUES ('%s', '%s')", - BigFormat.latestVersion, getCompactNameSuffix(compact), valPk, "foo bar baz")); + String valPk = Integer.toString(pk); + QueryProcessor.executeInternal(String.format("INSERT INTO legacy_tables.legacy_%s_simple (pk, val) VALUES ('%s', '%s')", + BigFormat.latestVersion, valPk, "foo bar baz")); - QueryProcessor.executeInternal(String.format("UPDATE legacy_tables.legacy_%s_simple_counter%s SET val = val + 1 WHERE pk = '%s'", - BigFormat.latestVersion, getCompactNameSuffix(compact), valPk)); + QueryProcessor.executeInternal(String.format("UPDATE legacy_tables.legacy_%s_simple_counter SET val = val + 1 WHERE pk = '%s'", + BigFormat.latestVersion, valPk)); - for (int ck = 0; ck < 50; ck++) - { - String valCk = Integer.toString(ck); - - QueryProcessor.executeInternal(String.format("INSERT INTO legacy_tables.legacy_%s_clust%s (pk, ck, val) VALUES ('%s', '%s', '%s')", - BigFormat.latestVersion, getCompactNameSuffix(compact), valPk, valCk + longString, randomString)); + for (int ck = 0; ck < 50; ck++) + { + String valCk = Integer.toString(ck); - QueryProcessor.executeInternal(String.format("UPDATE legacy_tables.legacy_%s_clust_counter%s SET val = val + 1 WHERE pk = '%s' AND ck='%s'", - BigFormat.latestVersion, getCompactNameSuffix(compact), valPk, valCk + longString)); + QueryProcessor.executeInternal(String.format("INSERT INTO legacy_tables.legacy_%s_clust (pk, ck, val) VALUES ('%s', '%s', '%s')", + BigFormat.latestVersion, valPk, valCk + longString, randomString)); - } + QueryProcessor.executeInternal(String.format("UPDATE legacy_tables.legacy_%s_clust_counter SET val = val + 1 WHERE pk = '%s' AND ck='%s'", + BigFormat.latestVersion, valPk, valCk + longString)); } } @@ -456,13 +424,10 @@ public class LegacySSTableTest File ksDir = new File(LEGACY_SSTABLE_ROOT, String.format("%s/legacy_tables", BigFormat.latestVersion)); ksDir.mkdirs(); - for (int compact = 0; compact <= 1; compact++) - { - copySstablesFromTestData(String.format("legacy_%s_simple%s", BigFormat.latestVersion, getCompactNameSuffix(compact)), ksDir); - copySstablesFromTestData(String.format("legacy_%s_simple_counter%s", BigFormat.latestVersion, getCompactNameSuffix(compact)), ksDir); - copySstablesFromTestData(String.format("legacy_%s_clust%s", BigFormat.latestVersion, getCompactNameSuffix(compact)), ksDir); - copySstablesFromTestData(String.format("legacy_%s_clust_counter%s", BigFormat.latestVersion, getCompactNameSuffix(compact)), ksDir); - } + copySstablesFromTestData(String.format("legacy_%s_simple", BigFormat.latestVersion), ksDir); + copySstablesFromTestData(String.format("legacy_%s_simple_counter", BigFormat.latestVersion), ksDir); + copySstablesFromTestData(String.format("legacy_%s_clust", BigFormat.latestVersion), ksDir); + copySstablesFromTestData(String.format("legacy_%s_clust_counter", BigFormat.latestVersion), ksDir); } private void copySstablesFromTestData(String table, File ksDir) throws IOException http://git-wip-us.apache.org/repos/asf/cassandra/blob/07fbd8ee/tools/stress/src/org/apache/cassandra/stress/settings/SettingsSchema.java ---------------------------------------------------------------------- diff --git a/tools/stress/src/org/apache/cassandra/stress/settings/SettingsSchema.java b/tools/stress/src/org/apache/cassandra/stress/settings/SettingsSchema.java index 26d159e..4c67c4f 100644 --- a/tools/stress/src/org/apache/cassandra/stress/settings/SettingsSchema.java +++ b/tools/stress/src/org/apache/cassandra/stress/settings/SettingsSchema.java @@ -138,7 +138,7 @@ public class SettingsSchema implements Serializable } //Compression - b.append(") WITH COMPACT STORAGE AND compression = {"); + b.append(") WITH compression = {"); if (compression != null) b.append("'sstable_compression' : '").append(compression).append("'"); @@ -179,7 +179,7 @@ public class SettingsSchema implements Serializable } //Compression - b.append(") WITH COMPACT STORAGE AND compression = {"); + b.append(") WITH compression = {"); if (compression != null) b.append("'sstable_compression' : '").append(compression).append("'"); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org