This is an automated email from the ASF dual-hosted git repository.

brandonwilliams pushed a commit to branch cassandra-5.0
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/cassandra-5.0 by this push:
     new 3d878201fb Only wait until native_transport_timeout for dispatcher to 
finish
3d878201fb is described below

commit 3d878201fb4ed40357aa4312741a605151e7d7e6
Author: Brandon Williams <brandonwilli...@apache.org>
AuthorDate: Tue Jun 18 08:40:56 2024 -0500

    Only wait until native_transport_timeout for dispatcher to finish
    
    Patch by brandonwilliams; reviewed by maedhroz and smiklosovic for
    CASSANDRA-19697
---
 CHANGES.txt                                         |  1 +
 src/java/org/apache/cassandra/transport/Server.java | 10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/CHANGES.txt b/CHANGES.txt
index f3bcf42bbe..1396600720 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 5.0-beta2
+ * Only wait until native_transport_timeout for dispatcher to finish 
(CASSANDRA-19697)
  * Disable chronicle analytics (CASSANDRA-19656)
  * Replace Stream iteration with for-loop for 
StorageProxy::updateCoordinatorWriteLatencyTableMetric (CASSANDRA-19676)
  * Enforce metric naming contract if scope is used in a metric name 
(CASSANDRA-19619)
diff --git a/src/java/org/apache/cassandra/transport/Server.java 
b/src/java/org/apache/cassandra/transport/Server.java
index 6b1b84d043..6abaf72515 100644
--- a/src/java/org/apache/cassandra/transport/Server.java
+++ b/src/java/org/apache/cassandra/transport/Server.java
@@ -57,6 +57,8 @@ import org.apache.cassandra.service.*;
 import org.apache.cassandra.transport.messages.EventMessage;
 import org.apache.cassandra.utils.FBUtilities;
 
+import static org.apache.cassandra.utils.Clock.Global.nanoTime;
+
 public class Server implements CassandraDaemon.Server
 {
     static
@@ -183,8 +185,16 @@ public class Server implements CassandraDaemon.Server
     {
         if (!force)
         {
+            long deadline = nanoTime() + 
DatabaseDescriptor.getNativeTransportTimeout(TimeUnit.NANOSECONDS);
             while (!dispatcher.isDone())
+            {
+                if (nanoTime() > deadline)
+                {
+                    logger.warn("Some connections took longer than the native 
transport timeout to complete");
+                    break;
+                }
                 LockSupport.parkNanos(TimeUnit.MILLISECONDS.toNanos(100));
+            }
         }
 
         // Close opened connections


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to