Skip to content

Commit

Permalink
Added log for unreachable version
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniil Tolstoukhov committed Jul 1, 2024
1 parent bb46b42 commit 00482ed
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Cassandra.ThriftClient/Connections/ClusterConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,13 @@ public void WaitUntilSchemaAgreementIsReached(TimeSpan timeout)
{
var schemaAgreementCommand = new SchemaAgreementCommand();
commandExecutor.Execute(schemaAgreementCommand);
if (schemaAgreementCommand.Output.Keys.Count(x => x != "UNREACHABLE") == 1)
if (schemaAgreementCommand.Output.ContainsKey(unreachableVersion))
{
logger.Warn("Found unreachable version");
LogVersions(schemaAgreementCommand.Output);
}

if (schemaAgreementCommand.Output.Keys.Count(x => x != unreachableVersion) == 1)
return;
LogVersions(schemaAgreementCommand.Output);
} while (sw.Elapsed < timeout);
Expand All @@ -77,6 +83,7 @@ private void LogVersions(IDictionary<string, List<string>> versions)
logger.Info(stringBuilder.ToString());
}

private const string unreachableVersion = "UNREACHABLE";
private readonly ICommandExecutor<IFierceCommand> commandExecutor;
private readonly ILog logger;
}
Expand Down

0 comments on commit 00482ed

Please sign in to comment.