Updated Branches: refs/heads/cassandra-1.0 c2f7af6e7 -> f943a6edf
Remove wait on hint future from writes patch by slebresne; reviewed by amorton for CASSANDRA-3870 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/f943a6ed Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f943a6ed Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/f943a6ed Branch: refs/heads/cassandra-1.0 Commit: f943a6edf20a62f08c17cdb1c392478fc9846987 Parents: c2f7af6 Author: Sylvain Lebresne <sylv...@datastax.com> Authored: Wed Feb 22 09:24:43 2012 +0100 Committer: Sylvain Lebresne <sylv...@datastax.com> Committed: Wed Feb 22 09:24:43 2012 +0100 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../service/AbstractWriteResponseHandler.java | 27 --------------- .../cassandra/service/IWriteResponseHandler.java | 1 - .../org/apache/cassandra/service/StorageProxy.java | 5 +-- 4 files changed, 3 insertions(+), 31 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/f943a6ed/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 500b9fb..5618610 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -20,6 +20,7 @@ (CASSANDRA-3844) * make CLI `show schema` to use output stream directly instead of StringBuilder (CASSANDRA-3842) + * remove the wait on hint future during write (CASSANDRA-3870) Merged from 0.8: * (Pig) fix CassandraStorage to use correct comparator in Super ColumnFamily case (CASSANDRA-3251) http://git-wip-us.apache.org/repos/asf/cassandra/blob/f943a6ed/src/java/org/apache/cassandra/service/AbstractWriteResponseHandler.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/service/AbstractWriteResponseHandler.java b/src/java/org/apache/cassandra/service/AbstractWriteResponseHandler.java index 29caa85..0a21676 100644 --- a/src/java/org/apache/cassandra/service/AbstractWriteResponseHandler.java +++ b/src/java/org/apache/cassandra/service/AbstractWriteResponseHandler.java @@ -43,7 +43,6 @@ public abstract class AbstractWriteResponseHandler implements IWriteResponseHand protected final long startTime; protected final Collection<InetAddress> writeEndpoints; protected final ConsistencyLevel consistencyLevel; - protected List<CreationTimeAwareFuture<?>> hintFutures; protected AbstractWriteResponseHandler(Collection<InetAddress> writeEndpoints, ConsistencyLevel consistencyLevel) { @@ -54,9 +53,6 @@ public abstract class AbstractWriteResponseHandler implements IWriteResponseHand public void get() throws TimeoutException { - if (hintFutures != null) - waitForHints(hintFutures); - long timeout = DatabaseDescriptor.getRpcTimeout() - (System.currentTimeMillis() - startTime); boolean success; try @@ -74,29 +70,6 @@ public abstract class AbstractWriteResponseHandler implements IWriteResponseHand } } - public void addFutureForHint(CreationTimeAwareFuture<?> hintFuture) - { - if (hintFutures == null) - hintFutures = new ArrayList<CreationTimeAwareFuture<?>>(writeEndpoints.size()); - hintFutures.add(hintFuture); - } - - protected static void waitForHints(List<CreationTimeAwareFuture<?>> hintFutures) throws TimeoutException - { - // Wait for hints - try - { - FBUtilities.waitOnFutures(hintFutures, DatabaseDescriptor.getRpcTimeout(), TimeUnit.MILLISECONDS); - } - catch (RuntimeException e) - { - // ExecutionEx needs a special treatment. We need to inform the client to back off because this node is overwhelmed. - if (e.getCause() != null && e.getCause() instanceof ExecutionException) - throw new TimeoutException(); - throw e; - } - } - /** null message means "response from local write" */ public abstract void response(Message msg); http://git-wip-us.apache.org/repos/asf/cassandra/blob/f943a6ed/src/java/org/apache/cassandra/service/IWriteResponseHandler.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/service/IWriteResponseHandler.java b/src/java/org/apache/cassandra/service/IWriteResponseHandler.java index f04d886..807df5b 100644 --- a/src/java/org/apache/cassandra/service/IWriteResponseHandler.java +++ b/src/java/org/apache/cassandra/service/IWriteResponseHandler.java @@ -29,6 +29,5 @@ import org.apache.cassandra.thrift.UnavailableException; public interface IWriteResponseHandler extends IAsyncCallback { public void get() throws TimeoutException; - public void addFutureForHint(CreationTimeAwareFuture<?> hintFuture); public void assureSufficientLiveNodes() throws UnavailableException; } http://git-wip-us.apache.org/repos/asf/cassandra/blob/f943a6ed/src/java/org/apache/cassandra/service/StorageProxy.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/service/StorageProxy.java b/src/java/org/apache/cassandra/service/StorageProxy.java index 27db551..ef70d1e 100644 --- a/src/java/org/apache/cassandra/service/StorageProxy.java +++ b/src/java/org/apache/cassandra/service/StorageProxy.java @@ -329,9 +329,8 @@ public class StorageProxy implements StorageProxyMBean if (!shouldHint(destination)) continue; - // Schedule a local hint and let the handler know it needs to wait for the hint to complete too - Future<Void> hintfuture = scheduleLocalHint(rm, destination, responseHandler, consistency_level); - responseHandler.addFutureForHint(new CreationTimeAwareFuture<Void>(hintfuture)); + // Schedule a local hint + scheduleLocalHint(rm, destination, responseHandler, consistency_level); } }