-
-
Notifications
You must be signed in to change notification settings - Fork 526
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
/go/libraries/doltcore/sql/dsess: parallelize sql.NewDatabase work #8740
Conversation
b3ae4da
to
4637ccf
Compare
4637ccf
to
d869c70
Compare
@coffeegoddd DOLT
|
@coffeegoddd DOLT
|
…d channel send error
@@ -40,35 +41,61 @@ func NewGlobalStateStoreForDb(ctx context.Context, dbName string, db *doltdb.Dol | |||
rootRefs = append(rootRefs, branches...) | |||
rootRefs = append(rootRefs, remotes...) | |||
|
|||
var roots []doltdb.Rootish | |||
rootRefsChan := make(chan doltdb.Rootish, len(rootRefs)) |
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.
Instead of a channel here, just allocate roots
here:
roots := make([]doltdb.Rootish, len(rootRefs))
and then have the loop capture the iteration variable and write the root into the right place:
for i, b := range rootRefs {
eg.Go(func() error {
...
roots[i] = cm
...
roots[i] = ws
...
})
}
Probably best to eg.SetLimit()
on this errgroup as well.
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.
LGTM. One suggestion on improving the code.
@coffeegoddd DOLT
|
@coffeegoddd DOLT
|
No description provided.