未验证 提交 21e0c18d 编写于 作者: N Nikita Koksharov 提交者: GitHub

Merge pull request #3818 from mikawudi/fix-mset-bug

fix: fix bug for mset cross slot (miss values except cluster mode)
......@@ -150,7 +150,7 @@ public class RedissonBuckets implements RBuckets {
}
return params.toArray();
}
}, buckets.keySet().toArray(new String[]{}));
}, buckets.keySet().toArray(new String[]{}), buckets);
}
}
......@@ -28,6 +28,7 @@ import org.redisson.liveobject.core.RedissonObjectBuilder;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
*
......@@ -115,7 +116,9 @@ public interface CommandAsyncExecutor {
ByteBuf encodeMapValue(Codec codec, Object value);
<T, R> RFuture<R> readBatchedAsync(Codec codec, RedisCommand<T> command, SlotCallback<T, R> callback, String... keys);
<T, R> RFuture<R> writeBatchedAsync(Codec codec, RedisCommand<T> command, SlotCallback<T, R> callback, String... keys);
<T, R> RFuture<R> writeBatchedAsync(Codec codec, RedisCommand<T> command, SlotCallback<T, R> callback, String[] keys, Map<String, ?> valueMap);
}
......@@ -588,20 +588,35 @@ public class CommandAsyncService implements CommandAsyncExecutor {
@Override
public <T, R> RFuture<R> readBatchedAsync(Codec codec, RedisCommand<T> command, SlotCallback<T, R> callback, String... keys) {
return executeBatchedAsync(true, codec, command, callback, keys);
return executeBatchedAsync(true, codec, command, callback, keys, null);
}
@Override
public <T, R> RFuture<R> writeBatchedAsync(Codec codec, RedisCommand<T> command, SlotCallback<T, R> callback, String... keys) {
return executeBatchedAsync(false, codec, command, callback, keys);
return executeBatchedAsync(false, codec, command, callback, keys, null);
}
@Override
public <T, R> RFuture<R> writeBatchedAsync(Codec codec, RedisCommand<T> command, SlotCallback<T, R> callback, String[] keys, Map<String, ?> valueMap) {
return executeBatchedAsync(false, codec, command, callback, keys, valueMap);
}
private <T, R> RFuture<R> executeBatchedAsync(boolean readOnly, Codec codec, RedisCommand<T> command, SlotCallback<T, R> callback, String... keys) {
private <T, R> RFuture<R> executeBatchedAsync(boolean readOnly, Codec codec, RedisCommand<T> command, SlotCallback<T, R> callback, String[] keys, Map<String, ?> valueMap) {
if (!connectionManager.isClusterMode()) {
List<Object> params = null;
if (valueMap != null) {
params = new ArrayList<>(keys.length * 2);
for (String key : keys) {
params.add(key);
params.add(valueMap.get(key));
}
} else {
params = Arrays.asList(keys);
}
if (readOnly) {
return readAsync((String) null, codec, command, keys);
return readAsync((String) null, codec, command, params.toArray());
}
return writeAsync((String) null, codec, command, keys);
return writeAsync((String) null, codec, command, params.toArray());
}
Map<MasterSlaveEntry, Map<Integer, List<String>>> entry2keys = Arrays.stream(keys).collect(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册