Skip to content

Refactor connection handling and add SQL compatibility tests#435

Merged
OutOfBedlam merged 4 commits into
mainfrom
wip-std-sql
Jul 1, 2026
Merged

Refactor connection handling and add SQL compatibility tests#435
OutOfBedlam merged 4 commits into
mainfrom
wip-std-sql

Conversation

@OutOfBedlam

Copy link
Copy Markdown
Contributor

This pull request refactors database connection handling across the server codebase to centralize and standardize the use of pooled connections. The changes replace previous ad-hoc or context-specific connection acquisition with a new getPoolConn helper function, improving maintainability and consistency. Additionally, a new parallel HTTP query benchmark is introduced, and minor improvements are made to resource management.

Database Connection Refactoring:

  • Added a new getPoolConn helper function in server.go to encapsulate pooled connection acquisition and wrapping, replacing repetitive connection logic throughout the codebase.
  • Updated all HTTP and MQTT query/write handlers (http_query.go, http_write.go, mqtt_query.go) to use getPoolConn instead of previous connection methods, ensuring consistent pooled connection usage and error handling. [1] [2] [3] [4] [5]

Benchmarking and Resource Management:

  • Added a new BenchmarkHTTPQueryParallel benchmark in http_test.go to measure parallel HTTP query performance under different database pool settings, aiding performance analysis and tuning.
  • Ensured proper connection closure in the watcher initialization logic to prevent resource leaks.

Dependency Update:

  • Updated the github.com/machbase/neo-client dependency in go.mod to a newer commit.

@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 47.82609% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.47%. Comparing base (0513907) to head (4450c6f).

Files with missing lines Patch % Lines
mods/server/http_write.go 28.57% 5 Missing ⚠️
mods/server/server.go 55.55% 2 Missing and 2 partials ⚠️
mods/server/http_query.go 60.00% 1 Missing and 1 partial ⚠️
spi/watch.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #435   +/-   ##
=======================================
  Coverage   65.46%   65.47%           
=======================================
  Files         351      351           
  Lines       69730    69730           
=======================================
+ Hits        45652    45656    +4     
+ Misses      19228    19226    -2     
+ Partials     4850     4848    -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@OutOfBedlam OutOfBedlam merged commit 653ef7d into main Jul 1, 2026
8 of 9 checks passed
@OutOfBedlam OutOfBedlam deleted the wip-std-sql branch July 1, 2026 03:17
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