-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Description
Bug Report
When migrating a slot, setting the slot to a "migrating" state may occasionally trigger MOVED errors when accessing keys in that slot. I've noticed that Issue #1218 on the Lettuce GitHub repository (#1218) describes a similar problem. However, the fix for this issue appears ineffective because in DefaultEndpoint.writeToChannelAndFlush, even when a command list is passed in, channelWrite still sends each command individually. This implementation may lead to a write race condition.
private void writeToChannelAndFlush(Collection<? extends RedisCommand<?, ?, ?>> commands) {
QUEUE_SIZE.addAndGet(this, commands.size());
if (reliability == Reliability.AT_MOST_ONCE) {
// Cancel on exceptions and remove from queue (no housekeeping)
for (RedisCommand<?, ?, ?> command : commands) {
channelWrite(command).addListener(AtMostOnceWriteListener.newInstance(this, command));
}
}
if (reliability == Reliability.AT_LEAST_ONCE) {
// Commands remain in queue for reconnect retries
for (RedisCommand<?, ?, ?> command : commands) {
channelWrite(command).addListener(RetryListener.newInstance(this, command));
}
}
channelFlush();
}Expected behavior/code
Environment
- Lettuce version(s): [6.3.2.RELEASE]
- Redis version: [6.2.13]
If this is indeed a bug, i would like to send a pr.