-
Notifications
You must be signed in to change notification settings - Fork 49
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
fix: inherit configuration in run_parallel
#215
Conversation
Signed-off-by: Bugen Zhao <[email protected]>
run_parallel
run_parallel
Signed-off-by: Bugen Zhao <[email protected]>
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.
OK-ish as a quick fix
// TODO: This is not a good interface, as the `make_conn` passed to `new` is unused but we | ||
// accept a new `conn_builder` here. May change `MakeConnection` to support specifying the | ||
// database name in the future. |
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 don't understand the comment here. Where's the make_conn
passed to new
?
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.
Oh, do you mean self.conn
?
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.
Ok, so it seems self.conn
is used to CREATE DATABASE
, but we need new conns for individual databases.
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.
The idea of conn_builder
here has something common with make_conn
passed to new
, but they're not compatible and seem to be kind of redundant to me. For example,
-
The first arg is a
host
randomly picked from thehosts
, which is strange. If the callers want load balancing between hosts, they are allowed to capture a slice ofhosts
and do random picking in the body ofmake_conn
orconn_builder
. -
The procedures to establish a connection to the database in
make_conn
andconn_builder
are likely to the same, except for targeting different databases. We should unify them by changing the definition ofMakeConnection
. Only using the one passed innew
to create databases in parallel mode does not seem to be a good design.
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
In
Runner
, we create a new runner for each parallelism without reusingself.conn
, which is not good. What's worse is that we don't inherit other fields fromself
, resulting inadd_label
not taking effect when running in parallel.