Skip to content
Open
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
6 changes: 4 additions & 2 deletions src/java/org/apache/cassandra/repair/RepairJobDesc.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,14 @@ public RepairJobDesc(UUID parentSessionId, UUID sessionId, String keyspace, Stri
@Override
public String toString()
{
return "[repair #" + sessionId + " on " + keyspace + "/" + columnFamily + ", " + ranges + "]";
String parentSessionId = this.parentSessionId == null ? "" : " (parent session id: #" + this.parentSessionId + ")";
return "[repair #" + sessionId + parentSessionId + " on " + keyspace + "/" + columnFamily + ", " + ranges + "]";
}

public String toString(PreviewKind previewKind)
{
return '[' + previewKind.logPrefix() + " #" + sessionId + " on " + keyspace + "/" + columnFamily + ", " + ranges + "]";
String parentSessionId = this.parentSessionId == null ? "" : " (parent session id: #" + this.parentSessionId + ")";
return '[' + previewKind.logPrefix() + " #" + sessionId + parentSessionId + " on " + keyspace + "/" + columnFamily + ", " + ranges + "]";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ else if (message.verb() == SYNC_REQ)
}
else if (message.verb() == CLEANUP_MSG)
{
logger.debug("cleaning up repair");
CleanupMessage cleanup = (CleanupMessage) message.payload;
logger.debug("Cleaning up parent repair session {}", cleanup.parentRepairSession);
ActiveRepairService.instance.removeParentRepairSession(cleanup.parentRepairSession);
MessagingService.instance().send(message.emptyResponse(), message.from());
}
Expand Down
14 changes: 14 additions & 0 deletions src/java/org/apache/cassandra/repair/messages/RepairMessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@
*/
public abstract class RepairMessage
{
/**
* If true, we will always consider remote nodes to support repair message timeouts,
* and fail the repair if a response is not received on time.
* Default: false, to preserve backward compatibility.
*/
private static final boolean ALWAYS_CONSIDER_TIMEOUTS_SUPPORTED = Boolean.parseBoolean(System.getProperty("cassandra.repair.always_consider_timeouts_supported", "false"));
private static final CassandraVersion SUPPORTS_TIMEOUTS = new CassandraVersion("4.0.7-SNAPSHOT");
private static final Logger logger = LoggerFactory.getLogger(RepairMessage.class);
public final RepairJobDesc desc;
Expand Down Expand Up @@ -90,6 +96,14 @@ public void onFailure(InetAddressAndPort from, RequestFailureReason failureReaso

private static boolean supportsTimeouts(InetAddressAndPort from, UUID parentSessionId)
{
/*
* In CNDB, repair services won't be added to the Nodes.peers() map, so there's no clear way
* to check the version of the remove peer. This is the reason why a system property is introduced
* to skip the version check, in case it's known that the deployed C* version supports repair message
* timeouts.
*/
if (ALWAYS_CONSIDER_TIMEOUTS_SUPPORTED)
return true;
CassandraVersion remoteVersion = Nodes.peers().map(from, NodeInfo::getReleaseVersion, () -> null);
if (remoteVersion != null && remoteVersion.compareTo(SUPPORTS_TIMEOUTS, true) >= 0)
return true;
Expand Down
Loading