mirror of
https://github.com/dolthub/dolt.git
synced 2026-05-12 19:39:32 -05:00
fixed conflicts
This commit is contained in:
@@ -172,6 +172,73 @@ SQL
|
||||
[[ ! "$output" =~ "README.md" ]] || false
|
||||
}
|
||||
|
||||
@test "read tables test" {
|
||||
# create table t1 and commit
|
||||
dolt remote add test-remote http://localhost:50051/test-org/test-repo
|
||||
dolt sql <<SQL
|
||||
CREATE TABLE t1 (
|
||||
pk BIGINT NOT NULL,
|
||||
PRIMARY KEY (pk)
|
||||
);
|
||||
SQL
|
||||
dolt add t1
|
||||
dolt commit -m "added t1"
|
||||
|
||||
# create table t2 and commit
|
||||
dolt sql <<SQL
|
||||
CREATE TABLE t2 (
|
||||
pk BIGINT NOT NULL,
|
||||
PRIMARY KEY (pk)
|
||||
);
|
||||
SQL
|
||||
dolt add t2
|
||||
dolt commit -m "added t2"
|
||||
|
||||
# create table t3 and commit
|
||||
dolt sql <<SQL
|
||||
CREATE TABLE t3 (
|
||||
pk BIGINT NOT NULL,
|
||||
PRIMARY KEY (pk)
|
||||
);
|
||||
SQL
|
||||
dolt add t3
|
||||
dolt commit -m "added t3"
|
||||
|
||||
# push repo
|
||||
dolt push test-remote master
|
||||
cd "dolt-repo-clones"
|
||||
|
||||
# Create a read latest tables and verify we have all the tables
|
||||
dolt read-tables http://localhost:50051/test-org/test-repo master
|
||||
cd test-repo
|
||||
run dolt ls
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "t1" ]] || false
|
||||
[[ "$output" =~ "t2" ]] || false
|
||||
[[ "$output" =~ "t3" ]] || false
|
||||
cd ..
|
||||
|
||||
# Read specific table from latest with a specified directory
|
||||
dolt read-tables --dir clone_t1_t2 http://localhost:50051/test-org/test-repo master t1 t2
|
||||
cd clone_t1_t2
|
||||
run dolt ls
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "t1" ]] || false
|
||||
[[ "$output" =~ "t2" ]] || false
|
||||
[[ ! "$output" =~ "t3" ]] || false
|
||||
cd ..
|
||||
|
||||
# Read tables from parent of parent of the tip of master. Should only have table t1
|
||||
dolt read-tables --dir clone_t1 http://localhost:50051/test-org/test-repo master~2
|
||||
cd clone_t1
|
||||
run dolt ls
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "t1" ]] || false
|
||||
[[ ! "$output" =~ "t2" ]] || false
|
||||
[[ ! "$output" =~ "t3" ]] || false
|
||||
cd ..
|
||||
}
|
||||
|
||||
@test "clone a remote with docs" {
|
||||
dolt remote add test-remote http://localhost:50051/test-org/test-repo
|
||||
echo "license-text" > LICENSE.md
|
||||
|
||||
@@ -352,3 +352,8 @@ func HandleVErrAndExitCode(verr errhand.VerboseError, usage cli.UsagePrinter) in
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
// BuildVerrAndExit is a shortcut for building a verbose error and calling HandleVerrAndExitCode with it
|
||||
func BuildVerrAndExit(errMsg string, cause error) int {
|
||||
return HandleVErrAndExitCode(errhand.BuildDError(errMsg).AddCause(cause).Build(), nil)
|
||||
}
|
||||
|
||||
@@ -208,10 +208,12 @@ func envForClone(ctx context.Context, nbf *types.NomsBinFormat, r env.Remote, di
|
||||
}
|
||||
|
||||
dEnv.RSLoadErr = nil
|
||||
dEnv.RepoState, err = env.CloneRepoState(dEnv.FS, r)
|
||||
if !env.IsEmptyRemote(r) {
|
||||
dEnv.RepoState, err = env.CloneRepoState(dEnv.FS, r)
|
||||
|
||||
if err != nil {
|
||||
return nil, errhand.BuildDError("error: unable to create repo state with remote " + r.Name).AddCause(err).Build()
|
||||
if err != nil {
|
||||
return nil, errhand.BuildDError("error: unable to create repo state with remote " + r.Name).AddCause(err).Build()
|
||||
}
|
||||
}
|
||||
|
||||
return dEnv, nil
|
||||
@@ -314,7 +316,7 @@ func cloneRemote(ctx context.Context, srcDB *doltdb.DoltDB, remoteName, branch s
|
||||
// the remote.
|
||||
performPull := true
|
||||
if branch == "" {
|
||||
err = initEmptyClonedRepo(dEnv, err, ctx)
|
||||
err = initEmptyClonedRepo(ctx, dEnv)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
@@ -392,7 +394,7 @@ func cloneRemote(ctx context.Context, srcDB *doltdb.DoltDB, remoteName, branch s
|
||||
|
||||
// Inits an empty, newly cloned repo. This would be unnecessary if we properly initialized the storage for a repository
|
||||
// when we created it on dolthub. If we do that, this code can be removed.
|
||||
func initEmptyClonedRepo(dEnv *env.DoltEnv, err error, ctx context.Context) error {
|
||||
func initEmptyClonedRepo(ctx context.Context, dEnv *env.DoltEnv) error {
|
||||
name := dEnv.Config.GetStringOrDefault(env.UserNameKey, "")
|
||||
email := dEnv.Config.GetStringOrDefault(env.UserEmailKey, "")
|
||||
|
||||
@@ -402,7 +404,7 @@ func initEmptyClonedRepo(dEnv *env.DoltEnv, err error, ctx context.Context) erro
|
||||
return errhand.BuildDError("error: could not determine email. run dolt config --global --add %[1]s", env.UserEmailKey).Build()
|
||||
}
|
||||
|
||||
err = dEnv.InitDBWithTime(ctx, types.Format_Default, *name, *email, doltdb.CommitNowFunc())
|
||||
err := dEnv.InitDBWithTime(ctx, types.Format_Default, *name, *email, doltdb.CommitNowFunc())
|
||||
if err != nil {
|
||||
return errhand.BuildDError("error: could not initialize repository").AddCause(err).Build()
|
||||
}
|
||||
|
||||
@@ -0,0 +1,245 @@
|
||||
// Copyright 2019 Liquidata, Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package commands
|
||||
|
||||
import (
|
||||
"context"
|
||||
"path"
|
||||
|
||||
"github.com/liquidata-inc/dolt/go/libraries/doltcore/doltdb"
|
||||
"github.com/liquidata-inc/dolt/go/libraries/utils/earl"
|
||||
"github.com/liquidata-inc/dolt/go/store/types"
|
||||
|
||||
"github.com/liquidata-inc/dolt/go/cmd/dolt/cli"
|
||||
"github.com/liquidata-inc/dolt/go/cmd/dolt/errhand"
|
||||
"github.com/liquidata-inc/dolt/go/libraries/doltcore/env"
|
||||
"github.com/liquidata-inc/dolt/go/libraries/utils/argparser"
|
||||
"github.com/liquidata-inc/dolt/go/libraries/utils/filesys"
|
||||
)
|
||||
|
||||
var readTablesDocs = cli.CommandDocumentationContent{
|
||||
ShortDesc: "Fetch table(s) at a specific commit into a new dolt repo",
|
||||
LongDesc: "A shallow clone operation will retrieve the state of table(s) from a remote repository at a given commit. " +
|
||||
"Retrieved data is placed into the working state of a newly created local Dolt repository. Changes to the data cannot " +
|
||||
"be submitted back to the remote repository, and the shallow clone cannot be converted into a regular clone of a " +
|
||||
"repository.",
|
||||
Synopsis: []string{
|
||||
"[--dir <directory>] {{.LessThan}}remote-url{{.GreaterThan}} {{.LessThan}}commit{{.GreaterThan}} [{{.LessThan}}table{{.GreaterThan}}...]",
|
||||
},
|
||||
}
|
||||
|
||||
// ReadTablesCmd is the implementation of the shallow-clone command
|
||||
type ReadTablesCmd struct{}
|
||||
|
||||
// Name is returns the name of the Dolt cli command. This is what is used on the command line to invoke the command
|
||||
func (cmd ReadTablesCmd) Name() string {
|
||||
return "read-tables"
|
||||
}
|
||||
|
||||
// Description returns a description of the command
|
||||
func (cmd ReadTablesCmd) Description() string {
|
||||
return readTablesDocs.ShortDesc
|
||||
}
|
||||
|
||||
// CreateMarkdown creates a markdown file containing the helptext for the command at the given path
|
||||
func (cmd ReadTablesCmd) CreateMarkdown(fs filesys.Filesys, path, commandStr string) error {
|
||||
ap := cmd.createArgParser()
|
||||
return CreateMarkdown(fs, path, cli.GetCommandDocumentation(commandStr, readTablesDocs, ap))
|
||||
}
|
||||
|
||||
// RequiresRepo should return false if this interface is implemented, and the command does not have the requirement
|
||||
// that it be run from within a data repository directory
|
||||
func (cmd ReadTablesCmd) RequiresRepo() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (cmd ReadTablesCmd) createArgParser() *argparser.ArgParser {
|
||||
ap := argparser.NewArgParser()
|
||||
ap.ArgListHelp = [][2]string{
|
||||
{"remote-repo", "Remote repository to retrieve data from"},
|
||||
{"commit", "Branch or commit hash representing a point in time to retrieve tables from"},
|
||||
{"table", " Optional tables to retrieve. If omitted, all tables are retrieved."},
|
||||
}
|
||||
ap.SupportsString(dirParamName, "d", "directory", "directory to createe and put retrieved table data.")
|
||||
return ap
|
||||
}
|
||||
|
||||
// Exec executes the command
|
||||
func (cmd ReadTablesCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
|
||||
ap := cmd.createArgParser()
|
||||
|
||||
help, usage := cli.HelpAndUsagePrinters(cli.GetCommandDocumentation(commandStr, readTablesDocs, ap))
|
||||
apr := cli.ParseArgs(ap, args, help)
|
||||
|
||||
if apr.NArg() < 2 {
|
||||
return HandleVErrAndExitCode(errhand.BuildDError("Missing required arguments").SetPrintUsage().Build(), usage)
|
||||
}
|
||||
|
||||
urlStr := apr.Arg(0)
|
||||
commitStr := apr.Arg(1)
|
||||
tblNames := apr.Args()[2:]
|
||||
|
||||
_, err := earl.Parse(urlStr)
|
||||
|
||||
if err != nil {
|
||||
return HandleVErrAndExitCode(errhand.BuildDError("Invalid remote url").AddCause(err).Build(), usage)
|
||||
}
|
||||
|
||||
dir := apr.GetValueOrDefault(dirParamName, path.Base(urlStr))
|
||||
|
||||
if dir == "" {
|
||||
return HandleVErrAndExitCode(errhand.BuildDError(`parameter %s has an invalid value of ""`, dirParamName).Build(), usage)
|
||||
}
|
||||
|
||||
scheme, remoteUrl, err := getAbsRemoteUrl(dEnv.FS, dEnv.Config, urlStr)
|
||||
|
||||
if err != nil {
|
||||
return HandleVErrAndExitCode(errhand.BuildDError("Invalid remote url").AddCause(err).Build(), usage)
|
||||
}
|
||||
|
||||
remoteUrlParams, verr := parseRemoteArgs(apr, scheme, remoteUrl)
|
||||
|
||||
if verr != nil {
|
||||
return HandleVErrAndExitCode(verr, usage)
|
||||
}
|
||||
|
||||
srcDB, srcRoot, verr := getRemoteDBAtCommit(ctx, remoteUrl, remoteUrlParams, commitStr)
|
||||
if verr != nil {
|
||||
return HandleVErrAndExitCode(verr, usage)
|
||||
}
|
||||
|
||||
dEnv, verr = initializeShallowCloneRepo(ctx, dEnv, srcDB.Format(), dir)
|
||||
if verr != nil {
|
||||
return HandleVErrAndExitCode(verr, usage)
|
||||
}
|
||||
|
||||
destRoot, err := dEnv.WorkingRoot(ctx)
|
||||
|
||||
if err != nil {
|
||||
return BuildVerrAndExit("Failed to read working root", err)
|
||||
}
|
||||
|
||||
if len(tblNames) == 0 {
|
||||
tblNames, err = srcRoot.GetTableNames(ctx)
|
||||
|
||||
if err != nil {
|
||||
return BuildVerrAndExit("Unable to read tables.", err)
|
||||
}
|
||||
}
|
||||
|
||||
for _, tblName := range tblNames {
|
||||
destRoot, verr = pullTableValue(ctx, dEnv, srcDB, srcRoot, destRoot, tblName, commitStr)
|
||||
|
||||
if verr != nil {
|
||||
return HandleVErrAndExitCode(verr, usage)
|
||||
}
|
||||
}
|
||||
|
||||
err = dEnv.UpdateWorkingRoot(ctx, destRoot)
|
||||
|
||||
if err != nil {
|
||||
return BuildVerrAndExit("Unable to update the working root for local database.", err)
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
func pullTableValue(ctx context.Context, dEnv *env.DoltEnv, srcDB *doltdb.DoltDB, srcRoot, destRoot *doltdb.RootValue, tblName, commitStr string) (*doltdb.RootValue, errhand.VerboseError) {
|
||||
tbl, ok, err := srcRoot.GetTable(ctx, tblName)
|
||||
|
||||
if !ok {
|
||||
return nil, errhand.BuildDError("No table named '%s' at '%s'", tblName, commitStr).Build()
|
||||
} else if err != nil {
|
||||
return nil, errhand.BuildDError("Failed reading table '%s' from remote database.", tblName).AddCause(err).Build()
|
||||
}
|
||||
|
||||
tblHash, err := tbl.HashOf()
|
||||
|
||||
if err != nil {
|
||||
return nil, errhand.BuildDError("Unable to read from remote database.").AddCause(err).Build()
|
||||
}
|
||||
|
||||
cli.Println("Retrieving", tblName)
|
||||
wg, progChan, pullerEventCh := runProgFuncs()
|
||||
err = dEnv.DoltDB.PushChunksForRefHash(ctx, dEnv.TempTableFilesDir(), srcDB, tblHash, pullerEventCh)
|
||||
|
||||
if err != nil {
|
||||
return nil, errhand.BuildDError("Failed reading chunks for remote table '%s' at '%s'", tblName, commitStr).AddCause(err).Build()
|
||||
}
|
||||
|
||||
stopProgFuncs(wg, progChan, pullerEventCh)
|
||||
|
||||
if err != nil {
|
||||
return nil, errhand.BuildDError("Failed to pull chunks.").AddCause(err).Build()
|
||||
}
|
||||
|
||||
destRoot, err = destRoot.SetTableHash(ctx, tblName, tblHash)
|
||||
|
||||
if err != nil {
|
||||
return nil, errhand.BuildDError("Unable to write to local database.").AddCause(err).Build()
|
||||
}
|
||||
|
||||
return destRoot, nil
|
||||
}
|
||||
|
||||
func getRemoteDBAtCommit(ctx context.Context, remoteUrl string, remoteUrlParams map[string]string, commitStr string) (*doltdb.DoltDB, *doltdb.RootValue, errhand.VerboseError) {
|
||||
_, srcDB, verr := createRemote(ctx, "temp", remoteUrl, remoteUrlParams)
|
||||
|
||||
if verr != nil {
|
||||
return nil, nil, verr
|
||||
}
|
||||
|
||||
cs, err := doltdb.NewCommitSpec(commitStr)
|
||||
|
||||
if err != nil {
|
||||
return nil, nil, errhand.BuildDError("Invalid Commit '%s'", commitStr).Build()
|
||||
}
|
||||
|
||||
cm, err := srcDB.Resolve(ctx, cs, nil)
|
||||
|
||||
if err != nil {
|
||||
return nil, nil, errhand.BuildDError("Failed to find commit '%s'", commitStr).Build()
|
||||
}
|
||||
|
||||
srcRoot, err := cm.GetRootValue()
|
||||
|
||||
if err != nil {
|
||||
return nil, nil, errhand.BuildDError("Failed to read from database").AddCause(err).Build()
|
||||
}
|
||||
|
||||
return srcDB, srcRoot, nil
|
||||
}
|
||||
|
||||
func initializeShallowCloneRepo(ctx context.Context, dEnv *env.DoltEnv, nbf *types.NomsBinFormat, dir string) (*env.DoltEnv, errhand.VerboseError) {
|
||||
var verr errhand.VerboseError
|
||||
dEnv, verr = envForClone(ctx, nbf, env.NoRemote, dir, dEnv.FS, dEnv.Version)
|
||||
|
||||
if verr != nil {
|
||||
return nil, verr
|
||||
}
|
||||
|
||||
err := initEmptyClonedRepo(ctx, dEnv)
|
||||
if err != nil {
|
||||
return nil, errhand.BuildDError("Unable to initialize repo.").AddCause(err).Build()
|
||||
}
|
||||
|
||||
err = dEnv.InitializeRepoState(ctx)
|
||||
|
||||
if err != nil {
|
||||
return nil, errhand.BuildDError("Unable to initialize repo.").AddCause(err).Build()
|
||||
}
|
||||
|
||||
return dEnv, nil
|
||||
}
|
||||
@@ -30,9 +30,9 @@ import (
|
||||
"github.com/liquidata-inc/go-mysql-server/sql"
|
||||
"github.com/liquidata-inc/go-mysql-server/sql/analyzer"
|
||||
"github.com/liquidata-inc/ishell"
|
||||
"github.com/liquidata-inc/vitess/go/vt/sqlparser"
|
||||
"github.com/liquidata-inc/vitess/go/vt/vterrors"
|
||||
"gopkg.in/src-d/go-errors.v1"
|
||||
"vitess.io/vitess/go/vt/sqlparser"
|
||||
"vitess.io/vitess/go/vt/vterrors"
|
||||
|
||||
"github.com/liquidata-inc/dolt/go/cmd/dolt/cli"
|
||||
"github.com/liquidata-inc/dolt/go/cmd/dolt/errhand"
|
||||
|
||||
@@ -24,8 +24,8 @@ import (
|
||||
"github.com/liquidata-inc/go-mysql-server/auth"
|
||||
"github.com/liquidata-inc/go-mysql-server/server"
|
||||
"github.com/liquidata-inc/go-mysql-server/sql"
|
||||
"github.com/liquidata-inc/vitess/go/mysql"
|
||||
"github.com/sirupsen/logrus"
|
||||
"vitess.io/vitess/go/mysql"
|
||||
|
||||
"github.com/liquidata-inc/dolt/go/cmd/dolt/cli"
|
||||
"github.com/liquidata-inc/dolt/go/cmd/dolt/commands"
|
||||
|
||||
@@ -77,6 +77,7 @@ var doltCommand = cli.NewSubCommandHandler("dolt", "it's git for data", []cli.Co
|
||||
dumpDocsCommand,
|
||||
commands.MigrateCmd{},
|
||||
indexcmds.Commands,
|
||||
commands.ReadTablesCmd{},
|
||||
commands.TagCmd{},
|
||||
})
|
||||
|
||||
|
||||
@@ -45,10 +45,11 @@ require (
|
||||
github.com/juju/gnuflag v0.0.0-20171113085948-2ce1bb71843d
|
||||
github.com/kch42/buzhash v0.0.0-20160816060738-9bdec3dec7c6
|
||||
github.com/liquidata-inc/dolt/go/gen/proto/dolt/services/eventsapi v0.0.0-20200730200742-c031ec8cba06
|
||||
github.com/liquidata-inc/go-mysql-server v0.5.1-0.20200807172435-6afbd6a26e29
|
||||
github.com/liquidata-inc/go-mysql-server v0.5.1-0.20200807224414-9fff937bd775
|
||||
github.com/liquidata-inc/ishell v0.0.0-20190514193646-693241f1f2a0
|
||||
github.com/liquidata-inc/mmap-go v1.0.3
|
||||
github.com/liquidata-inc/sqllogictest/go v0.0.0-20200320151923-b11801f10e15
|
||||
github.com/liquidata-inc/vitess v0.0.0-20200807222445-2db8e9fb6365
|
||||
github.com/mattn/go-colorable v0.1.6 // indirect
|
||||
github.com/mattn/go-isatty v0.0.12
|
||||
github.com/mattn/go-runewidth v0.0.9
|
||||
@@ -92,11 +93,8 @@ require (
|
||||
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 // indirect
|
||||
modernc.org/mathutil v1.1.0 // indirect
|
||||
modernc.org/strutil v1.1.0 // indirect
|
||||
vitess.io/vitess v3.0.0-rc.3.0.20190602171040-12bfde34629c+incompatible
|
||||
)
|
||||
|
||||
replace github.com/liquidata-inc/dolt/go/gen/proto/dolt/services/eventsapi => ./gen/proto/dolt/services/eventsapi
|
||||
|
||||
replace vitess.io/vitess => github.com/liquidata-inc/vitess v0.0.0-20200723020829-dc668aea2a8c
|
||||
|
||||
go 1.13
|
||||
|
||||
@@ -419,16 +419,16 @@ github.com/lib/pq v1.3.0 h1:/qkRGz8zljWiDcFvgpwUpwIAPu3r07TDvs3Rws+o/pU=
|
||||
github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||
github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM=
|
||||
github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4=
|
||||
github.com/liquidata-inc/go-mysql-server v0.5.1-0.20200807172435-6afbd6a26e29 h1:2/6TBwlKzLfwcKJkIlthBGcDvzypt8dyw9g4/LbwpTM=
|
||||
github.com/liquidata-inc/go-mysql-server v0.5.1-0.20200807172435-6afbd6a26e29/go.mod h1:MBtn6JaqJYAzAa6QxZmmBnLDtWLj9TQe/QO6owo68yo=
|
||||
github.com/liquidata-inc/go-mysql-server v0.5.1-0.20200807224414-9fff937bd775 h1:yEEs4XMgFcpiQbT45MuO9RJgTHq4/4Yl64LMrUkRKlw=
|
||||
github.com/liquidata-inc/go-mysql-server v0.5.1-0.20200807224414-9fff937bd775/go.mod h1:W9+xQ7WUIqkPomN8Ng1eLPCG9SWNwKMvB+6IMwvShxo=
|
||||
github.com/liquidata-inc/ishell v0.0.0-20190514193646-693241f1f2a0 h1:phMgajKClMUiIr+hF2LGt8KRuUa2Vd2GI1sNgHgSXoU=
|
||||
github.com/liquidata-inc/ishell v0.0.0-20190514193646-693241f1f2a0/go.mod h1:YC1rI9k5gx8D02ljlbxDfZe80s/iq8bGvaaQsvR+qxs=
|
||||
github.com/liquidata-inc/mmap-go v1.0.3 h1:2LndAeAtup9rpvUmu4wZSYCsjCQ0Zpc+NqE+6+PnT7g=
|
||||
github.com/liquidata-inc/mmap-go v1.0.3/go.mod h1:w0doE7jfkuDEZyxb/zD3VWnRaQBYx1uDTS816kH8HoY=
|
||||
github.com/liquidata-inc/sqllogictest/go v0.0.0-20200320151923-b11801f10e15 h1:H3RwcYfzkdW4kFh7znTUopcX3XZqnFXm6pcmxSy0mNo=
|
||||
github.com/liquidata-inc/sqllogictest/go v0.0.0-20200320151923-b11801f10e15/go.mod h1:kKRVtyuomkqz15YFRpS0OT8kpsU8y/F3jyiZtvALdKU=
|
||||
github.com/liquidata-inc/vitess v0.0.0-20200723020829-dc668aea2a8c h1:J3s/tW6yGvGtTT2rWOhmWt0cMkQheIg8p7gejNRNk+o=
|
||||
github.com/liquidata-inc/vitess v0.0.0-20200723020829-dc668aea2a8c/go.mod h1:zCpP+FJseQinxNM5gkVPahLzv7lt3YI0aSvrT5k95Qk=
|
||||
github.com/liquidata-inc/vitess v0.0.0-20200807222445-2db8e9fb6365 h1:aR9yZQEOJ7Sij0xIXRPqyj78G8oOjesHm5YcuR25/cs=
|
||||
github.com/liquidata-inc/vitess v0.0.0-20200807222445-2db8e9fb6365/go.mod h1:E8nYT1vcL2NROtFwUN02CiA6cz276CFuB0Q1Zja5CAo=
|
||||
github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
|
||||
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
||||
github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE=
|
||||
|
||||
@@ -26,7 +26,7 @@ import (
|
||||
"github.com/liquidata-inc/go-mysql-server/sql/expression/function"
|
||||
"github.com/liquidata-inc/go-mysql-server/sql/parse"
|
||||
"github.com/liquidata-inc/go-mysql-server/sql/plan"
|
||||
"vitess.io/vitess/go/vt/sqlparser"
|
||||
"github.com/liquidata-inc/vitess/go/vt/sqlparser"
|
||||
|
||||
"github.com/liquidata-inc/dolt/go/libraries/doltcore/doltdb"
|
||||
"github.com/liquidata-inc/dolt/go/libraries/doltcore/env"
|
||||
|
||||
@@ -849,6 +849,22 @@ func (ddb *DoltDB) PushChunks(ctx context.Context, tempDir string, srcDB *DoltDB
|
||||
}
|
||||
}
|
||||
|
||||
func (ddb *DoltDB) PushChunksForRefHash(ctx context.Context, tempDir string, srcDB *DoltDB, h hash.Hash, pullerEventCh chan datas.PullerEvent) error {
|
||||
if datas.CanUsePuller(srcDB.db) && datas.CanUsePuller(ddb.db) {
|
||||
puller, err := datas.NewPuller(ctx, tempDir, defaultChunksPerTF, srcDB.db, ddb.db, h, pullerEventCh)
|
||||
|
||||
if err == datas.ErrDBUpToDate {
|
||||
return nil
|
||||
} else if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return puller.Pull(ctx)
|
||||
} else {
|
||||
return errors.New("this type of chunk store does not support this operation")
|
||||
}
|
||||
}
|
||||
|
||||
// PullChunks initiates a pull into a database from the source database given, at the commit given. Progress is
|
||||
// communicated over the provided channel.
|
||||
func (ddb *DoltDB) PullChunks(ctx context.Context, tempDir string, srcDB *DoltDB, cm *Commit, progChan chan datas.PullProgress, pullerEventCh chan datas.PullerEvent) error {
|
||||
|
||||
@@ -46,7 +46,7 @@ func CreateTestEnv() *env.DoltEnv {
|
||||
err := dEnv.InitRepo(context.Background(), types.Format_7_18, name, email)
|
||||
|
||||
if err != nil {
|
||||
panic("Failed to initialize environment")
|
||||
panic("Failed to initialize environment:" + err.Error())
|
||||
}
|
||||
|
||||
return dEnv
|
||||
|
||||
+10
-5
@@ -19,7 +19,6 @@ import (
|
||||
"crypto/tls"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
@@ -105,7 +104,7 @@ func Load(ctx context.Context, hdp HomeDirProvider, fs filesys.Filesys, urlStr,
|
||||
|
||||
if dbLoadErr == nil && dEnv.HasDoltDir() {
|
||||
if !dEnv.HasDoltTempTableDir() {
|
||||
err := os.Mkdir(dEnv.TempTableFilesDir(), os.ModePerm)
|
||||
err := dEnv.FS.MkDirs(dEnv.TempTableFilesDir())
|
||||
dEnv.DBLoadError = err
|
||||
} else {
|
||||
// fire and forget cleanup routine. Will delete as many old temp files as it can during the main commands execution.
|
||||
@@ -282,6 +281,12 @@ func (dEnv *DoltEnv) createDirectories(dir string) (string, error) {
|
||||
return "", fmt.Errorf("unable to make directory '%s', cause: %s", absDataDir, err.Error())
|
||||
}
|
||||
|
||||
err = dEnv.FS.MkDirs(dEnv.TempTableFilesDir())
|
||||
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("unable to make directory '%s', cause: %s", dEnv.TempTableFilesDir(), err.Error())
|
||||
}
|
||||
|
||||
return filepath.Join(absPath, dbfactory.DoltDir), nil
|
||||
}
|
||||
|
||||
@@ -303,7 +308,7 @@ func (dEnv *DoltEnv) InitDBAndRepoState(ctx context.Context, nbf *types.NomsBinF
|
||||
return err
|
||||
}
|
||||
|
||||
return dEnv.initializeRepoState(ctx)
|
||||
return dEnv.InitializeRepoState(ctx)
|
||||
}
|
||||
|
||||
// Inits the dolt DB of this environment with an empty commit at the time given and writes default docs to disk.
|
||||
@@ -324,8 +329,8 @@ func (dEnv *DoltEnv) InitDBWithTime(ctx context.Context, nbf *types.NomsBinForma
|
||||
return nil
|
||||
}
|
||||
|
||||
// initializeRepoState writes a default repo state to disk, consisting of a master branch and current root hash value.
|
||||
func (dEnv *DoltEnv) initializeRepoState(ctx context.Context) error {
|
||||
// InitializeRepoState writes a default repo state to disk, consisting of a master branch and current root hash value.
|
||||
func (dEnv *DoltEnv) InitializeRepoState(ctx context.Context) error {
|
||||
cs, _ := doltdb.NewCommitSpec(doltdb.MasterBranch)
|
||||
commit, _ := dEnv.DoltDB.Resolve(ctx, cs, nil)
|
||||
|
||||
|
||||
Vendored
+4
@@ -23,6 +23,10 @@ import (
|
||||
|
||||
var NoRemote = Remote{}
|
||||
|
||||
func IsEmptyRemote(r Remote) bool {
|
||||
return len(r.Name) == 0 && len(r.Url) == 0 && r.FetchSpecs == nil && r.Params == nil
|
||||
}
|
||||
|
||||
type Remote struct {
|
||||
Name string `json:"name"`
|
||||
Url string `json:"url"`
|
||||
|
||||
@@ -22,8 +22,8 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/liquidata-inc/go-mysql-server/sql"
|
||||
"github.com/liquidata-inc/vitess/go/sqltypes"
|
||||
"github.com/stretchr/testify/require"
|
||||
"vitess.io/vitess/go/sqltypes"
|
||||
|
||||
"github.com/liquidata-inc/dolt/go/libraries/doltcore/doltdb"
|
||||
dtu "github.com/liquidata-inc/dolt/go/libraries/doltcore/dtestutils"
|
||||
|
||||
@@ -21,9 +21,9 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/liquidata-inc/go-mysql-server/sql"
|
||||
"github.com/liquidata-inc/vitess/go/sqltypes"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"vitess.io/vitess/go/sqltypes"
|
||||
|
||||
"github.com/liquidata-inc/dolt/go/libraries/doltcore/dbfactory"
|
||||
"github.com/liquidata-inc/dolt/go/libraries/doltcore/schema"
|
||||
|
||||
@@ -20,8 +20,8 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/liquidata-inc/go-mysql-server/sql"
|
||||
"github.com/liquidata-inc/vitess/go/sqltypes"
|
||||
"github.com/stretchr/testify/require"
|
||||
"vitess.io/vitess/go/sqltypes"
|
||||
|
||||
"github.com/liquidata-inc/dolt/go/libraries/utils/mathutil"
|
||||
)
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/liquidata-inc/go-mysql-server/sql"
|
||||
"vitess.io/vitess/go/sqltypes"
|
||||
"github.com/liquidata-inc/vitess/go/sqltypes"
|
||||
|
||||
"github.com/liquidata-inc/dolt/go/store/types"
|
||||
)
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
"strconv"
|
||||
|
||||
"github.com/liquidata-inc/go-mysql-server/sql"
|
||||
"vitess.io/vitess/go/sqltypes"
|
||||
"github.com/liquidata-inc/vitess/go/sqltypes"
|
||||
|
||||
"github.com/liquidata-inc/dolt/go/store/types"
|
||||
)
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
"math"
|
||||
|
||||
"github.com/liquidata-inc/go-mysql-server/sql"
|
||||
"vitess.io/vitess/go/sqltypes"
|
||||
"github.com/liquidata-inc/vitess/go/sqltypes"
|
||||
|
||||
"github.com/liquidata-inc/dolt/go/store/types"
|
||||
)
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
"strconv"
|
||||
|
||||
"github.com/liquidata-inc/go-mysql-server/sql"
|
||||
"vitess.io/vitess/go/sqltypes"
|
||||
"github.com/liquidata-inc/vitess/go/sqltypes"
|
||||
|
||||
"github.com/liquidata-inc/dolt/go/store/types"
|
||||
)
|
||||
|
||||
@@ -18,7 +18,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/liquidata-inc/go-mysql-server/sql"
|
||||
"vitess.io/vitess/go/sqltypes"
|
||||
"github.com/liquidata-inc/vitess/go/sqltypes"
|
||||
|
||||
"github.com/liquidata-inc/dolt/go/store/types"
|
||||
)
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
"strconv"
|
||||
|
||||
"github.com/liquidata-inc/go-mysql-server/sql"
|
||||
"vitess.io/vitess/go/sqltypes"
|
||||
"github.com/liquidata-inc/vitess/go/sqltypes"
|
||||
|
||||
"github.com/liquidata-inc/dolt/go/store/types"
|
||||
)
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/liquidata-inc/go-mysql-server/sql"
|
||||
"vitess.io/vitess/go/sqltypes"
|
||||
"github.com/liquidata-inc/vitess/go/sqltypes"
|
||||
|
||||
"github.com/liquidata-inc/dolt/go/store/types"
|
||||
)
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
"strconv"
|
||||
|
||||
"github.com/liquidata-inc/go-mysql-server/sql"
|
||||
"vitess.io/vitess/go/sqltypes"
|
||||
"github.com/liquidata-inc/vitess/go/sqltypes"
|
||||
|
||||
"github.com/liquidata-inc/dolt/go/store/types"
|
||||
)
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
"unicode"
|
||||
|
||||
"github.com/liquidata-inc/go-mysql-server/sql"
|
||||
"vitess.io/vitess/go/sqltypes"
|
||||
"github.com/liquidata-inc/vitess/go/sqltypes"
|
||||
|
||||
"github.com/liquidata-inc/dolt/go/store/types"
|
||||
)
|
||||
|
||||
@@ -25,8 +25,8 @@ import (
|
||||
"github.com/liquidata-inc/go-mysql-server/sql"
|
||||
"github.com/liquidata-inc/go-mysql-server/sql/parse"
|
||||
"github.com/liquidata-inc/go-mysql-server/sql/plan"
|
||||
"github.com/liquidata-inc/vitess/go/vt/proto/query"
|
||||
"gopkg.in/src-d/go-errors.v1"
|
||||
"vitess.io/vitess/go/vt/proto/query"
|
||||
|
||||
"github.com/liquidata-inc/dolt/go/libraries/doltcore/doltdb"
|
||||
"github.com/liquidata-inc/dolt/go/libraries/doltcore/env"
|
||||
|
||||
@@ -25,9 +25,9 @@ import (
|
||||
sqle "github.com/liquidata-inc/go-mysql-server"
|
||||
"github.com/liquidata-inc/go-mysql-server/sql"
|
||||
"github.com/liquidata-inc/sqllogictest/go/logictest"
|
||||
"github.com/liquidata-inc/vitess/go/vt/proto/query"
|
||||
"github.com/liquidata-inc/vitess/go/vt/sqlparser"
|
||||
"github.com/shopspring/decimal"
|
||||
"vitess.io/vitess/go/vt/proto/query"
|
||||
"vitess.io/vitess/go/vt/sqlparser"
|
||||
|
||||
"github.com/liquidata-inc/dolt/go/cmd/dolt/commands"
|
||||
"github.com/liquidata-inc/dolt/go/libraries/doltcore/doltdb"
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
|
||||
"github.com/liquidata-inc/go-mysql-server/sql"
|
||||
"github.com/liquidata-inc/go-mysql-server/sql/parse"
|
||||
"vitess.io/vitess/go/vt/sqlparser"
|
||||
"github.com/liquidata-inc/vitess/go/vt/sqlparser"
|
||||
|
||||
"github.com/liquidata-inc/dolt/go/libraries/doltcore/doltdb"
|
||||
"github.com/liquidata-inc/dolt/go/libraries/doltcore/schema"
|
||||
|
||||
@@ -21,9 +21,9 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/liquidata-inc/go-mysql-server/sql"
|
||||
"github.com/liquidata-inc/vitess/go/sqltypes"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"vitess.io/vitess/go/sqltypes"
|
||||
|
||||
"github.com/liquidata-inc/dolt/go/libraries/doltcore/doltdb"
|
||||
"github.com/liquidata-inc/dolt/go/libraries/doltcore/dtestutils"
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"vitess.io/vitess/go/sqltypes"
|
||||
"github.com/liquidata-inc/vitess/go/sqltypes"
|
||||
|
||||
"github.com/liquidata-inc/dolt/go/libraries/doltcore/row"
|
||||
"github.com/liquidata-inc/dolt/go/libraries/doltcore/schema"
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/liquidata-inc/go-mysql-server/sql"
|
||||
"vitess.io/vitess/go/sqltypes"
|
||||
"github.com/liquidata-inc/vitess/go/sqltypes"
|
||||
|
||||
"github.com/liquidata-inc/dolt/go/libraries/doltcore/doltdb"
|
||||
"github.com/liquidata-inc/dolt/go/libraries/doltcore/schema"
|
||||
|
||||
@@ -23,7 +23,7 @@ import (
|
||||
|
||||
sqle "github.com/liquidata-inc/go-mysql-server"
|
||||
"github.com/liquidata-inc/go-mysql-server/sql"
|
||||
"vitess.io/vitess/go/vt/sqlparser"
|
||||
"github.com/liquidata-inc/vitess/go/vt/sqlparser"
|
||||
|
||||
"github.com/liquidata-inc/dolt/go/libraries/doltcore/doltdb"
|
||||
"github.com/liquidata-inc/dolt/go/libraries/doltcore/env"
|
||||
|
||||
Reference in New Issue
Block a user