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
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
/go/libraries/doltcore/sqle/dsess/autoincrement_tracker.go: remove sy…
…nc.Once
coffeegoddd committed Jan 15, 2025
commit 68f99a49ad42bc3c15699318f95be21699000897
14 changes: 5 additions & 9 deletions go/libraries/doltcore/sqle/dsess/autoincrement_tracker.go
Original file line number Diff line number Diff line change
@@ -48,7 +48,6 @@ type AutoIncrementTracker struct {
sequences *sync.Map // map[string]uint64
mm *mutexmap.MutexMap
lockMode LockMode
init sync.Once
wg *sync.WaitGroup
initErr error
}
@@ -65,7 +64,6 @@ func NewAutoIncrementTracker(ctx context.Context, dbName string, roots ...doltdb
sequences: &sync.Map{},
mm: mutexmap.NewMutexMap(),
wg: &sync.WaitGroup{},
init: sync.Once{},
}
ait.runInitWithRootsAsync(ctx, roots...)
return &ait, nil
@@ -443,13 +441,11 @@ func (a *AutoIncrementTracker) waitForInit() error {
}

func (a *AutoIncrementTracker) runInitWithRootsAsync(ctx context.Context, roots ...doltdb.Rootish) {
a.init.Do(func() {
a.wg.Add(1)
go func() {
defer a.wg.Done()
a.initErr = a.initWithRoots(ctx, roots...)
}()
})
a.wg.Add(1)
go func() {
defer a.wg.Done()
a.initErr = a.initWithRoots(ctx, roots...)
}()
}

func (a *AutoIncrementTracker) initWithRoots(ctx context.Context, roots ...doltdb.Rootish) error {