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 ea3d4407b4d3f6f1e88097ec5e53879b3a354fd5 Merge: cb83fbf b714667 Author: Mick Semb Wever <[email protected]> AuthorDate: Tue Mar 10 09:04:01 2020 +0100 Merge branch 'cassandra-3.11' into trunk CHANGES.txt | 1 + .../cassandra/serializers/MapSerializer.java | 4 ++ .../cassandra/serializers/SetSerializer.java | 4 ++ .../cassandra/db/commitlog/CommitLogTest.java | 51 ++++++++++++++++++++-- 4 files changed, 57 insertions(+), 3 deletions(-) diff --cc test/unit/org/apache/cassandra/db/commitlog/CommitLogTest.java index 25e2f30,895cfd0..1e3f622 --- a/test/unit/org/apache/cassandra/db/commitlog/CommitLogTest.java +++ b/test/unit/org/apache/cassandra/db/commitlog/CommitLogTest.java @@@ -19,6 -19,6 +19,7 @@@ package org.apache.cassandra.db.commitlog; import java.io.*; ++import java.math.BigInteger; import java.nio.ByteBuffer; import java.util.*; import java.util.concurrent.Callable; @@@ -29,9 -29,9 +30,9 @@@ import java.util.zip.CRC32 import java.util.zip.Checksum; import com.google.common.collect.Iterables; ++import com.google.common.io.Files; import org.junit.*; --import com.google.common.io.Files; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; @@@ -68,19 -65,19 +69,25 @@@ import org.apache.cassandra.utils.Kille import org.apache.cassandra.utils.Pair; import org.apache.cassandra.utils.vint.VIntCoding; --import org.junit.After; import static org.apache.cassandra.utils.ByteBufferUtil.bytes; ++ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; ++import org.apache.cassandra.db.marshal.IntegerType; ++import org.apache.cassandra.db.marshal.MapType; ++import org.apache.cassandra.db.marshal.SetType; ++import org.apache.cassandra.db.marshal.UTF8Type; ++ +@Ignore @RunWith(Parameterized.class) -public class CommitLogTest +public abstract class CommitLogTest { - private static final String KEYSPACE1 = "CommitLogTest"; + protected static final String KEYSPACE1 = "CommitLogTest"; private static final String KEYSPACE2 = "CommitLogTestNonDurable"; - private static final String STANDARD1 = "Standard1"; + protected static final String STANDARD1 = "Standard1"; private static final String STANDARD2 = "Standard2"; + private static final String CUSTOM1 = "Custom1"; private static JVMStabilityInspector.Killer oldKiller; private static KillerForTests testKiller; @@@ -111,6 -108,15 +118,14 @@@ KeyspaceParams.DEFAULT_LOCAL_DURABLE_WRITES = false; SchemaLoader.prepareServer(); + - CFMetaData custom = CFMetaData.compile(String.format("CREATE TABLE \"%s\" (" + - "k int," + - "c1 frozen<map<text, text>>," + - "c2 frozen<set<text>>," + - "s int static," + - "PRIMARY KEY (k, c1, c2)" + - ");", CUSTOM1), KEYSPACE1); ++ TableMetadata.Builder custom = ++ TableMetadata.builder(KEYSPACE1, CUSTOM1) ++ .addPartitionKeyColumn("k", IntegerType.instance) ++ .addClusteringColumn("c1", MapType.getInstance(UTF8Type.instance, UTF8Type.instance, false)) ++ .addClusteringColumn("c2", SetType.getInstance(UTF8Type.instance, false)) ++ .addStaticColumn("s", IntegerType.instance); + SchemaLoader.createKeyspace(KEYSPACE1, KeyspaceParams.simple(1), SchemaLoader.standardCFMD(KEYSPACE1, STANDARD1, 0, AsciiType.instance, BytesType.instance), @@@ -900,5 -930,33 +918,32 @@@ { testOutOfOrderFlushRecovery(recycleSegments, true); } + + @Test + public void testRecoveryWithCollectionClusteringKeysStatic() throws Exception + { + + ColumnFamilyStore cfs = Keyspace.open(KEYSPACE1).getColumnFamilyStore(CUSTOM1); - RowUpdateBuilder rb = new RowUpdateBuilder(cfs.metadata, 0, 1); ++ RowUpdateBuilder rb = new RowUpdateBuilder(cfs.metadata(), 0, BigInteger.ONE); + - rb.add("s", 2); ++ rb.add("s", BigInteger.valueOf(2)); + + Mutation rm = rb.build(); + CommitLog.instance.add(rm); + + int replayed = 0; + + try + { + System.setProperty(CommitLogReplayer.IGNORE_REPLAY_ERRORS_PROPERTY, "true"); + replayed = CommitLog.instance.resetUnsafe(false); + } + finally + { + System.clearProperty(CommitLogReplayer.IGNORE_REPLAY_ERRORS_PROPERTY); + } + + Assert.assertEquals(replayed, 1); - + } } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
