-
Notifications
You must be signed in to change notification settings - Fork 473
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
Implement the GETEX command #961
Conversation
cool, thanks for your contribution. @maochongxin Can we put the ttl argument parse into a single function? so that we can avoid duplicate codes, the expire argument can be translated into ttl as well. |
Of course, I'm going to optimize it |
@git-hulk Complete the refactoring, but Is it waiting for #963 conclusion |
I think we should notice their difference: there is no So I do not think the whole parsing procedure for |
Co-authored-by: Twice <twice@apache.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems these TCL tests are migrated to golang, so maybe we should add these GetEX tests in go test cases again. cc @maochongxin
Ok, let me add it |
done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for your contriubution!
Just for record: https://github.com/apache/incubator-kvrocks/actions/runs/3231715201/jobs/5291557196
|
Thanks all, merging... |
submitted the doc updated PR: apache/kvrocks-website#19 |
This bug causes keys to be overwritten: ``` 127.0.0.1:6666> lpush foo bar (integer) 1 127.0.0.1:6666> type foo list 127.0.0.1:6666> getex foo "" 127.0.0.1:6666> type foo string ``` The reason is that we did not return early for wrong type error and then the code overwrites it as a string key. We should throw a wrong type error in this case: ``` 127.0.0.1:6666> lpush foo bar (integer) 1 127.0.0.1:6666> getex foo (error) ERR Invalid argument: WRONGTYPE Operation against a key holding the wrong kind of value 127.0.0.1:6666> type foo list ``` GETEX was added in apache#961, look like this bug has existed since the command was added.
Since we have already implemented these options in SET / GETEX, the change is very simple. Some ref links: - CAS was added in apache#415 - SET EXAP / PXAT options was added in apache#901 - GETEX was added in apache#961
This closes #960
Has passed the string.tcl test