-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Break drivers out into separate crates, clean up some technical debt #2039
Conversation
5756499
to
3e93acd
Compare
9ae5cc1
to
88e5885
Compare
1204b85
to
0d27f44
Compare
e02b9cb
to
ae2b293
Compare
6ae0a86
to
79d6441
Compare
28df9fb
to
ebba100
Compare
@tyrelr I'm getting a weird failure in the SQLite describe tests on this branch: https://github.com/launchbadge/sqlx/actions/runs/4069586336/jobs/7009510856#step:7:1062 |
also cleans up significant technical debt
ebba100
to
2ff1ac2
Compare
Once I get the other checks passing I'll merge this and then we can figure out what's going on. |
I'm assuming a new cargo.lock lead to a new sqlite binary, which happened to optimize that query in a way that broke the logic? But not a huge deal since (at least on my machine) the rebased PR #2253 fixes it. |
…2039) * WIP rt refactors * refactor: break drivers out into separate crates also cleans up significant technical debt
…2039) * WIP rt refactors * refactor: break drivers out into separate crates also cleans up significant technical debt
According to: launchbadge/sqlx#2039 (comment)
…aunchbadge#2039) * WIP rt refactors * refactor: break drivers out into separate crates also cleans up significant technical debt
Original Text
The goal of this PR is to make it possible to build SQLx without any runtime features enabled, or with just
runtime-async-std
orruntime-tokio
enabled (without a TLS provider). As a side-effect, multiple runtime and TLS features can be enabled simultaneously, in which case Tokio (if a Tokio context is available) and native-tls take precedent over async-std and rustls, respectively.Along the way, I'm fixing some perf issues re. buffering that's causing us to score very poorly on Diesel's metrics suite.
Preliminary benchmarks show a ~50% improvement on "Trivial query (postgres)" for 10,000 rows, bringing SQLx's time back to the same order of magnitude as Diesel's (7ms vs 3ms).
Amended Text
To support developing our planned SQLx Pro offering (#1616) while being able to reuse as much code as possible, we decided to separate out the database drivers into individual crates and do some other significant refactors that have been waiting in the wings. Since I already had a significant refactor pending in this PR, it made sense to roll these changes into it.
Breaking Change Summary
This is not an exhaustive list of breaking changes for 0.7.0, only those that are part of this PR. The full list will be in the
CHANGELOG.md
entry as usual.mssql
feature and associated database driver has been deleted from the source tree. It will return as part of our planned SQLx Pro offering as a from-scratch rewrite with extra features (such as TLS) and type integrations that were previously missing.runtime-actix-*
features have been deleted. They were previously changed to be aliases of theirruntime-tokio-*
counterparts for backwards compatibility reasons, but their continued existence is misleading as SQLx has no special knowledge of Actix anymore.runtime-actix-*
feature with itsruntime-tokio-*
equivalent.git2
feature has been removed. This was a requested integration from a while ago that over time made less and less sense to be part of SQLx itself. We have to be careful with the crates we add to our public API as each one introduces yet another semver hazard. The expected replacement is to make#[derive(sqlx::Type)]
useful enough that users can write wrapper types for whatever they want to use without SQLx needing to be specifically aware of it.Executor
impls forTransaction
andPoolConnection
have been deleted because they cannot exist in the new crate architecture without rewriting theExecutor
trait entirely.impl Executor
is expected, as they both dereference to the inner connection type which will still implement it:&mut transaction
->&mut *transaction
&mut connection
->&mut *connection
the driver crates cannot provide their own impls due to the orphan rule.
This will mean another major release of SQLx but ideally most API usage will not need to change significantly, if at all.
Migrator
are now#[doc(hidden)]
and semver-exempt; they weren't meant to be public.offline
feature has been removed from thesqlx
facade crate and is enabled unconditionally as most users are expected to have enabled it anyway and disabling it doesn't seem to appreciably affect compile times.decimal
feature has been renamed torust_decimal
to match the crate it actually provides integrations for.AnyDriver
andAnyConnection
now require eithersqlx::any::install_drivers()
orsqlx::any::install_default_drivers()
to be called at some point during the process' lifetime before the first connection is made, as the set of possible drivers is now determined at runtime. This was determined to be the least painful way to provide knowledge of database drivers toAny
without them being hardcoded.