in spark-job/src/main/java/org/apache/cassandra/diff/JobMetadataDb.java [244:260]
public void recordError(KeyspaceTablePair table, BigInteger token, Throwable error) {
logger.error(String.format("Encountered error during partition comparison in table %s; " +
"error for partition with token %s", table, token), error);
BatchStatement batch = new BatchStatement();
batch.add(bindErrorSummaryStatement(table));
DiffCluster.Type exceptionSource = null;
int maxRetrace = 10; // In case there is a loop, we do not want to loop forever or throw. So just limit the number of retracing.
for (Throwable t = error; t.getCause() != null && maxRetrace > 0; t = t.getCause(), maxRetrace--) {
if (t instanceof ClusterSourcedException) {
exceptionSource = ((ClusterSourcedException) t).exceptionSource;
break;
}
}
batch.add(bindErrorDetailStatement(table, token, exceptionSource));
batch.setIdempotent(true);
ignoreQueryException(() -> session.execute(batch));
}