Follow-up CASSANDRA-12905: always return future on Keyspace.applyFuture Before CASSANDRA-12905, applyFuture always returned a future, regardless of whether isDeferrable was set or not. This behavior should be maintained for applyFuture calls or compatibility method Keyspace.apply(mutation, writeCommitlog, updateIndexes, isClReplay, isDeferrable, future).
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/37e124e8 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/37e124e8 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/37e124e8 Branch: refs/heads/trunk Commit: 37e124e81da28b6459c6e150fcd831a6cdab0537 Parents: 617bd23 Author: Paulo Motta <[email protected]> Authored: Tue Jan 3 16:47:15 2017 -0200 Committer: Paulo Motta <[email protected]> Committed: Wed Jan 4 00:22:48 2017 -0200 ---------------------------------------------------------------------- src/java/org/apache/cassandra/db/Keyspace.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/37e124e8/src/java/org/apache/cassandra/db/Keyspace.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/Keyspace.java b/src/java/org/apache/cassandra/db/Keyspace.java index 217cf54..7349f42 100644 --- a/src/java/org/apache/cassandra/db/Keyspace.java +++ b/src/java/org/apache/cassandra/db/Keyspace.java @@ -381,13 +381,13 @@ public class Keyspace public CompletableFuture<?> applyFuture(Mutation mutation, boolean writeCommitLog, boolean updateIndexes) { - return applyInternal(mutation, writeCommitLog, updateIndexes, true, true, null); + return applyInternal(mutation, writeCommitLog, updateIndexes, true, true, new CompletableFuture<>()); } public CompletableFuture<?> applyFuture(Mutation mutation, boolean writeCommitLog, boolean updateIndexes, boolean isDroppable, boolean isDeferrable) { - return applyInternal(mutation, writeCommitLog, updateIndexes, isDroppable, isDeferrable, null); + return applyInternal(mutation, writeCommitLog, updateIndexes, isDroppable, isDeferrable, new CompletableFuture<>()); } public void apply(Mutation mutation, boolean writeCommitLog, boolean updateIndexes) @@ -433,7 +433,7 @@ public class Keyspace boolean isDeferrable, CompletableFuture<?> future) { - return applyInternal(mutation, writeCommitLog, updateIndexes, !isClReplay, isDeferrable, future); + return applyInternal(mutation, writeCommitLog, updateIndexes, !isClReplay, isDeferrable, future != null? future : new CompletableFuture<>()); } /** @@ -458,11 +458,6 @@ public class Keyspace boolean requiresViewUpdate = updateIndexes && viewManager.updatesAffectView(Collections.singleton(mutation), false); - // If apply is not deferrable, no future is required, returns always null - if (isDeferrable && future == null) { - future = new CompletableFuture<>(); - } - Lock lock = null; if (requiresViewUpdate) {
