Source:
static void waitForSchemaVersions( CassandraKeyValueServiceConfig config, Cassandra.Client client, String tableName, boolean allowQuorumAgreement) throws TException { long start = System.currentTimeMillis(); long sleepTime = INITIAL_SLEEP_TIME; Map<String, List<String>> versions; do { versions = client.describe_schema_versions(); if (versions.size() <= 1 && checkNodesAgreement(allowQuorumAgreement, config, versions)) { return; } try { Thread.sleep(sleepTime); } catch (InterruptedException e) { throw Throwables.throwUncheckedException(e); } sleepTime = Math.min(sleepTime * 2, MAX_SLEEP_TIME); } while (System.currentTimeMillis() < start + config.schemaMutationTimeoutMillis()); StringBuilder sb = new StringBuilder(); final String messageTemplate = "Cassandra cluster cannot come to agreement on schema versions," + " after attempting to modify table {}. {}" + " \nFind the nodes above that diverge from the majority schema" + " or have schema 'UNKNOWN', which likely means they are down/unresponsive" + " and examine their logs to determine the issue." + " Fixing the underlying issue and restarting Cassandra should resolve the problem." + " You can quick-check this with 'nodetool describecluster'."; for (Entry<String, List<String>> version : versions.entrySet()) { sb.append(String.format("%nAt schema version %s:", version.getKey())); for (String node : version.getValue()) { sb.append(String.format("%n\tNode: %s", node)); } } sb.append(String.format("\nThe current keyspaces are: %s", client.describe_keyspaces())); if (allowQuorumAgreement && exactlyOneNodeIsUnreachableAndOthersAgreeOnSchema(versions)) { log.error(messageTemplate, tableName, sb.toString()); } else { throw new IllegalStateException(sb.toString()); } }

Target:
static void waitForSchemaVersions( CassandraKeyValueServiceConfig config, Cassandra.Client client, String tableName, boolean allowQuorumAgreement) throws TException { long start = System.currentTimeMillis(); long sleepTime = INITIAL_SLEEP_TIME; Map<String, List<String>> versions; do { versions = client.describe_schema_versions(); if (requiredNumberNodesAgreeOnSchemaVersion(allowQuorumAgreement, config, versions)) { return; } try { Thread.sleep(sleepTime); } catch (InterruptedException e) { throw Throwables.throwUncheckedException(e); } sleepTime = Math.min(sleepTime * 2, MAX_SLEEP_TIME); } while (System.currentTimeMillis() < start + config.schemaMutationTimeoutMillis()); StringBuilder schemaVersions = new StringBuilder(); for (Entry<String, List<String>> version : versions.entrySet()) { schemaVersions.append(String.format("%nAt schema version %s:", version.getKey())); for (String node : version.getValue()) { schemaVersions.append(String.format("%n\tNode: %s", node)); } } String errorMessage = String.format("Cassandra cluster cannot come to agreement on schema versions," + " after attempting to modify table %s. %s" + " \nFind the nodes above that diverge from the majority schema" + " or have schema 'UNKNOWN', which likely means they are down/unresponsive" + " and examine their logs to determine the issue." + " Fixing the underlying issue and restarting Cassandra should resolve the problem." + " You can quick-check this with 'nodetool describecluster'." + " For this node, the current keyspaces are: %s", tableName, schemaVersions.toString(), client.describe_keyspaces()); throw new IllegalStateException(errorMessage); }