Skip to content

RATIS-2282. LogAppender Restart Due to Premature Log Entry Access During Concurrent Write Processing #1249

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

Merged
merged 2 commits into from
Apr 20, 2025

Conversation

RkGrit
Copy link
Contributor

@RkGrit RkGrit commented Apr 19, 2025

What changes were proposed in this pull request?

Put entry to cache before adding the record.
modify the getLogRecord function with contains.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/RATIS-2282

How was this patch tested?

unit tests

@RkGrit
Copy link
Contributor Author

RkGrit commented Apr 19, 2025

@szetszwo Plz review.

Copy link
Contributor

@szetszwo szetszwo left a comment

Choose a reason for hiding this comment

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

@RkGrit , the change looks good. Just two minor comments.

Comment on lines 522 to 524
if (records.contains(index)) {
return records.get(index);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Just return without calling contain(..):

  LogRecord getLogRecord(long index) {
    return records.get(index);
  }

Comment on lines 120 to 122
boolean contains(long index) {
return map.containsKey(index);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

contain(..) is not needed.

@RkGrit
Copy link
Contributor Author

RkGrit commented Apr 20, 2025

@szetszwo, thanks for your suggestion. It looks better.

Copy link
Contributor

@szetszwo szetszwo left a comment

Choose a reason for hiding this comment

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

+1 the change looks good.

@szetszwo szetszwo merged commit de58f05 into apache:master Apr 20, 2025
15 checks passed
szetszwo pushed a commit to szetszwo/ratis that referenced this pull request May 19, 2025
szetszwo pushed a commit to szetszwo/ratis that referenced this pull request May 19, 2025
szetszwo pushed a commit to szetszwo/ratis that referenced this pull request May 23, 2025
szetszwo pushed a commit to szetszwo/ratis that referenced this pull request May 23, 2025
szetszwo pushed a commit to szetszwo/ratis that referenced this pull request May 23, 2025
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