Skip to content
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

fix(server): Correctly set expiration from Lua scripts #2080

Merged
merged 2 commits into from
Oct 27, 2023
Merged

Conversation

chakaz
Copy link
Collaborator

@chakaz chakaz commented Oct 26, 2023

We used to set time_now_ms_ only in the non-squashed execution path.

Fixes #2034

We used to set `time_now_ms_` only in the non-squashed execution path.

Fixes #2034
Copy link
Contributor

@dranikpg dranikpg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree there is a bug, but this is not the fix 🙂

In the regular case time_now_ms_ is assigned only during scheduling (and for a multi transaction it keeps that value till the end)

How does it work with squashing? You can see that the stub-tx has a dedicated constructor which already assigns time_now_ms_ from the parent (so this change would break atomicity for multi/exec squashing)

What's wrong with single-shard-lua: The parent transaction did not schedule when we create the stub tx, so time-now-is is 0 (also I just remember that txid = 0 as well)

What would be the simplest solution? To create the stub-tx inside the callback, it should fix all problems because now initialization would happen as planned. Otherwise... Create something like a special init / assignment operator function for the stub tx to re-fetch data from its main tx (txid & time_now_)

BTW, we have a similar bug with pipeline squashing, where the value is not updated 🙄 Will fix it!

@chakaz
Copy link
Collaborator Author

chakaz commented Oct 27, 2023

Nice catch! And indeed, your proposal fixes the issue.

@chakaz chakaz requested a review from dranikpg October 27, 2023 05:13
Copy link
Contributor

@dranikpg dranikpg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

@chakaz chakaz merged commit 502efd8 into main Oct 27, 2023
10 checks passed
@chakaz chakaz deleted the lua-expiration branch October 27, 2023 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rate-limiter-flexible don't work since 1.11
2 participants