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.7 Commit: 5a5d0a1eb46dfa308acc9cff28f8c65fbb026b81 Parents: 958183f 2837ec6 Author: Benedict Elliott Smith <[email protected]> Authored: Wed May 18 21:51:40 2016 +0100 Committer: Benedict Elliott Smith <[email protected]> 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()
