Skip to content
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

Merged
merged 5 commits into from
Jan 16, 2025
Merged

make autoincrement tracker load async #8753

merged 5 commits into from
Jan 16, 2025

Conversation

coffeegoddd
Copy link
Contributor

No description provided.

@coffeegoddd coffeegoddd requested review from reltuk and zachmu January 15, 2025 19:44
@coffeegoddd
Copy link
Contributor Author

@coffeegoddd DOLT

comparing_percentages
100.000000 to 100.000000
version result total
68f99a4 ok 5937457
version total_tests
68f99a4 5937457
correctness_percentage
100.0

Copy link
Member

@zachmu zachmu left a 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()
Copy link
Member

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

@coffeegoddd
Copy link
Contributor Author

@coffeegoddd DOLT

comparing_percentages
100.000000 to 100.000000
version result total
abfafcb ok 5937457
version total_tests
abfafcb 5937457
correctness_percentage
100.0

@@ -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{})
Copy link
Member

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
Copy link
Contributor Author

@coffeegoddd DOLT

comparing_percentages
100.000000 to 100.000000
version result total
cabcb31 ok 5937457
version total_tests
cabcb31 5937457
correctness_percentage
100.0

@coffeegoddd coffeegoddd merged commit 57effdc into main Jan 16, 2025
21 checks passed
@coffeegoddd coffeegoddd deleted the db/async branch January 16, 2025 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants