cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bened...@apache.org
Subject [01/10] cassandra git commit: Make batch commit log mode easier to tune
Date Sat, 08 Aug 2015 10:37:04 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.1 1e3f03e5b -> 98a08ebcf
  refs/heads/cassandra-2.2 67903d778 -> 6fd41ab15
  refs/heads/cassandra-3.0 489a9e8fa -> 7ea2ce124
  refs/heads/trunk 05de664ac -> 6292aaa72


Make batch commit log mode easier to tune

This patch effectively ignores the batch commit log
mode sync interval option, and performs a sync as soon
as work becomes available, causing a natural grouping
of writes and minimal latency.

patch by benedict; reviewed by ariel for CASSANDRA-9533


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

Branch: refs/heads/cassandra-2.1
Commit: 98a08ebcf11a5124ddf865b5337c781a11377588
Parents: 1e3f03e
Author: Benedict Elliott Smith <benedict@apache.org>
Authored: Tue Aug 4 12:47:10 2015 +0100
Committer: Benedict Elliott Smith <benedict@apache.org>
Committed: Sat Aug 8 12:33:22 2015 +0200

----------------------------------------------------------------------
 .../apache/cassandra/db/commitlog/AbstractCommitLogService.java   | 3 ++-
 .../org/apache/cassandra/db/commitlog/BatchCommitLogService.java  | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/98a08ebc/src/java/org/apache/cassandra/db/commitlog/AbstractCommitLogService.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/commitlog/AbstractCommitLogService.java b/src/java/org/apache/cassandra/db/commitlog/AbstractCommitLogService.java
index d9ea683..9f3b410 100644
--- a/src/java/org/apache/cassandra/db/commitlog/AbstractCommitLogService.java
+++ b/src/java/org/apache/cassandra/db/commitlog/AbstractCommitLogService.java
@@ -43,7 +43,7 @@ public abstract class AbstractCommitLogService
 
     // signal that writers can wait on to be notified of a completed sync
     protected final WaitQueue syncComplete = new WaitQueue();
-    private final Semaphore haveWork = new Semaphore(1);
+    protected final Semaphore haveWork = new Semaphore(1);
 
     private static final Logger logger = LoggerFactory.getLogger(AbstractCommitLogService.class);
 
@@ -114,6 +114,7 @@ public abstract class AbstractCommitLogService
                         try
                         {
                             haveWork.tryAcquire(sleep, TimeUnit.MILLISECONDS);
+                            haveWork.drainPermits();
                         }
                         catch (InterruptedException e)
                         {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/98a08ebc/src/java/org/apache/cassandra/db/commitlog/BatchCommitLogService.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/commitlog/BatchCommitLogService.java b/src/java/org/apache/cassandra/db/commitlog/BatchCommitLogService.java
index 65bee40..dd55d24 100644
--- a/src/java/org/apache/cassandra/db/commitlog/BatchCommitLogService.java
+++ b/src/java/org/apache/cassandra/db/commitlog/BatchCommitLogService.java
@@ -30,6 +30,7 @@ class BatchCommitLogService extends AbstractCommitLogService
     {
         // wait until record has been safely persisted to disk
         pending.incrementAndGet();
+        haveWork.release();
         alloc.awaitDiskSync();
         pending.decrementAndGet();
     }


Mime
View raw message