/go/libraries/doltcore/sqle/dsess: remove logs

This commit is contained in:
coffeegoddd
2025-01-14 10:20:26 -08:00
parent 4035348eab
commit bff342afe5
2 changed files with 1 additions and 34 deletions

View File

@@ -16,16 +16,13 @@ package dsess
import (
"context"
"fmt"
"io"
"math"
"strings"
"sync"
"time"
"github.com/dolthub/go-mysql-server/sql"
gmstypes "github.com/dolthub/go-mysql-server/sql/types"
"github.com/fatih/color"
"golang.org/x/sync/errgroup"
"github.com/dolthub/dolt/go/libraries/doltcore/doltdb"
@@ -402,20 +399,17 @@ func (a *AutoIncrementTracker) AcquireTableLock(ctx *sql.Context, tableName stri
}
func (a *AutoIncrementTracker) InitWithRoots(ctx context.Context, roots ...doltdb.Rootish) error {
start := time.Now()
eg, egCtx := errgroup.WithContext(ctx)
eg.SetLimit(128)
for _, root := range roots {
eg.Go(func() error {
if egCtx.Err() != nil {
fmt.Fprintf(color.Output, "DUSTIN: InitWithRoots: ctx error: elapsed: %v\n", time.Since(start))
return egCtx.Err()
}
r, rerr := root.ResolveRootValue(egCtx)
if rerr != nil {
fmt.Fprintf(color.Output, "DUSTIN: InitWithRoots: resolve root error: elapsed: %v\n", time.Since(start))
return rerr
}
@@ -426,7 +420,6 @@ func (a *AutoIncrementTracker) InitWithRoots(ctx context.Context, roots ...doltd
seq, iErr := table.GetAutoIncrementValue(egCtx)
if iErr != nil {
fmt.Fprintf(color.Output, "DUSTIN: InitWithRoots: IterTables: get autoincrement value error: elapsed: %v\n", time.Since(start))
return true, iErr
}
@@ -440,11 +433,5 @@ func (a *AutoIncrementTracker) InitWithRoots(ctx context.Context, roots ...doltd
})
}
err := eg.Wait()
if err != nil {
return err
}
fmt.Fprintf(color.Output, "DUSTIN: InitWithRoots: success: elapsed: %v\n", time.Since(start))
return nil
return eg.Wait()
}

View File

@@ -16,12 +16,9 @@ package dsess
import (
"context"
"fmt"
"sync"
"time"
"github.com/dolthub/go-mysql-server/sql"
"github.com/fatih/color"
"golang.org/x/sync/errgroup"
"github.com/dolthub/dolt/go/libraries/doltcore/doltdb"
@@ -30,16 +27,13 @@ import (
)
func NewGlobalStateStoreForDb(ctx context.Context, dbName string, db *doltdb.DoltDB) (GlobalStateImpl, error) {
start := time.Now()
branches, err := db.GetBranches(ctx)
if err != nil {
fmt.Fprintf(color.Output, "DUSTIN: NewGlobalStateStoreForDb: get branches error: elapsed: %v\n", time.Since(start))
return GlobalStateImpl{}, err
}
remotes, err := db.GetRemoteRefs(ctx)
if err != nil {
fmt.Fprintf(color.Output, "DUSTIN: NewGlobalStateStoreForDb: get remote refs error: elapsed: %v\n", time.Since(start))
return GlobalStateImpl{}, err
}
@@ -65,7 +59,6 @@ func NewGlobalStateStoreForDb(ctx context.Context, dbName string, db *doltdb.Dol
case ref.BranchRefType:
wsRef, err := ref.WorkingSetRefForHead(b)
if err != nil {
fmt.Fprintf(color.Output, "DUSTIN: NewGlobalStateStoreForDb: working set error: elapsed: %v\n", time.Since(start))
return err
}
@@ -74,12 +67,10 @@ func NewGlobalStateStoreForDb(ctx context.Context, dbName string, db *doltdb.Dol
// use the branch head if there isn't a working set for it
cm, err := db.ResolveCommitRef(egCtx, b)
if err != nil {
fmt.Fprintf(color.Output, "DUSTIN: NewGlobalStateStoreForDb: resolve commit error: elapsed: %v\n", time.Since(start))
return err
}
rootRefsChan <- cm
} else if err != nil {
fmt.Fprintf(color.Output, "DUSTIN: NewGlobalStateStoreForDb: resolve working set error: elapsed: %v\n", time.Since(start))
return err
} else {
rootRefsChan <- ws
@@ -87,7 +78,6 @@ func NewGlobalStateStoreForDb(ctx context.Context, dbName string, db *doltdb.Dol
case ref.RemoteRefType:
cm, err := db.ResolveCommitRef(egCtx, b)
if err != nil {
fmt.Fprintf(color.Output, "DUSTIN: NewGlobalStateStoreForDb: resolve commit remote ref error: elapsed: %v\n", time.Since(start))
return err
}
rootRefsChan <- cm
@@ -101,21 +91,11 @@ func NewGlobalStateStoreForDb(ctx context.Context, dbName string, db *doltdb.Dol
return GlobalStateImpl{}, err
}
if len(rootRefsChan) != len(rootRefs) {
fmt.Fprintf(color.Output, "DUSTIN: NewGlobalStateStoreForDb: rootRefsChan does not equal rootRefs\n")
}
fmt.Fprintf(color.Output, "DUSTIN: NewGlobalStateStoreForDb: success: elapsed: %v\n", time.Since(start))
var roots []doltdb.Rootish
for rootRef := range rootRefsChan {
roots = append(roots, rootRef)
}
if len(roots) != len(rootRefs) {
fmt.Fprintf(color.Output, "DUSTIN: NewGlobalStateStoreForDb: roots does not equal rootRefs\n")
}
tracker, err := NewAutoIncrementTracker(ctx, dbName, roots...)
if err != nil {
return GlobalStateImpl{}, err