-
Notifications
You must be signed in to change notification settings - Fork 511
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] Added GETEX command #695
base: main
Are you sure you want to change the base?
Conversation
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.
Added some comments, will finish the review later today :)
Fixed the current review comments |
|
||
if (input.ExtraMetadata > 0) | ||
{ | ||
byte* pbOutput = stackalloc byte[ObjectOutputHeader.Size]; |
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.
What's this for?
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's to call existing EvaluateExpireInPlace method but I don't care about the output param, so created a temp SpanByteAndMemory without any allocation and called the existing method
case RespCommand.GETEX: | ||
CopyRespTo(ref value, ref output); | ||
|
||
if (input.ExtraMetadata > 0) |
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.
Shouldn't you check for !isPersist here?
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 don't have to because if there is ExtraMetadata then that means the user has provided the expiration time so it can't be a Persist options, so there is no point in checking for !isPersist
} | ||
|
||
oldValue.AsReadOnlySpan().CopyTo(newValue.AsSpan()); | ||
var isPersist = *(bool*)(inputPtr + RespInputHeader.Size); |
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.
Is this necessary? If we're only doing GET + PERSIST, would we ever reach CopyUpdate?
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.
Ideally not, add it just in case. I am doubting myself mainly because the existing PERSIST
comment also has an entry in CopyUpdater. if you are sure then I can remove it. Shall I?
if (input.ExtraMetadata > 0) | ||
{ | ||
Debug.Assert(newValue.Length == oldValue.Length + input.MetadataSize); | ||
byte* pbOutput = stackalloc byte[ObjectOutputHeader.Size]; |
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.
Again, what is this for?
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.
Same as above
@@ -185,6 +185,13 @@ public int GetRMWModifiedValueLength(ref SpanByte t, ref SpanByte input) | |||
// No additional allocation needed. | |||
break; | |||
|
|||
case RespCommand.GETEX: | |||
if (input.ExtraMetadata > 0) |
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.
Assuming this should always be true if we reach here? Could just do a Debug.Assert(input.ExtraMetadata > 0)
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.
Added a few more comments...
@TalZaccai Fixed the review comments, there is one open question there. |
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 add a slot verification test in ClusterSlotVeficationTests?
Adding GETEX command to garnet