Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Lock] compatiblity with redis cluster 7 #54252

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 13, 2024

Conversation

bastnic
Copy link
Contributor

@bastnic bastnic commented Mar 12, 2024

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
License MIT

While upgrading from redis 5 (no cluster) to AWS Elasticache redis 7 (cluster serverless), I stumble upon a fail.

This Redis command is not allowed from script script

Investigating, the fail is here, TIME is not available in cluster mode.

if (!isset($this->supportTime)) {
// Redis < 5.0 does not support TIME (not deterministic) in script.
// https://redis.io/commands/eval#replicating-commands-instead-of-scripts
// This code asserts TIME can be use, otherwise will fallback to a timestamp generated by the PHP process.
$script = '
local now = redis.call("TIME")
redis.call("SET", KEYS[1], "1", "PX", 1)
return 1
';

redis > EVAL 'local now = redis.call("TIME"); redis.call("SET", KEYS[1], "1", "PX", 1); return 1;' 1 pouet
(error) ERR This Redis command is not allowed from script script: b0e701c57bb0187cbd6ec8e404a7f6ba19b11a94, on @user_script:1.

BUT the error does not contains commands not allowed after non deterministic anymore, so no fallback on the PHP implementation.

Hence, the new exception catch.

See https://redis.io/docs/interact/programmability/eval-intro/#replicating-commands-instead-of-scripts

@bastnic bastnic requested a review from jderusse as a code owner March 12, 2024 13:25
@carsonbot carsonbot added this to the 5.4 milestone Mar 12, 2024
@bastnic bastnic force-pushed the feat/lock-redis-7-cluster branch from a317352 to 9ebf742 Compare March 12, 2024 13:27
@nicolas-grekas nicolas-grekas force-pushed the feat/lock-redis-7-cluster branch from 9ebf742 to ee5bd73 Compare March 13, 2024 12:23
@nicolas-grekas
Copy link
Member

Thank you @bastnic.

@nicolas-grekas nicolas-grekas merged commit c44cc73 into symfony:5.4 Mar 13, 2024
@bastnic bastnic deleted the feat/lock-redis-7-cluster branch March 14, 2024 09:58
This was referenced Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.