-
Notifications
You must be signed in to change notification settings - Fork 162
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
BED-5467 Allow DB injection into DAWGS #1314
Merged
Merged
Conversation
This file contains 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
This embeds schemamanager into the driver, so that the transaction methods can live on schemamanager but be accessed from the driver layer. This did necessitate moving batchWriteSize to a package level var instead of living on the driver. This ended up being the simplest change to allow injecting a pgxpool into dawgs, and additional work should be done to better unwind the driver and schemamanager responsibilities
superlinkx
commented
Apr 4, 2025
zinic
approved these changes
Apr 4, 2025
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.
Nothing here sticks out to me; good to pull.
definitelynotagoblin
approved these changes
Apr 4, 2025
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Description
Changes DAWGS to allow dependency injection of a pgxpool to the pg driver, rather than having the driver set up the connection itself. This allows us to use pgtestdb in our upcoming integration tests, and allows for better separation of concerns.
The way this was done required removing the circular relationship between Driver and SchemaManager, and the simplest fix was to make Driver embed a SchemaManager. A new SchemaManager is initialized when a new Driver is created, and passed the same pool as the Driver. WriteTransaction and ReadTransaction were lowered into the SchemaManager struct since they are common methods used by both Driver and SchemaManager. Using an embed, we write those methods once while still allowing Driver to satisfy the graph.Database interface.
This is not the prettiest, but it does open up further improvements down the road and causes the least disruption while also making bootstrapping the driver straightfoward. The dependency between Driver and SchemaManager is a bit more clear as a result as well.
Motivation and Context
This PR addresses: BED-5467
How Has This Been Tested?
Ran with local dev to ensure schema was brought up properly and that ingest/analysis continued to function as expected.
Types of changes
Checklist: