Skip to content
Closed
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 @@ -256,6 +256,13 @@ public enum CassandraRelevantProperties
*/
REPAIR_PARENT_SESSION_LISTENER("cassandra.custom_parent_repair_session_listener_class"),

/**
* 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"),

//cassandra properties (without the "cassandra." prefix)

/**
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 @@ -26,6 +26,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 @@ -41,6 +43,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 @@ -84,13 +88,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.";
"Repair is not supported in mixed major version clusters. " +
"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 @@ -110,7 +116,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
Loading