You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by dc...@apache.org on 2020/07/25 01:57:19 UTC

[cassandra] branch cassandra-3.0 updated (5ee720a -> ebf9c74)

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

dcapwell pushed a change to branch cassandra-3.0
in repository https://gitbox.apache.org/repos/asf/cassandra.git.


    from 5ee720a  Merge branch 'cassandra-2.2' into cassandra-3.0
     new 25fd7bd  Add support in jvm dtest to test thrift
     new ebf9c74  Merge branch 'cassandra-2.2' into cassandra-3.0

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 build.xml                                          |  1 +
 .../apache/cassandra/service/CassandraDaemon.java  | 35 ++++++++++++---
 .../distributed/test/ThriftClientTest.java         | 51 ++++++++++++++++++++++
 .../distributed/test/ThriftClientUtils.java        | 38 ++++++++++++++++
 4 files changed, 118 insertions(+), 7 deletions(-)
 create mode 100644 test/distributed/org/apache/cassandra/distributed/test/ThriftClientTest.java
 create mode 100644 test/distributed/org/apache/cassandra/distributed/test/ThriftClientUtils.java


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


[cassandra] 01/01: Merge branch 'cassandra-2.2' into cassandra-3.0

Posted by dc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit ebf9c74c4ea8aefb1262458664571fdb52b76102
Merge: 5ee720a 25fd7bd
Author: David Capwell <dc...@gmail.com>
AuthorDate: Fri Jul 24 18:47:39 2020 -0700

    Merge branch 'cassandra-2.2' into cassandra-3.0

 build.xml                                          |  1 +
 .../apache/cassandra/service/CassandraDaemon.java  | 35 ++++++++++++---
 .../distributed/test/ThriftClientTest.java         | 51 ++++++++++++++++++++++
 .../distributed/test/ThriftClientUtils.java        | 38 ++++++++++++++++
 4 files changed, 118 insertions(+), 7 deletions(-)

diff --cc src/java/org/apache/cassandra/service/CassandraDaemon.java
index 85a002f,7d85d9d..271f763
--- a/src/java/org/apache/cassandra/service/CassandraDaemon.java
+++ b/src/java/org/apache/cassandra/service/CassandraDaemon.java
@@@ -408,11 -367,12 +408,6 @@@ public class CassandraDaemo
          // due to scheduling errors or race conditions
          ScheduledExecutors.optionalTasks.scheduleWithFixedDelay(ColumnFamilyStore.getBackgroundCompactionTaskSubmitter(), 5, 1, TimeUnit.MINUTES);
  
-         // Thrift
-         InetAddress rpcAddr = DatabaseDescriptor.getRpcAddress();
-         int rpcPort = DatabaseDescriptor.getRpcPort();
-         int listenBacklog = DatabaseDescriptor.getRpcListenBacklog();
-         thriftServer = new ThriftServer(rpcAddr, rpcPort, listenBacklog);
 -        // schedule periodic dumps of table size estimates into SystemKeyspace.SIZE_ESTIMATES_CF
 -        // set cassandra.size_recorder_interval to 0 to disable
 -        int sizeRecorderInterval = Integer.getInteger("cassandra.size_recorder_interval", 5 * 60);
 -        if (sizeRecorderInterval > 0)
 -            ScheduledExecutors.optionalTasks.scheduleWithFixedDelay(SizeEstimatesRecorder.instance, 30, sizeRecorderInterval, TimeUnit.SECONDS);
 -
          initializeNativeTransport();
  
          completeSetup();
@@@ -420,9 -380,58 +415,16 @@@
  
      public void initializeNativeTransport()
      {
+         // Thrift
+         InetAddress rpcAddr = DatabaseDescriptor.getRpcAddress();
+         int rpcPort = DatabaseDescriptor.getRpcPort();
+         int listenBacklog = DatabaseDescriptor.getRpcListenBacklog();
 -        thriftServer = new ThriftServer(rpcAddr, rpcPort, listenBacklog);
 -
 -        // Native transport
 -        InetAddress nativeAddr = DatabaseDescriptor.getRpcAddress();
 -        int nativePort = DatabaseDescriptor.getNativeTransportPort();
 -        nativeServer = new org.apache.cassandra.transport.Server(nativeAddr, nativePort);
 -    }
 -
 -    public void startNativeTransport()
 -    {
 -        validateTransportsCanStart();
 -
 -        if (nativeServer == null)
 -            throw new IllegalStateException("native transport should be set up before it can be started");
 -
 -        nativeServer.start();
 -        logger.info("Native server running on {}", new InetSocketAddress(DatabaseDescriptor.getRpcAddress(), DatabaseDescriptor.getNativeTransportPort()));
 -
+         if (thriftServer == null)
 -            throw new IllegalStateException("thrift transport should be set up before it can be started");
 -        thriftServer.start();
 -        logger.info("Thrift server running on {}", new InetSocketAddress(DatabaseDescriptor.getRpcAddress(), DatabaseDescriptor.getRpcPort()));
 -    }
++            thriftServer = new ThriftServer(rpcAddr, rpcPort, listenBacklog);
+ 
 -    private void validateTransportsCanStart()
 -    {
 -        // We only start transports if bootstrap has completed and we're not in survey mode, OR if we are in
 -        // survey mode and streaming has completed but we're not using auth.
 -        // OR if we have not joined the ring yet.
 -        if (StorageService.instance.hasJoined())
 -        {
 -            if (StorageService.instance.isSurveyMode())
 -            {
 -                if (StorageService.instance.isBootstrapMode() || DatabaseDescriptor.getAuthenticator().requireAuthentication())
 -                {
 -                    throw new IllegalStateException("Not starting client transports in write_survey mode as it's bootstrapping or " +
 -                                                    "auth is enabled");
 -                }
 -            }
 -            else
 -            {
 -                if (!SystemKeyspace.bootstrapComplete())
 -                {
 -                    throw new IllegalStateException("Node is not yet bootstrapped completely. Use nodetool to check bootstrap" +
 -                                                    " state and resume. For more, see `nodetool help bootstrap`");
 -                }
 -            }
 -        }
 +        // Native transport
 +        if (nativeTransportService == null)
 +            nativeTransportService = new NativeTransportService();
      }
  
      /*
@@@ -563,11 -568,19 +565,17 @@@
      @VisibleForTesting
      public void destroyNativeTransport() throws InterruptedException
      {
 -        // In 2.2, just stopping the server works. Future versions require `destroy` to be called
 -        // so we maintain the name for consistency
 -        if (nativeServer != null)
 +        if (nativeTransportService != null)
          {
 -            nativeServer.stopAndAwaitTermination();
 -            nativeServer = null;
 +            nativeTransportService.destroy();
 +            nativeTransportService = null;
          }
+ 
+         if (thriftServer != null)
+         {
 -            thriftServer.stopAndAwaitTermination();
++            thriftServer.stop();
+             thriftServer = null;
+         }
      }
  
  
@@@ -648,64 -661,6 +656,77 @@@
          }
      }
  
 +    public void validateTransportsCanStart()
 +    {
 +        // We only start transports if bootstrap has completed and we're not in survey mode, OR if we are in
 +        // survey mode and streaming has completed but we're not using auth.
 +        // OR if we have not joined the ring yet.
 +        if (StorageService.instance.hasJoined())
 +        {
 +            if (StorageService.instance.isSurveyMode())
 +            {
 +                if (StorageService.instance.isBootstrapMode() || DatabaseDescriptor.getAuthenticator().requireAuthentication())
 +                {
 +                    throw new IllegalStateException("Not starting client transports in write_survey mode as it's bootstrapping or " +
 +                                                    "auth is enabled");
 +                }
 +            }
 +            else
 +            {
 +                if (!SystemKeyspace.bootstrapComplete())
 +                {
 +                    throw new IllegalStateException("Node is not yet bootstrapped completely. Use nodetool to check bootstrap" +
 +                                                    " state and resume. For more, see `nodetool help bootstrap`");
 +                }
 +            }
 +        }
 +    }
 +
 +    public void startNativeTransport()
 +    {
 +        validateTransportsCanStart();
 +
 +        if (nativeTransportService == null)
 +            throw new IllegalStateException("setup() must be called first for CassandraDaemon");
-         else
-             nativeTransportService.start();
++
++        nativeTransportService.start();
++
++        if (thriftServer == null)
++            throw new IllegalStateException("thrift transport should be set up before it can be started");
++        thriftServer.start();
 +    }
 +
 +    public void stopNativeTransport()
 +    {
 +        if (nativeTransportService != null)
++        {
 +            nativeTransportService.stop();
++            nativeTransportService = null;
++        }
++
++        if (thriftServer != null)
++        {
++            thriftServer.stop();
++            thriftServer = null;
++        }
 +    }
 +
 +    public boolean isNativeTransportRunning()
 +    {
 +        return nativeTransportService != null ? nativeTransportService.isRunning() : false;
 +    }
 +
 +    public int getMaxNativeProtocolVersion()
 +    {
 +        return nativeTransportService.getMaxProtocolVersion();
 +    }
 +
 +    public void refreshMaxNativeProtocolVersion()
 +    {
 +        if (nativeTransportService != null)
 +            nativeTransportService.refreshMaxNegotiableProtocolVersion();
 +    }
 +
      /**
       * A convenience method to stop and destroy the daemon in one shot.
       */


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