From f09de802e69b311047171647d89892c35b1340bc Mon Sep 17 00:00:00 2001 From: Nikita Koksharov Date: Mon, 11 Oct 2021 08:46:15 +0300 Subject: [PATCH] Fixed - don't retry non-idempotent operations which were successfully sent. #3850 --- .../java/org/redisson/RedissonBoundedBlockingQueue.java | 2 +- .../src/main/java/org/redisson/RedissonDelayedQueue.java | 6 +++--- redisson/src/main/java/org/redisson/RedissonDeque.java | 2 +- .../java/org/redisson/RedissonPriorityBlockingQueue.java | 2 +- .../src/main/java/org/redisson/RedissonPriorityDeque.java | 2 +- .../src/main/java/org/redisson/RedissonPriorityQueue.java | 2 +- redisson/src/main/java/org/redisson/RedissonQueue.java | 2 +- redisson/src/main/java/org/redisson/RedissonRingBuffer.java | 2 +- .../src/main/java/org/redisson/RedissonTransferQueue.java | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/redisson/src/main/java/org/redisson/RedissonBoundedBlockingQueue.java b/redisson/src/main/java/org/redisson/RedissonBoundedBlockingQueue.java index aa3efd097..1db62290e 100644 --- a/redisson/src/main/java/org/redisson/RedissonBoundedBlockingQueue.java +++ b/redisson/src/main/java/org/redisson/RedissonBoundedBlockingQueue.java @@ -177,7 +177,7 @@ public class RedissonBoundedBlockingQueue extends RedissonQueue implements @Override public RFuture pollAsync() { String channelName = RedissonSemaphore.getChannelName(getSemaphoreName()); - return commandExecutor.evalWriteAsync(getRawName(), codec, RedisCommands.EVAL_OBJECT, + return commandExecutor.evalWriteNoRetryAsync(getRawName(), codec, RedisCommands.EVAL_OBJECT, "local res = redis.call('lpop', KEYS[1]);" + "if res ~= false then " + "local value = redis.call('incrby', KEYS[2], ARGV[1]); " + diff --git a/redisson/src/main/java/org/redisson/RedissonDelayedQueue.java b/redisson/src/main/java/org/redisson/RedissonDelayedQueue.java index 44f1bb4ad..4cbd9ec28 100644 --- a/redisson/src/main/java/org/redisson/RedissonDelayedQueue.java +++ b/redisson/src/main/java/org/redisson/RedissonDelayedQueue.java @@ -275,7 +275,7 @@ public class RedissonDelayedQueue extends RedissonExpirable implements RDelay @Override public RFuture> pollAsync(int limit) { - return commandExecutor.evalWriteAsync(getRawName(), codec, RedisCommands.EVAL_LIST, + return commandExecutor.evalWriteNoRetryAsync(getRawName(), codec, RedisCommands.EVAL_LIST, "local result = {};" + "for i = 1, ARGV[1], 1 do " + "local v = redis.call('lpop', KEYS[1]);" + @@ -463,7 +463,7 @@ public class RedissonDelayedQueue extends RedissonExpirable implements RDelay @Override public RFuture pollAsync() { - return commandExecutor.evalWriteAsync(getRawName(), codec, RedisCommands.EVAL_OBJECT, + return commandExecutor.evalWriteNoRetryAsync(getRawName(), codec, RedisCommands.EVAL_OBJECT, "local v = redis.call('lpop', KEYS[1]); " + "if v ~= false then " + "redis.call('zrem', KEYS[2], v); " @@ -481,7 +481,7 @@ public class RedissonDelayedQueue extends RedissonExpirable implements RDelay @Override public RFuture pollLastAndOfferFirstToAsync(String queueName) { - return commandExecutor.evalWriteAsync(getRawName(), codec, RedisCommands.EVAL_OBJECT, + return commandExecutor.evalWriteNoRetryAsync(getRawName(), codec, RedisCommands.EVAL_OBJECT, "local v = redis.call('rpop', KEYS[1]); " + "if v ~= false then " + "redis.call('zrem', KEYS[2], v); " diff --git a/redisson/src/main/java/org/redisson/RedissonDeque.java b/redisson/src/main/java/org/redisson/RedissonDeque.java index 08437c8c1..2e73e9163 100644 --- a/redisson/src/main/java/org/redisson/RedissonDeque.java +++ b/redisson/src/main/java/org/redisson/RedissonDeque.java @@ -256,7 +256,7 @@ public class RedissonDeque extends RedissonQueue implements RDeque { @Override public RFuture> pollLastAsync(int limit) { - return commandExecutor.evalWriteAsync(getRawName(), codec, RedisCommands.EVAL_LIST, + return commandExecutor.evalWriteNoRetryAsync(getRawName(), codec, RedisCommands.EVAL_LIST, "local result = {};" + "for i = 1, ARGV[1], 1 do " + "local value = redis.call('rpop', KEYS[1]);" + diff --git a/redisson/src/main/java/org/redisson/RedissonPriorityBlockingQueue.java b/redisson/src/main/java/org/redisson/RedissonPriorityBlockingQueue.java index 20b13c1d8..98e1ff034 100644 --- a/redisson/src/main/java/org/redisson/RedissonPriorityBlockingQueue.java +++ b/redisson/src/main/java/org/redisson/RedissonPriorityBlockingQueue.java @@ -221,7 +221,7 @@ public class RedissonPriorityBlockingQueue extends RedissonPriorityQueue i @Override public RFuture> pollAsync(int limit) { return wrapLockedAsync(() -> { - return commandExecutor.evalWriteAsync(getRawName(), codec, RedisCommands.EVAL_LIST, + return commandExecutor.evalWriteNoRetryAsync(getRawName(), codec, RedisCommands.EVAL_LIST, "local result = {};" + "for i = 1, ARGV[1], 1 do " + "local value = redis.call('lpop', KEYS[1]);" + diff --git a/redisson/src/main/java/org/redisson/RedissonPriorityDeque.java b/redisson/src/main/java/org/redisson/RedissonPriorityDeque.java index 24dc35f54..1b91d545c 100644 --- a/redisson/src/main/java/org/redisson/RedissonPriorityDeque.java +++ b/redisson/src/main/java/org/redisson/RedissonPriorityDeque.java @@ -304,7 +304,7 @@ public class RedissonPriorityDeque extends RedissonPriorityQueue implement @Override public RFuture> pollLastAsync(int limit) { return wrapLockedAsync(() -> { - return commandExecutor.evalWriteAsync(getRawName(), codec, RedisCommands.EVAL_LIST, + return commandExecutor.evalWriteNoRetryAsync(getRawName(), codec, RedisCommands.EVAL_LIST, "local result = {};" + "for i = 1, ARGV[1], 1 do " + "local value = redis.call('rpop', KEYS[1]);" + diff --git a/redisson/src/main/java/org/redisson/RedissonPriorityQueue.java b/redisson/src/main/java/org/redisson/RedissonPriorityQueue.java index 3c7a4838f..ea522bd56 100644 --- a/redisson/src/main/java/org/redisson/RedissonPriorityQueue.java +++ b/redisson/src/main/java/org/redisson/RedissonPriorityQueue.java @@ -456,7 +456,7 @@ public class RedissonPriorityQueue extends RedissonList implements RPriori @Override public RFuture> pollAsync(int limit) { return wrapLockedAsync(() -> { - return commandExecutor.evalWriteAsync(getRawName(), codec, RedisCommands.EVAL_LIST, + return commandExecutor.evalWriteNoRetryAsync(getRawName(), codec, RedisCommands.EVAL_LIST, "local result = {};" + "for i = 1, ARGV[1], 1 do " + "local value = redis.call('lpop', KEYS[1]);" + diff --git a/redisson/src/main/java/org/redisson/RedissonQueue.java b/redisson/src/main/java/org/redisson/RedissonQueue.java index 92e54f961..9c92b3d41 100644 --- a/redisson/src/main/java/org/redisson/RedissonQueue.java +++ b/redisson/src/main/java/org/redisson/RedissonQueue.java @@ -86,7 +86,7 @@ public class RedissonQueue extends RedissonList implements RQueue { @Override public RFuture> pollAsync(int limit) { - return commandExecutor.evalWriteAsync(getRawName(), codec, RedisCommands.EVAL_LIST, + return commandExecutor.evalWriteNoRetryAsync(getRawName(), codec, RedisCommands.EVAL_LIST, "local result = {};" + "for i = 1, ARGV[1], 1 do " + "local value = redis.call('lpop', KEYS[1]);" + diff --git a/redisson/src/main/java/org/redisson/RedissonRingBuffer.java b/redisson/src/main/java/org/redisson/RedissonRingBuffer.java index d09cbbb24..68a95d9ab 100644 --- a/redisson/src/main/java/org/redisson/RedissonRingBuffer.java +++ b/redisson/src/main/java/org/redisson/RedissonRingBuffer.java @@ -79,7 +79,7 @@ public class RedissonRingBuffer extends RedissonQueue implements RRingBuff @Override public RFuture addAsync(V e) { - return commandExecutor.evalWriteAsync(getRawName(), LongCodec.INSTANCE, RedisCommands.EVAL_BOOLEAN, + return commandExecutor.evalWriteNoRetryAsync(getRawName(), LongCodec.INSTANCE, RedisCommands.EVAL_BOOLEAN, "local limit = redis.call('get', KEYS[2]); " + "assert(limit ~= false, 'RingBuffer capacity is not defined'); " + "local size = redis.call('rpush', KEYS[1], ARGV[1]); " diff --git a/redisson/src/main/java/org/redisson/RedissonTransferQueue.java b/redisson/src/main/java/org/redisson/RedissonTransferQueue.java index 230945db9..daf5eb363 100644 --- a/redisson/src/main/java/org/redisson/RedissonTransferQueue.java +++ b/redisson/src/main/java/org/redisson/RedissonTransferQueue.java @@ -522,7 +522,7 @@ public class RedissonTransferQueue extends RedissonExpirable implements RTran @Override public V remove(int index) { if (index == 0) { - RFuture future = commandExecutor.evalWriteAsync(queueName, codec, EVAL_REQUEST, + RFuture future = commandExecutor.evalWriteNoRetryAsync(queueName, codec, EVAL_REQUEST, "local id = redis.call('lpop', KEYS[1]); " + "if id ~= false then " + "return redis.call('hget', KEYS[2], id); "