Merge branch 'cassandra-3.0' into cassandra-3.11

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

Branch: refs/heads/trunk
Commit: 61edf6f2f027b4bf5596489ce2452e5993e6a683
Parents: a060698 00c90c1
Author: Jason Brown <jasedbr...@gmail.com>
Authored: Wed Mar 7 04:01:20 2018 -0800
Committer: Jason Brown <jasedbr...@gmail.com>
Committed: Wed Mar 7 04:06:15 2018 -0800

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../db/commitlog/BatchCommitLogTest.java        | 85 ++++++++++++++++++++
 2 files changed, 86 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/61edf6f2/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index ff726a9,6596602..bb652f3
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,7 -1,5 +1,8 @@@
 -3.0.17
 +3.11.3
 + * RateBasedBackPressure unnecessarily invokes a lock on the Guava 
RateLimiter (CASSANDRA-14163)
 + * Fix wildcard GROUP BY queries (CASSANDRA-14209)
 +Merged from 3.0:
+  * 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)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/61edf6f2/test/unit/org/apache/cassandra/db/commitlog/BatchCommitLogTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/db/commitlog/BatchCommitLogTest.java
index 0000000,c7f7e57..1f8dbdf
mode 000000,100644..100644
--- a/test/unit/org/apache/cassandra/db/commitlog/BatchCommitLogTest.java
+++ b/test/unit/org/apache/cassandra/db/commitlog/BatchCommitLogTest.java
@@@ -1,0 -1,66 +1,85 @@@
++/*
++ * 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.db.commitlog;
+ 
+ import static org.junit.Assert.*;
+ 
+ import java.nio.ByteBuffer;
+ import java.util.concurrent.TimeUnit;
+ 
+ import org.apache.cassandra.SchemaLoader;
+ import org.apache.cassandra.config.Config;
+ import org.apache.cassandra.config.DatabaseDescriptor;
+ import org.apache.cassandra.db.ColumnFamilyStore;
+ import org.apache.cassandra.db.Keyspace;
+ import org.apache.cassandra.db.Mutation;
+ import org.apache.cassandra.db.RowUpdateBuilder;
+ import org.apache.cassandra.db.compaction.CompactionManager;
+ import org.apache.cassandra.db.marshal.AsciiType;
+ import org.apache.cassandra.db.marshal.BytesType;
+ import org.apache.cassandra.schema.KeyspaceParams;
+ import org.junit.BeforeClass;
+ import org.junit.Test;
+ 
+ public class BatchCommitLogTest
+ {
+     private static final long CL_BATCH_SYNC_WINDOW = 1000; // 1 second
+     private static final String KEYSPACE1 = "CommitLogTest";
+     private static final String STANDARD1 = "Standard1";
+ 
+     @BeforeClass
+     public static void before()
+     {
++        DatabaseDescriptor.daemonInitialization();
+         DatabaseDescriptor.setCommitLogSync(Config.CommitLogSync.batch);
+         DatabaseDescriptor.setCommitLogSyncBatchWindow(CL_BATCH_SYNC_WINDOW);
+ 
+         KeyspaceParams.DEFAULT_LOCAL_DURABLE_WRITES = false;
+         SchemaLoader.prepareServer();
+         SchemaLoader.createKeyspace(KEYSPACE1,
+                                     KeyspaceParams.simple(1),
+                                     SchemaLoader.standardCFMD(KEYSPACE1, 
STANDARD1, 0, AsciiType.instance, BytesType.instance));
+         CompactionManager.instance.disableAutoCompaction();
+     }
+ 
+     @Test
+     public void testBatchCLSyncImmediately()
+     {
+         ColumnFamilyStore cfs1 = 
Keyspace.open(KEYSPACE1).getColumnFamilyStore(STANDARD1);
+         Mutation m = new RowUpdateBuilder(cfs1.metadata, 0, "key")
 -                         .clustering("bytes")
 -                         .add("val", ByteBuffer.allocate(10 * 1024))
 -                         .build();
++                     .clustering("bytes")
++                     .add("val", ByteBuffer.allocate(10 * 1024))
++                     .build();
+ 
+         long startNano = System.nanoTime();
+         CommitLog.instance.add(m);
+         long delta = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - 
startNano);
+         assertTrue("Expect batch commitlog sync immediately, but took " + 
delta, delta < CL_BATCH_SYNC_WINDOW);
+     }
+ 
+     @Test
+     public void testBatchCLShutDownImmediately() throws InterruptedException
+     {
+         long startNano = System.nanoTime();
+         CommitLog.instance.shutdownBlocking();
+         long delta = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - 
startNano);
+         assertTrue("Expect batch commitlog shutdown immediately, but took " + 
delta, delta < CL_BATCH_SYNC_WINDOW);
+         CommitLog.instance.start();
+     }
+ }


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

Reply via email to