Skip to content

feat: add configurable memory-limit for DuckDB engine#2059

Open
WellMafra wants to merge 1 commit into
mainfrom
feat/duckdb-memory-limit
Open

feat: add configurable memory-limit for DuckDB engine#2059
WellMafra wants to merge 1 commit into
mainfrom
feat/duckdb-memory-limit

Conversation

@WellMafra
Copy link
Copy Markdown
Contributor

Summary

  • Added memory-limit field to JdbcConfig.DuckDbConfig (JSON key memory-limit)
  • DuckDbExtensions.buildInitSql() now emits SET memory_limit='<value>' before loading extensions when the field is set
  • Fixed log statement: was logging null extensionDir value; now logs the env var name DUCKDB_EXTENSIONS_DIR

Usage

Configure in package.json server section:

"duckdb": {
  "url": "jdbc:duckdb:",
  "memory-limit": "20GB"
}

Without this setting, DuckDB defaults to ~80% of available system RAM — causing OOM kills when running alongside Flink in a shared pod.

Test plan

  • Deploy workbench query executor with memory-limit: "20GB" configured
  • Verify SELECT current_setting('memory_limit') in DuckDB returns "20.0 GiB"
  • Confirm TM pods no longer OOM crash loop under workbench query load

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
Copy link
Copy Markdown

codecov Bot commented May 11, 2026

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 13.00%. Comparing base (114962a) to head (4d82989).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
.../main/java/com/datasqrl/util/DuckDbExtensions.java 0.00% 4 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant