This is an automated email from the ASF dual-hosted git repository.
aleksey pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git
The following commit(s) were added to refs/heads/trunk by this push:
new 17caa28 Ninja-follow-up to CASSANDRA-15727 (move code slightly)
17caa28 is described below
commit 17caa288c311e0364f81f78a85831c36f0f4917e
Author: Aleksey Yeshchenko <[email protected]>
AuthorDate: Fri May 15 15:34:35 2020 +0100
Ninja-follow-up to CASSANDRA-15727 (move code slightly)
---
.../apache/cassandra/net/OutboundConnection.java | 36 ++++++++++------------
1 file changed, 17 insertions(+), 19 deletions(-)
diff --git a/src/java/org/apache/cassandra/net/OutboundConnection.java
b/src/java/org/apache/cassandra/net/OutboundConnection.java
index 315d086..d7ebcd8 100644
--- a/src/java/org/apache/cassandra/net/OutboundConnection.java
+++ b/src/java/org/apache/cassandra/net/OutboundConnection.java
@@ -1084,25 +1084,7 @@ public class OutboundConnection
if (hasPending())
{
Promise<Result<MessagingSuccess>> result = new
AsyncPromise<>(eventLoop);
- state = new Connecting(state.disconnected(),
- result,
- eventLoop.schedule(() ->
- {
- // Re-evaluate messagingVersion
before re-attempting the connection in case
- // endpointToVersion were
updated. This happens if the outbound connection
- // is made before the
endpointToVersion table is initially constructed or out
- // of date (e.g. if outbound
connections are established for gossip
- // as a result of an inbound
connection) and can result in the wrong outbound
- // port being selected if
configured with enable_legacy_ssl_storage_port=true.
- int maybeUpdatedVersion =
template.endpointToVersion().get(template.to);
- if (maybeUpdatedVersion !=
messagingVersion)
- {
- logger.trace("Endpoint
version changed from {} to {} since connection initialized, updating.",
-
messagingVersion, maybeUpdatedVersion);
- messagingVersion =
maybeUpdatedVersion;
- }
- attempt(result);
- }, max(100, retryRateMillis),
MILLISECONDS));
+ state = new Connecting(state.disconnected(), result,
eventLoop.schedule(() -> attempt(result), max(100, retryRateMillis),
MILLISECONDS));
retryRateMillis = min(1000, retryRateMillis * 2);
}
else
@@ -1194,6 +1176,22 @@ public class OutboundConnection
{
++connectionAttempts;
+ /*
+ * Re-evaluate messagingVersion before re-attempting the
connection in case
+ * endpointToVersion were updated. This happens if the
outbound connection
+ * is made before the endpointToVersion table is initially
constructed or out
+ * of date (e.g. if outbound connections are established for
gossip
+ * as a result of an inbound connection) and can result in the
wrong outbound
+ * port being selected if configured with
enable_legacy_ssl_storage_port=true.
+ */
+ int knownMessagingVersion = messagingVersion();
+ if (knownMessagingVersion != messagingVersion)
+ {
+ logger.trace("Endpoint version changed from {} to {} since
connection initialized, updating.",
+ messagingVersion, knownMessagingVersion);
+ messagingVersion = knownMessagingVersion;
+ }
+
settings = template;
if (messagingVersion > settings.acceptVersions.max)
messagingVersion = settings.acceptVersions.max;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]