Fixed - don't retry non-idempotent operations which were successfully sent. #3850

pull/3917/head
Nikita Koksharov 3 years ago
parent 586197e2a7
commit 0bc3705881

@ -63,7 +63,7 @@ public class RedissonIdGenerator extends RedissonExpirable implements RIdGenerat
@Override
public RFuture<Boolean> tryInitAsync(long value, long allocationSize) {
return commandExecutor.evalWriteAsync(getRawName(), StringCodec.INSTANCE, RedisCommands.EVAL_BOOLEAN,
return commandExecutor.evalWriteNoRetryAsync(getRawName(), StringCodec.INSTANCE, RedisCommands.EVAL_BOOLEAN,
"redis.call('setnx', KEYS[1], ARGV[1]); "
+ "return redis.call('setnx', KEYS[2], ARGV[2]); ",
Arrays.asList(getRawName(), getAllocationSizeName()), value, allocationSize);

@ -961,7 +961,7 @@ public class RedissonMap<K, V> extends RedissonExpirable implements RMap<K, V> {
protected RFuture<V> putIfAbsentOperationAsync(K key, V value) {
String name = getRawName(key);
return commandExecutor.evalWriteAsync(name, codec, RedisCommands.EVAL_MAP_VALUE,
return commandExecutor.evalWriteNoRetryAsync(name, codec, RedisCommands.EVAL_MAP_VALUE,
"if redis.call('hsetnx', KEYS[1], ARGV[1], ARGV[2]) == 1 then "
+ "return nil "
+ "else "

@ -106,7 +106,7 @@ public class RedissonMapCache<K, V> extends RedissonMap<K, V> implements RMapCac
throw new IllegalArgumentException("maxSize should be greater than zero");
}
return commandExecutor.evalWriteAsync(getRawName(), LongCodec.INSTANCE, RedisCommands.EVAL_BOOLEAN,
return commandExecutor.evalWriteNoRetryAsync(getRawName(), LongCodec.INSTANCE, RedisCommands.EVAL_BOOLEAN,
"redis.call('hsetnx', KEYS[1], 'max-size', ARGV[1]);"
+ "return redis.call('hsetnx', KEYS[1], 'mode', ARGV[2]);",
Collections.singletonList(getOptionsName()), maxSize, mode);

@ -242,7 +242,7 @@ public class RedissonRateLimiter extends RedissonExpirable implements RRateLimit
@Override
public RFuture<Boolean> trySetRateAsync(RateType type, long rate, long rateInterval, RateIntervalUnit unit) {
return commandExecutor.evalWriteAsync(getRawName(), LongCodec.INSTANCE, RedisCommands.EVAL_BOOLEAN,
return commandExecutor.evalWriteNoRetryAsync(getRawName(), LongCodec.INSTANCE, RedisCommands.EVAL_BOOLEAN,
"redis.call('hsetnx', KEYS[1], 'rate', ARGV[1]);"
+ "redis.call('hsetnx', KEYS[1], 'interval', ARGV[2]);"
+ "return redis.call('hsetnx', KEYS[1], 'type', ARGV[3]);",

@ -335,7 +335,7 @@ public class RedissonRemoteService extends BaseRemoteService implements RRemoteS
if (request.getOptions().isAckExpected()) {
String responseName = getResponseQueueName(request.getExecutorId());
String ackName = getAckName(request.getId());
RFuture<Boolean> ackClientsFuture = commandExecutor.evalWriteAsync(responseName,
RFuture<Boolean> ackClientsFuture = commandExecutor.evalWriteNoRetryAsync(responseName,
LongCodec.INSTANCE, RedisCommands.EVAL_BOOLEAN,
"if redis.call('setnx', KEYS[1], 1) == 1 then "
+ "redis.call('pexpire', KEYS[1], ARGV[1]);"

@ -56,7 +56,7 @@ public class MapCacheEvictionTask extends EvictionTask {
@Override
RFuture<Integer> execute() {
int latchExpireTime = Math.min(delay, 30);
return executor.evalWriteAsync(name, LongCodec.INSTANCE, RedisCommands.EVAL_INTEGER,
return executor.evalWriteNoRetryAsync(name, LongCodec.INSTANCE, RedisCommands.EVAL_INTEGER,
"if redis.call('setnx', KEYS[6], ARGV[4]) == 0 then "
+ "return -1;"
+ "end;"

@ -345,7 +345,7 @@ public class AsyncRemoteProxy extends BaseRemoteProxy {
RPromise<Boolean> result = new RedissonPromise<>();
if (optionsCopy.isAckExpected()) {
String ackName = remoteService.getAckName(requestId);
RFuture<Boolean> future = commandExecutor.evalWriteAsync(responseQueueName, LongCodec.INSTANCE,
RFuture<Boolean> future = commandExecutor.evalWriteNoRetryAsync(responseQueueName, LongCodec.INSTANCE,
RedisCommands.EVAL_BOOLEAN,
"if redis.call('setnx', KEYS[1], 1) == 1 then "
+ "redis.call('pexpire', KEYS[1], ARGV[1]);"

@ -72,8 +72,8 @@ public abstract class BaseRemoteProxy {
protected RFuture<RemoteServiceAck> tryPollAckAgainAsync(RemoteInvocationOptions optionsCopy,
String ackName, RequestId requestId) {
RPromise<RemoteServiceAck> promise = new RedissonPromise<RemoteServiceAck>();
RFuture<Boolean> ackClientsFuture = commandExecutor.evalWriteAsync(ackName, LongCodec.INSTANCE, RedisCommands.EVAL_BOOLEAN,
RPromise<RemoteServiceAck> promise = new RedissonPromise<>();
RFuture<Boolean> ackClientsFuture = commandExecutor.evalWriteNoRetryAsync(ackName, LongCodec.INSTANCE, RedisCommands.EVAL_BOOLEAN,
"if redis.call('setnx', KEYS[1], 1) == 1 then "
+ "redis.call('pexpire', KEYS[1], ARGV[1]);"
+ "return 0;"

Loading…
Cancel
Save