Skip to content

MINOR: add comment for correctness issue to LeaderEpochFileCache#16660

Merged
chia7712 merged 1 commit intoapache:trunkfrom
FrankYang0529:minor-add-comment-to-leader-epoch-file-cache
Jul 24, 2024
Merged

MINOR: add comment for correctness issue to LeaderEpochFileCache#16660
chia7712 merged 1 commit intoapache:trunkfrom
FrankYang0529:minor-add-comment-to-leader-epoch-file-cache

Conversation

@FrankYang0529
Copy link
Copy Markdown
Member

Follow up: #16641

  • Add comment for the correctness issue.
  • Change LeaderEpochCheckpointFile#writeForTruncation to LeaderEpochCheckpointFile#writeIfDirExists.
  • Change LeaderEpochFileCache#writeToFileForTruncation to LeaderEpochFileCache#writeIfDirExists.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@chia7712 chia7712 requested a review from junrao July 23, 2024 10:19
Copy link
Copy Markdown
Contributor

@junrao junrao left a comment

Choose a reason for hiding this comment

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

@FrankYang0529 : Thanks for the PR. Just a minor comment.

checkpoint.writeForTruncation(epochs.values());
// Write epoch entries under the read lock to avoid older epoch entries overwriting the newer epoch entries.
// If we take a snapshot of the epoch entries here and flush to disk outside the read lock,
// the leader epoch file may have correctness issue, because the new epoch entry may already in the file.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Perhaps rewording to sth like the following?

If we take a snapshot of the epoch entries here and flush them to disk outside the read lock, by the time of flushing, the leader epoch file may already be updated with newer epoch entries. Those newer entries will then be overridden with the old snapshot.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks for the review and suggestion. Updated it.

Signed-off-by: PoAn Yang <payang@apache.org>
@FrankYang0529 FrankYang0529 force-pushed the minor-add-comment-to-leader-epoch-file-cache branch from 910da0f to 584b5e7 Compare July 23, 2024 16:11
Copy link
Copy Markdown
Member

@chia7712 chia7712 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Contributor

@junrao junrao left a comment

Choose a reason for hiding this comment

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

@FrankYang0529 : Thanks for the updated PR. LGTM

@chia7712
Copy link
Copy Markdown
Member

JDK 11, JDK 17 and JDK 21 pass. I run JDK8 on my local and it works well. Will merge it.

@chia7712
Copy link
Copy Markdown
Member

chia7712 commented Jul 24, 2024

I re-trigger the QA again. It seems JDK8 gets hanging. not sure whether that is related to #16641. will loop tests on my local at the mean time

@chia7712
Copy link
Copy Markdown
Member

will loop tests on my local at the mean time

I don't reproduce the hanging on my local. Will merge this PR and then keep my eyes on it ...

@chia7712 chia7712 merged commit a6b9407 into apache:trunk Jul 24, 2024
@FrankYang0529 FrankYang0529 deleted the minor-add-comment-to-leader-epoch-file-cache branch July 24, 2024 15:08
abhi-ksolves pushed a commit to ksolves/kafka that referenced this pull request Jul 31, 2024
…che#16660)

Reviewers: Jun Rao <junrao@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
@FrankYang0529 FrankYang0529 restored the minor-add-comment-to-leader-epoch-file-cache branch December 16, 2024 06:18
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.

3 participants