You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jo...@apache.org on 2022/02/03 21:32:36 UTC

[cassandra] branch cassandra-3.11 updated (bfab1fd -> beb4563)

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

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


    from bfab1fd  Merge branch 'cassandra-3.0' into cassandra-3.11
     new 9ff28fc  Fixes for intermittent in-JVM dtest failures
     new beb4563  Merge branch 'cassandra-3.0' into cassandra-3.11

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:
 src/java/org/apache/cassandra/service/StorageService.java  | 14 ++++++++++----
 .../apache/cassandra/distributed/impl/AbstractCluster.java |  8 +++++++-
 .../org/apache/cassandra/distributed/impl/Instance.java    | 10 ++++++++++
 .../org/apache/cassandra/distributed/test/GossipTest.java  |  3 ---
 4 files changed, 27 insertions(+), 8 deletions(-)

---------------------------------------------------------------------
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-3.0' into cassandra-3.11

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

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

commit beb456305af307b20376b0190fea6c33d6b38ac6
Merge: bfab1fd 9ff28fc
Author: Jon Meredith <jo...@apache.org>
AuthorDate: Thu Feb 3 14:22:52 2022 -0700

    Merge branch 'cassandra-3.0' into cassandra-3.11

 src/java/org/apache/cassandra/service/StorageService.java  | 14 ++++++++++----
 .../apache/cassandra/distributed/impl/AbstractCluster.java |  8 +++++++-
 .../org/apache/cassandra/distributed/impl/Instance.java    | 10 ++++++++++
 .../org/apache/cassandra/distributed/test/GossipTest.java  |  3 ---
 4 files changed, 27 insertions(+), 8 deletions(-)

diff --cc src/java/org/apache/cassandra/service/StorageService.java
index 1a0d5b0,22040c1..49f3835
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@@ -4760,61 -4460,17 +4757,70 @@@ public class StorageService extends Not
          {
              logger.error("Caught an exception while draining ", t);
          }
 +        finally
 +        {
 +            Throwable postShutdownHookThrowable = Throwables.perform(null, postShutdownHooks.stream().map(h -> h::run));
 +            if (postShutdownHookThrowable != null)
 +                logger.error("Post-shutdown hooks returned exception", postShutdownHookThrowable);
 +        }
 +    }
 +
 +    /**
 +     * Add a runnable which will be called before shut down or drain. This is useful for other
 +     * applications running in the same JVM which may want to shut down first rather than time
 +     * out attempting to use Cassandra calls which will no longer work.
 +     * @param hook: the code to run
 +     * @return true on success, false if Cassandra is already shutting down, in which case the runnable
 +     * has NOT been added.
 +     */
 +    public synchronized boolean addPreShutdownHook(Runnable hook)
 +    {
 +        if (!isDraining() && !isDrained())
 +            return preShutdownHooks.add(hook);
 +
 +        return false;
 +    }
 +
 +    /**
 +     * Remove a preshutdown hook
 +     */
 +    public synchronized boolean removePreShutdownHook(Runnable hook)
 +    {
 +        return preShutdownHooks.remove(hook);
 +    }
 +
 +    /**
 +     * Add a runnable which will be called after shutdown or drain. This is useful for other applications
 +     * running in the same JVM that Cassandra needs to work and should shut down later.
 +     * @param hook: the code to run
 +     * @return true on success, false if Cassandra is already shutting down, in which case the runnable has NOT been
 +     * added.
 +     */
 +    public synchronized boolean addPostShutdownHook(Runnable hook)
 +    {
 +        if (!isDraining() && !isDrained())
 +            return postShutdownHooks.add(hook);
 +
 +        return false;
 +    }
 +
 +    /**
 +     * Remove a postshutdownhook
 +     */
 +    public synchronized boolean removePostShutdownHook(Runnable hook)
 +    {
 +        return postShutdownHooks.remove(hook);
      }
  
+     @VisibleForTesting
+     public void disableAutoCompaction()
+     {
+         // disable autocompaction - we don't want to start any new compactions while we are draining
+         for (Keyspace keyspace : Keyspace.all())
+             for (ColumnFamilyStore cfs : keyspace.getColumnFamilyStores())
+                 cfs.disableAutoCompaction();
+     }
+ 
      /**
       * Some services are shutdown during draining and we should not attempt to start them again.
       *
diff --cc test/distributed/org/apache/cassandra/distributed/impl/Instance.java
index 80728e2,776def3..1859742
--- a/test/distributed/org/apache/cassandra/distributed/impl/Instance.java
+++ b/test/distributed/org/apache/cassandra/distributed/impl/Instance.java
@@@ -717,8 -770,14 +725,10 @@@ public class Instance extends IsolatedE
              if (config.has(GOSSIP) || config.has(NETWORK))
              {
                  StorageService.instance.shutdownServer();
 -
 -                error = parallelRun(error, executor,
 -                                    () -> NanoTimeToCurrentTimeMillis.shutdown(MINUTES.toMillis(1L))
 -                );
              }
  
+             error = parallelRun(error, executor, StorageService.instance::disableAutoCompaction);
+ 
              error = parallelRun(error, executor,
                                  () -> Gossiper.instance.stopShutdownAndWait(1L, MINUTES),
                                  CompactionManager.instance::forceShutdown,

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