feat: add configurable memory-limit for DuckDB engine#2059
Open
WellMafra wants to merge 1 commit into
Open
Conversation
DuckDB had no memory cap — by default it uses 80% of available RAM.
Add `memory-limit` field to `DuckDbConfig` and emit
`SET memory_limit='...'` as the first init SQL statement when configured.
The limit is applied even when the extensions directory is absent so
development environments also benefit.
Configure via package.json:
"duckdb": { "url": "jdbc:duckdb:", "memory-limit": "20GB" }
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2059 +/- ##
============================================
- Coverage 13.00% 13.00% -0.01%
Complexity 805 805
============================================
Files 606 606
Lines 17465 17467 +2
Branches 2102 2104 +2
============================================
Hits 2271 2271
- Misses 14992 14994 +2
Partials 202 202 ☔ View full report in Codecov by Sentry. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
memory-limitfield toJdbcConfig.DuckDbConfig(JSON keymemory-limit)DuckDbExtensions.buildInitSql()now emitsSET memory_limit='<value>'before loading extensions when the field is setextensionDirvalue; now logs the env var nameDUCKDB_EXTENSIONS_DIRUsage
Configure in
package.jsonserver section:Without this setting, DuckDB defaults to ~80% of available system RAM — causing OOM kills when running alongside Flink in a shared pod.
Test plan
memory-limit: "20GB"configuredSELECT current_setting('memory_limit')in DuckDB returns"20.0 GiB"