* Add test for #4812: Autocomplete suggestions should have size limits
This test verifies that autocomplete suggestion maps enforce size limits
to prevent unbounded memory growth. The test calls setTablesForSchema()
and setQueriesForMod() methods that should enforce:
- Maximum 100 schemas in tablesBySchema
- Maximum 500 tables per schema
- Maximum 100 mods in queriesByMod
- Maximum 500 queries per mod
This test will fail until the size limiting implementation is added.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix#4812: Add size limits to autocomplete suggestions maps
Implements bounded size for autocomplete suggestion maps to prevent
unbounded memory growth with large schemas:
- Added constants for max schemas (100) and max tables per schema (500)
- Created setTablesForSchema() and setQueriesForMod() methods that enforce
limits using LRU-style eviction when limits are exceeded
- Updated interactive_client_autocomplete.go to use the new bounded setter
This prevents excessive memory consumption when dealing with databases
that have hundreds of connections with many tables each.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
* Add test for #4803: Race condition in initialisationComplete flag
Add TestInitialisationComplete_RaceCondition to demonstrate the data race
that occurs when the initialisationComplete boolean flag is accessed
concurrently by multiple goroutines without synchronization.
The test simulates:
- Init goroutine writing to the flag
- Query executor reading via isInitialised()
- Notification handler reading the flag directly
This test will fail when run with the -race flag, exposing the bug.
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix#4803: Use atomic.Bool for initialisationComplete flag
Replace the plain boolean initialisationComplete field with atomic.Bool
to prevent data races when accessed concurrently by multiple goroutines.
Changes:
- Change field type from bool to atomic.Bool
- Use .Store(true) for writes
- Use .Load() for reads in isInitialised() and handleConnectionUpdateNotification()
- Update test to use atomic operations
The test now passes with -race flag, confirming the race condition is fixed.
---------
Co-authored-by: Claude <noreply@anthropic.com>
Changes:
1. Renamed TestQueryContextLeakage -> TestContextCancellationTiming
- The test was checking cancellation timing, not memory leaks
- Updated comments to reflect actual purpose
2. Increased timeout from 1ms to 100ms
- 1ms is too aggressive for CI runners under load
- 100ms still catches real deadlocks while avoiding flakiness
- Added detailed comments explaining the timeout choice
3. Added TestNoGoroutineLeaks using goleak
- Properly tests for actual resource leaks (goroutines)
- More reliable than memory-based leak detection
- Uses industry-standard goleak library
The original 1ms timeout caused intermittent CI failures on slower
runners, as context cancellation involves goroutine scheduling that
has no guaranteed sub-millisecond timing.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <noreply@anthropic.com>
- JSON output format has changed to move the rows to under a `rows` property, with timing information under the `metadata` property
- Update timing display to show rows returned and rows fetched, as well as adding verbose mode which lists all scans
- Use enums for output mode and timing mode - timing is now either `on`, `off` or `verbose`
- Bugfix: ensure error is returned from ExecuteSystemClientCall. Closes#4246
* Add function to clear connection cache.
* Update FDW to v1.9.0 - Add ability to clear connection cache by inserting into settings table.
* Update plugin sdk to v5.6.1
* fix listen unit tests
(cherry picked from commit 4fa11a424e)