-
Notifications
You must be signed in to change notification settings - Fork 25
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 #193] fix cdc lose data by add resolved ts interval #196
Conversation
Signed-off-by: zeminzhou <[email protected]>
Signed-off-by: zeminzhou <[email protected]>
Signed-off-by: zeminzhou <[email protected]>
cdc/cdc/kv/region_worker.go
Outdated
logicalTs := oracle.ExtractLogical(resolvedTs) | ||
time := oracle.GetTimeFromTS(resolvedTs) | ||
|
||
safeTime := time.Add(-cfg.ResolvedTsSafeInterval) |
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.
If time
is less than cfg.ResolvedTsSafeInterval
, suggest to just return the time
.
A resolved-ts = 0
would be a legal one ?
Signed-off-by: zeminzhou <[email protected]>
Signed-off-by: zeminzhou <[email protected]>
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~
Signed-off-by: zeminzhou <[email protected]>
cdc/cdc/kv/region_worker.go
Outdated
// resolved ts, which may be larger than the new leader appends key to ts. | ||
// So we fallback the resolved ts to a safe interval to make sure it's correct. |
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.
// resolved ts, which may be larger than the new leader appends key to ts. | |
// So we fallback the resolved ts to a safe interval to make sure it's correct. | |
// So we fallback the resolved ts to a safe interval to make sure it's correct. | |
// See https://github.com/tikv/migration/issues/193. | |
// TODO: fix the issue completely. |
Also suggest to write a full analysis in #193, to help us discuss with others, and completely fix it later.
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.
OK
resolvedTs: (1<<18)*4*1000 + 1, | ||
expected: (1<<18)*1000 + 1, | ||
}, | ||
} |
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 boundary cases, e.g:
resolvedTs = 0
- Physical clock less than
3s
. - Physical clock equals to
3s
.
Signed-off-by: zeminzhou <[email protected]>
Signed-off-by: zeminzhou <[email protected]>
Signed-off-by: zeminzhou <[email protected]>
Signed-off-by: zeminzhou <[email protected]>
Signed-off-by: zeminzhou <[email protected]>
Signed-off-by: zeminzhou <[email protected]>
Signed-off-by: zeminzhou <[email protected]>
@pingyu PTAL~ |
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~
Signed-off-by: zeminzhou [email protected]
What problem does this PR solve?
TiKV-CDC maybe lose data when region leader tranfer happend
Issue Number: close #193
Problem Description: TBD
What is changed and how does it work?
Add a safe interval for resolved ts
Code changes
Check List for Tests
This PR has been tested by at least one of the following methods: