mirror of https://github.com/apache/cassandra
Merge branch 'cassandra-3.0' into trunk
This commit is contained in:
commit
c3be5ab022
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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"/>
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class DefinitionsUpdateVerbHandler implements IVerbHandler<Collection<Mut
|
|||
{
|
||||
public void runMayThrow() throws Exception
|
||||
{
|
||||
SchemaKeyspace.mergeSchema(message.payload);
|
||||
SchemaKeyspace.mergeSchemaAndAnnounceVersion(message.payload);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ class MigrationTask extends WrappedRunnable
|
|||
{
|
||||
try
|
||||
{
|
||||
SchemaKeyspace.mergeSchema(message.payload);
|
||||
SchemaKeyspace.mergeSchemaAndAnnounceVersion(message.payload);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue