valkey-io / valkey

A new project to resume development on the formerly open-source Redis project. We're calling it Valkey, since it's a twist on the key-value datastore.

Home Page:https://valkey.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make CLUSTER SETSLOT ... TIMEOUT 0 bypass the wait

zuiderkwast opened this issue · 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: #245 (comment)_

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

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?

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

@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.

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.

-1 = infinity then? ;)

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