8000 Fix out-of-memory issue in creating our pg_restore list file. by dimitri · Pull Request #831 · dimitri/pgcopydb · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix out-of-memory issue in creating our pg_restore list file. #831

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 1 commit into from
Jul 1, 2024

Conversation

dimitri
Copy link
Owner
@dimitri dimitri commented Jul 1, 2024

Instead of creating the whole contents of the file in-memory, write it to disk one line at a time, keeping only that line in-memory during the whole operation.

Also arrange to code to only read the pg_restore --list output one line at a time, no context is needed to be able to parse this file format (pg_dump archive Table Of Contents).

Fixes #811
Replaces and closes #818

Instead of creating the whole contents of the file in-memory, write it to
disk one line at a time, keeping only that line in-memory during the whole
operation.

Also arrange to code to only read the pg_restore --list output one line at a
time, no 
8000
context is needed to be able to parse this file format (pg_dump
archive Table Of Contents).
@dimitri dimitri added the bug Something isn't working label Jul 1, 2024
@dimitri dimitri added this to the v0.17 milestone Jul 1, 2024
@dimitri dimitri requested review from rimbi and hanefi July 1, 2024 17:38
@dimitri dimitri self-assigned this Jul 1, 2024
@dimitri dimitri merged commit cce0894 into main Jul 1, 2024
38 checks passed
@dimitri dimitri deleted the fix/archive-list-out-of-memory branch July 1, 2024 17:45
Comment on lines +61 to +63
bool file_iter_lines(const char *filename, size_t bufsize,
void *context,
FileIterLinesFun *callback);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we have a function declaration and definition if it is not used anywhere in the codebase?

Copy link
Owner Author

Choose a reason for hiding this comment

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

The idea is that we have other places where we read a file line-by-line that could benefit from this iterator and one-line-at-a-time in memory approach. Also to implement the full iterator protocol, even though the composition with the archive iterator needs to be “open-coded” at the moment, using the lower-level API directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error:Failed to create pg_restore list file : out of memory
2 participants
0