From 00482edec79912b618815e2c4377b3342fa441eb Mon Sep 17 00:00:00 2001 From: Daniil Tolstoukhov Date: Mon, 1 Jul 2024 20:54:16 +0400 Subject: [PATCH] Added log for unreachable version --- Cassandra.ThriftClient/Connections/ClusterConnection.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Cassandra.ThriftClient/Connections/ClusterConnection.cs b/Cassandra.ThriftClient/Connections/ClusterConnection.cs index e3f7274..dd7f490 100644 --- a/Cassandra.ThriftClient/Connections/ClusterConnection.cs +++ b/Cassandra.ThriftClient/Connections/ClusterConnection.cs @@ -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); @@ -77,6 +83,7 @@ private void LogVersions(IDictionary> versions) logger.Info(stringBuilder.ToString()); } + private const string unreachableVersion = "UNREACHABLE"; private readonly ICommandExecutor commandExecutor; private readonly ILog logger; }