Merge branch 'cassandra-2.2' into cassandra-3.0

This commit is contained in:
Aleksey Yeschenko 2015-11-17 16:52:16 +00:00
commit aa21bd295a
3 changed files with 12 additions and 0 deletions

View File

@ -10,6 +10,7 @@ Merged from 2.2:
* (Hadoop) fix splits calculation (CASSANDRA-10640)
* (Hadoop) ensure that Cluster instances are always closed (CASSANDRA-10058)
Merged from 2.1:
* Forbid compact clustering column type changes in ALTER TABLE (CASSANDRA-8879)
* Reject incremental repair with subrange repair (CASSANDRA-10422)
* Add a nodetool command to refresh size_estimates (CASSANDRA-9579)
* Invalidate cache after stream receive task is completed (CASSANDRA-10341)

View File

@ -348,6 +348,9 @@ public class AlterTableStatement extends SchemaAlteringStatement
validatorType.asCQL3Type()));
break;
case CLUSTERING:
if (!cfm.isCQLTable())
throw new InvalidRequestException(String.format("Cannot alter clustering column %s in a non-CQL3 table", def.name));
AbstractType<?> oldType = cfm.comparator.subtype(def.position());
// Note that CFMetaData.validateCompatibility already validate the change we're about to do. However, the error message it
// sends is a bit cryptic for a CQL3 user, so validating here for a sake of returning a better error message

View File

@ -21,6 +21,7 @@ import org.apache.cassandra.cql3.CQLTester;
import org.apache.cassandra.db.ColumnFamilyStore;
import org.apache.cassandra.db.Keyspace;
import org.apache.cassandra.exceptions.ConfigurationException;
import org.apache.cassandra.exceptions.InvalidRequestException;
import org.apache.cassandra.exceptions.SyntaxException;
import org.apache.cassandra.schema.SchemaKeyspace;
@ -316,4 +317,11 @@ public class AlterTest extends CQLTester
assertEquals(errorMsg, e.getMessage());
}
}
@Test // tests CASSANDRA-8879
public void testAlterClusteringColumnTypeInCompactTable() throws Throwable
{
createTable("CREATE TABLE %s (key blob, column1 blob, value blob, PRIMARY KEY ((key), column1)) WITH COMPACT STORAGE");
assertInvalidThrow(InvalidRequestException.class, "ALTER TABLE %s ALTER column1 TYPE ascii");
}
}