fix(duckdb): use SET GLOBAL for all settings to ensure pool consistency#172
Conversation
xe-nvdk
left a comment
There was a problem hiding this comment.
Good catch on the connection pool issue — SET only applies to the connection that runs it, so other pooled connections would use defaults. SET GLOBAL is the right fix for most of these.
Two issues:
1. custom_profiling_settings should stay SET, not SET GLOBAL
QueryWithProfileContext is meant to enable profiling for a specific diagnostic query. Making it SET GLOBAL enables profiling on all connections, adding overhead to every query — not just the one being profiled. This should remain SET (or ideally be scoped to just that connection/transaction).
2. Conflicts with PR #171
This PR still references enable_object_cache (line 140), but PR #171 replaces it with parquet_metadata_cache. These two PRs will conflict — please coordinate with #171 and rebase after it merges.
Change configuration settings to SET GLOBAL to ensure they apply to all connections in the pool, not just the one executing the statement. Keep custom_profiling_settings as SET since it's used for per-query diagnostics and should not affect all connections.
xe-nvdk
left a comment
There was a problem hiding this comment.
Thanks for catching the connection pool scoping issue, Khalid — this is a solid fix. We'll handle the rebase against #171 on our end and apply the remaining SET GLOBAL changes to the new settings. Merging as-is and fixing up locally.
Summary
Change all
SETstatements toSET GLOBALto ensure settings apply to all connections in the pool.Arc uses a connection pool (
SetMaxOpenConns), soSETonly affects one connection while other pooled connections use defaults.Changes
SET memory_limit→SET GLOBAL memory_limitSET threads→SET GLOBAL threadsSET enable_object_cache→SET GLOBAL enable_object_cacheSET preserve_insertion_order→SET GLOBAL preserve_insertion_orderSET cache_httpfs_type→SET GLOBAL cache_httpfs_typeSET cache_httpfs_max_in_mem_cache_block_count→SET GLOBAL ...SET cache_httpfs_in_mem_cache_block_timeout_millisec→SET GLOBAL ...SET custom_profiling_settings→SET GLOBAL custom_profiling_settingsTest plan