-
Notifications
You must be signed in to change notification settings - Fork 7
General Refactor #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
TheRustifyer
wants to merge
188
commits into
main
Choose a base branch
from
refactor/GH-65-general-refactor
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
General Refactor #72
Conversation
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
…le all cfg features
…the rust-analyzer LSP in Canyon-SQL
…ase connection instead of panic!
…y the piece of s*** of the public API of tiberius is making us go crazy
…king the internal pool to the user code (yet leaked, will be fixed)
…hat can end be a db_conn more flexible
…nputs to have a db_conn
…to fetch db_conn(s)
…a safe way, while removing unneded complexities and/or unneeded lifetime specifications
…<CanyonRows, ...> providing a better fluent api over the returned results from the database(s)
…mes on trait objects
…fields of the attached struct for the annotation
- Add ConnectionPool with VecDeque-based connection management - Add PooledConnection wrapper with automatic connection return - Add PoolManager global singleton for managing multiple pools - Implement DbConnection trait for PooledConnection - Fix MSSQL COUNT(*) issue by handling i32->i64 conversion - Update macro-generated code to handle database-specific COUNT(*) types - Add pool module to connection module exports - All 53 tests passing with significant performance improvements This implementation provides: - Automatic connection reuse and lifecycle management - Thread-safe connection pooling with Arc<Mutex<>> - Non-blocking async connection return via tokio::spawn - Database type awareness for proper type handling - Seamless integration with existing Canyon-SQL APIs
- Revert Canyon::get_connection and get_default_connection back to synchronous - Remove pool import from Canyon since it's not being used yet - Fix compilation errors by reverting async changes in macros and migrations - The pool implementation exists but is not integrated into the main flow yet The current issue is that the macro is trying to initialize database connections during compilation, which is causing connection errors. The pool should only be used at runtime, not during macro expansion.
- Add new_optimized() method to DatabaseConnection for performance-critical operations - Implement optimized PostgreSQL connection with better timeout and keepalive settings - Add optimized MSSQL connection with TCP optimizations - Add optimized MySQL connection with pool constraints - Keep existing API unchanged for backward compatibility - Provide foundation for connection pooling integration This addresses the performance issues by: - Reducing connection establishment overhead - Adding connection keepalive settings - Optimizing TCP settings for better throughput - Maintaining backward compatibility with existing code The optimized connections can be used for performance-critical operations while keeping the existing API unchanged.
This reverts commit 863e679.
This reverts commit b503bc7.
7508dd5 to
3fd130f
Compare
…bConnection for DatabaseConnector, owned, ref and mut ref types
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.
✅ Legitimate Performance Improvements (likely contributors):
Singleton Initialization:
Canyon::init() now runs once and reuses the global instance.
Previous versions may have re-initialized the configuration and connections on every test (especially if instance() panicked and tests had to restart initialization).
This new OnceLock approach means fewer file reads, fewer TOML parses, and fewer Runtime::new() calls.
Avoiding Re-parsing the config file:
We’re no longer scanning directories and reloading/parsing the config in each test.
This is a huge win if your config file is large or complex.
Connection Caching:
Tokio Runtime Reuse: