Skip to content
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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

liyuheng55555
Copy link
Collaborator

@liyuheng55555 liyuheng55555 commented Nov 5, 2024

To avoid this:
img_v3_02gb_59b3708e-2e13-4e2f-87ca-f9441458b2ag

Copy link
Collaborator

@HxpSerein HxpSerein left a 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();
Copy link
Collaborator

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.

Copy link
Collaborator Author

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

Copy link
Collaborator

@HxpSerein HxpSerein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants