Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ public enum CassandraRelevantProperties
ALLOW_CURSOR_COMPACTION("cassandra.allow_cursor_compaction", "true"),
/** If we should allow having duplicate keys in the config file, default to true for legacy reasons */
ALLOW_DUPLICATE_CONFIG_KEYS("cassandra.allow_duplicate_config_keys", "true"),

/**
* Allow repair in mixed major version clusters. When false (default), repair operations
* will fail in clusters with mixed major versions unless explicitly allowed.
* Set to true to allow repair during rolling upgrades.
*/
ALLOW_MIXED_REPAIR("cassandra.allow_mixed_repair", "false"),

/** If we should allow having both new (post CASSANDRA-15234) and old config keys for the same config item in the yaml */
ALLOW_NEW_OLD_CONFIG_KEYS("cassandra.allow_new_old_config_keys"),
ALLOW_UNLIMITED_CONCURRENT_VALIDATIONS("cassandra.allow_unlimited_concurrent_validations"),
Expand Down
13 changes: 10 additions & 3 deletions src/java/org/apache/cassandra/repair/messages/PrepareMessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

import com.google.common.base.Preconditions;

import org.apache.cassandra.config.CassandraRelevantProperties;

import org.apache.cassandra.db.TypeSizes;
import org.apache.cassandra.dht.IPartitioner;
import org.apache.cassandra.dht.Range;
Expand All @@ -40,6 +42,8 @@

public class PrepareMessage extends RepairMessage
{
private static final boolean ALLOW_MIXED_REPAIR = CassandraRelevantProperties.ALLOW_MIXED_REPAIR.getBoolean();

public final List<TableId> tableIds;
public final Collection<Range<Token>> ranges;

Expand Down Expand Up @@ -91,13 +95,15 @@ public int hashCode()
private static final String MIXED_MODE_ERROR = "Some nodes involved in repair are on an incompatible major version. " +
"Repair is not supported in mixed major version clusters. Note that " +
"5.x nodes running in storage compatibility mode = 4 are considered " +
"4.x nodes.";
"4.x nodes. " +
"To allow repair during rolling upgrades, set -Dcassandra.allow_mixed_repair=true";

public static final IVersionedSerializer<PrepareMessage> serializer = new IVersionedSerializer<PrepareMessage>()
{
public void serialize(PrepareMessage message, DataOutputPlus out, int version) throws IOException
{
Preconditions.checkArgument(version == MessagingService.current_version, MIXED_MODE_ERROR);
if (!ALLOW_MIXED_REPAIR)
Preconditions.checkArgument(version == MessagingService.current_version, MIXED_MODE_ERROR);

out.writeInt(message.tableIds.size());
for (TableId tableId : message.tableIds)
Expand All @@ -117,7 +123,8 @@ public void serialize(PrepareMessage message, DataOutputPlus out, int version) t

public PrepareMessage deserialize(DataInputPlus in, int version) throws IOException
{
Preconditions.checkArgument(version == MessagingService.current_version, MIXED_MODE_ERROR);
if (!ALLOW_MIXED_REPAIR)
Preconditions.checkArgument(version == MessagingService.current_version, MIXED_MODE_ERROR);

int tableIdCount = in.readInt();
List<TableId> tableIds = new ArrayList<>(tableIdCount);
Expand Down