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: ethhashlookup: clean-up query management and lifecycle #12235

Merged
merged 1 commit into from
Jul 16, 2024

Conversation

rvagg
Copy link
Member

@rvagg rvagg commented Jul 15, 2024

Closes: #12171

Prompted because I'm noticing that my WAL for both calibnet and mainnet nodes is ~32M, even with my calibnet node running master which has #12098 which should result in it being compacted earlier than that (suggests that queries may be remaining open?).

The main thing that stands out in this file is the use of the preparedstatement that's prepared each time it's used, and not closed. So that's what's probably retaining memory and perhaps it's also responsible for the WAL size (I'm not sure how though tbh).

This refactor makes all queries use preparedstatements that persist for the lifecycle of the index, so we get the efficiency gains from that.

@rvagg rvagg requested review from snissn and aarshkshah1992 July 15, 2024 09:55
@rvagg rvagg added the skip/changelog This change does not require CHANGELOG.md update label Jul 15, 2024
@rvagg
Copy link
Member Author

rvagg commented Jul 15, 2024

Running master along with #12236, my WAL is a reasonable size now.

@rvagg rvagg force-pushed the rvagg/ethhashlookupdb-cleanup branch from d43f6b4 to acdc069 Compare July 15, 2024 10:34
Copy link
Contributor

@aarshkshah1992 aarshkshah1992 left a comment

Choose a reason for hiding this comment

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

lgtm - (some comments around leaving the responsibility of finishing DB operations before calling Close to the caller)

@aarshkshah1992
Copy link
Contributor

@rvagg Did this really reduce the size of your WAL ? How does that work ? IIUC, the only positive impact here should be reduced heap usage because of not leaking prepared statements anymore.

@aarshkshah1992
Copy link
Contributor

@rvagg Just confirming that this was fixed and not rerun:
https://github.com/filecoin-project/lotus/actions/runs/9937341686/job/27447513414

@rvagg
Copy link
Member Author

rvagg commented Jul 16, 2024

@rvagg Just confirming that this was fixed and not rerun: https://github.com/filecoin-project/lotus/actions/runs/9937341686/job/27447513414

Yes, fixed by changing the ordering of ei.db = nil and close, as per comment above.

@rvagg rvagg force-pushed the rvagg/ethhashlookupdb-cleanup branch from acdc069 to 66a0ccc Compare July 16, 2024 01:49
@rvagg rvagg merged commit 1c05985 into master Jul 16, 2024
79 checks passed
@rvagg rvagg deleted the rvagg/ethhashlookupdb-cleanup branch July 16, 2024 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip/changelog This change does not require CHANGELOG.md update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EthTxHashLookup has poor query management
2 participants