[ga-format-pr] Run go/utils/repofmt/format_repo.sh and go/Godeps/update.sh

This commit is contained in:
zachmu
2023-04-27 18:45:09 +00:00
parent 10d74d25d4
commit 01b40f62eb
17 changed files with 71 additions and 76 deletions
-4
View File
@@ -166,10 +166,6 @@ github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2 h1:u3PMzfF8RkKd3lB9pZ2bfn0qEG+1G
github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2/go.mod h1:mIEZOHnFx4ZMQeawhw9rhsj+0zwQj7adVsnBX7t+eKY=
github.com/dolthub/fslock v0.0.3 h1:iLMpUIvJKMKm92+N1fmHVdxJP5NdyDK5bK7z7Ba2s2U=
github.com/dolthub/fslock v0.0.3/go.mod h1:QWql+P17oAAMLnL4HGB5tiovtDuAjdDTPbuqx7bYfa0=
github.com/dolthub/go-mysql-server v0.15.1-0.20230419220841-24dded8c61ef h1:V0FbcJR0nYgeDG1iYhrfy7SxkZsaYqlV8BRfzSkp/2A=
github.com/dolthub/go-mysql-server v0.15.1-0.20230419220841-24dded8c61ef/go.mod h1:1/+9LW/gnZSVmXjc9DpEI+3thxjO/rSwasNw+9h3VvM=
github.com/dolthub/go-mysql-server v0.15.1-0.20230424210837-b0555760f17e h1:677Wo/DrEn72agIX5nDSXqZ+isyF+GpFrlCJ4DOWfj8=
github.com/dolthub/go-mysql-server v0.15.1-0.20230424210837-b0555760f17e/go.mod h1:B+vF4ambU4nWlkqEivILt0KJyvnIV22xFNWB9Xje948=
github.com/dolthub/go-mysql-server v0.15.1-0.20230424215657-62cb35ac61a2 h1:jKtEfBQlcYknZSRpjFfo0V0sqybrWoCQTdmoVkAVdGY=
github.com/dolthub/go-mysql-server v0.15.1-0.20230424215657-62cb35ac61a2/go.mod h1:B+vF4ambU4nWlkqEivILt0KJyvnIV22xFNWB9Xje948=
github.com/dolthub/ishell v0.0.0-20221214210346-d7db0b066488 h1:0HHu0GWJH0N6a6keStrHhUAK5/o9LVfkh44pvsV4514=
+5 -5
View File
@@ -23,6 +23,8 @@ import (
"strings"
"time"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/dolt/go/libraries/doltcore/dbfactory"
"github.com/dolthub/dolt/go/libraries/doltcore/ref"
"github.com/dolthub/dolt/go/libraries/utils/filesys"
@@ -33,7 +35,6 @@ import (
"github.com/dolthub/dolt/go/store/prolly/tree"
"github.com/dolthub/dolt/go/store/types"
"github.com/dolthub/dolt/go/store/types/edits"
"github.com/dolthub/go-mysql-server/sql"
)
func init() {
@@ -260,7 +261,7 @@ func (ddb *DoltDB) GetHashForRefStrByNomsRoot(ctx context.Context, ref string, n
if err != nil {
return nil, err
}
return hashOfCommit(ds, ref)
}
@@ -372,7 +373,7 @@ func (ddb *DoltDB) getHashFromCommitSpec(ctx context.Context, cs *CommitSpec, cw
}
if nomsRoot.IsEmpty() {
return ddb.GetHashForRefStr(ctx, cwb.String())
}else {
} else {
return ddb.GetHashForRefStrByNomsRoot(ctx, cwb.String(), nomsRoot)
}
default:
@@ -426,7 +427,6 @@ func (ddb *DoltDB) ResolveByNomsRoot(ctx *sql.Context, cs *CommitSpec, cwb ref.D
return commit.GetAncestor(ctx, cs.aSpec)
}
// ResolveCommitRef takes a DoltRef and returns a Commit, or an error if the commit cannot be found. The ref given must
// point to a Commit.
func (ddb *DoltDB) ResolveCommitRef(ctx context.Context, ref ref.DoltRef) (*Commit, error) {
@@ -1675,4 +1675,4 @@ func (ddb *DoltDB) GetStashRootAndHeadCommitAtIdx(ctx context.Context, idx int)
}
return getStashAtIdx(ctx, ds, ddb.vrw, ddb.NodeStore(), idx)
}
}
@@ -18,7 +18,6 @@ import (
"context"
"fmt"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/dsess"
sqle "github.com/dolthub/go-mysql-server"
"github.com/dolthub/go-mysql-server/sql"
@@ -28,6 +27,7 @@ import (
"github.com/dolthub/dolt/go/libraries/doltcore/row"
"github.com/dolthub/dolt/go/libraries/doltcore/schema"
dsqle "github.com/dolthub/dolt/go/libraries/doltcore/sqle"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/dsess"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/sqlutil"
)
+1 -1
View File
@@ -469,7 +469,7 @@ func resolveAsOfTime(ctx *sql.Context, ddb *doltdb.DoltDB, head ref.DoltRef, asO
func resolveAsOfCommitRef(ctx *sql.Context, db Database, head ref.DoltRef, commitRef string) (*doltdb.Commit, *doltdb.RootValue, error) {
ddb := db.ddb
if commitRef == doltdb.Working || commitRef == doltdb.Staged {
sess := dsess.DSessFromSess(ctx.Session)
root, _, _, err := sess.ResolveRootForRef(ctx, ctx.GetCurrentDatabase(), commitRef)
@@ -315,18 +315,18 @@ func (p DoltDatabaseProvider) AllDatabases(ctx *sql.Context) (all []sql.Database
func (p DoltDatabaseProvider) DoltDatabases() []dsess.SqlDatabase {
p.mu.RLock()
defer p.mu.RUnlock()
dbs := make([]dsess.SqlDatabase, len(p.databases))
i := 0
for _, db := range p.databases {
dbs[i] = db
i++
}
sort.Slice(dbs, func(i, j int) bool {
return strings.ToLower(dbs[i].Name()) < strings.ToLower(dbs[j].Name())
})
return dbs
}
@@ -1284,15 +1284,15 @@ func initialStateForBranchDb(ctx *sql.Context, srcDb dsess.SqlDatabase) (dsess.I
_, revSpec := dsess.SplitRevisionDbName(srcDb)
// TODO: this may be a disabled transaction, need to kill those
rootHash, err := dsess.TransactionRoot(ctx, srcDb)
if err != nil {
return dsess.InitialDbState{}, err
}
branch := ref.NewBranchRef(revSpec)
cm, err := srcDb.DbData().Ddb.ResolveCommitRefAtRoot(ctx, branch, rootHash)
if err != nil {
if err != nil {
return dsess.InitialDbState{}, err
}
@@ -21,13 +21,13 @@ import (
"math"
"strings"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/dsess"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
"golang.org/x/sync/errgroup"
"github.com/dolthub/dolt/go/libraries/doltcore/diff"
"github.com/dolthub/dolt/go/libraries/doltcore/doltdb"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/dsess"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/dtables"
)
@@ -20,12 +20,12 @@ import (
"sort"
"strings"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/dsess"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/libraries/doltcore/diff"
"github.com/dolthub/dolt/go/libraries/doltcore/schema"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/dsess"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/dtables"
)
@@ -20,7 +20,6 @@ import (
"sort"
"strings"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/dsess"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/expression"
"github.com/dolthub/go-mysql-server/sql/rowexec"
@@ -32,6 +31,7 @@ import (
"github.com/dolthub/dolt/go/libraries/doltcore/doltdb"
"github.com/dolthub/dolt/go/libraries/doltcore/env"
"github.com/dolthub/dolt/go/libraries/doltcore/schema"
"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/sqlfmt"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/sqlutil"
@@ -87,8 +87,8 @@ func commitTransaction(ctx *sql.Context, dSess *dsess.DoltSession) error {
if err != nil {
return err
}
// Because this transaction manipulation is happening outside the engine's awareness, we need to set it to nil here
// Because this transaction manipulation is happening outside the engine's awareness, we need to set it to nil here
// to get a fresh transaction started on the next statement.
// TODO: put this under engine control
ctx.SetTransaction(nil)
@@ -391,7 +391,7 @@ func createMergeSpec(ctx *sql.Context, sess *dsess.DoltSession, dbName string, a
if err != nil {
return nil, err
}
return mergeSpec, nil
}
@@ -297,4 +297,4 @@ func (e emptyRevisionDatabaseProvider) CreateDatabase(ctx *sql.Context, dbName s
func (e emptyRevisionDatabaseProvider) RevisionDbState(_ *sql.Context, revDB string) (InitialDbState, error) {
return InitialDbState{}, sql.ErrDatabaseNotFound.New(revDB)
}
}
+7 -7
View File
@@ -23,7 +23,6 @@ import (
"sync"
"time"
"github.com/dolthub/dolt/go/store/hash"
"github.com/dolthub/go-mysql-server/sql"
sqltypes "github.com/dolthub/go-mysql-server/sql/types"
goerrors "gopkg.in/src-d/go-errors.v1"
@@ -38,6 +37,7 @@ import (
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/writer"
"github.com/dolthub/dolt/go/libraries/doltcore/table/editor"
"github.com/dolthub/dolt/go/libraries/utils/config"
"github.com/dolthub/dolt/go/store/hash"
"github.com/dolthub/dolt/go/store/types"
)
@@ -203,7 +203,7 @@ func (d *DoltSession) Flush(ctx *sql.Context, dbName string) error {
if err != nil {
return err
}
return d.SetRoot(ctx, dbName, ws.WorkingRoot())
}
@@ -254,7 +254,7 @@ func (d *DoltSession) StartTransaction(ctx *sql.Context, tCharacteristic sql.Tra
if TransactionsDisabled(ctx) {
return DisabledTransaction{}, nil
}
// TODO: remove this when we have true multi-db transaction support
dbName := ctx.GetTransactionDatabase()
if isNoOpTransactionDatabase(dbName) {
@@ -343,11 +343,12 @@ func (d *DoltSession) StartTransaction(ctx *sql.Context, tCharacteristic sql.Tra
return NewDoltTransaction(dbName, nomsRoots, ws, wsRef, sessionState.dbData, sessionState.WriteSession.GetOptions(), tCharacteristic), nil
}
// clearRevisionDbState clears all revision DB states for this session. This is necessary on transaction start,
// clearRevisionDbState clears all revision DB states for this session. This is necessary on transaction start,
// because they will be re-initialized with the current branch head / working set.
// TODO: this should happen with every dbstate, not just revision DBs. The problem is that we track the current working
// set *only* in the session state. We need to disentangle the metadata about a state (working ref, persists across
// transactions) from its data (re-initialized on every transaction start)
//
// set *only* in the session state. We need to disentangle the metadata about a state (working ref, persists across
// transactions) from its data (re-initialized on every transaction start)
func (d *DoltSession) clearRevisionDbState() {
d.mu.Lock()
defer d.mu.Unlock()
@@ -1634,4 +1635,3 @@ func TransactionRoot(ctx *sql.Context, db SqlDatabase) (hash.Hash, error) {
const (
DbRevisionDelimiter = "/"
)
@@ -98,4 +98,3 @@ type SqlDatabase interface {
DbData() env.DbData
Flush(*sql.Context) error
}
@@ -18,12 +18,12 @@ import (
"fmt"
"io"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/dsess"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/dolt/go/libraries/doltcore/doltdb"
"github.com/dolthub/dolt/go/libraries/doltcore/ref"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/dsess"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/index"
)
@@ -115,9 +115,9 @@ func NewBranchItr(ctx *sql.Context, db dsess.SqlDatabase, remote bool) (*BranchI
if err != nil {
return nil, err
}
ddb := db.DbData().Ddb
if remote {
branchRefs, err = ddb.GetRefsOfTypeByNomsRoot(ctx, map[ref.RefType]struct{}{ref.RemoteRefType: {}}, txRoot)
if err != nil {
@@ -21,7 +21,6 @@ import (
"testing"
"time"
"github.com/dolthub/dolt/go/store/datas"
gms "github.com/dolthub/go-mysql-server"
"github.com/dolthub/go-mysql-server/enginetest"
"github.com/dolthub/go-mysql-server/enginetest/queries"
@@ -41,6 +40,7 @@ import (
"github.com/dolthub/dolt/go/libraries/doltcore/sqle"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/dsess"
"github.com/dolthub/dolt/go/libraries/utils/config"
"github.com/dolthub/dolt/go/store/datas"
"github.com/dolthub/dolt/go/store/types"
)
@@ -1448,7 +1448,7 @@ func TestSingleTransactionScript(t *testing.T) {
tcc := &testCommitClock{}
cleanup := installTestCommitClock(tcc)
defer cleanup()
sql.RunWithNowFunc(tcc.Now, func() error {
script := queries.TransactionTest{
@@ -1476,16 +1476,16 @@ func TestSingleTransactionScript(t *testing.T) {
Expected: []sql.Row{},
},
{
Query: "/* client a */ select * from dolt_log order by date",
Query: "/* client a */ select * from dolt_log order by date",
Expected:
// existing transaction logic
// existing transaction logic
[]sql.Row{
sql.Row{"j131v1r3cf6mrdjjjuqgkv4t33oa0l54", "billy bob", "bigbillieb@fake.horse", time.Date(1969, time.December, 31, 21, 0, 0, 0, time.Local), "Initialize data repository"},
sql.Row{"kcg4345ir3tjfb13mr0on1bv1m56h9if", "billy bob", "bigbillieb@fake.horse", time.Date(1970, time.January, 1, 4, 0, 0, 0, time.Local), "checkpoint enginetest database mydb"},
sql.Row{"9jtjpggd4t5nso3mefilbde3tkfosdna", "billy bob", "bigbillieb@fake.horse", time.Date(1970, time.January, 1, 12, 0, 0, 0, time.Local), "Step 1"},
sql.Row{"559f6kdh0mm5i1o40hs3t8dr43bkerav", "billy bob", "bigbillieb@fake.horse", time.Date(1970, time.January, 2, 3, 0, 0, 0, time.Local), "update a value"},
},
// new tx logic
// []sql.Row{
// sql.Row{"j131v1r3cf6mrdjjjuqgkv4t33oa0l54", "billy bob", "bigbillieb@fake.horse", time.Date(1969, time.December, 31, 21, 0, 0, 0, time.Local), "Initialize data repository"},
@@ -1565,7 +1565,7 @@ func TestSingleTransactionScript(t *testing.T) {
h := newDoltHarness(t)
defer h.Close()
enginetest.TestTransactionScript(t, h, script)
return nil
})
}
@@ -2157,8 +2157,8 @@ var DoltConstraintViolationTransactionTests = []queries.TransactionTest{
var BranchIsolationTests = []queries.TransactionTest{
{
Name: "clients can't see changes on other branch working sets made since transaction start",
SetUpScript: []string{
Name: "clients can't see changes on other branch working sets made since transaction start",
SetUpScript: []string{
"create table t1 (a int)",
"insert into t1 values (1)",
"call dolt_add('.')",
@@ -2167,9 +2167,9 @@ var BranchIsolationTests = []queries.TransactionTest{
"set autocommit = 0",
},
Assertions: []queries.ScriptTestAssertion{
{
{
Query: "/* client a */ start transaction",
SkipResultsCheck: true,
SkipResultsCheck: true,
},
{
Query: "/* client b */ start transaction",
@@ -2188,15 +2188,15 @@ var BranchIsolationTests = []queries.TransactionTest{
SkipResultsCheck: true,
},
{
Query: "/* client a */ select * from t1 order by a",
Query: "/* client a */ select * from t1 order by a",
Expected: []sql.Row{{1}},
},
{
Query: "/* client a */ select * from t1 as of 'b1' order by a",
Query: "/* client a */ select * from t1 as of 'b1' order by a",
Expected: []sql.Row{{1}},
},
{
Query: "/* client a */ select * from `mydb/b1`.t1 order by a",
Query: "/* client a */ select * from `mydb/b1`.t1 order by a",
Expected: []sql.Row{{1}},
},
{
@@ -2204,24 +2204,24 @@ var BranchIsolationTests = []queries.TransactionTest{
SkipResultsCheck: true,
},
{
Query: "/* client a */ select * from t1 order by a",
Query: "/* client a */ select * from t1 order by a",
Expected: []sql.Row{{1}},
},
{
// This query specifies the branch HEAD commit, which hasn't changed
Query: "/* client a */ select * from t1 as of 'b1' order by a",
Query: "/* client a */ select * from t1 as of 'b1' order by a",
Expected: []sql.Row{{1}},
},
{
// This query specifies the working set of that branch, which has changed
Query: "/* client a */ select * from `mydb/b1`.t1 order by a",
Query: "/* client a */ select * from `mydb/b1`.t1 order by a",
Expected: []sql.Row{{1}, {2}},
},
},
},
{
Name: "clients can't see changes on other branch heads made since transaction start",
SetUpScript: []string{
Name: "clients can't see changes on other branch heads made since transaction start",
SetUpScript: []string{
"create table t1 (a int)",
"insert into t1 values (1)",
"call dolt_add('.')",
@@ -2251,15 +2251,15 @@ var BranchIsolationTests = []queries.TransactionTest{
SkipResultsCheck: true,
},
{
Query: "/* client a */ select * from t1 order by a",
Query: "/* client a */ select * from t1 order by a",
Expected: []sql.Row{{1}},
},
{
Query: "/* client a */ select * from t1 as of 'b1' order by a",
Query: "/* client a */ select * from t1 as of 'b1' order by a",
Expected: []sql.Row{{1}},
},
{
Query: "/* client a */ select * from `mydb/b1`.t1 order by a",
Query: "/* client a */ select * from `mydb/b1`.t1 order by a",
Expected: []sql.Row{{1}},
},
{
@@ -2267,22 +2267,22 @@ var BranchIsolationTests = []queries.TransactionTest{
SkipResultsCheck: true,
},
{
Query: "/* client a */ select * from t1 order by a",
Query: "/* client a */ select * from t1 order by a",
Expected: []sql.Row{{1}},
},
{
Query: "/* client a */ select * from t1 as of 'b1' order by a",
Query: "/* client a */ select * from t1 as of 'b1' order by a",
Expected: []sql.Row{{1}, {2}},
},
{
Query: "/* client a */ select * from `mydb/b1`.t1 order by a",
Query: "/* client a */ select * from `mydb/b1`.t1 order by a",
Expected: []sql.Row{{1}, {2}},
},
},
},
{
Name: "dolt_branches table has consistent view",
SetUpScript: []string{
Name: "dolt_branches table has consistent view",
SetUpScript: []string{
"create table t1 (a int)",
"insert into t1 values (1)",
"call dolt_add('.')",
@@ -2304,24 +2304,24 @@ var BranchIsolationTests = []queries.TransactionTest{
SkipResultsCheck: true,
},
{
Query: "/* client b */ select name from dolt_branches order by 1",
Expected: []sql.Row{{"b2"}, {"main"}},
Query: "/* client b */ select name from dolt_branches order by 1",
Expected: []sql.Row{{"b2"}, {"main"}},
},
{
Query: "/* client b */ commit",
SkipResultsCheck: true,
},
{
Query: "/* client a */ select name from dolt_branches order by 1",
Expected: []sql.Row{{"b1"}, {"main"}},
Query: "/* client a */ select name from dolt_branches order by 1",
Expected: []sql.Row{{"b1"}, {"main"}},
},
{
Query: "/* client a */ start transaction",
SkipResultsCheck: true,
},
{
Query: "/* client a */ select name from dolt_branches order by 1",
Expected: []sql.Row{{"b2"}, {"main"}},
Query: "/* client a */ select name from dolt_branches order by 1",
Expected: []sql.Row{{"b2"}, {"main"}},
},
},
},
@@ -2329,8 +2329,8 @@ var BranchIsolationTests = []queries.TransactionTest{
var MultiDbTransactionTests = []queries.ScriptTest{
{
Name: "committing to another branch",
SetUpScript: []string{
Name: "committing to another branch",
SetUpScript: []string{
"create table t1 (a int)",
"call dolt_add('.')",
"call dolt_commit('-am', 'new table')",
@@ -2345,17 +2345,17 @@ var MultiDbTransactionTests = []queries.ScriptTest{
},
},
{
Query: "insert into `mydb/b1`.t1 values (2)",
Query: "insert into `mydb/b1`.t1 values (2)",
Expected: []sql.Row{
{types.OkResult{RowsAffected: 1}},
},
},
{
Query: "commit",
Query: "commit",
Expected: []sql.Row{},
},
{
Query: "select * from t1 order by a",
Query: "select * from t1 order by a",
Expected: []sql.Row{},
},
{
@@ -2363,9 +2363,9 @@ var MultiDbTransactionTests = []queries.ScriptTest{
SkipResultsCheck: true,
},
{
Query: "select * from t1 order by a",
Query: "select * from t1 order by a",
Expected: []sql.Row{
{1},{2},
{1}, {2},
},
},
},
+2 -2
View File
@@ -59,11 +59,11 @@ type Database interface {
// GetDataset returns a Dataset struct containing the current mapping of
// datasetID in the above Datasets Map.
GetDataset(ctx context.Context, datasetID string) (Dataset, error)
// DatasetsByRootHash returns all datasets as of the root hash given
DatasetsByRootHash(ctx context.Context, rootHash hash.Hash) (DatasetsMap, error)
// GetDatasetByRootHash returns a Dataset struct containing the mapping of datasetId in the Datasets map as it
// GetDatasetByRootHash returns a Dataset struct containing the mapping of datasetId in the Datasets map as it
// existed at the root hash given.
GetDatasetByRootHash(ctx context.Context, datasetID string, rootHash hash.Hash) (Dataset, error)