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

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

commit 43e33247351aeefd508965c951a3258fae1736e4
Merge: a497d43 116e9c1
Author: Mick Semb Wever <m...@apache.org>
AuthorDate: Tue Aug 25 20:08:54 2020 +0200

    Merge branch 'cassandra-3.11' into trunk

 CHANGES.txt                                        |   1 +
 .../cassandra/index/sasi/conf/IndexMode.java       |  12 +-
 .../index/sasi/disk/PerSSTableIndexWriter.java     |   2 +-
 .../cassandra/index/sasi/conf/IndexModeTest.java   | 222 +++++++++++++++++++++
 4 files changed, 230 insertions(+), 7 deletions(-)

diff --cc CHANGES.txt
index a36c910,1ba44f5..1e2c64a
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,24 -1,6 +1,25 @@@
 -3.11.8
 +4.0-beta2
 + * Remove deprecated HintedHandOffManager (CASSANDRA-15939)
 + * Prevent repair from overrunning compaction (CASSANDRA-15817)
 + * fix cqlsh COPY functions in Python 3.8 on Mac (CASSANDRA-16053)
 + * Strip comment blocks from cqlsh input before processing statements 
(CASSANDRA-15802)
 + * Fix unicode chars error input (CASSANDRA-15990)
 + * Improved testability for CacheMetrics and ChunkCacheMetrics 
(CASSANDRA-15788)
 + * Handle errors in StreamSession#prepare (CASSANDRA-15852)
 + * FQL replay should have options to ignore DDL statements (CASSANDRA-16039)
 + * Remove COMPACT STORAGE internals (CASSANDRA-13994)
 + * Make TimestampSerializer accept fractional seconds of varying precision 
(CASSANDRA-15976)
 + * Improve cassandra-stress logging when using a profile file that doesn't 
exist (CASSANDRA-14425)
 + * Improve logging for socket connection/disconnection (CASSANDRA-15980)
 + * Throw FSWriteError upon write failures in order to apply DiskFailurePolicy 
(CASSANDRA-15928)
 + * Forbid altering UDTs used in partition keys (CASSANDRA-15933)
 + * Fix version parsing logic when upgrading from 3.0 (CASSANDRA-15973)
 + * Optimize NoSpamLogger use in hot paths (CASSANDRA-15766)
 + * Verify sstable components on startup (CASSANDRA-15945)
 +Merged from 3.11:
+  * Correctly interpret SASI's `max_compaction_flush_memory_in_mb` setting in 
megabytes not bytes (CASSANDRA-16071)
   * Fix short read protection for GROUP BY queries (CASSANDRA-15459)
 + * stop_paranoid disk failure policy is ignored on CorruptSSTableException 
after node is up (CASSANDRA-15191)
   * Frozen RawTuple is not annotated with frozen in the toString method 
(CASSANDRA-15857)
  Merged from 3.0:
   * Fix gossip shutdown order (CASSANDRA-15816)
diff --cc test/unit/org/apache/cassandra/index/sasi/conf/IndexModeTest.java
index 0000000,9f93f27..1cea469
mode 000000,100644..100644
--- a/test/unit/org/apache/cassandra/index/sasi/conf/IndexModeTest.java
+++ b/test/unit/org/apache/cassandra/index/sasi/conf/IndexModeTest.java
@@@ -1,0 -1,222 +1,222 @@@
+ /*
+  * Licensed to the Apache Software Foundation (ASF) under one
+  * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
+  * regarding copyright ownership.  The ASF licenses this file
+  * to you under the Apache License, Version 2.0 (the
+  * "License"); you may not use this file except in compliance
+  * with the License.  You may obtain a copy of the License at
+  *
+  *     http://www.apache.org/licenses/LICENSE-2.0
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  */
+ package org.apache.cassandra.index.sasi.conf;
+ 
+ import java.util.Collections;
+ import java.util.Map;
+ 
+ import com.google.common.collect.ImmutableMap;
+ import org.junit.Assert;
+ import org.junit.BeforeClass;
+ import org.junit.Test;
+ 
 -import org.apache.cassandra.config.CFMetaData;
 -import org.apache.cassandra.config.ColumnDefinition;
+ import org.apache.cassandra.config.DatabaseDescriptor;
+ import org.apache.cassandra.db.marshal.AsciiType;
+ import org.apache.cassandra.db.marshal.BytesType;
+ import org.apache.cassandra.db.marshal.UTF8Type;
+ import org.apache.cassandra.exceptions.ConfigurationException;
+ import org.apache.cassandra.index.sasi.disk.OnDiskIndexBuilder.Mode;
++import org.apache.cassandra.schema.ColumnMetadata;
++import org.apache.cassandra.schema.TableMetadata;
+ import org.apache.cassandra.utils.ByteBufferUtil;
+ 
+ 
+ public class IndexModeTest
+ {
+ 
 -    private final CFMetaData cfm = CFMetaData.Builder.create("ks", "cf")
 -                        .addPartitionKey("pkey", AsciiType.instance)
++    private final TableMetadata cfm = TableMetadata.builder("ks", "cf")
++                        .addPartitionKeyColumn("pkey", AsciiType.instance)
+                         .build();
+ 
+     @BeforeClass
+     public static void setupDD()
+     {
+         DatabaseDescriptor.daemonInitialization();
+     }
+ 
+     @Test
+     public void test_notIndexed()
+     {
+         Assert.assertEquals(IndexMode.NOT_INDEXED, IndexMode.getMode(null, 
(Map)null));
+         Assert.assertEquals(IndexMode.NOT_INDEXED, IndexMode.getMode(null, 
Collections.EMPTY_MAP));
+     }
+ 
+     @Test(expected = ConfigurationException.class)
+     public void test_bad_mode_option()
+     {
+         IndexMode.getMode(null, Collections.singletonMap("mode", "invalid"));
+     }
+ 
+     @Test
+     public void test_asciiType()
+     {
 -        ColumnDefinition cd = ColumnDefinition.regularDef(cfm, 
ByteBufferUtil.bytes("TestColumnDefinition"), AsciiType.instance);
++        ColumnMetadata cd = ColumnMetadata.regularColumn(cfm, 
ByteBufferUtil.bytes("TestColumnMetadata"), AsciiType.instance);
+ 
+         IndexMode result = IndexMode.getMode(cd, 
Collections.singletonMap("something", "nothing"));
+         Assert.assertNull(result.analyzerClass);
+         Assert.assertFalse(result.isAnalyzed);
+         Assert.assertTrue(result.isLiteral);
+         Assert.assertEquals((long)(1073741824 * 0.15), 
result.maxCompactionFlushMemoryInBytes);
+         Assert.assertEquals(Mode.PREFIX, result.mode);
+     }
+ 
+     @Test
+     public void test_asciiType_notLiteral()
+     {
 -        ColumnDefinition cd = ColumnDefinition.regularDef(cfm, 
ByteBufferUtil.bytes("TestColumnDefinition"), AsciiType.instance);
++        ColumnMetadata cd = ColumnMetadata.regularColumn(cfm, 
ByteBufferUtil.bytes("TestColumnMetadata"), AsciiType.instance);
+ 
+         IndexMode result = IndexMode.getMode(cd, 
Collections.singletonMap("is_literal", "false"));
+         Assert.assertNull(result.analyzerClass);
+         Assert.assertFalse(result.isAnalyzed);
+         Assert.assertFalse(result.isLiteral);
+         Assert.assertEquals((long)(1073741824 * 0.15), 
result.maxCompactionFlushMemoryInBytes);
+         Assert.assertEquals(Mode.PREFIX, result.mode);
+     }
+ 
+     @Test
+     public void test_asciiType_errLiteral()
+     {
 -        ColumnDefinition cd = ColumnDefinition.regularDef(cfm, 
ByteBufferUtil.bytes("TestColumnDefinition"), AsciiType.instance);
++        ColumnMetadata cd = ColumnMetadata.regularColumn(cfm, 
ByteBufferUtil.bytes("TestColumnMetadata"), AsciiType.instance);
+ 
+         IndexMode result = IndexMode.getMode(cd, 
Collections.singletonMap("is_literal", "junk"));
+         Assert.assertNull(result.analyzerClass);
+         Assert.assertFalse(result.isAnalyzed);
+         Assert.assertFalse(result.isLiteral);
+         Assert.assertEquals((long)(1073741824 * 0.15), 
result.maxCompactionFlushMemoryInBytes);
+         Assert.assertEquals(Mode.PREFIX, result.mode);
+     }
+ 
+     @Test
+     public void test_asciiType_analyzed()
+     {
 -        ColumnDefinition cd = ColumnDefinition.regularDef(cfm, 
ByteBufferUtil.bytes("TestColumnDefinition"), AsciiType.instance);
++        ColumnMetadata cd = ColumnMetadata.regularColumn(cfm, 
ByteBufferUtil.bytes("TestColumnMetadata"), AsciiType.instance);
+ 
+         IndexMode result = IndexMode.getMode(cd, 
Collections.singletonMap("analyzed", "true"));
+         Assert.assertNull(result.analyzerClass);
+         Assert.assertTrue(result.isAnalyzed);
+         Assert.assertTrue(result.isLiteral);
+         Assert.assertEquals((long)(1073741824 * 0.15), 
result.maxCompactionFlushMemoryInBytes);
+         Assert.assertEquals(Mode.PREFIX, result.mode);
+     }
+ 
+     @Test
+     public void test_utf8Type()
+     {
 -        ColumnDefinition cd = ColumnDefinition.regularDef(cfm, 
ByteBufferUtil.bytes("TestColumnDefinition"), UTF8Type.instance);
++        ColumnMetadata cd = ColumnMetadata.regularColumn(cfm, 
ByteBufferUtil.bytes("TestColumnMetadata"), UTF8Type.instance);
+ 
+         IndexMode result = IndexMode.getMode(cd, 
Collections.singletonMap("something", "nothing"));
+         Assert.assertNull(result.analyzerClass);
+         Assert.assertFalse(result.isAnalyzed);
+         Assert.assertTrue(result.isLiteral);
+         Assert.assertEquals((long)(1073741824 * 0.15), 
result.maxCompactionFlushMemoryInBytes);
+         Assert.assertEquals(Mode.PREFIX, result.mode);
+     }
+ 
+     @Test
+     public void test_bytesType()
+     {
 -        ColumnDefinition cd = ColumnDefinition.regularDef(cfm, 
ByteBufferUtil.bytes("TestColumnDefinition"), BytesType.instance);
++        ColumnMetadata cd = ColumnMetadata.regularColumn(cfm, 
ByteBufferUtil.bytes("TestColumnMetadata"), BytesType.instance);
+ 
+         IndexMode result = IndexMode.getMode(cd, 
Collections.singletonMap("something", "nothing"));
+         Assert.assertNull(result.analyzerClass);
+         Assert.assertFalse(result.isAnalyzed);
+         Assert.assertFalse(result.isLiteral);
+         Assert.assertEquals((long)(1073741824 * 0.15), 
result.maxCompactionFlushMemoryInBytes);
+         Assert.assertEquals(Mode.PREFIX, result.mode);
+     }
+ 
+     @Test
+     public void test_bytesType_isLiteral()
+     {
 -        ColumnDefinition cd = ColumnDefinition.regularDef(cfm, 
ByteBufferUtil.bytes("TestColumnDefinition"), BytesType.instance);
++        ColumnMetadata cd = ColumnMetadata.regularColumn(cfm, 
ByteBufferUtil.bytes("TestColumnMetadata"), BytesType.instance);
+ 
+         IndexMode result = IndexMode.getMode(cd, 
Collections.singletonMap("is_literal", "true"));
+         Assert.assertNull(result.analyzerClass);
+         Assert.assertFalse(result.isAnalyzed);
+         Assert.assertTrue(result.isLiteral);
+         Assert.assertEquals((long)(1073741824 * 0.15), 
result.maxCompactionFlushMemoryInBytes);
+         Assert.assertEquals(Mode.PREFIX, result.mode);
+     }
+ 
+     @Test
+     public void test_bytesType_errLiteral()
+     {
 -        ColumnDefinition cd = ColumnDefinition.regularDef(cfm, 
ByteBufferUtil.bytes("TestColumnDefinition"), BytesType.instance);
++        ColumnMetadata cd = ColumnMetadata.regularColumn(cfm, 
ByteBufferUtil.bytes("TestColumnMetadata"), BytesType.instance);
+ 
+         IndexMode result = IndexMode.getMode(cd, 
Collections.singletonMap("is_literal", "junk"));
+         Assert.assertNull(result.analyzerClass);
+         Assert.assertFalse(result.isAnalyzed);
+         Assert.assertFalse(result.isLiteral);
+         Assert.assertEquals((long)(1073741824 * 0.15), 
result.maxCompactionFlushMemoryInBytes);
+         Assert.assertEquals(Mode.PREFIX, result.mode);
+     }
+ 
+     @Test
+     public void test_bytesType_analyzed()
+     {
 -        ColumnDefinition cd = ColumnDefinition.regularDef(cfm, 
ByteBufferUtil.bytes("TestColumnDefinition"), BytesType.instance);
++        ColumnMetadata cd = ColumnMetadata.regularColumn(cfm, 
ByteBufferUtil.bytes("TestColumnMetadata"), BytesType.instance);
+ 
+         IndexMode result = IndexMode.getMode(cd, 
Collections.singletonMap("analyzed", "true"));
+         Assert.assertNull(result.analyzerClass);
+         Assert.assertTrue(result.isAnalyzed);
+         Assert.assertFalse(result.isLiteral);
+         Assert.assertEquals((long)(1073741824 * 0.15), 
result.maxCompactionFlushMemoryInBytes);
+         Assert.assertEquals(Mode.PREFIX, result.mode);
+     }
+ 
+     @Test
+     public void test_bytesType_analyzer()
+     {
 -        ColumnDefinition cd = ColumnDefinition.regularDef(cfm, 
ByteBufferUtil.bytes("TestColumnDefinition"), BytesType.instance);
++        ColumnMetadata cd = ColumnMetadata.regularColumn(cfm, 
ByteBufferUtil.bytes("TestColumnMetadata"), BytesType.instance);
+ 
+         IndexMode result = IndexMode.getMode(cd, 
Collections.singletonMap("analyzer_class", "java.lang.Object"));
+         Assert.assertEquals(Object.class, result.analyzerClass);
+         Assert.assertTrue(result.isAnalyzed);
+         Assert.assertFalse(result.isLiteral);
+         Assert.assertEquals((long)(1073741824 * 0.15), 
result.maxCompactionFlushMemoryInBytes);
+         Assert.assertEquals(Mode.PREFIX, result.mode);
+     }
+ 
+     @Test
+     public void test_bytesType_analyzer_unanalyzed()
+     {
 -        ColumnDefinition cd = ColumnDefinition.regularDef(cfm, 
ByteBufferUtil.bytes("TestColumnDefinition"), BytesType.instance);
++        ColumnMetadata cd = ColumnMetadata.regularColumn(cfm, 
ByteBufferUtil.bytes("TestColumnMetadata"), BytesType.instance);
+ 
+         IndexMode result = IndexMode.getMode(cd, 
ImmutableMap.of("analyzer_class", "java.lang.Object",
+                                                                  "analyzed", 
"false"));
+ 
+         Assert.assertEquals(Object.class, result.analyzerClass);
+         Assert.assertFalse(result.isAnalyzed);
+         Assert.assertFalse(result.isLiteral);
+         Assert.assertEquals((long)(1073741824 * 0.15), 
result.maxCompactionFlushMemoryInBytes);
+         Assert.assertEquals(Mode.PREFIX, result.mode);
+     }
+ 
+     @Test
+     public void test_bytesType_maxCompactionFlushMemoryInBytes()
+     {
 -        ColumnDefinition cd = ColumnDefinition.regularDef(cfm, 
ByteBufferUtil.bytes("TestColumnDefinition"), BytesType.instance);
++        ColumnMetadata cd = ColumnMetadata.regularColumn(cfm, 
ByteBufferUtil.bytes("TestColumnMetadata"), BytesType.instance);
+ 
+         IndexMode result = IndexMode.getMode(cd, 
Collections.singletonMap("max_compaction_flush_memory_in_mb", "1"));
+         Assert.assertNull(result.analyzerClass);
+         Assert.assertFalse(result.isAnalyzed);
+         Assert.assertFalse(result.isLiteral);
+         Assert.assertEquals(1048576L, result.maxCompactionFlushMemoryInBytes);
+         Assert.assertEquals(Mode.PREFIX, result.mode);
+     }
+ }


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

Reply via email to