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

ZOOKEEPER-4794: Reduce the ZKDatabase#committedLog memory usage. #2115

Merged
merged 2 commits into from
Feb 9, 2024

Conversation

horizonzy
Copy link
Member

In most cases, the committed log isn't used, it's only used in the fast follower synchronization.
So we can generate the QuorumPacket when fast follower synchronizing to reduce the ZKDatabase#committedLog memory usage.

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

Overall I appreciate the refactor, the code looks nicer.

But I am not sure about the impact of the change, maybe we are solving one problem but we add another problem somewhere else.

I have added a comment, PTAL

public byte[] getSerializeData() {
if (this.hdr == null) {
return null;
}

if (this.serializeData == null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

so basically you are saying that caching this value is useless ?
do you know why we were caching it ?

Copy link
Member Author

Choose a reason for hiding this comment

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

See #2030, the aim is to reduce the serialization. From the prd, the memory looks more sensitive.

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

LGTM

thanks for your clarification

@eolivelli
Copy link
Contributor

Copy link
Contributor

@anmolnar anmolnar left a comment

Choose a reason for hiding this comment

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

lgtm. Thanks @horizonzy !

// This is the only place that can throw IO exception
hasNext = itr.next();

} catch (IOException e) {
LOG.error("Unable to read txnlog from disk", e);
hasNext = false;
p = new Proposal();
Copy link
Contributor

Choose a reason for hiding this comment

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

Weird to create objects in catch block, but it's okay.

@anmolnar anmolnar merged commit 18c78cd into apache:master Feb 9, 2024
13 checks passed
asfgit pushed a commit that referenced this pull request Feb 9, 2024
Reduce the committed log memory usage.
Fix ci.
Reviewers: eolivelli, hangc0276, anmolnar
Author: horizonzy
Closes #2115 from horizonzy/reduce-committed-log-memory-usage

(cherry picked from commit 18c78cd)
Signed-off-by: Andor Molnar <andor@apache.org>
@anmolnar
Copy link
Contributor

anmolnar commented Feb 9, 2024

Merged to master and branch-3.9 branches. Thanks @horizonzy! Please share your jira id.

@horizonzy
Copy link
Member Author

Merged to master and branch-3.9 branches. Thanks @horizonzy! Please share your jira id.

horizonzy

@anmolnar
Copy link
Contributor

horizonzy

Thanks, now you're officially a ZooKeeper contributor. ;)

AlphaCanisMajoris pushed a commit to AlphaCanisMajoris/zookeeper that referenced this pull request Mar 28, 2024
Reduce the committed log memory usage.
Fix ci.
Reviewers: eolivelli, hangc0276, anmolnar
Author: horizonzy
Closes apache#2115 from horizonzy/reduce-committed-log-memory-usage
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.

4 participants