You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by mc...@apache.org on 2020/11/18 12:29:43 UTC

[cassandra] branch cassandra-3.11 updated: Protect against max_compaction_flush_memory_in_mb configurations configured still in bytes

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

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


The following commit(s) were added to refs/heads/cassandra-3.11 by this push:
     new ad9b715  Protect against max_compaction_flush_memory_in_mb configurations configured still in bytes
ad9b715 is described below

commit ad9b7156bd3df143c1d090a3d77f9479d906e0ec
Author: Mick Semb Wever <mc...@apache.org>
AuthorDate: Sun Nov 15 13:13:19 2020 +0100

    Protect against max_compaction_flush_memory_in_mb configurations configured still in bytes
    
     patch by Mick Semb Wever; reviewed by Zhao Yang for CASSANDRA-16071
---
 CHANGES.txt                                                  | 1 +
 NEWS.txt                                                     | 6 ++++++
 src/java/org/apache/cassandra/index/sasi/conf/IndexMode.java | 8 +++++++-
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index 80b1532..e16f3e5 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 3.11.10
+ * SASI's `max_compaction_flush_memory_in_mb` settings over 100GB revert to default of 1GB (CASSANDRA-16071)
 Merged from 3.0:
  * Improved check of num_tokens against the length of initial_token (CASSANDRA-14477)
  * Fix a race condition on ColumnFamilyStore and TableMetrics (CASSANDRA-16228)
diff --git a/NEWS.txt b/NEWS.txt
index 99d589d..3af2150 100644
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -49,6 +49,11 @@ Upgrading
     - In cassandra.yaml, when using vnodes num_tokens must be defined if initial_token is defined.
       If it is not defined, or not equal to the numbers of tokens defined in initial_tokens,
       the node will not start. See CASSANDRA-14477 for details.
+    - SASI's `max_compaction_flush_memory_in_mb` setting was previously getting interpreted in bytes. From 3.11.8
+      it is correctly interpreted in megabytes, but prior to 3.11.10 previous configurations of this setting will
+      lead to nodes OOM during compaction. From 3.11.10 previous configurations will be detected as incorrect,
+      logged, and the setting reverted to the default value of 1GB. It is up to the user to correct the setting
+      after an upgrade, via dropping and recreating the index. See CASSANDRA-16071 for details.
 
 3.11.9
 ======
@@ -66,6 +71,7 @@ Upgrading
     - Nothing specific to this release, but please see previous upgrading sections,
       especially if you are upgrading from 3.0.
 
+
 3.11.6
 ======
 
diff --git a/src/java/org/apache/cassandra/index/sasi/conf/IndexMode.java b/src/java/org/apache/cassandra/index/sasi/conf/IndexMode.java
index 8d76bb0..60a19a6 100644
--- a/src/java/org/apache/cassandra/index/sasi/conf/IndexMode.java
+++ b/src/java/org/apache/cassandra/index/sasi/conf/IndexMode.java
@@ -56,6 +56,7 @@ public class IndexMode
     private static final String INDEX_IS_LITERAL_OPTION = "is_literal";
     private static final String INDEX_MAX_FLUSH_MEMORY_OPTION = "max_compaction_flush_memory_in_mb";
     private static final double INDEX_MAX_FLUSH_DEFAULT_MULTIPLIER = 0.15;
+    private static final long DEFAULT_MAX_MEM_BYTES = (long) (1073741824 * INDEX_MAX_FLUSH_DEFAULT_MULTIPLIER); // 1G default for memtable
 
     public final Mode mode;
     public final boolean isAnalyzed, isLiteral;
@@ -187,9 +188,14 @@ public class IndexMode
         }
 
         long maxMemBytes = indexOptions.get(INDEX_MAX_FLUSH_MEMORY_OPTION) == null
-                ? (long) (1073741824 * INDEX_MAX_FLUSH_DEFAULT_MULTIPLIER) // 1G default for memtable
+                ? DEFAULT_MAX_MEM_BYTES
                 : 1048576L * Long.parseLong(indexOptions.get(INDEX_MAX_FLUSH_MEMORY_OPTION));
 
+        if (maxMemBytes > 100L * 1073741824)
+        {
+            logger.error("{} configured as {} is above 100GB, reverting to default 1GB", INDEX_MAX_FLUSH_MEMORY_OPTION, maxMemBytes);
+            maxMemBytes = DEFAULT_MAX_MEM_BYTES;
+        }
         return new IndexMode(mode, isLiteral, isAnalyzed, analyzerClass, maxMemBytes);
     }
 


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