-
Notifications
You must be signed in to change notification settings - Fork 24
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 #192] fix unified sorter #194
Conversation
Signed-off-by: zeminzhou <[email protected]>
Signed-off-by: zeminzhou <[email protected]>
Signed-off-by: zeminzhou <[email protected]>
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.
Rest LGTM.
cdc/cdc/model/kv.go
Outdated
@@ -87,11 +87,13 @@ type RawKVEntry struct { | |||
// Additional debug info | |||
RegionID uint64 `msg:"region_id"` | |||
KeySpanID uint64 `msg:"keyspan_id"` | |||
// For sort |
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.
// For sort | |
// For providing additional sequence number. | |
// To keep `RawKVEntries` from the same region in order during unstable sorting of `sorter`. | |
// The sequence number is generated by auto-increment in `puller` node of `processor.pipeline`. |
@@ -69,6 +74,8 @@ func ComparePolymorphicEvents(i, j *PolymorphicEvent) bool { | |||
} else if j.IsResolved() { | |||
return true | |||
} | |||
|
|||
return i.Sequence() < j.Sequence() |
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.
Suggest to add unit test for ComparePolymorphicEvents
.
Signed-off-by: zeminzhou <[email protected]>
Signed-off-by: zeminzhou <[email protected]>
Signed-off-by: zeminzhou <[email protected]>
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~
@haojinming PTAL~ |
Signed-off-by: zeminzhou [email protected]
What problem does this PR solve?
fix issue #192
Issue Number: close #192
Problem Description: TBD
The unified sort use heap sort which is unstable algorithm, which can swap two equial events.
What is changed and how does it work?
Add new field for RawKV to help sorter.
Code changes
Check List for Tests
This PR has been tested by at least one of the following methods: