Skip to content

Commit

Permalink
ISPN-8712 BiasRevocationTest.testFailedRevocationDuringPutAllOnNonOwn…
Browse files Browse the repository at this point in the history
…erThrowBefore random failures

* Avoid NullPointerException in EntryWrappingInterceptor
  when resetting the context entries for a retried command.
* Wrap triangle ACK exceptions on the originator
* Use the same logic as for synchronous commands, preserving
  OutdatedTopologyExceptions.
  • Loading branch information
danberindei authored and rvansa committed Jan 23, 2018
1 parent bc58d17 commit dd0a845
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
Expand Up @@ -5,8 +5,12 @@
import java.io.ObjectOutput;

import org.infinispan.commands.remote.BaseRpcCommand;
import org.infinispan.commons.CacheException;
import org.infinispan.remoting.transport.ResponseCollectors;
import org.infinispan.util.ByteString;
import org.infinispan.util.concurrent.CommandAckCollector;
import org.infinispan.util.logging.Log;
import org.infinispan.util.logging.LogFactory;

/**
* A command that represents an exception acknowledge sent by any owner.
Expand All @@ -17,6 +21,7 @@
* @since 9.0
*/
public class ExceptionAckCommand extends BaseRpcCommand {
private static final Log log = LogFactory.getLog(ExceptionAckCommand.class);

public static final byte COMMAND_ID = 42;
private CommandAckCollector commandAckCollector;
Expand All @@ -40,7 +45,8 @@ public ExceptionAckCommand(ByteString cacheName, long id, Throwable throwable, i
}

public void ack() {
commandAckCollector.completeExceptionally(id, throwable, topologyId);
CacheException remoteException = ResponseCollectors.wrapRemoteException(getOrigin(), this.throwable);
commandAckCollector.completeExceptionally(id, remoteException, topologyId);
}

@Override
Expand Down
Expand Up @@ -337,7 +337,10 @@ private void removeFromContextOnRetry(InvocationContext ctx, Collection<?> keys)
}
for (Object key : keys) {
MVCCEntry entry = (MVCCEntry) ctx.lookupEntry(key);
entry.resetCurrentValue();
// When a non-transactional command is retried remotely, the context is going to be empty
if (entry != null) {
entry.resetCurrentValue();
}
}
} else {
ctx.removeLookedUpEntries(keys);
Expand Down
Expand Up @@ -21,7 +21,6 @@
import org.infinispan.factories.annotations.Inject;
import org.infinispan.factories.annotations.Start;
import org.infinispan.interceptors.locking.ClusteringDependentLogic;
import org.infinispan.remoting.RemoteException;
import org.infinispan.remoting.inboundhandler.action.Action;
import org.infinispan.remoting.inboundhandler.action.ActionState;
import org.infinispan.remoting.inboundhandler.action.ActionStatus;
Expand Down Expand Up @@ -235,7 +234,7 @@ private BlockingRunnable createIndirectRpcRunnable(SingleRpcCommand command, int
return new DefaultTopologyRunnable(this, command, Reply.NO_OP, TopologyMode.READY_TX_DATA, commandTopologyId, false) {
@Override
protected void onException(Throwable throwable) {
sendExceptionAck(writeCommand.getCommandInvocationId(), new RemoteException("Exception on " + localAddress, throwable), commandTopologyId);
sendExceptionAck(writeCommand.getCommandInvocationId(), throwable, commandTopologyId);
}
};
}
Expand Down
Expand Up @@ -16,7 +16,7 @@
public class ResponseCollectors {
private static final Log log = LogFactory.getLog(ResponseCollectors.class);

public static CacheException wrapRemoteException(Address sender, Exception exception) {
public static CacheException wrapRemoteException(Address sender, Throwable exception) {
CacheException e;
if (exception instanceof SuspectException) {
e = log.thirdPartySuspected(sender, (SuspectException) exception);
Expand Down

0 comments on commit dd0a845

Please sign in to comment.