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

fix(atomix): consume read buffer correctly #4372

Merged
merged 2 commits into from
May 1, 2020
Merged

Conversation

Zelldon
Copy link
Member

@Zelldon Zelldon commented Apr 24, 2020

Description

Fix issue where the read buffer was consumed only half and the rest was
thrown away.

Refactor FileChannelJournalSegmentReader#readNext to improve readability and hopefully maintainability.

I run also a benchmark with these changes (#4358 was also part of the branch I run a benchmark with)

metrics

Related issues

closes #4248

Pull Request Checklist

  • All commit messages match our commit message guidelines
  • The submitting code follows our code style
  • If submitting code, please run mvn clean install -DskipTests locally before committing

 Fix issue where the read buffer was consumed only half and the rest was
 thrown away.

 Refactor FileChannelJournalSegmentReader#readNext to improve
 readability and hopefully maintainability.
Copy link
Contributor

@deepthidevaki deepthidevaki left a comment

Choose a reason for hiding this comment

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

I didn't quite understand what was the problem in the previous version. But now the code is more readable , so 👍 🙂

Can we add more tests for this in FileChannelSegmentReaderTest? I could find the problem with reading checksum length by tweaking the existing test to read all events, write entries of type Long and set max entry size to 2*Long. I think that we have to test it with different configuration - entry size, max entry size etc. to find potential bugs here.

 Adjust check such that it takes also checksum into account. Adjust tests such that they fail if this change is missing
@Zelldon
Copy link
Member Author

Zelldon commented Apr 28, 2020

Thanks @deepthidevaki for the review. I adjusted my PR and take the checksum length into account. I also changed to current tests such that they are failing if this check is missing. Furthermore I added one more test.

Copy link
Contributor

@deepthidevaki deepthidevaki left a comment

Choose a reason for hiding this comment

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

👍 Looks good. Just one minor comment.

@Zelldon
Copy link
Member Author

Zelldon commented Apr 29, 2020

bors r+

zeebe-bors bot added a commit that referenced this pull request Apr 29, 2020
4372: fix(atomix): consume read buffer correctly r=Zelldon a=Zelldon

## Description

Fix issue where the read buffer was consumed only half and the rest was
 thrown away.

Refactor `FileChannelJournalSegmentReader#readNext` to improve readability and hopefully maintainability.
<!-- Please explain the changes you made here. -->

I run also a benchmark with these changes (#4358 was also part of the branch I run a benchmark with)

![metrics](https://user-images.githubusercontent.com/2758593/80199113-45202a00-8621-11ea-9595-e8c65130ec97.png)


## Related issues

<!-- Which issues are closed by this PR or are related -->

closes #4248 

#

Co-authored-by: Christopher Zell <zelldon91@googlemail.com>
@zeebe-bors
Copy link
Contributor

zeebe-bors bot commented Apr 29, 2020

Build failed

@Zelldon
Copy link
Member Author

Zelldon commented May 1, 2020

Bors r+

@zeebe-bors
Copy link
Contributor

zeebe-bors bot commented May 1, 2020

Build succeeded

@zeebe-bors zeebe-bors bot merged commit bf5d2fa into develop May 1, 2020
@zeebe-bors zeebe-bors bot deleted the zell-fix-reader branch May 1, 2020 08:26
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.

FileChannelJournalSegmentReader throws half buffers away
3 participants