Chain commit log marker potential performance regression in batch commit mode
patch by jasobrown; reviewed by Ariel Weisberg for CASSANDRA-14194 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/85fafd0c Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/85fafd0c Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/85fafd0c Branch: refs/heads/trunk Commit: 85fafd0c134cae5aa84133ad54d67f2dba28c953 Parents: f88ec93 Author: Jason Brown <jasedbr...@gmail.com> Authored: Tue Feb 20 14:16:59 2018 -0800 Committer: Jason Brown <jasedbr...@gmail.com> Committed: Mon Mar 5 14:24:18 2018 -0800 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../cassandra/db/commitlog/AbstractCommitLogService.java | 4 ++-- .../org/apache/cassandra/db/commitlog/CommitLogSegment.java | 9 +++++---- 3 files changed, 8 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/85fafd0c/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 5599906..9734507 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 3.0.17 + * Chain commit log marker potential performance regression in batch commit mode (CASSANDRA-14194) * Fully utilise specified compaction threads (CASSANDRA-14210) * Pre-create deletion log records to finish compactions quicker (CASSANDRA-12763) Merged from 2.1: http://git-wip-us.apache.org/repos/asf/cassandra/blob/85fafd0c/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 829530d..f3cfd29 100644 --- a/src/java/org/apache/cassandra/db/commitlog/AbstractCommitLogService.java +++ b/src/java/org/apache/cassandra/db/commitlog/AbstractCommitLogService.java @@ -37,7 +37,7 @@ public abstract class AbstractCommitLogService */ static final long DEFAULT_MARKER_INTERVAL_MILLIS = 100; - private Thread thread; + private volatile Thread thread; private volatile boolean shutdown = false; // all Allocations written before this time will be synced @@ -168,8 +168,8 @@ public abstract class AbstractCommitLogService if (lastSyncedAt + syncIntervalMillis <= pollStarted || shutdown || syncRequested) { // in this branch, we want to flush the commit log to disk - commitLog.sync(shutdown, true); syncRequested = false; + commitLog.sync(shutdown, true); lastSyncedAt = pollStarted; syncComplete.signalAll(); } http://git-wip-us.apache.org/repos/asf/cassandra/blob/85fafd0c/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java b/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java index 8834c8c..b803d88 100644 --- a/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java +++ b/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java @@ -337,11 +337,12 @@ public abstract class CommitLogSegment { flush(startMarker, sectionEnd); lastSyncedOffset = lastMarkerOffset = nextMarker; - } - if (close) - internalClose(); - syncComplete.signalAll(); + if (close) + internalClose(); + + syncComplete.signalAll(); + } } protected static void writeSyncMarker(long id, ByteBuffer buffer, int offset, int filePos, int nextMarker) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org