-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
*: support get-old-kv in watch #5850
Conversation
@ajityagaty You might want to review this. |
Isn't |
@@ -43,4 +43,7 @@ message Event { | |||
// A DELETE/EXPIRE event contains the deleted key with | |||
// its modification revision set to the revision of deletion. | |||
KeyValue kv = 2; | |||
|
|||
// oldkv holds the KeyValue before the event happens when requested. | |||
KeyValue oldKV = 3; |
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.
prev_kv
?
@chancez @heyitsanthony OK. I think we can rename old_kv to prev_kv. For delete, the original idea was named it as |
/cc @hongchaodeng |
@@ -253,6 +268,14 @@ func (sws *serverWatchStream) sendLoop() { | |||
events := make([]*mvccpb.Event, len(evs)) | |||
for i := range evs { | |||
events[i] = &evs[i] | |||
|
|||
if sws.getOldKV[wresp.WatchID] { |
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.
do map lookup before loop?
approach looks fine, but not a fan of the naming |
4b453d5
to
f7f13c7
Compare
@heyitsanthony @chancez All fixed. PTAL. |
|
||
// If prevKV is set, created watcher gets the previous KV before the event happens. | ||
// If the previous KV is already compacted, nothing will be returned. | ||
bool prevKV = 6; |
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.
should this be prev_kv
, not prevKV
?
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.
sure.
lgtm after protobuf naming style fixups |
/cc @heyitsanthony
I will rename the preserve-kv in delete to get-old-kv too. also i will probably add the same option for put.