From bb46b42952e3c2413745ecfbf01546e9a951faa4 Mon Sep 17 00:00:00 2001 From: Daniil Tolstoukhov Date: Mon, 1 Jul 2024 19:29:02 +0400 Subject: [PATCH 1/3] ignore unreachable version --- Cassandra.ThriftClient/Connections/ClusterConnection.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Cassandra.ThriftClient/Connections/ClusterConnection.cs b/Cassandra.ThriftClient/Connections/ClusterConnection.cs index 32efbc9..e3f7274 100644 --- a/Cassandra.ThriftClient/Connections/ClusterConnection.cs +++ b/Cassandra.ThriftClient/Connections/ClusterConnection.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Linq; using System.Text; using SkbKontur.Cassandra.ThriftClient.Abstractions; @@ -60,7 +61,7 @@ public void WaitUntilSchemaAgreementIsReached(TimeSpan timeout) { var schemaAgreementCommand = new SchemaAgreementCommand(); commandExecutor.Execute(schemaAgreementCommand); - if (schemaAgreementCommand.Output.Count == 1) + if (schemaAgreementCommand.Output.Keys.Count(x => x != "UNREACHABLE") == 1) return; LogVersions(schemaAgreementCommand.Output); } while (sw.Elapsed < timeout); From 00482edec79912b618815e2c4377b3342fa441eb Mon Sep 17 00:00:00 2001 From: Daniil Tolstoukhov Date: Mon, 1 Jul 2024 20:54:16 +0400 Subject: [PATCH 2/3] 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; } From 5f11b39524dac8b2dea90a99bbebbcde67adf2f5 Mon Sep 17 00:00:00 2001 From: Daniil Tolstoukhov Date: Mon, 1 Jul 2024 20:55:42 +0400 Subject: [PATCH 3/3] Replace warn with error --- Cassandra.ThriftClient/Connections/ClusterConnection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cassandra.ThriftClient/Connections/ClusterConnection.cs b/Cassandra.ThriftClient/Connections/ClusterConnection.cs index dd7f490..13a79c6 100644 --- a/Cassandra.ThriftClient/Connections/ClusterConnection.cs +++ b/Cassandra.ThriftClient/Connections/ClusterConnection.cs @@ -63,7 +63,7 @@ public void WaitUntilSchemaAgreementIsReached(TimeSpan timeout) commandExecutor.Execute(schemaAgreementCommand); if (schemaAgreementCommand.Output.ContainsKey(unreachableVersion)) { - logger.Warn("Found unreachable version"); + logger.Error("Found unreachable version"); LogVersions(schemaAgreementCommand.Output); }