resolve conflicts

This commit is contained in:
jennifersp
2021-11-18 14:54:15 -08:00
19 changed files with 426 additions and 179 deletions
+2
View File
@@ -9,3 +9,5 @@ venv
benchmark/perf_tools/dolt-builds/dolt
benchmark/perf_tools/dolt-builds/working
benchmark/perf_tools/output
test.sh
+10
View File
@@ -5228,6 +5228,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
= LICENSE d444eac7bc0c9b4473712ca71079dd0af192c0204b1846213e79865d =
================================================================================
================================================================================
= github.com/silvasur/buzhash licensed under: =
DO WHATEVER THE FUCK YOU WANT, PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHATEVER THE FUCK YOU WANT.
= LICENSE 03d3e3813a51a67f46a07063e39f5d6451619f4ede2ae1c4c4cccb9e =
================================================================================
================================================================================
= github.com/sirupsen/logrus licensed under: =
+1 -1
View File
@@ -478,7 +478,7 @@ func newReplicaDatabase(ctx context.Context, name string, remoteName string, dEn
db := dsqle.NewDatabase(name, dEnv.DbData(), opts)
rrd, err := dsqle.NewReadReplicaDatabase(ctx, db, remoteName, dEnv.RepoStateReader(), dEnv.TempTableFilesDir())
rrd, err := dsqle.NewReadReplicaDatabase(ctx, db, remoteName, dEnv)
if err != nil {
err = fmt.Errorf("%w from remote '%s'; %s", dsqle.ErrFailedToLoadReplicaDB, remoteName, err.Error())
if !dsqle.SkipReplicationWarnings() {
+4 -7
View File
@@ -50,7 +50,7 @@ import (
)
const (
Version = "0.34.2"
Version = "0.34.3"
)
var dumpDocsCommand = &commands.DumpDocsCmd{}
@@ -305,12 +305,9 @@ func runMain() int {
defer tempfiles.MovableTempFileProvider.Clean()
if dEnv.DoltDB != nil {
err := dsess.InitPersistedSystemVars(dEnv)
if err != nil {
cli.Printf("error: failed to load persisted global variables: %s\n", err.Error())
}
dEnv.DoltDB.SetCommitHookLogger(ctx, cli.OutStream)
err = dsess.InitPersistedSystemVars(dEnv)
if err != nil {
cli.Printf("error: failed to load persisted global variables: %s\n", err.Error())
}
start := time.Now()
+3 -3
View File
@@ -19,7 +19,7 @@ require (
github.com/denisbrodbeck/machineid v1.0.1
github.com/dolthub/dolt/go/gen/proto/dolt/services/eventsapi v0.0.0-20201005193433-3ee972b1d078
github.com/dolthub/fslock v0.0.3
github.com/dolthub/go-mysql-server v0.11.1-0.20211115234702-2f03ef4e94b9
github.com/dolthub/go-mysql-server v0.11.1-0.20211118151213-d685afc5e3da
github.com/dolthub/ishell v0.0.0-20210205014355-16a4ce758446
github.com/dolthub/mmap-go v1.0.4-0.20201107010347-f9f2a9588a66
github.com/dolthub/sqllogictest/go v0.0.0-20201107003712-816f3ae12d81
@@ -31,7 +31,7 @@ require (
github.com/go-openapi/errors v0.19.6 // indirect
github.com/go-openapi/strfmt v0.19.5 // indirect
github.com/go-sql-driver/mysql v1.6.0
github.com/gocraft/dbr/v2 v2.7.0
github.com/gocraft/dbr/v2 v2.7.2
github.com/golang/glog v0.0.0-20210429001901-424d2337a529 // indirect
github.com/golang/protobuf v1.5.2
github.com/golang/snappy v0.0.1
@@ -41,7 +41,6 @@ require (
github.com/jedib0t/go-pretty v4.3.1-0.20191104025401-85fe5d6a7c4d+incompatible
github.com/jpillora/backoff v1.0.0
github.com/juju/gnuflag v0.0.0-20171113085948-2ce1bb71843d
github.com/kch42/buzhash v0.0.0-20160816060738-9bdec3dec7c6
github.com/lestrrat-go/strftime v1.0.4 // indirect
github.com/mattn/go-isatty v0.0.12
github.com/mattn/go-runewidth v0.0.9
@@ -55,6 +54,7 @@ require (
github.com/sergi/go-diff v1.1.0 // indirect
github.com/shirou/gopsutil v3.21.2+incompatible
github.com/shopspring/decimal v1.2.0
github.com/silvasur/buzhash v0.0.0-20160816060738-9bdec3dec7c6
github.com/sirupsen/logrus v1.8.1
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
github.com/spf13/cobra v1.0.0
+21 -13
View File
@@ -47,8 +47,8 @@ github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBp
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/DATA-DOG/go-sqlmock v1.4.1 h1:ThlnYciV1iM/V0OSF/dtkqWb6xo5qITT1TJBG1MRDJM=
github.com/DATA-DOG/go-sqlmock v1.4.1/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60=
github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
github.com/Djarvur/go-err113 v0.0.0-20200511133814-5174e21577d5/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs=
github.com/HdrHistogram/hdrhistogram-go v1.0.0 h1:jivTvI9tBw5B8wW9Qd0uoQ2qaajb29y4TPhYTgh8Lb0=
github.com/HdrHistogram/hdrhistogram-go v1.0.0/go.mod h1:YzE1EgsuAz8q9lfGdlxBZo2Ma655+PfKp2mlzcAqIFw=
@@ -167,12 +167,14 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/denis-tingajkin/go-header v0.3.1/go.mod h1:sq/2IxMhaZX+RRcgHfCRx/m0M5na0fBt4/CRe7Lrji0=
github.com/denisbrodbeck/machineid v1.0.1 h1:geKr9qtkB876mXguW2X6TU4ZynleN6ezuMSRhl4D7AQ=
github.com/denisbrodbeck/machineid v1.0.1/go.mod h1:dJUwb7PTidGDeYyUBmXZ2GphQBbjJCrnectwCyxcUSI=
github.com/denisenkom/go-mssqldb v0.10.0 h1:QykgLZBorFE95+gO3u9esLd0BmbvpWp0/waNNZfHBM8=
github.com/denisenkom/go-mssqldb v0.10.0/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
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.11.1-0.20211115234702-2f03ef4e94b9 h1:93o1aeMgc1ldKBgJTGAMYux+2GRHxsrDuBB5ktRbq+U=
github.com/dolthub/go-mysql-server v0.11.1-0.20211115234702-2f03ef4e94b9/go.mod h1:ErW9BTVXE8z3RfPyi3pXzbThv3ujfXlzU6x1hUJuiys=
github.com/dolthub/go-mysql-server v0.11.1-0.20211118151213-d685afc5e3da h1:ZSGrphp3cQrxt/tHXtaL7w7CATcUeH2SSKI4S0rXVmU=
github.com/dolthub/go-mysql-server v0.11.1-0.20211118151213-d685afc5e3da/go.mod h1:pP7nKutPckQ4vaLNsHt1WQ6OTSBMJ6oAL3PIYnpWdbM=
github.com/dolthub/ishell v0.0.0-20210205014355-16a4ce758446 h1:0ol5pj+QlKUKAtqs1LiPM3ZJKs+rHPgLSsMXmhTrCAM=
github.com/dolthub/ishell v0.0.0-20210205014355-16a4ce758446/go.mod h1:dhGBqcCEfK5kuFmeO5+WOx3hqc1k3M29c1oS/R7N4ms=
github.com/dolthub/jsonpath v0.0.0-20210609232853-d49537a30474 h1:xTrR+l5l+1Lfq0NvhiEsctylXinUMFhhsqaEcl414p8=
@@ -269,14 +271,16 @@ github.com/gobuffalo/packr/v2 v2.0.9/go.mod h1:emmyGweYTm6Kdper+iywB6YK5YzuKchGt
github.com/gobuffalo/packr/v2 v2.2.0/go.mod h1:CaAwI0GPIAv+5wKLtv8Afwl+Cm78K/I/VCm/3ptBN+0=
github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw=
github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8=
github.com/gocraft/dbr/v2 v2.7.0 h1:x+UnhSBYPFBBdtikLSMLQ9KPuquSUj4yBijsQAhhNZo=
github.com/gocraft/dbr/v2 v2.7.0/go.mod h1:wQdbxPBSloo2OlSedMxfNW0mgk0GXys9O1VFmQiwcx4=
github.com/gocraft/dbr/v2 v2.7.2 h1:ccUxMuz6RdZvD7VPhMRRMSS/ECF3gytPhPtcavjktHk=
github.com/gocraft/dbr/v2 v2.7.2/go.mod h1:5bCqyIXO5fYn3jEp/L06QF4K1siFdhxChMjdNu6YJrg=
github.com/gofrs/flock v0.8.0/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU=
github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY=
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/glog v0.0.0-20210429001901-424d2337a529 h1:2voWjNECnrZRbfwXxHB1/j8wa6xdKn85B5NzgVL/pTU=
github.com/golang/glog v0.0.0-20210429001901-424d2337a529/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
@@ -425,8 +429,9 @@ github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHW
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks=
github.com/jmoiron/sqlx v1.2.1-0.20190826204134-d7d95172beb5 h1:lrdPtrORjGv1HbbEvKWDUAy97mPpFm4B8hp77tcCUJY=
github.com/jmoiron/sqlx v1.2.1-0.20190826204134-d7d95172beb5/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks=
github.com/jmoiron/sqlx v1.3.4 h1:wv+0IJZfL5z0uZoUjlpKgHkgaFSYD+r9CfrXjEXsO7w=
github.com/jmoiron/sqlx v1.3.4/go.mod h1:2BljVx/86SuTyjE+aPYlHCTNvZrnJXghYGpNiXLBMCQ=
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA=
@@ -443,8 +448,6 @@ github.com/juju/gnuflag v0.0.0-20171113085948-2ce1bb71843d/go.mod h1:2PavIy+JPci
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaRPx4tDPEn4=
github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA=
github.com/kch42/buzhash v0.0.0-20160816060738-9bdec3dec7c6 h1:l6Y3mFnF46A+CeZsTrT8kVIuhayq1266oxWpDKE7hnQ=
github.com/kch42/buzhash v0.0.0-20160816060738-9bdec3dec7c6/go.mod h1:UtDV9qK925GVmbdjR+e1unqoo+wGWNHHC6XB1Eu6wpE=
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
@@ -472,8 +475,9 @@ github.com/lestrrat-go/envload v0.0.0-20180220234015-a3eb8ddeffcc/go.mod h1:kopu
github.com/lestrrat-go/strftime v1.0.4 h1:T1Rb9EPkAhgxKqbcMIPguPq8glqXTA1koF8n9BHElA8=
github.com/lestrrat-go/strftime v1.0.4/go.mod h1:E1nN3pCbtMSu1yjSVeyuRFVm/U0xoR76fd03sz+Qz4g=
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
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/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.10.0 h1:Zx5DJFEYQXio93kgXnQ09fXNiUKsqv4OUEu2UtGcB1E=
github.com/lib/pq v1.10.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
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/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4=
@@ -503,8 +507,9 @@ github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzp
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
github.com/mattn/go-sqlite3 v2.0.3+incompatible h1:gXHsfypPkaMZrKbD5209QV9jbUTJKjyR5WD3HYQSd+U=
github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/mattn/go-sqlite3 v1.14.7 h1:fxWBnXkxfM6sRiuH3bqJ4CfzZojMOLVc0UTsTglEghA=
github.com/mattn/go-sqlite3 v1.14.7/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4=
@@ -647,6 +652,8 @@ github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFR
github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk=
github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/silvasur/buzhash v0.0.0-20160816060738-9bdec3dec7c6 h1:31fhvQj+O9qDqMxUgQDOCQA5RV1iIFMzYPhBUyzg2p0=
github.com/silvasur/buzhash v0.0.0-20160816060738-9bdec3dec7c6/go.mod h1:jk5gVE20+MCoyJ2TFiiMrbWPyaH4t9T5F3HwVdthB2w=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
@@ -776,6 +783,7 @@ golang.org/x/crypto v0.0.0-20180723164146-c126467f60eb/go.mod h1:6SG95UA2DQfeDnf
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190422162423-af44ce270edf/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
@@ -51,6 +51,45 @@ func AddPrimaryKeyToTable(ctx context.Context, table *doltdb.Table, tableName st
return col
})
// Get Row Data out of Table
rowData, err := table.GetRowData(ctx)
if err != nil {
return nil, err
}
// Go through every row
err = rowData.Iter(ctx, func(key, value types.Value) (stop bool, err error) {
r, err := row.FromNoms(sch, key.(types.Tuple), value.(types.Tuple))
if err != nil {
return false, err
}
// Go through every column of row
err = newCollection.Iter(func(tag uint64, col schema.Column) (stop bool, err error) {
// Skip if they are not part of primary key
if !col.IsPartOfPK {
return false, nil
}
// Check if column value is null
val, ok := r.GetColVal(tag)
if !ok || val == nil || val == types.NullValue {
return true, fmt.Errorf("primary key cannot have NULL values")
}
return false, nil
})
if err != nil {
return true, err
}
return false, nil
})
if err != nil {
return nil, err
}
newSchema, err := schema.SchemaFromCols(newCollection)
if err != nil {
return nil, err
@@ -144,4 +144,28 @@ func TestAddPk(t *testing.T) {
assert.NoError(t, err)
assert.True(t, ok)
})
t.Run("Add primary key when one more cells contain NULL", func(t *testing.T) {
dEnv := dtestutils.CreateTestEnv()
ctx := context.Background()
for _, c := range setupAdd {
c.exec(t, ctx, dEnv)
}
_, err := getTable(ctx, dEnv, "test")
assert.NoError(t, err)
exitCode := commands.SqlCmd{}.Exec(ctx, "sql", []string{"-q", "ALTER TABLE test ADD PRIMARY KEY (c1)"}, dEnv)
require.Equal(t, 0, exitCode)
exitCode = commands.SqlCmd{}.Exec(ctx, "sql", []string{"-q", "ALTER TABLE test ADD COLUMN (c2 INT NULL)"}, dEnv)
require.Equal(t, 0, exitCode)
exitCode = commands.SqlCmd{}.Exec(ctx, "sql", []string{"-q", "ALTER TABLE test DROP PRIMARY KEY"}, dEnv)
require.Equal(t, 0, exitCode)
exitCode = commands.SqlCmd{}.Exec(ctx, "sql", []string{"-q", "ALTER TABLE test ADD PRIMARY KEY (id, c1, c2)"}, dEnv)
require.Equal(t, 1, exitCode)
})
}
@@ -227,6 +227,12 @@ func TestIntParseValue(t *testing.T) {
math.MaxInt64,
false,
},
{
Int64Type,
"100.5",
100,
false,
},
{
Int32Type,
"something",
+18 -13
View File
@@ -105,6 +105,7 @@ RangeLoop:
}
cb := columnBounds{}
// We promote each type as the value has already been validated against the type
promotedType := di.cols[i].TypeInfo.Promote()
if rangeColumnExpr.HasLowerBound() {
key := sql.GetRangeCutKey(rangeColumnExpr.LowerBound)
@@ -112,13 +113,16 @@ RangeLoop:
if err != nil {
return nil, err
}
cb.lowerbound.equals = rangeColumnExpr.LowerBound.TypeAsLowerBound() == sql.Closed
cb.lowerbound.infinity = false
cb.lowerbound.val = val
if rangeColumnExpr.LowerBound.TypeAsLowerBound() == sql.Closed {
// For each lowerbound case, we set the upperbound to infinity, as the upperbound can increment to
// get to the desired overall case while retaining whatever was set for the lowerbound.
cb.boundsCase = boundsCase_greaterEquals_infinity
} else {
cb.boundsCase = boundsCase_greater_infinity
}
cb.lowerbound = val
} else {
cb.lowerbound.equals = false
cb.lowerbound.infinity = true
cb.lowerbound.val = nil
cb.boundsCase = boundsCase_infinity_infinity
}
if rangeColumnExpr.HasUpperBound() {
key := sql.GetRangeCutKey(rangeColumnExpr.UpperBound)
@@ -126,13 +130,14 @@ RangeLoop:
if err != nil {
return nil, err
}
cb.upperbound.equals = rangeColumnExpr.UpperBound.TypeAsUpperBound() == sql.Closed
cb.upperbound.infinity = false
cb.upperbound.val = val
} else {
cb.upperbound.equals = false
cb.upperbound.infinity = true
cb.upperbound.val = nil
if rangeColumnExpr.UpperBound.TypeAsUpperBound() == sql.Closed {
// Bounds cases are enum aliases on bytes, and they're arranged such that we can increment the case
// that was previously set when evaluating the lowerbound to get the proper overall case.
cb.boundsCase += 1
} else {
cb.boundsCase += 2
}
cb.upperbound = val
}
rangeCheck[i] = cb
}
@@ -238,12 +238,15 @@ func InitPersistedSystemVars(dEnv *env.DoltEnv) error {
defer initMu.Unlock()
var globals config.ReadWriteConfig
if localConf, ok := dEnv.Config.GetConfig(env.LocalConfig); !ok {
cli.Println("warning: multi-db mode does not support persistable sessions")
globals = config.NewMapConfig(make(map[string]string))
} else {
if localConf, ok := dEnv.Config.GetConfig(env.LocalConfig); ok {
globals = config.NewPrefixConfig(localConf, env.SqlServerGlobalsPrefix)
} else if globalConf, ok := dEnv.Config.GetConfig(env.GlobalConfig); ok {
globals = config.NewPrefixConfig(globalConf, env.SqlServerGlobalsPrefix)
} else {
cli.Println("warning: no local or global Dolt configuration found; session is not persistable")
globals = config.NewMapConfig(make(map[string]string))
}
persistedGlobalVars, err := SystemVariablesInConfig(globals)
if err != nil {
return err
+111 -64
View File
@@ -38,16 +38,27 @@ type doltIndexLookup struct {
var _ sql.IndexLookup = (*doltIndexLookup)(nil)
// boundsCase determines the case upon which the bounds are tested.
type boundsCase byte
// For each boundsCase, the first element is the lowerbound and the second element is the upperbound
const (
boundsCase_infinity_infinity boundsCase = iota
boundsCase_infinity_lessEquals
boundsCase_infinity_less
boundsCase_greaterEquals_infinity
boundsCase_greaterEquals_lessEquals
boundsCase_greaterEquals_less
boundsCase_greater_infinity
boundsCase_greater_lessEquals
boundsCase_greater_less
)
// columnBounds are used to compare a given value in the noms row iterator.
type columnBounds struct {
lowerbound bound
upperbound bound
}
type bound struct {
equals bool
infinity bool
val types.Value
boundsCase
lowerbound types.Value
upperbound types.Value
}
// nomsRangeCheck is used to compare a tuple against a set of comparisons in the noms row iterator.
@@ -110,55 +121,88 @@ func (il *doltIndexLookup) RowIterForRanges(ctx *sql.Context, rowData types.Map,
// Between returns whether the given types.Value is between the bounds. In addition, this returns if the value is outside
// the bounds and above the upperbound.
func (cb columnBounds) Between(ctx context.Context, nbf *types.NomsBinFormat, val types.Value) (ok bool, over bool, err error) {
if !cb.lowerbound.infinity {
if cb.lowerbound.equals {
ok, err := val.Less(nbf, cb.lowerbound.val)
if err != nil || ok {
return false, false, err
}
} else {
ok, err := cb.lowerbound.val.Less(nbf, val)
if err != nil || !ok {
return false, false, err
}
switch cb.boundsCase {
case boundsCase_infinity_infinity:
return true, false, nil
case boundsCase_infinity_lessEquals:
ok, err := cb.upperbound.Less(nbf, val)
if err != nil || ok {
return false, true, err
}
}
if !cb.upperbound.infinity {
if cb.upperbound.equals {
ok, err := cb.upperbound.val.Less(nbf, val)
if err != nil || ok {
return false, true, err
}
} else {
ok, err := val.Less(nbf, cb.upperbound.val)
if err != nil || !ok {
return false, true, err
}
case boundsCase_infinity_less:
ok, err := val.Less(nbf, cb.upperbound)
if err != nil || !ok {
return false, true, err
}
case boundsCase_greaterEquals_infinity:
ok, err := val.Less(nbf, cb.lowerbound)
if err != nil || ok {
return false, false, err
}
case boundsCase_greaterEquals_lessEquals:
ok, err := val.Less(nbf, cb.lowerbound)
if err != nil || ok {
return false, false, err
}
ok, err = cb.upperbound.Less(nbf, val)
if err != nil || ok {
return false, true, err
}
case boundsCase_greaterEquals_less:
ok, err := val.Less(nbf, cb.lowerbound)
if err != nil || ok {
return false, false, err
}
ok, err = val.Less(nbf, cb.upperbound)
if err != nil || !ok {
return false, true, err
}
case boundsCase_greater_infinity:
ok, err := cb.lowerbound.Less(nbf, val)
if err != nil || !ok {
return false, false, err
}
case boundsCase_greater_lessEquals:
ok, err := cb.lowerbound.Less(nbf, val)
if err != nil || !ok {
return false, false, err
}
ok, err = cb.upperbound.Less(nbf, val)
if err != nil || ok {
return false, true, err
}
case boundsCase_greater_less:
ok, err := cb.lowerbound.Less(nbf, val)
if err != nil || !ok {
return false, false, err
}
ok, err = val.Less(nbf, cb.upperbound)
if err != nil || !ok {
return false, true, err
}
default:
return false, false, fmt.Errorf("unknown bounds")
}
return true, false, nil
}
// Equals returns whether the calling columnBounds is equivalent to the given columnBounds.
func (cb columnBounds) Equals(otherBounds columnBounds) bool {
if cb.lowerbound.infinity != otherBounds.lowerbound.infinity ||
cb.upperbound.infinity != otherBounds.upperbound.infinity ||
cb.lowerbound.equals != otherBounds.lowerbound.equals ||
cb.upperbound.equals != otherBounds.upperbound.equals {
if cb.boundsCase != otherBounds.boundsCase {
return false
}
if cb.lowerbound.val == nil || otherBounds.lowerbound.val == nil {
if cb.lowerbound.val != nil || otherBounds.lowerbound.val != nil {
if cb.lowerbound == nil || otherBounds.lowerbound == nil {
if cb.lowerbound != nil || otherBounds.lowerbound != nil {
return false
}
} else if !cb.lowerbound.val.Equals(otherBounds.lowerbound.val) {
} else if !cb.lowerbound.Equals(otherBounds.lowerbound) {
return false
}
if cb.upperbound.val == nil || otherBounds.upperbound.val == nil {
if cb.upperbound.val != nil || otherBounds.upperbound.val != nil {
if cb.upperbound == nil || otherBounds.upperbound == nil {
if cb.upperbound != nil || otherBounds.upperbound != nil {
return false
}
} else if !cb.upperbound.val.Equals(otherBounds.upperbound.val) {
} else if !cb.upperbound.Equals(otherBounds.upperbound) {
return false
}
return true
@@ -166,32 +210,35 @@ func (cb columnBounds) Equals(otherBounds columnBounds) bool {
// Check implements the interface noms.InRangeCheck.
func (nrc nomsRangeCheck) Check(ctx context.Context, tuple types.Tuple) (valid bool, skip bool, err error) {
valid = true
err = tuple.IterFields(func(tupleIndex uint64, tupleVal types.Value) (stop bool, err error) {
if tupleIndex%2 == 0 {
return false, nil
}
compIndex := (tupleIndex - 1) / 2
if compIndex >= uint64(len(nrc)) {
return true, nil
}
ok, over, err := nrc[compIndex].Between(ctx, tuple.Format(), tupleVal)
if err != nil {
return true, err
}
if !ok {
skip = true
if compIndex == 0 && over {
valid = false
}
return true, nil
}
return false, nil
})
itr := types.TupleItrPool.Get().(*types.TupleIterator)
defer types.TupleItrPool.Put(itr)
err = itr.InitForTuple(tuple)
if err != nil {
return false, false, err
}
return valid, skip, nil
nbf := tuple.Format()
for i := 0; i < len(nrc) && itr.HasMore(); i++ {
if err := itr.Skip(); err != nil {
return false, false, err
}
_, val, err := itr.Next()
if err != nil {
return false, false, err
}
if val == nil {
break
}
ok, over, err := nrc[i].Between(ctx, nbf, val)
if err != nil {
return false, false, err
}
if !ok {
return i != 0 || !over, true, nil
}
}
return true, false, nil
}
// Equals returns whether the calling nomsRangeCheck is equivalent to the given nomsRangeCheck.
@@ -134,13 +134,17 @@ func customRange(tpl1, tpl2 types.Tuple, bt1, bt2 sql.RangeBoundType) *noms.Read
if tupleIndex%2 == 0 {
return false, nil
}
nrc = append(nrc, columnBounds{
lowerbound: bound{
equals: bt1 == sql.Closed,
infinity: false,
val: tupleVal,
},
})
if bt1 == sql.Closed {
nrc = append(nrc, columnBounds{
boundsCase: boundsCase_greaterEquals_infinity,
lowerbound: tupleVal,
})
} else {
nrc = append(nrc, columnBounds{
boundsCase: boundsCase_greater_infinity,
lowerbound: tupleVal,
})
}
return false, nil
})
_ = tpl2.IterFields(func(tupleIndex uint64, tupleVal types.Value) (stop bool, err error) {
@@ -148,10 +152,14 @@ func customRange(tpl1, tpl2 types.Tuple, bt1, bt2 sql.RangeBoundType) *noms.Read
return false, nil
}
idx := (tupleIndex - 1) / 2
nrc[idx].upperbound = bound{
equals: bt2 == sql.Closed,
infinity: false,
val: tupleVal,
if bt2 == sql.Closed {
// Bounds cases are enum aliases on bytes, and they're arranged such that we can increment the case
// that was previously set when evaluating the lowerbound to get the proper overall case.
nrc[idx].boundsCase += 1
nrc[idx].upperbound = tupleVal
} else {
nrc[idx].boundsCase += 2
nrc[idx].upperbound = tupleVal
}
return false, nil
})
@@ -170,16 +178,8 @@ func greaterThanRange(tpl types.Tuple) *noms.ReadRange {
return false, nil
}
nrc = append(nrc, columnBounds{
lowerbound: bound{
equals: false,
infinity: false,
val: tupleVal,
},
upperbound: bound{
equals: false,
infinity: true,
val: nil,
},
boundsCase: boundsCase_greater_infinity,
lowerbound: tupleVal,
})
return false, nil
})
@@ -198,16 +198,8 @@ func lessThanRange(tpl types.Tuple) *noms.ReadRange {
return false, nil
}
nrc = append(nrc, columnBounds{
lowerbound: bound{
equals: false,
infinity: true,
val: nil,
},
upperbound: bound{
equals: false,
infinity: false,
val: tupleVal,
},
boundsCase: boundsCase_infinity_less,
upperbound: tupleVal,
})
return false, nil
})
@@ -226,16 +218,8 @@ func greaterOrEqualRange(tpl types.Tuple) *noms.ReadRange {
return false, nil
}
nrc = append(nrc, columnBounds{
lowerbound: bound{
equals: true,
infinity: false,
val: tupleVal,
},
upperbound: bound{
equals: false,
infinity: true,
val: nil,
},
boundsCase: boundsCase_greaterEquals_infinity,
lowerbound: tupleVal,
})
return false, nil
})
@@ -254,16 +238,8 @@ func lessOrEqualRange(tpl types.Tuple) *noms.ReadRange {
return false, nil
}
nrc = append(nrc, columnBounds{
lowerbound: bound{
equals: false,
infinity: true,
val: nil,
},
upperbound: bound{
equals: true,
infinity: false,
val: tupleVal,
},
boundsCase: boundsCase_infinity_lessEquals,
upperbound: tupleVal,
})
return false, nil
})
@@ -282,16 +258,7 @@ func allRange(tpl types.Tuple) *noms.ReadRange {
return false, nil
}
nrc = append(nrc, columnBounds{
lowerbound: bound{
equals: false,
infinity: true,
val: nil,
},
upperbound: bound{
equals: false,
infinity: true,
val: nil,
},
boundsCase: boundsCase_infinity_infinity,
})
return false, nil
})
@@ -55,8 +55,8 @@ var ErrCannotCreateReplicaRevisionDbForCommit = errors.New("cannot create replic
var EmptyReadReplica = ReadReplicaDatabase{}
func NewReadReplicaDatabase(ctx context.Context, db Database, remoteName string, rsr env.RepoStateReader, tmpDir string) (ReadReplicaDatabase, error) {
remotes, err := rsr.GetRemotes()
func NewReadReplicaDatabase(ctx context.Context, db Database, remoteName string, dEnv *env.DoltEnv) (ReadReplicaDatabase, error) {
remotes, err := dEnv.GetRemotes()
if err != nil {
return EmptyReadReplica, err
}
@@ -74,9 +74,9 @@ func NewReadReplicaDatabase(ctx context.Context, db Database, remoteName string,
return ReadReplicaDatabase{
Database: db,
remote: remote,
tmpDir: tmpDir,
tmpDir: dEnv.TempTableFilesDir(),
srcDB: srcDB,
headRef: rsr.CWBHeadRef(),
headRef: dEnv.RepoStateReader().CWBHeadRef(),
}, nil
}
@@ -21,7 +21,7 @@
package gen
import "github.com/kch42/buzhash"
import "github.com/silvasur/buzhash"
const (
chunkPattern = uint32(1<<12 - 1) // Avg Chunk Size of 4k
+1 -1
View File
@@ -34,7 +34,7 @@ import (
"github.com/codahale/blake2"
humanize "github.com/dustin/go-humanize"
flag "github.com/juju/gnuflag"
"github.com/kch42/buzhash"
"github.com/silvasur/buzhash"
)
func main() {
+1 -1
View File
@@ -26,7 +26,7 @@ import (
"github.com/dolthub/dolt/go/store/sloppy"
"github.com/kch42/buzhash"
"github.com/silvasur/buzhash"
)
const (
@@ -10,6 +10,13 @@ teardown() {
teardown_common
}
@test "primary-key-changes: add primary key using null values" {
dolt sql -q "create table t(pk int, val int)"
dolt sql -q "INSERT INTO t (val) VALUES (1)"
run dolt sql -q "ALTER TABLE t ADD PRIMARY KEY (pk)"
[ "$status" -eq 1 ]
}
@test "primary-key-changes: add single primary key" {
dolt sql -q "create table t(pk int, val int)"
run dolt sql -q "ALTER TABLE t ADD PRIMARY KEY (pk)"
@@ -573,11 +580,5 @@ SQL
dolt sql -q "create table t (pk int, c1 int)"
dolt sql -q "insert into t values (NULL, NULL)"
run dolt sql -q "alter table t add primary key(pk)"
skip "This should fail on some sort of constraint error"
[ $status -eq 1 ]
# This is the current failure mode
run dolt sql -q "update t set c1=1"
[ $status -eq 1 ]
[[ "$output" =~ "received nil" ]] || false
}
@@ -0,0 +1,138 @@
#!/usr/bin/env bats
load $BATS_TEST_DIRNAME/helper/common.bash
load $BATS_TEST_DIRNAME/helper/query-server-common.bash
setup() {
setup_common
TMPDIRS=$(pwd)/tmpdirs
init_helper $TMPDIRS
cd $TMPDIRS
}
init_helper() {
TMPDIRS=$1
mkdir -p "${TMPDIRS}/dbs1"
for i in {1..3}; do
mkdir "${TMPDIRS}/dbs1/repo${i}"
cd "${TMPDIRS}/dbs1/repo${i}"
dolt init
mkdir -p "${TMPDIRS}/rem1/repo${i}"
dolt remote add remote1 "file://../../rem1/repo${i}"
done
}
clone_helper() {
TMPDIRS=$1
mkdir -p "${TMPDIRS}/dbs2"
for i in {1..3}; do
cd $TMPDIRS
if [ -f "rem1/repo${i}/manifest" ]; then
dolt clone "file://./rem1/repo${i}" "dbs2/repo${i}"
cd "dbs2/repo${i}"
dolt remote add remote1 "file://../../rem1/repo${i}"
fi
done
cd $TMPDIRS
}
push_helper() {
TMPDIRS=$1
for i in {1..3}; do
cd "${TMPDIRS}/dbs1/repo${i}"
dolt push remote1 main
done
cd $TMPDIRS
}
teardown() {
stop_sql_server
teardown_common
rm -rf $TMPDIRS
cd $BATS_TMPDIR
dolt config --list | awk '{ print $1 }' | grep sqlserver.global | xargs dolt config --global --unset
}
@test "replication-multidb: load global vars" {
dolt config --global --add sqlserver.global.dolt_replicate_to_remote remote1
cd dbs1/repo1
dolt config --local --add sqlserver.global.dolt_replicate_to_remote unknown
cd ../..
run dolt sql --multi-db-dir=dbs1 -b -q "select @@GLOBAL.dolt_replicate_to_remote"
[ "$status" -eq 0 ]
[[ "$output" =~ "remote1" ]] || false
}
@test "replication-multidb: push on sqlengine commit" {
dolt config --global --add sqlserver.global.dolt_replicate_to_remote remote1
dolt sql --multi-db-dir=dbs1 -b -q "use repo1; create table t1 (a int primary key)"
dolt sql --multi-db-dir=dbs1 -b -q "use repo1; select dolt_commit('-am', 'cm')"
clone_helper $TMPDIRS
run dolt sql --multi-db-dir=dbs2 -b -q "use repo1; show tables" -r csv
[ "$status" -eq 0 ]
[ "${#lines[@]}" -eq 4 ]
[[ "$output" =~ "t1" ]] || false
}
@test "replication-multidb: pull on read" {
push_helper $TMPDIRS
dolt sql --multi-db-dir=dbs1 -b -q "use repo1; create table t1 (a int primary key)"
dolt sql --multi-db-dir=dbs1 -b -q "use repo1; select dolt_commit('-am', 'cm')"
clone_helper $TMPDIRS
push_helper $TMPDIRS
dolt config --global --add sqlserver.global.dolt_read_replica_remote remote1
dolt config --global --add sqlserver.global.dolt_replicate_heads main
run dolt sql --multi-db-dir=dbs2 -b -q "use repo1; show tables" -r csv
[ "$status" -eq 0 ]
[ "${#lines[@]}" -eq 4 ]
[[ "$output" =~ "t1" ]] || false
}
@test "replication-multidb: missing database config" {
dolt config --global --add sqlserver.global.dolt_replicate_to_remote unknown
run dolt sql --multi-db-dir=dbs1 -b -q "use repo1; create table t1 (a int primary key)"
[ "$status" -eq 1 ]
[[ ! "$output" =~ "panic" ]] || false
[[ "$output" =~ "remote not found: 'unknown'" ]] || false
}
@test "replication-multidb: missing database config quiet warning" {
dolt config --global --add sqlserver.global.dolt_replicate_to_remote unknown
dolt config --global --add sqlserver.global.dolt_skip_replication_errors 1
dolt sql --multi-db-dir=dbs1 -b -q "use repo1; create table t1 (a int primary key)"
}
@test "replication-multidb: sql-server push on commit" {
dolt config --global --add sqlserver.global.dolt_replicate_to_remote remote1
cd dbs1
start_multi_db_server repo1
cd ..
server_query repo1 1 "create table t1 (a int primary key)"
multi_query repo1 1 "select dolt_commit('-am', 'cm')"
clone_helper $TMPDIRS
run dolt sql --multi-db-dir=dbs2 -b -q "use repo1; show tables" -r csv
[ "$status" -eq 0 ]
[ "${#lines[@]}" -eq 4 ]
[[ "$output" =~ "t1" ]] || false
}
@test "replication-multidb: sql-server pull on read" {
push_helper $TMPDIRS
dolt sql --multi-db-dir=dbs1 -b -q "use repo1; create table t1 (a int primary key)"
dolt sql --multi-db-dir=dbs1 -b -q "use repo1; select dolt_commit('-am', 'cm')"
clone_helper $TMPDIRS
push_helper $TMPDIRS
dolt config --global --add sqlserver.global.dolt_read_replica_remote remote1
dolt config --global --add sqlserver.global.dolt_replicate_heads main
cd dbs1
start_multi_db_server repo1
server_query repo1 1 "show tables" "Table\nt1"
}