Skip to content

Fix offset handling when doing chunked replaces #162

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 4 commits into from
Jul 19, 2021
Merged

Conversation

schlessera
Copy link
Member

In #153 the --precise queries were chunked to avoid loading the entire DB into memory and thus risking OOM issues.

However, the replacement is happening within each chunk, which breaks the $offset handling, causing every second chunk to be missed. This makes it necessary to run a query multiple times to ensure all occurrences are replaced.

This PR defers the actual updates until after the full search. This is still worse in terms of memory management that completely isolated chunking, but it should still be an overall improvement while making the replacements in a reliable way.

Fixes #157

@schlessera schlessera requested a review from a team as a code owner July 19, 2021 13:36
@schlessera schlessera added this to the 2.0.13 milestone Jul 19, 2021
@schlessera schlessera merged commit 7ffc573 into master Jul 19, 2021
@schlessera schlessera deleted the fix/chunking branch July 19, 2021 13:44
danielbachhuber pushed a commit that referenced this pull request Nov 18, 2022
Fix offset handling when doing chunked replaces
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regex search-replace has to be run multiple times to replace all instances
1 participant