You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by be...@apache.org on 2016/05/18 20:58:15 UTC

[1/6] cassandra git commit: Fix deadlock on truncation with secondary index.

Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.2 be653932d -> 2837ec65b
  refs/heads/cassandra-3.0 958183fad -> 5a5d0a1eb
  refs/heads/trunk 5bdf3184b -> bc7846680


Fix deadlock on truncation with secondary index.

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

Branch: refs/heads/cassandra-2.2
Commit: 2837ec65b91abd78ec1bb37f1d69565b976e42e6
Parents: be65393
Author: Branimir Lambov <br...@datastax.com>
Authored: Tue May 17 12:22:21 2016 +0300
Committer: Benedict Elliott Smith <be...@vast.com>
Committed: Wed May 18 21:49:39 2016 +0100

----------------------------------------------------------------------
 .../apache/cassandra/db/ColumnFamilyStore.java  | 32 +++++++++++---------
 1 file changed, 17 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/2837ec65/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
index 88e22c0..45486c1 100644
--- a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
+++ b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
@@ -2762,28 +2762,30 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
         final long truncatedAt;
         final ReplayPosition replayAfter;
 
-        synchronized (data)
+        if (keyspace.getMetadata().durableWrites || takeSnapshot)
         {
-            if (keyspace.getMetadata().durableWrites || takeSnapshot)
-            {
-                replayAfter = forceBlockingFlush();
-            }
-            else
+            replayAfter = forceBlockingFlush();
+        }
+        else
+        {
+            // just nuke the memtable data w/o writing to disk first
+            Future<ReplayPosition> replayAfterFuture;
+            synchronized (data)
             {
-                // just nuke the memtable data w/o writing to disk first
                 final Flush flush = new Flush(true);
                 flushExecutor.execute(flush);
-                replayAfter = FBUtilities.waitOnFuture(postFlushExecutor.submit(flush.postFlush));
+                replayAfterFuture = postFlushExecutor.submit(flush.postFlush);
             }
-
-            long now = System.currentTimeMillis();
-            // make sure none of our sstables are somehow in the future (clock drift, perhaps)
-            for (ColumnFamilyStore cfs : concatWithIndexes())
-                for (SSTableReader sstable : cfs.data.getSSTables())
-                    now = Math.max(now, sstable.maxDataAge);
-            truncatedAt = now;
+            replayAfter = FBUtilities.waitOnFuture(replayAfterFuture);
         }
 
+        long now = System.currentTimeMillis();
+        // make sure none of our sstables are somehow in the future (clock drift, perhaps)
+        for (ColumnFamilyStore cfs : concatWithIndexes())
+            for (SSTableReader sstable : cfs.data.getSSTables())
+                now = Math.max(now, sstable.maxDataAge);
+        truncatedAt = now;
+
         Runnable truncateRunnable = new Runnable()
         {
             public void run()


[3/6] cassandra git commit: Fix deadlock on truncation with secondary index.

Posted by be...@apache.org.
Fix deadlock on truncation with secondary index.

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

Branch: refs/heads/trunk
Commit: 2837ec65b91abd78ec1bb37f1d69565b976e42e6
Parents: be65393
Author: Branimir Lambov <br...@datastax.com>
Authored: Tue May 17 12:22:21 2016 +0300
Committer: Benedict Elliott Smith <be...@vast.com>
Committed: Wed May 18 21:49:39 2016 +0100

----------------------------------------------------------------------
 .../apache/cassandra/db/ColumnFamilyStore.java  | 32 +++++++++++---------
 1 file changed, 17 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/2837ec65/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
index 88e22c0..45486c1 100644
--- a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
+++ b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
@@ -2762,28 +2762,30 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
         final long truncatedAt;
         final ReplayPosition replayAfter;
 
-        synchronized (data)
+        if (keyspace.getMetadata().durableWrites || takeSnapshot)
         {
-            if (keyspace.getMetadata().durableWrites || takeSnapshot)
-            {
-                replayAfter = forceBlockingFlush();
-            }
-            else
+            replayAfter = forceBlockingFlush();
+        }
+        else
+        {
+            // just nuke the memtable data w/o writing to disk first
+            Future<ReplayPosition> replayAfterFuture;
+            synchronized (data)
             {
-                // just nuke the memtable data w/o writing to disk first
                 final Flush flush = new Flush(true);
                 flushExecutor.execute(flush);
-                replayAfter = FBUtilities.waitOnFuture(postFlushExecutor.submit(flush.postFlush));
+                replayAfterFuture = postFlushExecutor.submit(flush.postFlush);
             }
-
-            long now = System.currentTimeMillis();
-            // make sure none of our sstables are somehow in the future (clock drift, perhaps)
-            for (ColumnFamilyStore cfs : concatWithIndexes())
-                for (SSTableReader sstable : cfs.data.getSSTables())
-                    now = Math.max(now, sstable.maxDataAge);
-            truncatedAt = now;
+            replayAfter = FBUtilities.waitOnFuture(replayAfterFuture);
         }
 
+        long now = System.currentTimeMillis();
+        // make sure none of our sstables are somehow in the future (clock drift, perhaps)
+        for (ColumnFamilyStore cfs : concatWithIndexes())
+            for (SSTableReader sstable : cfs.data.getSSTables())
+                now = Math.max(now, sstable.maxDataAge);
+        truncatedAt = now;
+
         Runnable truncateRunnable = new Runnable()
         {
             public void run()


[6/6] cassandra git commit: Merge branch 'cassandra-3.0' into trunk

Posted by be...@apache.org.
Merge branch 'cassandra-3.0' into trunk


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

Branch: refs/heads/trunk
Commit: bc7846680e82b2c728adbc1f35e11c09c659dd33
Parents: 5bdf318 5a5d0a1
Author: Benedict Elliott Smith <be...@vast.com>
Authored: Wed May 18 21:51:57 2016 +0100
Committer: Benedict Elliott Smith <be...@vast.com>
Committed: Wed May 18 21:51:57 2016 +0100

----------------------------------------------------------------------
 .../apache/cassandra/db/ColumnFamilyStore.java  | 41 +++++++++-----------
 1 file changed, 19 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/bc784668/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
----------------------------------------------------------------------


[4/6] cassandra git commit: Merge branch 'cassandra-2.2' into cassandra-3.0

Posted by be...@apache.org.
Merge branch 'cassandra-2.2' into cassandra-3.0


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

Branch: refs/heads/trunk
Commit: 5a5d0a1eb46dfa308acc9cff28f8c65fbb026b81
Parents: 958183f 2837ec6
Author: Benedict Elliott Smith <be...@vast.com>
Authored: Wed May 18 21:51:40 2016 +0100
Committer: Benedict Elliott Smith <be...@vast.com>
Committed: Wed May 18 21:51:40 2016 +0100

----------------------------------------------------------------------
 .../apache/cassandra/db/ColumnFamilyStore.java  | 41 +++++++++-----------
 1 file changed, 19 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/5a5d0a1e/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/ColumnFamilyStore.java
index 98ba781,45486c1..a6d5c17
--- a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
+++ b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
@@@ -1973,35 -2762,30 +1973,32 @@@ public class ColumnFamilyStore implemen
          final long truncatedAt;
          final ReplayPosition replayAfter;
  
-         synchronized (data)
 -        if (keyspace.getMetadata().durableWrites || takeSnapshot)
++        if (keyspace.getMetadata().params.durableWrites || DatabaseDescriptor.isAutoSnapshot())
+         {
+             replayAfter = forceBlockingFlush();
++            viewManager.forceBlockingFlush();
+         }
+         else
          {
-             if (keyspace.getMetadata().params.durableWrites || DatabaseDescriptor.isAutoSnapshot())
+             // just nuke the memtable data w/o writing to disk first
 -            Future<ReplayPosition> replayAfterFuture;
 -            synchronized (data)
++            viewManager.dumpMemtables();
++            try
              {
-                 replayAfter = forceBlockingFlush();
-                 viewManager.forceBlockingFlush();
 -                final Flush flush = new Flush(true);
 -                flushExecutor.execute(flush);
 -                replayAfterFuture = postFlushExecutor.submit(flush.postFlush);
++                replayAfter = dumpMemtable().get();
 +            }
-             else
++            catch (Exception e)
 +            {
-                 // just nuke the memtable data w/o writing to disk first
-                 viewManager.dumpMemtables();
-                 try
-                 {
-                     replayAfter = dumpMemtable().get();
-                 }
-                 catch (Exception e)
-                 {
-                     throw new RuntimeException(e);
-                 }
++                throw new RuntimeException(e);
              }
- 
-             long now = System.currentTimeMillis();
-             // make sure none of our sstables are somehow in the future (clock drift, perhaps)
-             for (ColumnFamilyStore cfs : concatWithIndexes())
-                 for (SSTableReader sstable : cfs.data.getSSTables())
-                     now = Math.max(now, sstable.maxDataAge);
-             truncatedAt = now;
 -            replayAfter = FBUtilities.waitOnFuture(replayAfterFuture);
          }
  
+         long now = System.currentTimeMillis();
+         // make sure none of our sstables are somehow in the future (clock drift, perhaps)
+         for (ColumnFamilyStore cfs : concatWithIndexes())
+             for (SSTableReader sstable : cfs.data.getSSTables())
+                 now = Math.max(now, sstable.maxDataAge);
+         truncatedAt = now;
+ 
          Runnable truncateRunnable = new Runnable()
          {
              public void run()


[5/6] cassandra git commit: Merge branch 'cassandra-2.2' into cassandra-3.0

Posted by be...@apache.org.
Merge branch 'cassandra-2.2' into cassandra-3.0


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

Branch: refs/heads/cassandra-3.0
Commit: 5a5d0a1eb46dfa308acc9cff28f8c65fbb026b81
Parents: 958183f 2837ec6
Author: Benedict Elliott Smith <be...@vast.com>
Authored: Wed May 18 21:51:40 2016 +0100
Committer: Benedict Elliott Smith <be...@vast.com>
Committed: Wed May 18 21:51:40 2016 +0100

----------------------------------------------------------------------
 .../apache/cassandra/db/ColumnFamilyStore.java  | 41 +++++++++-----------
 1 file changed, 19 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/5a5d0a1e/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/ColumnFamilyStore.java
index 98ba781,45486c1..a6d5c17
--- a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
+++ b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
@@@ -1973,35 -2762,30 +1973,32 @@@ public class ColumnFamilyStore implemen
          final long truncatedAt;
          final ReplayPosition replayAfter;
  
-         synchronized (data)
 -        if (keyspace.getMetadata().durableWrites || takeSnapshot)
++        if (keyspace.getMetadata().params.durableWrites || DatabaseDescriptor.isAutoSnapshot())
+         {
+             replayAfter = forceBlockingFlush();
++            viewManager.forceBlockingFlush();
+         }
+         else
          {
-             if (keyspace.getMetadata().params.durableWrites || DatabaseDescriptor.isAutoSnapshot())
+             // just nuke the memtable data w/o writing to disk first
 -            Future<ReplayPosition> replayAfterFuture;
 -            synchronized (data)
++            viewManager.dumpMemtables();
++            try
              {
-                 replayAfter = forceBlockingFlush();
-                 viewManager.forceBlockingFlush();
 -                final Flush flush = new Flush(true);
 -                flushExecutor.execute(flush);
 -                replayAfterFuture = postFlushExecutor.submit(flush.postFlush);
++                replayAfter = dumpMemtable().get();
 +            }
-             else
++            catch (Exception e)
 +            {
-                 // just nuke the memtable data w/o writing to disk first
-                 viewManager.dumpMemtables();
-                 try
-                 {
-                     replayAfter = dumpMemtable().get();
-                 }
-                 catch (Exception e)
-                 {
-                     throw new RuntimeException(e);
-                 }
++                throw new RuntimeException(e);
              }
- 
-             long now = System.currentTimeMillis();
-             // make sure none of our sstables are somehow in the future (clock drift, perhaps)
-             for (ColumnFamilyStore cfs : concatWithIndexes())
-                 for (SSTableReader sstable : cfs.data.getSSTables())
-                     now = Math.max(now, sstable.maxDataAge);
-             truncatedAt = now;
 -            replayAfter = FBUtilities.waitOnFuture(replayAfterFuture);
          }
  
+         long now = System.currentTimeMillis();
+         // make sure none of our sstables are somehow in the future (clock drift, perhaps)
+         for (ColumnFamilyStore cfs : concatWithIndexes())
+             for (SSTableReader sstable : cfs.data.getSSTables())
+                 now = Math.max(now, sstable.maxDataAge);
+         truncatedAt = now;
+ 
          Runnable truncateRunnable = new Runnable()
          {
              public void run()


[2/6] cassandra git commit: Fix deadlock on truncation with secondary index.

Posted by be...@apache.org.
Fix deadlock on truncation with secondary index.

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

Branch: refs/heads/cassandra-3.0
Commit: 2837ec65b91abd78ec1bb37f1d69565b976e42e6
Parents: be65393
Author: Branimir Lambov <br...@datastax.com>
Authored: Tue May 17 12:22:21 2016 +0300
Committer: Benedict Elliott Smith <be...@vast.com>
Committed: Wed May 18 21:49:39 2016 +0100

----------------------------------------------------------------------
 .../apache/cassandra/db/ColumnFamilyStore.java  | 32 +++++++++++---------
 1 file changed, 17 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/2837ec65/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
index 88e22c0..45486c1 100644
--- a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
+++ b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
@@ -2762,28 +2762,30 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
         final long truncatedAt;
         final ReplayPosition replayAfter;
 
-        synchronized (data)
+        if (keyspace.getMetadata().durableWrites || takeSnapshot)
         {
-            if (keyspace.getMetadata().durableWrites || takeSnapshot)
-            {
-                replayAfter = forceBlockingFlush();
-            }
-            else
+            replayAfter = forceBlockingFlush();
+        }
+        else
+        {
+            // just nuke the memtable data w/o writing to disk first
+            Future<ReplayPosition> replayAfterFuture;
+            synchronized (data)
             {
-                // just nuke the memtable data w/o writing to disk first
                 final Flush flush = new Flush(true);
                 flushExecutor.execute(flush);
-                replayAfter = FBUtilities.waitOnFuture(postFlushExecutor.submit(flush.postFlush));
+                replayAfterFuture = postFlushExecutor.submit(flush.postFlush);
             }
-
-            long now = System.currentTimeMillis();
-            // make sure none of our sstables are somehow in the future (clock drift, perhaps)
-            for (ColumnFamilyStore cfs : concatWithIndexes())
-                for (SSTableReader sstable : cfs.data.getSSTables())
-                    now = Math.max(now, sstable.maxDataAge);
-            truncatedAt = now;
+            replayAfter = FBUtilities.waitOnFuture(replayAfterFuture);
         }
 
+        long now = System.currentTimeMillis();
+        // make sure none of our sstables are somehow in the future (clock drift, perhaps)
+        for (ColumnFamilyStore cfs : concatWithIndexes())
+            for (SSTableReader sstable : cfs.data.getSSTables())
+                now = Math.max(now, sstable.maxDataAge);
+        truncatedAt = now;
+
         Runnable truncateRunnable = new Runnable()
         {
             public void run()