-
-
Notifications
You must be signed in to change notification settings - Fork 525
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
make autoincrement tracker load async #8753
Conversation
@coffeegoddd DOLT
|
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
@@ -398,7 +435,20 @@ func (a *AutoIncrementTracker) AcquireTableLock(ctx *sql.Context, tableName stri | |||
return a.mm.Lock(tableName), nil | |||
} | |||
|
|||
func (a *AutoIncrementTracker) InitWithRoots(ctx context.Context, roots ...doltdb.Rootish) error { | |||
func (a *AutoIncrementTracker) waitForInit() error { | |||
a.wg.Wait() |
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.
Probably want to add a generous timeout here and return a different error if it is surpassed
…ut to ai waitForInit
@coffeegoddd DOLT
|
@@ -398,7 +437,31 @@ func (a *AutoIncrementTracker) AcquireTableLock(ctx *sql.Context, tableName stri | |||
return a.mm.Lock(tableName), nil | |||
} | |||
|
|||
func (a *AutoIncrementTracker) InitWithRoots(ctx context.Context, roots ...doltdb.Rootish) error { | |||
func (a *AutoIncrementTracker) waitForInit() error { | |||
done := make(chan struct{}) |
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.
Probably don't want to initialize a new channel here, this is called a lot.
I think instead I would get rid of the waitgroup entirely (it's just a single work item) and use a channel in the struct, then close the channel instead of calling wg.Done()
. Your logic for waiting below still works fine.
@coffeegoddd DOLT
|
No description provided.