You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by aw...@apache.org on 2017/07/17 20:54:05 UTC
[1/3] cassandra git commit: Deadlock in
AbstractCommitLogSegmentManager
Repository: cassandra
Updated Branches:
refs/heads/cassandra-3.11 6d0e95af7 -> eb717f154
refs/heads/trunk 855dd0eee -> 6eb2758e4
Deadlock in AbstractCommitLogSegmentManager
Patch by Fedor Bobin; Reviewed by Ariel Weisberg for CASSANDRA-13652
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/eb717f15
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/eb717f15
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/eb717f15
Branch: refs/heads/cassandra-3.11
Commit: eb717f154bd24453273d7175006fdef75e5724c2
Parents: 6d0e95a
Author: Fedor Bobin <fu...@gmail.com>
Authored: Tue Jul 11 15:10:28 2017 -0400
Committer: Ariel Weisberg <aw...@apple.com>
Committed: Mon Jul 17 13:50:09 2017 -0700
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../AbstractCommitLogSegmentManager.java | 11 +++++------
.../cassandra/utils/concurrent/WaitQueue.java | 20 ++++++++++++++++++++
3 files changed, 26 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/eb717f15/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 8abf1f4..e7a10f5 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
3.11.1
+ * Deadlock in AbstractCommitLogSegmentManager (CASSANDRA-13652)
* Duplicate the buffer before passing it to analyser in SASI operation (CASSANDRA-13512)
* Properly evict pstmts from prepared statements cache (CASSANDRA-13641)
Merged from 3.0:
http://git-wip-us.apache.org/repos/asf/cassandra/blob/eb717f15/src/java/org/apache/cassandra/db/commitlog/AbstractCommitLogSegmentManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/commitlog/AbstractCommitLogSegmentManager.java b/src/java/org/apache/cassandra/db/commitlog/AbstractCommitLogSegmentManager.java
old mode 100644
new mode 100755
index 0ab941b..7f3c9f8
--- a/src/java/org/apache/cassandra/db/commitlog/AbstractCommitLogSegmentManager.java
+++ b/src/java/org/apache/cassandra/db/commitlog/AbstractCommitLogSegmentManager.java
@@ -22,7 +22,7 @@ import java.io.IOException;
import java.util.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicLong;
-import java.util.concurrent.locks.LockSupport;
+import java.util.function.BooleanSupplier;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.util.concurrent.*;
@@ -82,6 +82,8 @@ public abstract class AbstractCommitLogSegmentManager
private Thread managerThread;
protected final CommitLog commitLog;
private volatile boolean shutdown;
+ private final BooleanSupplier managerThreadWaitCondition = () -> (availableSegment == null && !atSegmentBufferLimit()) || shutdown;
+ private final WaitQueue managerThreadWaitQueue = new WaitQueue();
private static final SimpleCachedBufferPool bufferPool =
new SimpleCachedBufferPool(DatabaseDescriptor.getCommitLogMaxCompressionBuffersInPool(), DatabaseDescriptor.getCommitLogSegmentSize());
@@ -124,8 +126,6 @@ public abstract class AbstractCommitLogSegmentManager
// Writing threads are not waiting for new segments, we can spend time on other tasks.
// flush old Cfs if we're full
maybeFlushToReclaim();
-
- LockSupport.park();
}
catch (Throwable t)
{
@@ -140,8 +140,7 @@ public abstract class AbstractCommitLogSegmentManager
// shutting down-- nothing more can or needs to be done in that case.
}
- while (availableSegment != null || atSegmentBufferLimit() && !shutdown)
- LockSupport.park();
+ WaitQueue.waitOnCondition(managerThreadWaitCondition, managerThreadWaitQueue);
}
}
};
@@ -530,7 +529,7 @@ public abstract class AbstractCommitLogSegmentManager
void wakeManager()
{
- LockSupport.unpark(managerThread);
+ managerThreadWaitQueue.signalAll();
}
/**
http://git-wip-us.apache.org/repos/asf/cassandra/blob/eb717f15/src/java/org/apache/cassandra/utils/concurrent/WaitQueue.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/utils/concurrent/WaitQueue.java b/src/java/org/apache/cassandra/utils/concurrent/WaitQueue.java
index be271b6..5b453b0 100644
--- a/src/java/org/apache/cassandra/utils/concurrent/WaitQueue.java
+++ b/src/java/org/apache/cassandra/utils/concurrent/WaitQueue.java
@@ -22,6 +22,7 @@ import java.util.Iterator;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.concurrent.locks.LockSupport;
+import java.util.function.BooleanSupplier;
import com.codahale.metrics.Timer;
@@ -518,4 +519,23 @@ public final class WaitQueue
{
return new AllSignal(signals);
}
+
+ /**
+ * Loops waiting on the supplied condition and WaitQueue and will not return until the condition is true
+ */
+ public static void waitOnCondition(BooleanSupplier condition, WaitQueue queue)
+ {
+ while (!condition.getAsBoolean())
+ {
+ Signal s = queue.register();
+ if (!condition.getAsBoolean())
+ {
+ s.awaitUninterruptibly();
+ }
+ else
+ {
+ s.cancel();
+ }
+ }
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org
[3/3] cassandra git commit: Merge branch 'cassandra-3.11' into trunk
Posted by aw...@apache.org.
Merge branch 'cassandra-3.11' into trunk
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/6eb2758e
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/6eb2758e
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/6eb2758e
Branch: refs/heads/trunk
Commit: 6eb2758e4038564b084f000ac411061d3b942d1f
Parents: 855dd0e eb717f1
Author: Ariel Weisberg <aw...@apple.com>
Authored: Mon Jul 17 13:51:57 2017 -0700
Committer: Ariel Weisberg <aw...@apple.com>
Committed: Mon Jul 17 13:51:57 2017 -0700
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../AbstractCommitLogSegmentManager.java | 11 +++++------
.../cassandra/utils/concurrent/WaitQueue.java | 20 ++++++++++++++++++++
3 files changed, 26 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6eb2758e/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 0be0e39,e7a10f5..3fb2716
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,102 -1,5 +1,103 @@@
+4.0
+ * Don't add localhost to the graph when calculating where to stream from (CASSANDRA-13583)
+ * Allow skipping equality-restricted clustering columns in ORDER BY clause (CASSANDRA-10271)
+ * Use common nowInSec for validation compactions (CASSANDRA-13671)
+ * Improve handling of IR prepare failures (CASSANDRA-13672)
+ * Send IR coordinator messages synchronously (CASSANDRA-13673)
+ * Flush system.repair table before IR finalize promise (CASSANDRA-13660)
+ * Fix column filter creation for wildcard queries (CASSANDRA-13650)
+ * Add 'nodetool getbatchlogreplaythrottle' and 'nodetool setbatchlogreplaythrottle' (CASSANDRA-13614)
+ * fix race condition in PendingRepairManager (CASSANDRA-13659)
+ * Allow noop incremental repair state transitions (CASSANDRA-13658)
+ * Run repair with down replicas (CASSANDRA-10446)
+ * Added started & completed repair metrics (CASSANDRA-13598)
+ * Added started & completed repair metrics (CASSANDRA-13598)
+ * Improve secondary index (re)build failure and concurrency handling (CASSANDRA-10130)
+ * Improve calculation of available disk space for compaction (CASSANDRA-13068)
+ * Change the accessibility of RowCacheSerializer for third party row cache plugins (CASSANDRA-13579)
+ * Allow sub-range repairs for a preview of repaired data (CASSANDRA-13570)
+ * NPE in IR cleanup when columnfamily has no sstables (CASSANDRA-13585)
+ * Fix Randomness of stress values (CASSANDRA-12744)
+ * Allow selecting Map values and Set elements (CASSANDRA-7396)
+ * Fast and garbage-free Streaming Histogram (CASSANDRA-13444)
+ * Update repairTime for keyspaces on completion (CASSANDRA-13539)
+ * Add configurable upper bound for validation executor threads (CASSANDRA-13521)
+ * Bring back maxHintTTL propery (CASSANDRA-12982)
+ * Add testing guidelines (CASSANDRA-13497)
+ * Add more repair metrics (CASSANDRA-13531)
+ * RangeStreamer should be smarter when picking endpoints for streaming (CASSANDRA-4650)
+ * Avoid rewrapping an exception thrown for cache load functions (CASSANDRA-13367)
+ * Log time elapsed for each incremental repair phase (CASSANDRA-13498)
+ * Add multiple table operation support to cassandra-stress (CASSANDRA-8780)
+ * Fix incorrect cqlsh results when selecting same columns multiple times (CASSANDRA-13262)
+ * Fix WriteResponseHandlerTest is sensitive to test execution order (CASSANDRA-13421)
+ * Improve incremental repair logging (CASSANDRA-13468)
+ * Start compaction when incremental repair finishes (CASSANDRA-13454)
+ * Add repair streaming preview (CASSANDRA-13257)
+ * Cleanup isIncremental/repairedAt usage (CASSANDRA-13430)
+ * Change protocol to allow sending key space independent of query string (CASSANDRA-10145)
+ * Make gc_log and gc_warn settable at runtime (CASSANDRA-12661)
+ * Take number of files in L0 in account when estimating remaining compaction tasks (CASSANDRA-13354)
+ * Skip building views during base table streams on range movements (CASSANDRA-13065)
+ * Improve error messages for +/- operations on maps and tuples (CASSANDRA-13197)
+ * Remove deprecated repair JMX APIs (CASSANDRA-11530)
+ * Fix version check to enable streaming keep-alive (CASSANDRA-12929)
+ * Make it possible to monitor an ideal consistency level separate from actual consistency level (CASSANDRA-13289)
+ * Outbound TCP connections ignore internode authenticator (CASSANDRA-13324)
+ * Upgrade junit from 4.6 to 4.12 (CASSANDRA-13360)
+ * Cleanup ParentRepairSession after repairs (CASSANDRA-13359)
+ * Upgrade snappy-java to 1.1.2.6 (CASSANDRA-13336)
+ * Incremental repair not streaming correct sstables (CASSANDRA-13328)
+ * Upgrade the jna version to 4.3.0 (CASSANDRA-13300)
+ * Add the currentTimestamp, currentDate, currentTime and currentTimeUUID functions (CASSANDRA-13132)
+ * Remove config option index_interval (CASSANDRA-10671)
+ * Reduce lock contention for collection types and serializers (CASSANDRA-13271)
+ * Make it possible to override MessagingService.Verb ids (CASSANDRA-13283)
+ * Avoid synchronized on prepareForRepair in ActiveRepairService (CASSANDRA-9292)
+ * Adds the ability to use uncompressed chunks in compressed files (CASSANDRA-10520)
+ * Don't flush sstables when streaming for incremental repair (CASSANDRA-13226)
+ * Remove unused method (CASSANDRA-13227)
+ * Fix minor bugs related to #9143 (CASSANDRA-13217)
+ * Output warning if user increases RF (CASSANDRA-13079)
+ * Remove pre-3.0 streaming compatibility code for 4.0 (CASSANDRA-13081)
+ * Add support for + and - operations on dates (CASSANDRA-11936)
+ * Fix consistency of incrementally repaired data (CASSANDRA-9143)
+ * Increase commitlog version (CASSANDRA-13161)
+ * Make TableMetadata immutable, optimize Schema (CASSANDRA-9425)
+ * Refactor ColumnCondition (CASSANDRA-12981)
+ * Parallelize streaming of different keyspaces (CASSANDRA-4663)
+ * Improved compactions metrics (CASSANDRA-13015)
+ * Speed-up start-up sequence by avoiding un-needed flushes (CASSANDRA-13031)
+ * Use Caffeine (W-TinyLFU) for on-heap caches (CASSANDRA-10855)
+ * Thrift removal (CASSANDRA-11115)
+ * Remove pre-3.0 compatibility code for 4.0 (CASSANDRA-12716)
+ * Add column definition kind to dropped columns in schema (CASSANDRA-12705)
+ * Add (automate) Nodetool Documentation (CASSANDRA-12672)
+ * Update bundled cqlsh python driver to 3.7.0 (CASSANDRA-12736)
+ * Reject invalid replication settings when creating or altering a keyspace (CASSANDRA-12681)
+ * Clean up the SSTableReader#getScanner API wrt removal of RateLimiter (CASSANDRA-12422)
+ * Use new token allocation for non bootstrap case as well (CASSANDRA-13080)
+ * Avoid byte-array copy when key cache is disabled (CASSANDRA-13084)
+ * Require forceful decommission if number of nodes is less than replication factor (CASSANDRA-12510)
+ * Allow IN restrictions on column families with collections (CASSANDRA-12654)
+ * Log message size in trace message in OutboundTcpConnection (CASSANDRA-13028)
+ * Add timeUnit Days for cassandra-stress (CASSANDRA-13029)
+ * Add mutation size and batch metrics (CASSANDRA-12649)
+ * Add method to get size of endpoints to TokenMetadata (CASSANDRA-12999)
+ * Expose time spent waiting in thread pool queue (CASSANDRA-8398)
+ * Conditionally update index built status to avoid unnecessary flushes (CASSANDRA-12969)
+ * cqlsh auto completion: refactor definition of compaction strategy options (CASSANDRA-12946)
+ * Add support for arithmetic operators (CASSANDRA-11935)
+ * Add histogram for delay to deliver hints (CASSANDRA-13234)
+ * Fix cqlsh automatic protocol downgrade regression (CASSANDRA-13307)
+ * Changing `max_hint_window_in_ms` at runtime (CASSANDRA-11720)
+ * Trivial format error in StorageProxy (CASSANDRA-13551)
+ * Nodetool repair can hang forever if we lose the notification for the repair completing/failing (CASSANDRA-13480)
+ * Anticompaction can cause noisy log messages (CASSANDRA-13684)
+
+
3.11.1
+ * Deadlock in AbstractCommitLogSegmentManager (CASSANDRA-13652)
* Duplicate the buffer before passing it to analyser in SASI operation (CASSANDRA-13512)
* Properly evict pstmts from prepared statements cache (CASSANDRA-13641)
Merged from 3.0:
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6eb2758e/src/java/org/apache/cassandra/db/commitlog/AbstractCommitLogSegmentManager.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/commitlog/AbstractCommitLogSegmentManager.java
index 7e94911,7f3c9f8..808ef37
mode 100644,100755..100755
--- a/src/java/org/apache/cassandra/db/commitlog/AbstractCommitLogSegmentManager.java
+++ b/src/java/org/apache/cassandra/db/commitlog/AbstractCommitLogSegmentManager.java
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org
[2/3] cassandra git commit: Deadlock in
AbstractCommitLogSegmentManager
Posted by aw...@apache.org.
Deadlock in AbstractCommitLogSegmentManager
Patch by Fedor Bobin; Reviewed by Ariel Weisberg for CASSANDRA-13652
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/eb717f15
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/eb717f15
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/eb717f15
Branch: refs/heads/trunk
Commit: eb717f154bd24453273d7175006fdef75e5724c2
Parents: 6d0e95a
Author: Fedor Bobin <fu...@gmail.com>
Authored: Tue Jul 11 15:10:28 2017 -0400
Committer: Ariel Weisberg <aw...@apple.com>
Committed: Mon Jul 17 13:50:09 2017 -0700
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../AbstractCommitLogSegmentManager.java | 11 +++++------
.../cassandra/utils/concurrent/WaitQueue.java | 20 ++++++++++++++++++++
3 files changed, 26 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/eb717f15/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 8abf1f4..e7a10f5 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
3.11.1
+ * Deadlock in AbstractCommitLogSegmentManager (CASSANDRA-13652)
* Duplicate the buffer before passing it to analyser in SASI operation (CASSANDRA-13512)
* Properly evict pstmts from prepared statements cache (CASSANDRA-13641)
Merged from 3.0:
http://git-wip-us.apache.org/repos/asf/cassandra/blob/eb717f15/src/java/org/apache/cassandra/db/commitlog/AbstractCommitLogSegmentManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/commitlog/AbstractCommitLogSegmentManager.java b/src/java/org/apache/cassandra/db/commitlog/AbstractCommitLogSegmentManager.java
old mode 100644
new mode 100755
index 0ab941b..7f3c9f8
--- a/src/java/org/apache/cassandra/db/commitlog/AbstractCommitLogSegmentManager.java
+++ b/src/java/org/apache/cassandra/db/commitlog/AbstractCommitLogSegmentManager.java
@@ -22,7 +22,7 @@ import java.io.IOException;
import java.util.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicLong;
-import java.util.concurrent.locks.LockSupport;
+import java.util.function.BooleanSupplier;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.util.concurrent.*;
@@ -82,6 +82,8 @@ public abstract class AbstractCommitLogSegmentManager
private Thread managerThread;
protected final CommitLog commitLog;
private volatile boolean shutdown;
+ private final BooleanSupplier managerThreadWaitCondition = () -> (availableSegment == null && !atSegmentBufferLimit()) || shutdown;
+ private final WaitQueue managerThreadWaitQueue = new WaitQueue();
private static final SimpleCachedBufferPool bufferPool =
new SimpleCachedBufferPool(DatabaseDescriptor.getCommitLogMaxCompressionBuffersInPool(), DatabaseDescriptor.getCommitLogSegmentSize());
@@ -124,8 +126,6 @@ public abstract class AbstractCommitLogSegmentManager
// Writing threads are not waiting for new segments, we can spend time on other tasks.
// flush old Cfs if we're full
maybeFlushToReclaim();
-
- LockSupport.park();
}
catch (Throwable t)
{
@@ -140,8 +140,7 @@ public abstract class AbstractCommitLogSegmentManager
// shutting down-- nothing more can or needs to be done in that case.
}
- while (availableSegment != null || atSegmentBufferLimit() && !shutdown)
- LockSupport.park();
+ WaitQueue.waitOnCondition(managerThreadWaitCondition, managerThreadWaitQueue);
}
}
};
@@ -530,7 +529,7 @@ public abstract class AbstractCommitLogSegmentManager
void wakeManager()
{
- LockSupport.unpark(managerThread);
+ managerThreadWaitQueue.signalAll();
}
/**
http://git-wip-us.apache.org/repos/asf/cassandra/blob/eb717f15/src/java/org/apache/cassandra/utils/concurrent/WaitQueue.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/utils/concurrent/WaitQueue.java b/src/java/org/apache/cassandra/utils/concurrent/WaitQueue.java
index be271b6..5b453b0 100644
--- a/src/java/org/apache/cassandra/utils/concurrent/WaitQueue.java
+++ b/src/java/org/apache/cassandra/utils/concurrent/WaitQueue.java
@@ -22,6 +22,7 @@ import java.util.Iterator;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.concurrent.locks.LockSupport;
+import java.util.function.BooleanSupplier;
import com.codahale.metrics.Timer;
@@ -518,4 +519,23 @@ public final class WaitQueue
{
return new AllSignal(signals);
}
+
+ /**
+ * Loops waiting on the supplied condition and WaitQueue and will not return until the condition is true
+ */
+ public static void waitOnCondition(BooleanSupplier condition, WaitQueue queue)
+ {
+ while (!condition.getAsBoolean())
+ {
+ Signal s = queue.register();
+ if (!condition.getAsBoolean())
+ {
+ s.awaitUninterruptibly();
+ }
+ else
+ {
+ s.cancel();
+ }
+ }
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org