-
Notifications
You must be signed in to change notification settings - Fork 545
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
[Compatibility] Add hash expiration - HEXPIRE, HPEXPIRE, HEXPIREAT, HPEXPIREAT, HTTL, HPTTL, HEXPIRETIME, HPEXPIRETIME, HPERSIST and HCOLLECT #864
base: main
Are you sure you want to change the base?
Conversation
@badrishc Can you quick look at this draft PR and let me know if I am going on the right path? Also, you will see a lot of TODO comments, I would like to get your opinion and help on some of those. Add your comments on those TODO items if possible. Thanks |
For maintaining the performance bar, we may need to: (1) Have a separate small PR to main, that adds BDN for more of the hash APIs for perf test (i.e., the ones that this PR might potentially regress). We only have one right now here: (2) Use those BDNs to compare main versus this PR, to ensure that there is no regression |
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.
This is a great start! See my comments, thank you. Let me know if anything is still unclear.
I think it's ready for review. Let the review comments flood it 😄 @badrishc I am working on creating a separate PR for adding more hash APIs in BDN |
main branch results as of commit
this PR branch results as of commit
Difference
For me, Variant looks minimal with the PR but I like to know your opinion. I will analyze why there is an additional allocation for HKeys, HGetAll, HVals commands |
I have to remove the This PR as of
Difference
For me, HMSet is the only one that looks outstanding. Update: Not sure what's going on in HMSet commands. Even after reverting everything back in HMSet commands flow, the performance is still slower than the main. But changing other parts of the code affects its performance like using |
Fixed all review comments except the one where we need to find the size of the new objects |
Please rereview this PR, closed all outstanding items from my end |
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.
Thanks for this extensive contribution. Added a few comments.
libs/resources/RespCommandsInfo.json
Outdated
@@ -1546,6 +1546,31 @@ | |||
} | |||
] | |||
}, | |||
{ | |||
"Command": "HCOLLECT", |
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.
This should be added to GarnetCommandsInfo.json (in CommandInfoUpdater)
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.
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.
Can you please run CommandInfoUpdater with --force and make sure that the .json files that it produces (RespCommandInfo.json & RespCommandDocs.json) are the same the existing ones? (it might move some commands around as it is alphabetizes the commands & subcommands, if the files are different please update them with the tool's outputs). Thanks!
@TalZaccai Fixed the review comments with some points to discuss |
if (expirationTimes.TryGetValue(key, out var currentExpiration)) | ||
{ | ||
if (expireOption.HasFlag(ExpireOption.NX) || | ||
expireOption.HasFlag(ExpireOption.GT) && expiration <= currentExpiration || |
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.
I think you're missing parentheses here
public GarnetStatus HashTimeToLive(ArgSlice key, bool isMilliseconds, bool isTimestamp, ref ObjectInput input, ref GarnetObjectStoreOutput outputFooter) | ||
=> storageSession.HashTimeToLive(key, isMilliseconds, isTimestamp, ref input, ref outputFooter, ref objectContext); | ||
|
||
public GarnetStatus HashCollect(ReadOnlySpan<ArgSlice> keys, ref ObjectInput input) |
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.
Missing inheritdoc
/// </summary> | ||
/// <param name="keys">The keys of the hash.</param> | ||
/// <returns>The status of the operation.</returns> | ||
GarnetStatus HashCollect(ReadOnlySpan<ArgSlice> keys, ref ObjectInput input); |
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.
Missing XML comment for input variable
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, few small comments.
Adding support for field-specific expiration in hash set. This PR adds HEXPIRE, HPEXPIRE, HEXPIREAT, HPEXPIREAT, HTTL, HPTTL, HEXPIRETIME, HPEXPIRETIME, HPERSIST and HCOLLECT commands to garnet to support this feature.
Fixes: #857