use of org.apache.cassandra.db.MutationExceededMaxSizeException in project cassandra by apache.
the class BlockingReadRepairs method createRepairMutation.
/**
* Create a read repair mutation from the given update, if the mutation is not larger than the maximum
* mutation size, otherwise return null. Or, if we're configured to be strict, throw an exception.
*/
public static Mutation createRepairMutation(PartitionUpdate update, ConsistencyLevel consistency, InetAddressAndPort destination, boolean suppressException) {
if (update == null)
return null;
DecoratedKey key = update.partitionKey();
Mutation mutation = new Mutation(update);
int messagingVersion = MessagingService.instance().versions.get(destination);
try {
mutation.validateSize(messagingVersion, 0);
return mutation;
} catch (MutationExceededMaxSizeException e) {
Keyspace keyspace = Keyspace.open(mutation.getKeyspaceName());
TableMetadata metadata = update.metadata();
if (DROP_OVERSIZED_READ_REPAIR_MUTATIONS) {
logger.debug("Encountered an oversized ({}/{}) read repair mutation for table {}, key {}, node {}", e.mutationSize, MAX_MUTATION_SIZE, metadata, metadata.partitionKeyType.getString(key.getKey()), destination);
} else {
logger.warn("Encountered an oversized ({}/{}) read repair mutation for table {}, key {}, node {}", e.mutationSize, MAX_MUTATION_SIZE, metadata, metadata.partitionKeyType.getString(key.getKey()), destination);
if (!suppressException) {
int blockFor = consistency.blockFor(keyspace.getReplicationStrategy());
Tracing.trace("Timed out while read-repairing after receiving all {} data and digest responses", blockFor);
throw new ReadTimeoutException(consistency, blockFor - 1, blockFor, true);
}
}
return null;
}
}
Aggregations