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

[columnar] delete the scanContext whenever possible after creation #226

Merged
merged 1 commit into from
Jan 17, 2024

Conversation

JerrySievert
Copy link
Contributor

during logical replication of large tables, multiple MemoryContext's are created via CreateColumnarScanMemoryContext() and do not get removed, eventually resulting in the OOM killer killing off the replication process and forcibly restarting the database.

since a scan context can get used outside of an actual read, it did not make sense to delete it in ColumnarEndRead(), so individual scan contexts are deleted when the function that created them are about to end execution.

this eliminates the ever-growing of scan contexts that appear under TopMemoryContext, and fixes the leak.

@JerrySievert JerrySievert added the bug Something isn't working label Jan 16, 2024
@JerrySievert JerrySievert self-assigned this Jan 16, 2024
@JerrySievert
Copy link
Contributor Author

I was not able to find a way to create a test to verify the results, verification was done by adding a memory walking debug output (which I removed) that showed the existence of thousands of memory contexts (all 8k) that went away after my fix.

@JerrySievert JerrySievert merged commit 9d98073 into main Jan 17, 2024
14 checks passed
@JerrySievert JerrySievert deleted the runaway-scan-contexts branch January 17, 2024 15:48
@wuputah wuputah mentioned this pull request Jan 26, 2024
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.

3 participants