Skip to content

Commit

Permalink
go: dtables: help_table: Manually specify that dolt_gc exists for now.
Browse files Browse the repository at this point in the history
  • Loading branch information
reltuk committed Jan 29, 2025
1 parent 13c9ddf commit 819136d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions go/libraries/doltcore/sqle/dtables/help_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,11 @@ func generateProcedureHelpRows(cmdStr string, cmd cli.Command) ([]sql.Row, error

// procedureExists returns whether |procedureName| is the name of a dolt procedure.
func procedureExists(procedureName string) bool {
// "dolt_gc" is dynamically registered because it has state (a safepoint controller).
// For now, special case it here.
if procedureName == "dolt_gc" {
return true
}
for _, procedure := range dprocedures.DoltProcedures {
if procedure.Name == procedureName {
return true
Expand Down
2 changes: 2 additions & 0 deletions go/libraries/doltcore/sqle/enginetest/dolt_harness.go
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,8 @@ func (d *DoltHarness) NewReadOnlyEngine(provider sql.DatabaseProvider) (enginete
if err != nil {
return nil, err
}
gcSafepointController := dsess.NewGCSafepointController()
readOnlyProvider.RegisterProcedure(dprocedures.NewDoltGCProcedure(gcSafepointController))

// reset the session as well since we have swapped out the database provider, which invalidates caching assumptions
d.session, err = dsess.NewDoltSession(enginetest.NewBaseSession(), readOnlyProvider, d.multiRepoEnv.Config(), d.branchControl, d.statsPro, writer.NewWriteSession, nil)
Expand Down
3 changes: 3 additions & 0 deletions go/libraries/doltcore/sqle/sqlddl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
"github.com/dolthub/dolt/go/libraries/doltcore/env"
"github.com/dolthub/dolt/go/libraries/doltcore/row"
"github.com/dolthub/dolt/go/libraries/doltcore/schema"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/dprocedures"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/dsess"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/dtables"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/sqlutil"
Expand Down Expand Up @@ -1107,6 +1108,8 @@ func newTestEngine(ctx context.Context, dEnv *env.DoltEnv) (*gms.Engine, *sql.Co
if err != nil {
panic(err)
}
gcSafepointController := dsess.NewGCSafepointController()
pro.RegisterProcedure(dprocedures.NewDoltGCProcedure(gcSafepointController))

mrEnv, err := env.MultiEnvForDirectory(ctx, dEnv.Config.WriteableConfig(), dEnv.FS, dEnv.Version, dEnv)
if err != nil {
Expand Down
3 changes: 3 additions & 0 deletions go/libraries/doltcore/sqle/testutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"github.com/dolthub/dolt/go/libraries/doltcore/env"
"github.com/dolthub/dolt/go/libraries/doltcore/row"
"github.com/dolthub/dolt/go/libraries/doltcore/schema"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/dprocedures"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/dsess"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/sqlutil"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/writer"
Expand Down Expand Up @@ -135,6 +136,8 @@ func NewTestEngine(dEnv *env.DoltEnv, ctx context.Context, db dsess.SqlDatabase)
if err != nil {
return nil, nil, err
}
gcSafepointController := dsess.NewGCSafepointController()
pro.Register(dprocedures.NewDoltGCProcedure(gcSafepointController))

engine := sqle.NewDefault(pro)

Expand Down

0 comments on commit 819136d

Please sign in to comment.