-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[region migration] Fix sync lag metric during add region #13995
base: master
Are you sure you want to change the base?
[region migration] Fix sync lag metric during add region #13995
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.
PTAL~
@@ -844,8 +844,7 @@ public long getSearchIndex() { | |||
} | |||
|
|||
public long getSyncLag() { | |||
long minSyncIndex = getMinSyncIndex(); | |||
return getSearchIndex() - minSyncIndex; | |||
return getSearchIndex() - getMinFlushedSyncIndex(); |
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 is recommended to use a local variable as before. Because the two get operation is not an atomic operation, subtracting the two function may result in a negative number.
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.
- getMinFlushedSyncIndex() + getSearchIndex() looks better :P
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~
To avoid this: