valkey icon indicating copy to clipboard operation
valkey copied to clipboard

Make CLUSTER SETSLOT ... TIMEOUT 0 bypass the wait

Open zuiderkwast opened this issue 2 months ago • 6 comments

Follow-up of #245.

TIMEOUT 0 is interpreted as the default value (2 seconds?) which is counter-intuitive given that TIMEOUT 1 is 1ms.

It's better that TIMEOUT 0 bypasses replication-before-execution.

@madolson wrote

If a node is disconnected might be a valid use case? If a replica is unavailable for some reason, you might still want this to through. Maybe you're trying to move the data from an unhealthy to a healthy shard by migrating the data.

Original discussion: https://github.com/valkey-io/valkey/pull/245#discussion_r1587252134_

zuiderkwast avatar May 02 '24 17:05 zuiderkwast

TIMEOUT 0 normally means infinite, so it also seems a bit weird that TIMEOUT 0 might mean disable the feature.

madolson avatar May 03 '24 19:05 madolson

Maybe it would be better to validate the value. Just as it would be counter-intuitive for a value of zero to default to 2, wouldn't it be counter-intuitive for a value of 0 to disable the feature?

vinigracindo avatar May 12 '24 21:05 vinigracindo

I think it is intuitive that TIMEOUT 0 means don't wait at all. (That's what disable the feature means.)

zuiderkwast avatar May 13 '24 09:05 zuiderkwast

@madolson you argued that there might be uses cases for disabling the feature. What other syntax would you suggest for that, if not TIMEOUT 0? I don't think there's any use case for infinite wait.

zuiderkwast avatar May 13 '24 11:05 zuiderkwast

The only other option I would consider is -1, but I suppose I don't feel all that strongly. I'm okay with either option.

madolson avatar May 13 '24 20:05 madolson

-1 = infinity then? ;)

sleep(0) returns immediately, as an example of 0 meaning don't wait.

zuiderkwast avatar May 14 '24 13:05 zuiderkwast