You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jz...@apache.org on 2018/12/31 06:15:00 UTC

[2/4] cassandra git commit: Merge branch 'cassandra-2.2' into cassandra-3.0

Merge branch 'cassandra-2.2' into cassandra-3.0


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/e2ee2045
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/e2ee2045
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/e2ee2045

Branch: refs/heads/trunk
Commit: e2ee204580a0ee87b36e1df6aa2717830dfb33d0
Parents: 23d722e a6196a3
Author: Jay Zhuang <ja...@yahoo.com>
Authored: Sun Dec 30 21:41:28 2018 -0800
Committer: Jay Zhuang <ja...@yahoo.com>
Committed: Sun Dec 30 21:49:33 2018 -0800

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../cassandra/service/CassandraDaemon.java      | 47 ++++++++++++
 .../cassandra/service/StorageService.java       | 78 ++++++++++++++++----
 .../cassandra/service/StorageServiceMBean.java  |  7 ++
 .../org/apache/cassandra/tools/NodeProbe.java   |  5 ++
 .../apache/cassandra/tools/nodetool/Join.java   |  1 +
 6 files changed, 126 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/e2ee2045/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 8fd0200,16695c8..d29cdc1
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -33,39 -8,8 +33,40 @@@
   * Returns null instead of NaN or Infinity in JSON strings (CASSANDRA-14377)
  
  
 -2.2.13
 +3.0.17
 + * Fix corrupted static collection deletions in 3.0 -> 2.{1,2} messages (CASSANDRA-14568)
 + * Fix potential IndexOutOfBoundsException with counters (CASSANDRA-14167)
 + * Restore resumable hints delivery, backport CASSANDRA-11960 (CASSANDRA-14419)
 + * Always close RT markers returned by ReadCommand#executeLocally() (CASSANDRA-14515)
 + * Reverse order queries with range tombstones can cause data loss (CASSANDRA-14513)
 + * Fix regression of lagging commitlog flush log message (CASSANDRA-14451)
 + * Add Missing dependencies in pom-all (CASSANDRA-14422)
 + * Cleanup StartupClusterConnectivityChecker and PING Verb (CASSANDRA-14447)
 + * Fix deprecated repair error notifications from 3.x clusters to legacy JMX clients (CASSANDRA-13121)
 + * Cassandra not starting when using enhanced startup scripts in windows (CASSANDRA-14418)
 + * Fix progress stats and units in compactionstats (CASSANDRA-12244)
 + * Better handle missing partition columns in system_schema.columns (CASSANDRA-14379)
 + * Delay hints store excise by write timeout to avoid race with decommission (CASSANDRA-13740)
 + * Deprecate background repair and probablistic read_repair_chance table options
 +   (CASSANDRA-13910)
 + * Add missed CQL keywords to documentation (CASSANDRA-14359)
 + * Fix unbounded validation compactions on repair / revert CASSANDRA-13797 (CASSANDRA-14332)
 + * Avoid deadlock when running nodetool refresh before node is fully up (CASSANDRA-14310)
 + * Handle all exceptions when opening sstables (CASSANDRA-14202)
 + * Handle incompletely written hint descriptors during startup (CASSANDRA-14080)
 + * Handle repeat open bound from SRP in read repair (CASSANDRA-14330)
 + * Respect max hint window when hinting for LWT (CASSANDRA-14215)
 + * Adding missing WriteType enum values to v3, v4, and v5 spec (CASSANDRA-13697)
 + * Don't regenerate bloomfilter and summaries on startup (CASSANDRA-11163)
 + * Fix NPE when performing comparison against a null frozen in LWT (CASSANDRA-14087)
 + * Log when SSTables are deleted (CASSANDRA-14302)
 + * Fix batch commitlog sync regression (CASSANDRA-14292)
 + * Write to pending endpoint when view replica is also base replica (CASSANDRA-14251)
 + * Chain commit log marker potential performance regression in batch commit mode (CASSANDRA-14194)
 + * Fully utilise specified compaction threads (CASSANDRA-14210)
 + * Pre-create deletion log records to finish compactions quicker (CASSANDRA-12763)
 +Merged from 2.2:
+  * Don't enable client transports when bootstrap is pending (CASSANDRA-14525)
   * Fix bug that prevented compaction of SSTables after full repairs (CASSANDRA-14423)
   * Incorrect counting of pending messages in OutboundTcpConnection (CASSANDRA-11551)
   * Fix compaction failure caused by reading un-flushed data (CASSANDRA-12743)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/e2ee2045/src/java/org/apache/cassandra/service/CassandraDaemon.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/service/CassandraDaemon.java
index 177f8e3,e250050..6869d2c
--- a/src/java/org/apache/cassandra/service/CassandraDaemon.java
+++ b/src/java/org/apache/cassandra/service/CassandraDaemon.java
@@@ -609,26 -597,6 +633,49 @@@ public class CassandraDaemo
          }
      }
  
 +    public void startNativeTransport()
 +    {
++        // 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`");
++                }
++            }
++        }
++
 +        if (nativeTransportService == null)
 +            throw new IllegalStateException("setup() must be called first for CassandraDaemon");
 +        else
 +            nativeTransportService.start();
 +    }
 +
 +    public void stopNativeTransport()
 +    {
 +        if (nativeTransportService != null)
 +            nativeTransportService.stop();
 +    }
 +
 +    public boolean isNativeTransportRunning()
 +    {
 +        return nativeTransportService != null ? nativeTransportService.isRunning() : false;
 +    }
 +
 +
      /**
       * A convenience method to stop and destroy the daemon in one shot.
       */

http://git-wip-us.apache.org/repos/asf/cassandra/blob/e2ee2045/src/java/org/apache/cassandra/service/StorageService.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/service/StorageService.java
index 5f76f7d,03470b6..55bc9ae
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@@ -175,7 -156,8 +175,9 @@@ public class StorageService extends Not
      private volatile boolean isBootstrapMode;
  
      /* we bootstrap but do NOT join the ring unless told to do so */
-     private boolean isSurveyMode = Boolean.parseBoolean(System.getProperty("cassandra.write_survey", "false"));
+     private boolean isSurveyMode = Boolean.parseBoolean(System.getProperty
+             ("cassandra.write_survey", "false"));
++
      /* true if node is rebuilding and receiving data */
      private final AtomicBoolean isRebuilding = new AtomicBoolean();
  
@@@ -211,6 -192,18 +213,16 @@@
  
      private final StreamStateStore streamStateStore = new StreamStateStore();
  
 -    private final AtomicBoolean doneAuthSetup = new AtomicBoolean(false);
 -
+     public boolean isSurveyMode()
+     {
+         return isSurveyMode;
+     }
+ 
+     public boolean hasJoined()
+     {
+         return joined;
+     }
+ 
      /** This method updates the local token on disk  */
      public void setTokens(Collection<Token> tokens)
      {
@@@ -352,6 -337,30 +364,29 @@@
          {
              throw new IllegalStateException("No configured daemon");
          }
+ 
+         // 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 RPC server in write_survey mode as " +
 -                            "it's bootstrapping or auth is enabled");
++                    throw new IllegalStateException("Not starting RPC server 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`");
++                    throw new IllegalStateException("Node is not yet bootstrapped completely. Use nodetool to check bootstrap state and resume. For more, see `nodetool help bootstrap`");
+                 }
+             }
+         }
 -        
++
          daemon.thriftServer.start();
      }
  
@@@ -1284,20 -1303,19 +1337,19 @@@
                  @Override
                  public void onSuccess(StreamState streamState)
                  {
 -                    isBootstrapMode = false;
 +                    bootstrapFinished();
-                     // start participating in the ring.
-                     // pretend we are in survey mode so we can use joinRing() here
-                     isSurveyMode = true;
-                     try
+                     if (isSurveyMode)
                      {
-                         progressSupport.progress("bootstrap", ProgressEvent.createNotification("Joining ring..."));
-                         joinRing();
+                         logger.info("Startup complete, but write survey mode is active, not becoming an active ring member. Use JMX (StorageService->joinRing()) to finalize ring joining.");
                      }
-                     catch (IOException ignore)
+                     else
                      {
-                         // joinRing with survey mode does not throw IOException
+                         isSurveyMode = false;
+                         progressSupport.progress("bootstrap", ProgressEvent.createNotification("Joining ring..."));
+                         finishJoiningRing(bootstrapTokens);
                      }
                      progressSupport.progress("bootstrap", new ProgressEvent(ProgressEventType.COMPLETE, 1, 1, "Resume bootstrap complete"));
+                     daemon.start();
                      logger.info("Resume complete");
                  }
  

http://git-wip-us.apache.org/repos/asf/cassandra/blob/e2ee2045/src/java/org/apache/cassandra/service/StorageServiceMBean.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/service/StorageServiceMBean.java
index 10d47f7,43d26c6..835da17
--- a/src/java/org/apache/cassandra/service/StorageServiceMBean.java
+++ b/src/java/org/apache/cassandra/service/StorageServiceMBean.java
@@@ -492,9 -490,14 +492,16 @@@ public interface StorageServiceMBean ex
      // allows a node that have been started without joining the ring to join it
      public void joinRing() throws IOException;
      public boolean isJoined();
 +    public boolean isDrained();
 +    public boolean isDraining();
  
+     /** Check if currently bootstrapping.
+      * Note this becomes false before {@link org.apache.cassandra.db.SystemKeyspace#bootstrapComplete()} is called,
+      * as setting bootstrap to complete is called only when the node joins the ring.
+      * @return True prior to bootstrap streaming completing. False prior to start of bootstrap and post streaming.
+      */
+     public boolean isBootstrapMode();
+ 
      public void setStreamThroughputMbPerSec(int value);
      public int getStreamThroughputMbPerSec();
  

http://git-wip-us.apache.org/repos/asf/cassandra/blob/e2ee2045/src/java/org/apache/cassandra/tools/NodeProbe.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/tools/NodeProbe.java
index 0d3c078,a022595..7ed40bb
--- a/src/java/org/apache/cassandra/tools/NodeProbe.java
+++ b/src/java/org/apache/cassandra/tools/NodeProbe.java
@@@ -613,16 -574,11 +613,21 @@@ public class NodeProbe implements AutoC
          return ssProxy.isJoined();
      }
  
 +    public boolean isDrained()
 +    {
 +        return ssProxy.isDrained();
 +    }
 +
 +    public boolean isDraining()
 +    {
 +        return ssProxy.isDraining();
 +    }
 +
+     public boolean isBootstrapMode()
+     {
+         return ssProxy.isBootstrapMode();
+     }
+ 
      public void joinRing() throws IOException
      {
          ssProxy.joinRing();


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