mirror of https://github.com/apache/cassandra
TopologyMixupTestBase does not fix replication factor for Keyspaces after reaching rf=3
patch by David Capwell; reviewed by Alex Petrov for CASSANDRA-19975
This commit is contained in:
parent
1f80f99b71
commit
e94d86b1e5
|
|
@ -1 +1 @@
|
|||
Subproject commit d914ee69816ebfdf88b2120ff1d8e0bc16edecbc
|
||||
Subproject commit 25f23ffec439a921387ca249908798b9cc7d4620
|
||||
|
|
@ -140,6 +140,12 @@ public class DistributedSchema implements MetadataValue<DistributedSchema>
|
|||
return tables.get(id);
|
||||
}
|
||||
|
||||
public TableMetadata getTableMetadata(String keyspace, String cf)
|
||||
{
|
||||
KeyspaceMetadata ks = keyspaces.getNullable(keyspace);
|
||||
return ks == null ? null : ks.tables.getNullable(cf);
|
||||
}
|
||||
|
||||
public static DistributedSchema fromSystemTables(Keyspaces keyspaces, Set<String> knownDatacenters)
|
||||
{
|
||||
if (!keyspaces.containsKeyspace(SchemaConstants.METADATA_KEYSPACE_NAME))
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ import org.apache.cassandra.dht.Range;
|
|||
import org.apache.cassandra.dht.Token;
|
||||
import org.apache.cassandra.io.util.DataInputPlus;
|
||||
import org.apache.cassandra.io.util.DataOutputPlus;
|
||||
import org.apache.cassandra.schema.Schema;
|
||||
import org.apache.cassandra.schema.TableId;
|
||||
import org.apache.cassandra.schema.TableMetadata;
|
||||
import org.apache.cassandra.service.consensus.migration.ConsensusMigrationTarget;
|
||||
|
|
@ -83,7 +82,7 @@ public class BeginConsensusMigrationForTableAndRange implements Transformation
|
|||
public Result execute(ClusterMetadata prev)
|
||||
{
|
||||
Transformer transformer = prev.transformer();
|
||||
Collection<TableMetadata> metadata = tables.stream().map(Schema.instance::getTableMetadata).collect(Collectors.toList());
|
||||
Collection<TableMetadata> metadata = tables.stream().map(prev.schema::getTableMetadata).collect(Collectors.toList());
|
||||
ConsensusMigrationState consensusMigrationState = prev.consensusMigrationState.withRangesMigrating(metadata, ranges, false);
|
||||
return Transformation.success(transformer.with(consensusMigrationState), LockedRanges.AffectedRanges.EMPTY);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ import org.apache.cassandra.io.util.DataOutputPlus;
|
|||
import org.apache.cassandra.schema.DistributedSchema;
|
||||
import org.apache.cassandra.schema.KeyspaceMetadata;
|
||||
import org.apache.cassandra.schema.Keyspaces;
|
||||
import org.apache.cassandra.schema.Schema;
|
||||
import org.apache.cassandra.schema.TableId;
|
||||
import org.apache.cassandra.schema.TableMetadata;
|
||||
import org.apache.cassandra.schema.TableParams;
|
||||
|
|
@ -134,7 +133,7 @@ public class MaybeFinishConsensusMigrationForTableAndRange implements Transforma
|
|||
logger.info("Completed repair eligibiliy '{}' paxos repaired ranges {}, accord repaired ranges {}", repairType, paxosRepairedRanges, accordBarrieredRanges);
|
||||
checkNotNull(metadata, "clusterMetadata should not be null");
|
||||
String ksAndCF = keyspace + "." + cf;
|
||||
TableMetadata tbm = Schema.instance.getTableMetadata(keyspace, cf);
|
||||
TableMetadata tbm = metadata.schema.getTableMetadata(keyspace, cf);
|
||||
if (tbm == null)
|
||||
return new Rejected(INVALID, format("Table %s is not currently performing consensus migration", ksAndCF));
|
||||
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ public class AccordTopologyMixupTest extends TopologyMixupTestBase<AccordTopolog
|
|||
private static BiFunction<RandomSource, State<Spec>, Command<State<Spec>, Void, ?>> cqlOperations(Spec spec)
|
||||
{
|
||||
Gen<Statement> select = (Gen<Statement>) (Gen<?>) fromQT(new ASTGenerators.SelectGenBuilder(spec.metadata).withLimit1().build());
|
||||
Gen<Statement> mutation = (Gen<Statement>) (Gen<?>) fromQT(new ASTGenerators.MutationGenBuilder(spec.metadata).withoutTimestamp().build());
|
||||
Gen<Statement> mutation = (Gen<Statement>) (Gen<?>) fromQT(new ASTGenerators.MutationGenBuilder(spec.metadata).withoutTimestamp().withoutTtl().build());
|
||||
Gen<Statement> txn = (Gen<Statement>) (Gen<?>) fromQT(new ASTGenerators.TxnGenBuilder(spec.metadata).build());
|
||||
Map<Gen<Statement>, Integer> operations = new LinkedHashMap<>();
|
||||
operations.put(select, 1);
|
||||
|
|
|
|||
Loading…
Reference in New Issue