-
-
Notifications
You must be signed in to change notification settings - Fork 948
[WIP] using db-pool library to create a pool of databases #5846
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
Draft
momentary-lapse
wants to merge
87
commits into
LemmyNet:main
Choose a base branch
from
momentary-lapse:parallel-db-tests
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.
Draft
Changes from 1 commit
Commits
Show all changes
87 commits
Select commit
Hold shift + click to select a range
1443731
draft: using db-pool form a 2021 branch
momentary-lapse 55d010d
Merge branch 'main' of github.com:LemmyNet/lemmy into parallel-db-tests
momentary-lapse 91613fb
fix
momentary-lapse 618f635
some renaming
momentary-lapse ef155c5
reusable pool integrated except everywhere, some tests adapted
momentary-lapse f949aea
Merge branch 'main' of github.com:LemmyNet/lemmy into parallel-db-tests
momentary-lapse 6b13d21
generic pool in context and stat modules, now it compiles
momentary-lapse 8528a7f
Merge branch 'main' into parallel-db-tests
momentary-lapse e90c8be
fix taplo
momentary-lapse 5d6fe0c
clippy fix
momentary-lapse 906c36a
Merge branch 'main' of github.com:LemmyNet/lemmy into parallel-db-tests
momentary-lapse 418e91b
clippy fix
momentary-lapse fe3305b
fmt fix
momentary-lapse a95ad45
Merge branch 'main' of github.com:LemmyNet/lemmy into parallel-db-tests
momentary-lapse 4377da8
shear fix
momentary-lapse e18c7f7
clippy + shear fixes
momentary-lapse 5264ab1
fmt fix
momentary-lapse 9db404d
Merge branch 'main' of github.com:LemmyNet/lemmy into parallel-db-tests
momentary-lapse 6e795ea
fix merge issues
momentary-lapse 603efb3
config forrunning new tests locally
momentary-lapse 0d59fcf
Merge branch 'main' of github.com:LemmyNet/lemmy into parallel-db-tests
momentary-lapse 1fbe5f4
Merge branch 'main' of github.com:LemmyNet/lemmy into parallel-db-tests
momentary-lapse 64bc9e6
removing the rest of serial tests
momentary-lapse 6534cbc
fmt
momentary-lapse 12037df
excluding serial_test dep
momentary-lapse b8c2836
fix
momentary-lapse aadfcca
Merge branch 'main' of github.com:LemmyNet/lemmy into parallel-db-tests
momentary-lapse 99f4f03
Merge branch 'main' of github.com:LemmyNet/lemmy into parallel-db-tests
momentary-lapse 2b1776b
Merge branch 'main' of github.com:LemmyNet/lemmy into parallel-db-tests
momentary-lapse 3abdada
add tokio-shared-rt library
momentary-lapse 7457486
Merge branch 'main' of github.com:LemmyNet/lemmy into parallel-db-tests
momentary-lapse 355e6fe
updated lock
momentary-lapse f936ec3
removing serial
momentary-lapse 9ab549a
post crate changes partial
momentary-lapse 5f00b50
Merge branch 'main' of github.com:LemmyNet/lemmy into parallel-db-tests
momentary-lapse 5ba2328
merge fixes
momentary-lapse 8f9d819
full access to r schema in tests
momentary-lapse 738c71c
Merge branch 'main' of github.com:LemmyNet/lemmy into parallel-db-tests
momentary-lapse 1d3c3d8
made it compile
momentary-lapse 35ac090
using db-pool version with superuser test user
momentary-lapse 7e92da6
Merge branch 'main' of github.com:LemmyNet/lemmy into parallel-db-tests
momentary-lapse 5d52b36
PrivilegedPostgresConfig adapted to conn string containing options
momentary-lapse 59dbc62
Merge branch 'main' of github.com:LemmyNet/lemmy into parallel-db-tests
momentary-lapse 3d469ef
tests are compiling
momentary-lapse 7984f6d
shared runtime in tests
momentary-lapse f912ecf
prettier fix
momentary-lapse 20e9b46
linter fixes
momentary-lapse c4ad852
removing empty file
momentary-lapse c7f9151
fixing tests
momentary-lapse 90c6152
ignoring tokio to satisfy shear
momentary-lapse a847d44
taplo fix
momentary-lapse 4be9c32
Merge branch 'main' of github.com:LemmyNet/lemmy into parallel-db-tests
momentary-lapse 75d5671
fixing tests and tomls
momentary-lapse ec18a6b
fixing lemmy_db_views_post tests
momentary-lapse d5b3fd5
Merge branch 'main' of github.com:LemmyNet/lemmy into parallel-db-tests
momentary-lapse ae6ac4b
fix test
momentary-lapse c26ab70
some more fixes
momentary-lapse b9d1b18
Merge branch 'main' of github.com:LemmyNet/lemmy into parallel-db-tests
momentary-lapse 4abcc9d
using improved db-pool config accepting a connection string
momentary-lapse d977c4e
Merge branch 'main' of https://github.com/LemmyNet/lemmy into paralle…
momentary-lapse 1c1433a
Cargo lock changed
momentary-lapse 290f64f
Merge branch 'main' of https://github.com/LemmyNet/lemmy into paralle…
momentary-lapse bc61f54
fixes for submodule
7824a91
test fix
9006d18
fmt fix
a011e9f
fix compilation
909c7b9
failed tests ignored
bfd799a
Merge branch 'main' of https://github.com/LemmyNet/lemmy into paralle…
21156df
removing serial in new tests
94ed7b2
removing empty file
0b4676f
removing empty file
b172cdb
adding multi-thread flavor
eba169d
db-pool upd
9fd3d24
Revert "db-pool upd"
e037df5
fix pool sizes
a5d4d96
Merge branch 'main' of https://github.com/LemmyNet/lemmy into paralle…
923177b
db-pool doesn't throw errors on cleanup
0230818
use serial for workers which share the same port
73aad3e
removing ignore
3b187a8
removing ignore
dc3c087
clippy and fmt fixes
9c00d0a
Merge branch 'main' of https://github.com/LemmyNet/lemmy into paralle…
5dfa1df
db-pool dependency library supports diesel-async 0.8.0
1bcd4ff
test fixes
28d869e
Merge branch 'main' of https://github.com/LemmyNet/lemmy into paralle…
46f2d66
fmt fix
fabeac1
Merge branch 'main' of https://github.com/LemmyNet/lemmy into paralle…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
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
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.
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 created this WIP PR to share the progress and the issue I'm stuck with currently. The crate I use operates with its own structure wrapping connection pools: code
And we have our own ActualDbPool. They are kinda same, but it's not obvious for me how to correctly convert one to another.
I had an idea to make
ActualDbPoola enum with two possible values: RegularPool and ReusablePool, but stuck on trying to adapt stuff like LemmyContext, which also requires pool struct to be clone-able (and ReusablePool is not). And it seems a lot of changes to the main codebase for purely test changes.Do you folks have any ideas how to manage that? Or should I stick to the initial plan without using this library?
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.
Our
ActualDbPoolis just a type alias for deadpoolPool<AsyncPgConnection>.Their crate should be able to work with deadpool pools, but I'm not familiar with how to plug that into their crate... you'll have to ask them.
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.
Yeah, I see. I returned to this issue today after a week of a break. I'm in contact with the db-pool author and they're helping to understand a lot of moments and really willing to collaborate, so i think we'll make this work.
I'd like to clarify one moment: do we want
build_db_pool_for_teststo return stillActualDbPool?db-poolhas its own wrapperReusableConnectionPoolwhich works like a deadpoolPool, but a bit different and needs adaptation. And it might be easier to adapt tests for working withReusableConnectionPoolthan convertingReusableConnectionPooltoActualDbPoolThere 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.
The return type of
build_db_pool_for_testsmay be changed. Also, aDbPoolvariant may be added if needed.