Merge branch 'cassandra-3.0' into trunk

This commit is contained in:
Tyler Hobbs 2015-10-01 14:26:42 -05:00
commit c3be5ab022
7 changed files with 16 additions and 10 deletions

View File

@ -3,6 +3,7 @@
3.0
* Flush system schema tables after local schema changes (CASSANDRA-10429)
Merged from 2.2:
* cqlsh prompt includes name of keyspace after failed `use` statement (CASSANDRA-10369)

View File

@ -101,6 +101,9 @@
<!-- default for cql tests. Can be override by -Dcassandra.test.use_prepared=false -->
<property name="cassandra.test.use_prepared" value="true" />
<!-- skip flushing schema tables during tests -->
<property name="cassandra.test.flush_local_schema_changes" value="false" />
<!-- http://cobertura.sourceforge.net/ -->
<property name="cobertura.version" value="2.0.3"/>
<property name="cobertura.build.dir" value="${build.dir}/cobertura"/>

View File

@ -47,7 +47,7 @@ public class DefinitionsUpdateVerbHandler implements IVerbHandler<Collection<Mut
{
public void runMayThrow() throws Exception
{
SchemaKeyspace.mergeSchema(message.payload);
SchemaKeyspace.mergeSchemaAndAnnounceVersion(message.payload);
}
});
}

View File

@ -62,6 +62,8 @@ public final class SchemaKeyspace
private static final Logger logger = LoggerFactory.getLogger(SchemaKeyspace.class);
private static final boolean FLUSH_SCHEMA_TABLES = Boolean.valueOf(System.getProperty("cassandra.test.flush_local_schema_changes", "true"));
public static final String NAME = "system_schema";
public static final String KEYSPACES = "keyspaces";
@ -476,13 +478,13 @@ public final class SchemaKeyspace
* @throws ConfigurationException If one of metadata attributes has invalid value
* @throws IOException If data was corrupted during transportation or failed to apply fs operations
*/
public static synchronized void mergeSchema(Collection<Mutation> mutations) throws ConfigurationException, IOException
public static synchronized void mergeSchemaAndAnnounceVersion(Collection<Mutation> mutations) throws ConfigurationException, IOException
{
mergeSchema(mutations, true);
mergeSchema(mutations);
Schema.instance.updateVersionAndAnnounce();
}
public static synchronized void mergeSchema(Collection<Mutation> mutations, boolean doFlush) throws IOException
public static synchronized void mergeSchema(Collection<Mutation> mutations) throws IOException
{
// compare before/after schemas of the affected keyspaces only
Set<String> keyspaces = new HashSet<>(mutations.size());
@ -499,7 +501,7 @@ public final class SchemaKeyspace
mutations.forEach(Mutation::apply);
if (doFlush)
if (FLUSH_SCHEMA_TABLES)
flush();
// with new data applied

View File

@ -471,7 +471,7 @@ public class MigrationManager
{
try
{
SchemaKeyspace.mergeSchema(Collections.singletonList(schema), false);
SchemaKeyspace.mergeSchema(Collections.singletonList(schema));
}
catch (IOException e)
{
@ -499,7 +499,7 @@ public class MigrationManager
{
protected void runMayThrow() throws IOException, ConfigurationException
{
SchemaKeyspace.mergeSchema(schema);
SchemaKeyspace.mergeSchemaAndAnnounceVersion(schema);
}
});

View File

@ -72,7 +72,7 @@ class MigrationTask extends WrappedRunnable
{
try
{
SchemaKeyspace.mergeSchema(message.payload);
SchemaKeyspace.mergeSchemaAndAnnounceVersion(message.payload);
}
catch (IOException e)
{

View File

@ -162,7 +162,7 @@ public class SchemaKeyspaceTest
{
KeyspaceMetadata ksm = Schema.instance.getKeyspaceInstance(keyspace).getMetadata();
Mutation mutation = SchemaKeyspace.makeUpdateTableMutation(ksm, oldTable, newTable, FBUtilities.timestampMicros(), false);
SchemaKeyspace.mergeSchema(Collections.singleton(mutation), true);
SchemaKeyspace.mergeSchema(Collections.singleton(mutation));
}
private static void createTable(String keyspace, String cql) throws IOException
@ -171,7 +171,7 @@ public class SchemaKeyspaceTest
KeyspaceMetadata ksm = KeyspaceMetadata.create(keyspace, KeyspaceParams.simple(1), Tables.of(table));
Mutation mutation = SchemaKeyspace.makeCreateTableMutation(ksm, table, FBUtilities.timestampMicros());
SchemaKeyspace.mergeSchema(Collections.singleton(mutation), true);
SchemaKeyspace.mergeSchema(Collections.singleton(mutation));
}
private static void checkInverses(CFMetaData cfm) throws Exception