-
Notifications
You must be signed in to change notification settings - Fork 40
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
[db] Access DB via connections, not via pool #4140
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree this is a cleaner interface. I reviewed the datastore/mod.rs, error.rs, and a few other areas, but I did not review most of nexus/db-queries/src/db because there's so much delta here that's mechanical but non-trivial.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this!
I ran the following command: cargo build -p omicron-nexus && touch nexus/src/lib.rs && cargo build -p omicron-nexus --timings (AKA, do a clean build, touch one file, rebuild validating timings). This is what I saw on my Linux laptop on main: This is what I saw with this PR: I'm surprised by this result, and think I might need to do a deep dive into why this is happening. |
Huh, well, that's... interesting. I tried using https://blog.rust-lang.org/inside-rust/2020/02/25/intro-rustc-self-profile.html to dig into "why did this make the build slower", and here's what I found: I basically wanted to run $ rustup run nightly rustc --version
rustc 1.74.0-nightly (e7c502d93 2023-09-27) I ran the following command: cargo +nightly rustc -p omicron-nexus --lib && touch nexus/src/lib.rs && cargo +nightly rustc -p omicron-nexus --lib -- -Zself-profile -Zself-profile-events=default (just like before -- build, touch one file, rebuild) I ran this on both Since I was forced to use the nightly compiler, I figured I'd redo the mainThis PRMy takeawayI think this PR is safe to land? It seems that the issues causing build speeds to regress are more related to our rust version than the commit itself. |
In case it's helpful for anybody else, I had a branch with changes that needed to be updated after merging with this change and this worked to update my branch:
|
Depends on oxidecomputer/async-bb8-diesel#54 As of #4140 , we check out connections before issuing queries to the underlying database. This means that when we receive errors from the database, they are not overloaded as "connection checkout" OR "database" errors - they are now always database errors.
Depends on oxidecomputer/async-bb8-diesel#52
Fixes #4132