Skip to content

Commit

Permalink
additional slop fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongjiewu committed May 16, 2013
1 parent 7ef135d commit c1400bd
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
2 changes: 2 additions & 0 deletions src/java/voldemort/server/storage/StorageService.java
Expand Up @@ -1024,6 +1024,8 @@ protected void stopInner() {

logger.info("Closed client threadpool.");

storeFactory.close();

if(this.failureDetector != null) {
try {
this.failureDetector.destroy();
Expand Down
Expand Up @@ -31,6 +31,7 @@
import voldemort.store.InsufficientOperationalNodesException;
import voldemort.store.InsufficientZoneResponsesException;
import voldemort.store.InvalidMetadataException;
import voldemort.store.PersistenceFailureException;
import voldemort.store.UnreachableStoreException;
import voldemort.store.nonblockingstore.NonblockingStore;
import voldemort.store.nonblockingstore.NonblockingStoreCallback;
Expand Down Expand Up @@ -138,7 +139,7 @@ public void requestComplete(Object result, long requestTime) {
}

if(!responseHandledByMaster) {
if(result instanceof UnreachableStoreException) {
if(isSlopableFailure(response.getValue())) {
if(logger.isDebugEnabled())
logger.debug("PUT {key:" + key + "} failed on node={id:"
+ node.getId() + ",host:" + node.getHost() + "}");
Expand Down Expand Up @@ -364,7 +365,7 @@ private void processResponse(Response<ByteArray, Object> response, Pipeline pipe

return;
}
if(response.getValue() instanceof UnreachableStoreException) {
if(isSlopableFailure(response.getValue())) {
pipelineData.getSynchronizer().tryDelegateSlop(response.getNode());
}

Expand All @@ -379,4 +380,9 @@ private void processResponse(Response<ByteArray, Object> response, Pipeline pipe
}
}
}

private boolean isSlopableFailure(Object object) {
return object instanceof UnreachableStoreException
|| object instanceof PersistenceFailureException;
}
}
Expand Up @@ -24,6 +24,7 @@
import voldemort.cluster.failuredetector.FailureDetector;
import voldemort.store.InsufficientOperationalNodesException;
import voldemort.store.InsufficientZoneResponsesException;
import voldemort.store.PersistenceFailureException;
import voldemort.store.Store;
import voldemort.store.UnreachableStoreException;
import voldemort.store.routed.Pipeline;
Expand Down Expand Up @@ -126,7 +127,8 @@ public void execute(Pipeline pipeline) {
+ (System.nanoTime() - start) + " ns" + " (keyRef: "
+ System.identityHashCode(key) + ")");

if(e instanceof UnreachableStoreException) {
if(e instanceof UnreachableStoreException
|| e instanceof PersistenceFailureException) {
pipelineData.getSynchronizer().tryDelegateSlop(node);
}
if(handleResponseError(e, node, requestTime, pipeline, failureDetector))
Expand Down
Expand Up @@ -108,13 +108,14 @@ public synchronized void addClientRequest(ClientRequest<?> clientRequest,
if(timeoutMs == -1) {
this.expiration = -1;
} else {
long nowNs = System.nanoTime();
if(elapsedNs > (Time.NS_PER_MS * timeoutMs)) {
this.expiration = System.nanoTime();
this.expiration = nowNs;
} else {
this.expiration = System.nanoTime() + (Time.NS_PER_MS * timeoutMs) - elapsedNs;
this.expiration = nowNs + (Time.NS_PER_MS * timeoutMs) - elapsedNs;
}

if(this.expiration < System.nanoTime())
if(this.expiration < nowNs)
throw new IllegalArgumentException("timeout " + timeoutMs + " not valid");
}

Expand Down
Expand Up @@ -28,7 +28,7 @@
public class LongHintedHandoffTest {

private final Logger logger = Logger.getLogger(LongHintedHandoffTest.class);
private static final Long MAX_TOTAL_TIME_MS = 1000L * 1 * 10;
private static final Long MAX_TOTAL_TIME_MS = 1000L * 60 * 10;
private static final Integer KEY_LENGTH = 16;
private static final Integer VALUE_LENGTH = 32;
private HintedHandoffTestEnvironment testEnv;
Expand Down

0 comments on commit c1400bd

Please sign in to comment.