From e0f7aa03aa6ae78464ed98449df2cd3b74bde5e5 Mon Sep 17 00:00:00 2001 From: Jason Fulghum Date: Tue, 19 Sep 2023 14:41:58 -0700 Subject: [PATCH 01/18] First pass on supporting display widths for integer types. --- go/libraries/doltcore/schema/typeinfo/int.go | 3 ++- .../doltcore/schema/typeinfo/typeinfo.go | 27 +++++-------------- go/libraries/doltcore/schema/typeinfo/uint.go | 3 ++- 3 files changed, 11 insertions(+), 22 deletions(-) diff --git a/go/libraries/doltcore/schema/typeinfo/int.go b/go/libraries/doltcore/schema/typeinfo/int.go index 0a7e94b08b..fc862c5f93 100644 --- a/go/libraries/doltcore/schema/typeinfo/int.go +++ b/go/libraries/doltcore/schema/typeinfo/int.go @@ -144,7 +144,8 @@ func (ti *intType) Equals(other TypeInfo) bool { return false } if ti2, ok := other.(*intType); ok { - return ti.sqlIntType.Type() == ti2.sqlIntType.Type() + return ti.sqlIntType.Type() == ti2.sqlIntType.Type() && + ti.sqlIntType.DisplayWidth() == ti2.sqlIntType.DisplayWidth() } return false } diff --git a/go/libraries/doltcore/schema/typeinfo/typeinfo.go b/go/libraries/doltcore/schema/typeinfo/typeinfo.go index 94dac92b57..d354b44e49 100644 --- a/go/libraries/doltcore/schema/typeinfo/typeinfo.go +++ b/go/libraries/doltcore/schema/typeinfo/typeinfo.go @@ -144,26 +144,13 @@ func FromSqlType(sqlType sql.Type) (TypeInfo, error) { switch queryType { case sqltypes.Null: return UnknownType, nil - case sqltypes.Int8: - return Int8Type, nil - case sqltypes.Int16: - return Int16Type, nil - case sqltypes.Int24: - return Int24Type, nil - case sqltypes.Int32: - return Int32Type, nil - case sqltypes.Int64: - return Int64Type, nil - case sqltypes.Uint8: - return Uint8Type, nil - case sqltypes.Uint16: - return Uint16Type, nil - case sqltypes.Uint24: - return Uint24Type, nil - case sqltypes.Uint32: - return Uint32Type, nil - case sqltypes.Uint64: - return Uint64Type, nil + case sqltypes.Int8, sqltypes.Int16, sqltypes.Int24, sqltypes.Int32, sqltypes.Int64, + sqltypes.Uint8, sqltypes.Uint16, sqltypes.Uint24, sqltypes.Uint32, sqltypes.Uint64: + numberType, ok := sqlType.(sql.NumberType) + if !ok { + return nil, fmt.Errorf("expected sql.NumberType, but received: %T", sqlType) + } + return &intType{numberType}, nil case sqltypes.Float32: return Float32Type, nil case sqltypes.Float64: diff --git a/go/libraries/doltcore/schema/typeinfo/uint.go b/go/libraries/doltcore/schema/typeinfo/uint.go index 78c3bde98b..1d21f1e91a 100644 --- a/go/libraries/doltcore/schema/typeinfo/uint.go +++ b/go/libraries/doltcore/schema/typeinfo/uint.go @@ -144,7 +144,8 @@ func (ti *uintType) Equals(other TypeInfo) bool { return false } if ti2, ok := other.(*uintType); ok { - return ti.sqlUintType.Type() == ti2.sqlUintType.Type() + return ti.sqlUintType.Type() == ti2.sqlUintType.Type() && + ti.sqlUintType.DisplayWidth() == ti2.sqlUintType.DisplayWidth() } return false } From baa5d20097562a5f2f7d9edb82f1013a32f58d7e Mon Sep 17 00:00:00 2001 From: Jason Fulghum Date: Tue, 19 Sep 2023 16:32:08 -0700 Subject: [PATCH 02/18] Bumping GMS dependency to latest build from fulghum/dolt-6682 dev branch (6fba7ce3e66080769f4f71929aee244e8ce6e882) --- go/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go/go.mod b/go/go.mod index 1ae5d4d5f3..32de5bc8f7 100644 --- a/go/go.mod +++ b/go/go.mod @@ -59,7 +59,7 @@ require ( github.com/cespare/xxhash v1.1.0 github.com/creasty/defaults v1.6.0 github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2 - github.com/dolthub/go-mysql-server v0.17.1-0.20230919172639-41921e74502c + github.com/dolthub/go-mysql-server v0.17.1-0.20230919231734-6fba7ce3e660 github.com/dolthub/swiss v0.1.0 github.com/goccy/go-json v0.10.2 github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 From 5e6e92b3303d29a95ec27384fbcc349039d24c10 Mon Sep 17 00:00:00 2001 From: Jason Fulghum Date: Tue, 19 Sep 2023 16:38:17 -0700 Subject: [PATCH 03/18] go mod tidy to fixup go.sum --- go/go.sum | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/go/go.sum b/go/go.sum index c501988797..b224ca00f1 100644 --- a/go/go.sum +++ b/go/go.sum @@ -180,8 +180,8 @@ 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-icu-regex v0.0.0-20230524105445-af7e7991c97e h1:kPsT4a47cw1+y/N5SSCkma7FhAPw7KeGmD6c9PBZW9Y= github.com/dolthub/go-icu-regex v0.0.0-20230524105445-af7e7991c97e/go.mod h1:KPUcpx070QOfJK1gNe0zx4pA5sicIK1GMikIGLKC168= -github.com/dolthub/go-mysql-server v0.17.1-0.20230919172639-41921e74502c h1:WWrDzivtwyxkXL/2AVxbwQaBnewlXbA1NSoHciswZuE= -github.com/dolthub/go-mysql-server v0.17.1-0.20230919172639-41921e74502c/go.mod h1:s4hz5TZpFkw8IdLVz58EKKm9cxvRd4jVw1Hs2o+tEXw= +github.com/dolthub/go-mysql-server v0.17.1-0.20230919231734-6fba7ce3e660 h1:Liyzc3SgYjxref1ZixwMN/1m+RgY9fMuRAJ/VPEM2c4= +github.com/dolthub/go-mysql-server v0.17.1-0.20230919231734-6fba7ce3e660/go.mod h1:s4hz5TZpFkw8IdLVz58EKKm9cxvRd4jVw1Hs2o+tEXw= github.com/dolthub/ishell v0.0.0-20221214210346-d7db0b066488 h1:0HHu0GWJH0N6a6keStrHhUAK5/o9LVfkh44pvsV4514= github.com/dolthub/ishell v0.0.0-20221214210346-d7db0b066488/go.mod h1:ehexgi1mPxRTk0Mok/pADALuHbvATulTh6gzr7NzZto= github.com/dolthub/jsonpath v0.0.2-0.20230525180605-8dc13778fd72 h1:NfWmngMi1CYUWU4Ix8wM+USEhjc+mhPlT9JUR/anvbQ= From 9318604d7d3dfd52989fc0e8c9cd3f4e80df3a98 Mon Sep 17 00:00:00 2001 From: Jason Fulghum Date: Tue, 19 Sep 2023 17:09:25 -0700 Subject: [PATCH 04/18] bug fix for uints --- go/libraries/doltcore/schema/typeinfo/typeinfo.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/go/libraries/doltcore/schema/typeinfo/typeinfo.go b/go/libraries/doltcore/schema/typeinfo/typeinfo.go index d354b44e49..11fc732daa 100644 --- a/go/libraries/doltcore/schema/typeinfo/typeinfo.go +++ b/go/libraries/doltcore/schema/typeinfo/typeinfo.go @@ -144,13 +144,18 @@ func FromSqlType(sqlType sql.Type) (TypeInfo, error) { switch queryType { case sqltypes.Null: return UnknownType, nil - case sqltypes.Int8, sqltypes.Int16, sqltypes.Int24, sqltypes.Int32, sqltypes.Int64, - sqltypes.Uint8, sqltypes.Uint16, sqltypes.Uint24, sqltypes.Uint32, sqltypes.Uint64: + case sqltypes.Int8, sqltypes.Int16, sqltypes.Int24, sqltypes.Int32, sqltypes.Int64: numberType, ok := sqlType.(sql.NumberType) if !ok { return nil, fmt.Errorf("expected sql.NumberType, but received: %T", sqlType) } return &intType{numberType}, nil + case sqltypes.Uint8, sqltypes.Uint16, sqltypes.Uint24, sqltypes.Uint32, sqltypes.Uint64: + numberType, ok := sqlType.(sql.NumberType) + if !ok { + return nil, fmt.Errorf("expected sql.NumberType, but received: %T", sqlType) + } + return &uintType{numberType}, nil case sqltypes.Float32: return Float32Type, nil case sqltypes.Float64: From ea3a0004eb48b36c69ea85a0aa309c57cbf0c1d8 Mon Sep 17 00:00:00 2001 From: Jason Fulghum Date: Tue, 19 Sep 2023 17:10:10 -0700 Subject: [PATCH 05/18] Bumping GMS dep to latest build from fulghum/dolt-6682 dev branch (c5a8aec65f59) --- go/go.mod | 2 +- go/go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go/go.mod b/go/go.mod index 32de5bc8f7..2d4e73a187 100644 --- a/go/go.mod +++ b/go/go.mod @@ -59,7 +59,7 @@ require ( github.com/cespare/xxhash v1.1.0 github.com/creasty/defaults v1.6.0 github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2 - github.com/dolthub/go-mysql-server v0.17.1-0.20230919231734-6fba7ce3e660 + github.com/dolthub/go-mysql-server v0.17.1-0.20230919234459-c5a8aec65f59 github.com/dolthub/swiss v0.1.0 github.com/goccy/go-json v0.10.2 github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 diff --git a/go/go.sum b/go/go.sum index b224ca00f1..9d551643b1 100644 --- a/go/go.sum +++ b/go/go.sum @@ -182,6 +182,8 @@ github.com/dolthub/go-icu-regex v0.0.0-20230524105445-af7e7991c97e h1:kPsT4a47cw github.com/dolthub/go-icu-regex v0.0.0-20230524105445-af7e7991c97e/go.mod h1:KPUcpx070QOfJK1gNe0zx4pA5sicIK1GMikIGLKC168= github.com/dolthub/go-mysql-server v0.17.1-0.20230919231734-6fba7ce3e660 h1:Liyzc3SgYjxref1ZixwMN/1m+RgY9fMuRAJ/VPEM2c4= github.com/dolthub/go-mysql-server v0.17.1-0.20230919231734-6fba7ce3e660/go.mod h1:s4hz5TZpFkw8IdLVz58EKKm9cxvRd4jVw1Hs2o+tEXw= +github.com/dolthub/go-mysql-server v0.17.1-0.20230919234459-c5a8aec65f59 h1:aA9oXI1D7ziTEP2JoiRmyaNOYyj2+yh//S3F1FVkTp4= +github.com/dolthub/go-mysql-server v0.17.1-0.20230919234459-c5a8aec65f59/go.mod h1:s4hz5TZpFkw8IdLVz58EKKm9cxvRd4jVw1Hs2o+tEXw= github.com/dolthub/ishell v0.0.0-20221214210346-d7db0b066488 h1:0HHu0GWJH0N6a6keStrHhUAK5/o9LVfkh44pvsV4514= github.com/dolthub/ishell v0.0.0-20221214210346-d7db0b066488/go.mod h1:ehexgi1mPxRTk0Mok/pADALuHbvATulTh6gzr7NzZto= github.com/dolthub/jsonpath v0.0.2-0.20230525180605-8dc13778fd72 h1:NfWmngMi1CYUWU4Ix8wM+USEhjc+mhPlT9JUR/anvbQ= From d56e72c0f49e5d80a278520fb592fc1a7fa5f5a5 Mon Sep 17 00:00:00 2001 From: Jason Fulghum Date: Tue, 19 Sep 2023 19:07:06 -0700 Subject: [PATCH 06/18] Fixing BATS tests for TINYINT(1) support --- integration-tests/bats/types.bats | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/integration-tests/bats/types.bats b/integration-tests/bats/types.bats index 5b5eec5b28..82fd08931c 100644 --- a/integration-tests/bats/types.bats +++ b/integration-tests/bats/types.bats @@ -190,12 +190,11 @@ CREATE TABLE test ( SQL run dolt schema show [ "$status" -eq "0" ] - [[ "$output" =~ "\`v\` tinyint" ]] || false + [[ "$output" =~ "\`v\` tinyint(1)" ]] || false # check information_schema.COLUMNS table - # TODO : 'column_type' should be 'tinyint(1)' run dolt sql -q "select * from information_schema.COLUMNS where table_name = 'test' and column_name = 'v';" -r csv - [[ "$output" =~ 'test,v,2,,YES,tinyint,,,3,0,,,,tinyint,"","","insert,references,select,update","","",' ]] || false + [[ "$output" =~ 'test,v,2,,YES,tinyint,,,3,0,,,,tinyint(1),"","","insert,references,select,update","","",' ]] || false } @test "types: BOOLEAN" { @@ -208,7 +207,7 @@ CREATE TABLE test ( SQL run dolt schema show [ "$status" -eq "0" ] - [[ "$output" =~ "\`v\` tinyint" ]] || false + [[ "$output" =~ "\`v\` tinyint(1)" ]] || false dolt sql -q "INSERT INTO test VALUES (1, true);" run dolt sql -q "SELECT * FROM test" [ "$status" -eq "0" ] @@ -219,9 +218,8 @@ SQL [[ "${lines[3]}" =~ " 0 " ]] || false # check information_schema.COLUMNS table - # TODO : 'column_type' should be 'tinyint(1)' run dolt sql -q "select * from information_schema.COLUMNS where table_name = 'test' and column_name = 'v';" -r csv - [[ "$output" =~ 'test,v,2,,YES,tinyint,,,3,0,,,,tinyint,"","","insert,references,select,update","","",' ]] || false + [[ "$output" =~ 'test,v,2,,YES,tinyint,,,3,0,,,,tinyint(1),"","","insert,references,select,update","","",' ]] || false } @test "types: CHAR(10)" { From 1ba53109d9c52f420c392f77c372e9c24cf5b591 Mon Sep 17 00:00:00 2001 From: Jason Fulghum Date: Tue, 19 Sep 2023 19:27:03 -0700 Subject: [PATCH 07/18] Bumping to latest GMS dev build --- go/go.mod | 2 +- go/go.sum | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/go/go.mod b/go/go.mod index 2d4e73a187..74a5e92c1a 100644 --- a/go/go.mod +++ b/go/go.mod @@ -59,7 +59,7 @@ require ( github.com/cespare/xxhash v1.1.0 github.com/creasty/defaults v1.6.0 github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2 - github.com/dolthub/go-mysql-server v0.17.1-0.20230919234459-c5a8aec65f59 + github.com/dolthub/go-mysql-server v0.17.1-0.20230920022453-e17d48ed31aa github.com/dolthub/swiss v0.1.0 github.com/goccy/go-json v0.10.2 github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 diff --git a/go/go.sum b/go/go.sum index 9d551643b1..1594ff06ed 100644 --- a/go/go.sum +++ b/go/go.sum @@ -180,10 +180,8 @@ 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-icu-regex v0.0.0-20230524105445-af7e7991c97e h1:kPsT4a47cw1+y/N5SSCkma7FhAPw7KeGmD6c9PBZW9Y= github.com/dolthub/go-icu-regex v0.0.0-20230524105445-af7e7991c97e/go.mod h1:KPUcpx070QOfJK1gNe0zx4pA5sicIK1GMikIGLKC168= -github.com/dolthub/go-mysql-server v0.17.1-0.20230919231734-6fba7ce3e660 h1:Liyzc3SgYjxref1ZixwMN/1m+RgY9fMuRAJ/VPEM2c4= -github.com/dolthub/go-mysql-server v0.17.1-0.20230919231734-6fba7ce3e660/go.mod h1:s4hz5TZpFkw8IdLVz58EKKm9cxvRd4jVw1Hs2o+tEXw= -github.com/dolthub/go-mysql-server v0.17.1-0.20230919234459-c5a8aec65f59 h1:aA9oXI1D7ziTEP2JoiRmyaNOYyj2+yh//S3F1FVkTp4= -github.com/dolthub/go-mysql-server v0.17.1-0.20230919234459-c5a8aec65f59/go.mod h1:s4hz5TZpFkw8IdLVz58EKKm9cxvRd4jVw1Hs2o+tEXw= +github.com/dolthub/go-mysql-server v0.17.1-0.20230920022453-e17d48ed31aa h1:JlHH1wqvOSkLK+YwQ0xq/cTZZt/nJmvdV+WszvRoiVk= +github.com/dolthub/go-mysql-server v0.17.1-0.20230920022453-e17d48ed31aa/go.mod h1:s4hz5TZpFkw8IdLVz58EKKm9cxvRd4jVw1Hs2o+tEXw= github.com/dolthub/ishell v0.0.0-20221214210346-d7db0b066488 h1:0HHu0GWJH0N6a6keStrHhUAK5/o9LVfkh44pvsV4514= github.com/dolthub/ishell v0.0.0-20221214210346-d7db0b066488/go.mod h1:ehexgi1mPxRTk0Mok/pADALuHbvATulTh6gzr7NzZto= github.com/dolthub/jsonpath v0.0.2-0.20230525180605-8dc13778fd72 h1:NfWmngMi1CYUWU4Ix8wM+USEhjc+mhPlT9JUR/anvbQ= From ee99d7c3b1afd720903c0a25b314ab80e9cb7f01 Mon Sep 17 00:00:00 2001 From: Jason Fulghum Date: Tue, 19 Sep 2023 19:27:25 -0700 Subject: [PATCH 08/18] New test --- go/libraries/doltcore/sqle/sqlddl_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/go/libraries/doltcore/sqle/sqlddl_test.go b/go/libraries/doltcore/sqle/sqlddl_test.go index 4a83ba5e92..874f8ee848 100644 --- a/go/libraries/doltcore/sqle/sqlddl_test.go +++ b/go/libraries/doltcore/sqle/sqlddl_test.go @@ -137,7 +137,8 @@ func TestCreateTable(t *testing.T) { c23 tinyint unsigned, c24 smallint unsigned, c25 mediumint unsigned, - c26 bigint unsigned)`, + c26 bigint unsigned, + c27 tinyint(1))`, expectedSchema: dtestutils.CreateSchema( schemaNewColumn(t, "c0", 594, gmstypes.Int32, true, schema.NotNullConstraint{}), schemaNewColumn(t, "c1", 601, gmstypes.Int8, false), @@ -166,6 +167,7 @@ func TestCreateTable(t *testing.T) { schemaNewColumn(t, "c24", 8689, gmstypes.Uint16, false), schemaNewColumn(t, "c25", 5243, gmstypes.Uint24, false), schemaNewColumn(t, "c26", 9338, gmstypes.Uint64, false), + schemaNewColumn(t, "c27", 5981, gmstypes.Boolean, false), ), }, { From 365d62f22597c3d7f6214c06514d12e9430d39bb Mon Sep 17 00:00:00 2001 From: Jason Fulghum Date: Wed, 20 Sep 2023 10:07:08 -0700 Subject: [PATCH 09/18] BATS test updates for TINYINT(1) --- integration-tests/bats/schema-import.bats | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration-tests/bats/schema-import.bats b/integration-tests/bats/schema-import.bats index a0b2059005..653e02f91d 100755 --- a/integration-tests/bats/schema-import.bats +++ b/integration-tests/bats/schema-import.bats @@ -338,7 +338,7 @@ DELIM [ "$status" -eq 0 ] [[ "$output" =~ '- `a` varchar(16383),' ]] || false [[ "$output" =~ '- `b` float,' ]] || false - [[ "$output" =~ '- `c` tinyint,' ]] || false + [[ "$output" =~ '- `c` tinyint(1),' ]] || false # assert no columns were added [[ ! "$output" = "+ \`" ]] || false } From 81de47c791bf7e0211f1648768df18ea03de78e7 Mon Sep 17 00:00:00 2001 From: Jason Fulghum Date: Wed, 20 Sep 2023 10:11:00 -0700 Subject: [PATCH 10/18] Updating tests to use gmstypes.Boolean --- go/libraries/doltcore/sqle/sqlselect_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/go/libraries/doltcore/sqle/sqlselect_test.go b/go/libraries/doltcore/sqle/sqlselect_test.go index 3c000c984b..e5213712f2 100644 --- a/go/libraries/doltcore/sqle/sqlselect_test.go +++ b/go/libraries/doltcore/sqle/sqlselect_test.go @@ -466,7 +466,7 @@ func BasicSelectTests() []SelectTest { Query: "select is_married and age >= 40 from people where last_name = 'Simpson' order by id limit 2", ExpectedRows: []sql.Row{{true}, {false}}, ExpectedSqlSchema: sql.Schema{ - &sql.Column{Name: "is_married and age >= 40", Type: gmstypes.Int8}, + &sql.Column{Name: "is_married and age >= 40", Type: gmstypes.Boolean}, }, }, { @@ -480,7 +480,7 @@ func BasicSelectTests() []SelectTest { }, ExpectedSqlSchema: sql.Schema{ &sql.Column{Name: "first_name", Type: typeinfo.StringDefaultType.ToSqlType()}, - &sql.Column{Name: "not_marge", Type: gmstypes.Int8}, + &sql.Column{Name: "not_marge", Type: gmstypes.Boolean}, }, }, { From f9129e446c295357c18515d91142f0c70bc1a85a Mon Sep 17 00:00:00 2001 From: Jason Fulghum Date: Wed, 20 Sep 2023 10:14:55 -0700 Subject: [PATCH 11/18] Bumping GMS dep to latest build from fulghum/dolt-6682 dev branch (ed0131c15f468436d0b63e4b482b10445a23be73) --- go/go.mod | 2 +- go/go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go/go.mod b/go/go.mod index 74a5e92c1a..4128b75436 100644 --- a/go/go.mod +++ b/go/go.mod @@ -59,7 +59,7 @@ require ( github.com/cespare/xxhash v1.1.0 github.com/creasty/defaults v1.6.0 github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2 - github.com/dolthub/go-mysql-server v0.17.1-0.20230920022453-e17d48ed31aa + github.com/dolthub/go-mysql-server v0.17.1-0.20230920170148-ed0131c15f46 github.com/dolthub/swiss v0.1.0 github.com/goccy/go-json v0.10.2 github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 diff --git a/go/go.sum b/go/go.sum index 1594ff06ed..6aee557a3b 100644 --- a/go/go.sum +++ b/go/go.sum @@ -182,6 +182,8 @@ github.com/dolthub/go-icu-regex v0.0.0-20230524105445-af7e7991c97e h1:kPsT4a47cw github.com/dolthub/go-icu-regex v0.0.0-20230524105445-af7e7991c97e/go.mod h1:KPUcpx070QOfJK1gNe0zx4pA5sicIK1GMikIGLKC168= github.com/dolthub/go-mysql-server v0.17.1-0.20230920022453-e17d48ed31aa h1:JlHH1wqvOSkLK+YwQ0xq/cTZZt/nJmvdV+WszvRoiVk= github.com/dolthub/go-mysql-server v0.17.1-0.20230920022453-e17d48ed31aa/go.mod h1:s4hz5TZpFkw8IdLVz58EKKm9cxvRd4jVw1Hs2o+tEXw= +github.com/dolthub/go-mysql-server v0.17.1-0.20230920170148-ed0131c15f46 h1:Wy+kUQLsVPqa5Cx97/pzDKWjTvEbE64jDsDNmsbcO7E= +github.com/dolthub/go-mysql-server v0.17.1-0.20230920170148-ed0131c15f46/go.mod h1:s4hz5TZpFkw8IdLVz58EKKm9cxvRd4jVw1Hs2o+tEXw= github.com/dolthub/ishell v0.0.0-20221214210346-d7db0b066488 h1:0HHu0GWJH0N6a6keStrHhUAK5/o9LVfkh44pvsV4514= github.com/dolthub/ishell v0.0.0-20221214210346-d7db0b066488/go.mod h1:ehexgi1mPxRTk0Mok/pADALuHbvATulTh6gzr7NzZto= github.com/dolthub/jsonpath v0.0.2-0.20230525180605-8dc13778fd72 h1:NfWmngMi1CYUWU4Ix8wM+USEhjc+mhPlT9JUR/anvbQ= From e87f4ef67a6ca53e7cea074e22c201866a305c12 Mon Sep 17 00:00:00 2001 From: Jason Fulghum Date: Wed, 20 Sep 2023 11:21:18 -0700 Subject: [PATCH 12/18] Tidying up --- .../doltcore/schema/typeinfo/typeinfo.go | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/go/libraries/doltcore/schema/typeinfo/typeinfo.go b/go/libraries/doltcore/schema/typeinfo/typeinfo.go index 11fc732daa..bca2437edc 100644 --- a/go/libraries/doltcore/schema/typeinfo/typeinfo.go +++ b/go/libraries/doltcore/schema/typeinfo/typeinfo.go @@ -144,18 +144,32 @@ func FromSqlType(sqlType sql.Type) (TypeInfo, error) { switch queryType { case sqltypes.Null: return UnknownType, nil - case sqltypes.Int8, sqltypes.Int16, sqltypes.Int24, sqltypes.Int32, sqltypes.Int64: + case sqltypes.Int8: + // MySQL allows only the TINYINT type to have a display width, so it's the only + // integer type that needs to be checked for it's underlying NumberType data. numberType, ok := sqlType.(sql.NumberType) if !ok { return nil, fmt.Errorf("expected sql.NumberType, but received: %T", sqlType) } return &intType{numberType}, nil - case sqltypes.Uint8, sqltypes.Uint16, sqltypes.Uint24, sqltypes.Uint32, sqltypes.Uint64: - numberType, ok := sqlType.(sql.NumberType) - if !ok { - return nil, fmt.Errorf("expected sql.NumberType, but received: %T", sqlType) - } - return &uintType{numberType}, nil + case sqltypes.Int16: + return Int16Type, nil + case sqltypes.Int24: + return Int24Type, nil + case sqltypes.Int32: + return Int32Type, nil + case sqltypes.Int64: + return Int64Type, nil + case sqltypes.Uint8: + return Uint8Type, nil + case sqltypes.Uint16: + return Uint16Type, nil + case sqltypes.Uint24: + return Uint24Type, nil + case sqltypes.Uint32: + return Uint32Type, nil + case sqltypes.Uint64: + return Uint64Type, nil case sqltypes.Float32: return Float32Type, nil case sqltypes.Float64: From 9407716896c2c223d4288b858c880144361a9574 Mon Sep 17 00:00:00 2001 From: Jason Fulghum Date: Wed, 20 Sep 2023 11:25:42 -0700 Subject: [PATCH 13/18] Bumping GMS dep to latest build from fulghum/dolt-6682 dev branch (f1f94577d4a5e10ced803fb6fe4be07a8499010f) --- go/go.mod | 2 +- go/go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go/go.mod b/go/go.mod index 4128b75436..2d0df9c922 100644 --- a/go/go.mod +++ b/go/go.mod @@ -59,7 +59,7 @@ require ( github.com/cespare/xxhash v1.1.0 github.com/creasty/defaults v1.6.0 github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2 - github.com/dolthub/go-mysql-server v0.17.1-0.20230920170148-ed0131c15f46 + github.com/dolthub/go-mysql-server v0.17.1-0.20230920175905-f1f94577d4a5 github.com/dolthub/swiss v0.1.0 github.com/goccy/go-json v0.10.2 github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 diff --git a/go/go.sum b/go/go.sum index 6aee557a3b..7e968654ab 100644 --- a/go/go.sum +++ b/go/go.sum @@ -184,6 +184,8 @@ github.com/dolthub/go-mysql-server v0.17.1-0.20230920022453-e17d48ed31aa h1:JlHH github.com/dolthub/go-mysql-server v0.17.1-0.20230920022453-e17d48ed31aa/go.mod h1:s4hz5TZpFkw8IdLVz58EKKm9cxvRd4jVw1Hs2o+tEXw= github.com/dolthub/go-mysql-server v0.17.1-0.20230920170148-ed0131c15f46 h1:Wy+kUQLsVPqa5Cx97/pzDKWjTvEbE64jDsDNmsbcO7E= github.com/dolthub/go-mysql-server v0.17.1-0.20230920170148-ed0131c15f46/go.mod h1:s4hz5TZpFkw8IdLVz58EKKm9cxvRd4jVw1Hs2o+tEXw= +github.com/dolthub/go-mysql-server v0.17.1-0.20230920175905-f1f94577d4a5 h1:ANjP6HuwLJEmMWqs3VqBbdYnnNv4jaw27R5+EPG5de0= +github.com/dolthub/go-mysql-server v0.17.1-0.20230920175905-f1f94577d4a5/go.mod h1:s4hz5TZpFkw8IdLVz58EKKm9cxvRd4jVw1Hs2o+tEXw= github.com/dolthub/ishell v0.0.0-20221214210346-d7db0b066488 h1:0HHu0GWJH0N6a6keStrHhUAK5/o9LVfkh44pvsV4514= github.com/dolthub/ishell v0.0.0-20221214210346-d7db0b066488/go.mod h1:ehexgi1mPxRTk0Mok/pADALuHbvATulTh6gzr7NzZto= github.com/dolthub/jsonpath v0.0.2-0.20230525180605-8dc13778fd72 h1:NfWmngMi1CYUWU4Ix8wM+USEhjc+mhPlT9JUR/anvbQ= From ab26d3e71986821e4320a0cbfb72d6bfac59a516 Mon Sep 17 00:00:00 2001 From: Jason Fulghum Date: Wed, 20 Sep 2023 12:45:58 -0700 Subject: [PATCH 14/18] Bumping GMS dep to latest build from fulghum/dolt-6682 dev branch (d248817fc35140736b894d811974566f2bd62412) --- go/go.mod | 2 +- go/go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go/go.mod b/go/go.mod index 2d0df9c922..33461d2c96 100644 --- a/go/go.mod +++ b/go/go.mod @@ -59,7 +59,7 @@ require ( github.com/cespare/xxhash v1.1.0 github.com/creasty/defaults v1.6.0 github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2 - github.com/dolthub/go-mysql-server v0.17.1-0.20230920175905-f1f94577d4a5 + github.com/dolthub/go-mysql-server v0.17.1-0.20230920194137-d248817fc351 github.com/dolthub/swiss v0.1.0 github.com/goccy/go-json v0.10.2 github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 diff --git a/go/go.sum b/go/go.sum index 7e968654ab..8a6e317222 100644 --- a/go/go.sum +++ b/go/go.sum @@ -186,6 +186,8 @@ github.com/dolthub/go-mysql-server v0.17.1-0.20230920170148-ed0131c15f46 h1:Wy+k github.com/dolthub/go-mysql-server v0.17.1-0.20230920170148-ed0131c15f46/go.mod h1:s4hz5TZpFkw8IdLVz58EKKm9cxvRd4jVw1Hs2o+tEXw= github.com/dolthub/go-mysql-server v0.17.1-0.20230920175905-f1f94577d4a5 h1:ANjP6HuwLJEmMWqs3VqBbdYnnNv4jaw27R5+EPG5de0= github.com/dolthub/go-mysql-server v0.17.1-0.20230920175905-f1f94577d4a5/go.mod h1:s4hz5TZpFkw8IdLVz58EKKm9cxvRd4jVw1Hs2o+tEXw= +github.com/dolthub/go-mysql-server v0.17.1-0.20230920194137-d248817fc351 h1:hf0/QHynrQuRHY70Rpubuhw0P93NcXvxNxUpQwglhVU= +github.com/dolthub/go-mysql-server v0.17.1-0.20230920194137-d248817fc351/go.mod h1:s4hz5TZpFkw8IdLVz58EKKm9cxvRd4jVw1Hs2o+tEXw= github.com/dolthub/ishell v0.0.0-20221214210346-d7db0b066488 h1:0HHu0GWJH0N6a6keStrHhUAK5/o9LVfkh44pvsV4514= github.com/dolthub/ishell v0.0.0-20221214210346-d7db0b066488/go.mod h1:ehexgi1mPxRTk0Mok/pADALuHbvATulTh6gzr7NzZto= github.com/dolthub/jsonpath v0.0.2-0.20230525180605-8dc13778fd72 h1:NfWmngMi1CYUWU4Ix8wM+USEhjc+mhPlT9JUR/anvbQ= From 1c2939d3176288348471f49442730efc017f9253 Mon Sep 17 00:00:00 2001 From: James Cor Date: Wed, 20 Sep 2023 13:56:09 -0700 Subject: [PATCH 15/18] bump --- go/go.mod | 4 ++-- go/go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go/go.mod b/go/go.mod index 8495221284..4afc5876e9 100644 --- a/go/go.mod +++ b/go/go.mod @@ -15,7 +15,7 @@ require ( github.com/dolthub/fslock v0.0.3 github.com/dolthub/ishell v0.0.0-20221214210346-d7db0b066488 github.com/dolthub/sqllogictest/go v0.0.0-20201107003712-816f3ae12d81 - github.com/dolthub/vitess v0.0.0-20230920000107-f381b0714e35 + github.com/dolthub/vitess v0.0.0-20230920190630-648c869b4af5 github.com/dustin/go-humanize v1.0.0 github.com/fatih/color v1.13.0 github.com/flynn-archive/go-shlex v0.0.0-20150515145356-3f9db97f8568 @@ -59,7 +59,7 @@ require ( github.com/cespare/xxhash v1.1.0 github.com/creasty/defaults v1.6.0 github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2 - github.com/dolthub/go-mysql-server v0.17.1-0.20230920182617-dd7450c028bb + github.com/dolthub/go-mysql-server v0.17.1-0.20230920193236-f6f51f8a84aa github.com/dolthub/swiss v0.1.0 github.com/goccy/go-json v0.10.2 github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 diff --git a/go/go.sum b/go/go.sum index 4653b13e9e..d1ad88daa9 100644 --- a/go/go.sum +++ b/go/go.sum @@ -180,8 +180,8 @@ 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-icu-regex v0.0.0-20230524105445-af7e7991c97e h1:kPsT4a47cw1+y/N5SSCkma7FhAPw7KeGmD6c9PBZW9Y= github.com/dolthub/go-icu-regex v0.0.0-20230524105445-af7e7991c97e/go.mod h1:KPUcpx070QOfJK1gNe0zx4pA5sicIK1GMikIGLKC168= -github.com/dolthub/go-mysql-server v0.17.1-0.20230920182617-dd7450c028bb h1:KMCaqPNWAS3i6DhHHYB44MKRA46VtDZZUp9TJqFmfrs= -github.com/dolthub/go-mysql-server v0.17.1-0.20230920182617-dd7450c028bb/go.mod h1:AIAn5YQYb8NyO4Sdgf7RW/Ih7DRChd5kAcow260NbAw= +github.com/dolthub/go-mysql-server v0.17.1-0.20230920193236-f6f51f8a84aa h1:TRARXLwRp5vV5oVLF0lelfIvuEtJ3iqRDdBKlvkAjmM= +github.com/dolthub/go-mysql-server v0.17.1-0.20230920193236-f6f51f8a84aa/go.mod h1:Q4x3bXy1fzb7/HyhIXc35cXj0J7ETS6K0FwlbTNw9m4= github.com/dolthub/ishell v0.0.0-20221214210346-d7db0b066488 h1:0HHu0GWJH0N6a6keStrHhUAK5/o9LVfkh44pvsV4514= github.com/dolthub/ishell v0.0.0-20221214210346-d7db0b066488/go.mod h1:ehexgi1mPxRTk0Mok/pADALuHbvATulTh6gzr7NzZto= github.com/dolthub/jsonpath v0.0.2-0.20230525180605-8dc13778fd72 h1:NfWmngMi1CYUWU4Ix8wM+USEhjc+mhPlT9JUR/anvbQ= @@ -192,8 +192,8 @@ github.com/dolthub/sqllogictest/go v0.0.0-20201107003712-816f3ae12d81 h1:7/v8q9X github.com/dolthub/sqllogictest/go v0.0.0-20201107003712-816f3ae12d81/go.mod h1:siLfyv2c92W1eN/R4QqG/+RjjX5W2+gCTRjZxBjI3TY= github.com/dolthub/swiss v0.1.0 h1:EaGQct3AqeP/MjASHLiH6i4TAmgbG/c4rA6a1bzCOPc= github.com/dolthub/swiss v0.1.0/go.mod h1:BeucyB08Vb1G9tumVN3Vp/pyY4AMUnr9p7Rz7wJ7kAQ= -github.com/dolthub/vitess v0.0.0-20230920000107-f381b0714e35 h1:LIfh8Uq3DJt8MS/cNC5aOYOQKmi5/SXt0zwhIS/9eRA= -github.com/dolthub/vitess v0.0.0-20230920000107-f381b0714e35/go.mod h1:IwjNXSQPymrja5pVqmfnYdcy7Uv7eNJNBPK/MEh9OOw= +github.com/dolthub/vitess v0.0.0-20230920190630-648c869b4af5 h1:RfDb0ycMTSPu+0dpJZSNZAiI3lanJR5IrHirEVP/CVg= +github.com/dolthub/vitess v0.0.0-20230920190630-648c869b4af5/go.mod h1:IwjNXSQPymrja5pVqmfnYdcy7Uv7eNJNBPK/MEh9OOw= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= From 49a579f5bfd3da73c4888593d26433282731afe2 Mon Sep 17 00:00:00 2001 From: macneale4 <46170177+macneale4@users.noreply.github.com> Date: Wed, 20 Sep 2023 21:55:23 +0000 Subject: [PATCH 16/18] [ga-bump-dep] Bump dependency in Dolt by macneale4 --- go/go.mod | 4 ++-- go/go.sum | 14 ++++---------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/go/go.mod b/go/go.mod index 33461d2c96..e553f62f88 100644 --- a/go/go.mod +++ b/go/go.mod @@ -15,7 +15,7 @@ require ( github.com/dolthub/fslock v0.0.3 github.com/dolthub/ishell v0.0.0-20221214210346-d7db0b066488 github.com/dolthub/sqllogictest/go v0.0.0-20201107003712-816f3ae12d81 - github.com/dolthub/vitess v0.0.0-20230915082726-ef1b92774b14 + github.com/dolthub/vitess v0.0.0-20230920212116-eb645ef178c2 github.com/dustin/go-humanize v1.0.0 github.com/fatih/color v1.13.0 github.com/flynn-archive/go-shlex v0.0.0-20150515145356-3f9db97f8568 @@ -59,7 +59,7 @@ require ( github.com/cespare/xxhash v1.1.0 github.com/creasty/defaults v1.6.0 github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2 - github.com/dolthub/go-mysql-server v0.17.1-0.20230920194137-d248817fc351 + github.com/dolthub/go-mysql-server v0.17.1-0.20230920214618-75692cb811e7 github.com/dolthub/swiss v0.1.0 github.com/goccy/go-json v0.10.2 github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 diff --git a/go/go.sum b/go/go.sum index 8a6e317222..776bd37c4b 100644 --- a/go/go.sum +++ b/go/go.sum @@ -180,14 +180,8 @@ 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-icu-regex v0.0.0-20230524105445-af7e7991c97e h1:kPsT4a47cw1+y/N5SSCkma7FhAPw7KeGmD6c9PBZW9Y= github.com/dolthub/go-icu-regex v0.0.0-20230524105445-af7e7991c97e/go.mod h1:KPUcpx070QOfJK1gNe0zx4pA5sicIK1GMikIGLKC168= -github.com/dolthub/go-mysql-server v0.17.1-0.20230920022453-e17d48ed31aa h1:JlHH1wqvOSkLK+YwQ0xq/cTZZt/nJmvdV+WszvRoiVk= -github.com/dolthub/go-mysql-server v0.17.1-0.20230920022453-e17d48ed31aa/go.mod h1:s4hz5TZpFkw8IdLVz58EKKm9cxvRd4jVw1Hs2o+tEXw= -github.com/dolthub/go-mysql-server v0.17.1-0.20230920170148-ed0131c15f46 h1:Wy+kUQLsVPqa5Cx97/pzDKWjTvEbE64jDsDNmsbcO7E= -github.com/dolthub/go-mysql-server v0.17.1-0.20230920170148-ed0131c15f46/go.mod h1:s4hz5TZpFkw8IdLVz58EKKm9cxvRd4jVw1Hs2o+tEXw= -github.com/dolthub/go-mysql-server v0.17.1-0.20230920175905-f1f94577d4a5 h1:ANjP6HuwLJEmMWqs3VqBbdYnnNv4jaw27R5+EPG5de0= -github.com/dolthub/go-mysql-server v0.17.1-0.20230920175905-f1f94577d4a5/go.mod h1:s4hz5TZpFkw8IdLVz58EKKm9cxvRd4jVw1Hs2o+tEXw= -github.com/dolthub/go-mysql-server v0.17.1-0.20230920194137-d248817fc351 h1:hf0/QHynrQuRHY70Rpubuhw0P93NcXvxNxUpQwglhVU= -github.com/dolthub/go-mysql-server v0.17.1-0.20230920194137-d248817fc351/go.mod h1:s4hz5TZpFkw8IdLVz58EKKm9cxvRd4jVw1Hs2o+tEXw= +github.com/dolthub/go-mysql-server v0.17.1-0.20230920214618-75692cb811e7 h1:QWo34tf44CmwZh27GMqgPrNU0cr+Fc9ULoX6o40PwMQ= +github.com/dolthub/go-mysql-server v0.17.1-0.20230920214618-75692cb811e7/go.mod h1:9xeYTIAFZLOdDZzuOf1HQF5Td6OYqMt24IRSJM0ayjM= github.com/dolthub/ishell v0.0.0-20221214210346-d7db0b066488 h1:0HHu0GWJH0N6a6keStrHhUAK5/o9LVfkh44pvsV4514= github.com/dolthub/ishell v0.0.0-20221214210346-d7db0b066488/go.mod h1:ehexgi1mPxRTk0Mok/pADALuHbvATulTh6gzr7NzZto= github.com/dolthub/jsonpath v0.0.2-0.20230525180605-8dc13778fd72 h1:NfWmngMi1CYUWU4Ix8wM+USEhjc+mhPlT9JUR/anvbQ= @@ -198,8 +192,8 @@ github.com/dolthub/sqllogictest/go v0.0.0-20201107003712-816f3ae12d81 h1:7/v8q9X github.com/dolthub/sqllogictest/go v0.0.0-20201107003712-816f3ae12d81/go.mod h1:siLfyv2c92W1eN/R4QqG/+RjjX5W2+gCTRjZxBjI3TY= github.com/dolthub/swiss v0.1.0 h1:EaGQct3AqeP/MjASHLiH6i4TAmgbG/c4rA6a1bzCOPc= github.com/dolthub/swiss v0.1.0/go.mod h1:BeucyB08Vb1G9tumVN3Vp/pyY4AMUnr9p7Rz7wJ7kAQ= -github.com/dolthub/vitess v0.0.0-20230915082726-ef1b92774b14 h1:w0MwDEgWWei13UqZeS6mlSPUQ3iMHMDlrU+MUKQtR4s= -github.com/dolthub/vitess v0.0.0-20230915082726-ef1b92774b14/go.mod h1:IwjNXSQPymrja5pVqmfnYdcy7Uv7eNJNBPK/MEh9OOw= +github.com/dolthub/vitess v0.0.0-20230920212116-eb645ef178c2 h1:L2ST5YNistuYVkVfZcTp5ItVpTNQ0i6oGGM7l6If9ME= +github.com/dolthub/vitess v0.0.0-20230920212116-eb645ef178c2/go.mod h1:IwjNXSQPymrja5pVqmfnYdcy7Uv7eNJNBPK/MEh9OOw= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= From 3b0ca8bb21635e723eeffe4ced5b97deb4219b53 Mon Sep 17 00:00:00 2001 From: Aaron Son Date: Wed, 20 Sep 2023 15:47:46 -0700 Subject: [PATCH 17/18] go/libraries/doltcore/sqle: cluster: When a database is dropped, shutdown the replication goroutines and stop returning its status in the dolt_cluster_status table. --- go/cmd/dolt/commands/engine/sqlengine.go | 1 + .../doltcore/sqle/cluster/commithook.go | 10 ++- .../doltcore/sqle/cluster/controller.go | 21 ++++++ .../doltcore/sqle/database_provider.go | 8 +++ .../tests/sql-server-cluster.yaml | 65 +++++++++++++++++++ 5 files changed, 103 insertions(+), 2 deletions(-) diff --git a/go/cmd/dolt/commands/engine/sqlengine.go b/go/cmd/dolt/commands/engine/sqlengine.go index fd8602ad2e..f87e4819f2 100644 --- a/go/cmd/dolt/commands/engine/sqlengine.go +++ b/go/cmd/dolt/commands/engine/sqlengine.go @@ -130,6 +130,7 @@ func NewSqlEngine( config.ClusterController.RegisterStoredProcedures(pro) pro.InitDatabaseHook = cluster.NewInitDatabaseHook(config.ClusterController, bThreads, pro.InitDatabaseHook) + pro.DropDatabaseHook = config.ClusterController.DropDatabaseHook // Create the engine engine := gms.New(analyzer.NewBuilder(pro).WithParallelism(parallelism).Build(), &gms.Config{ diff --git a/go/libraries/doltcore/sqle/cluster/commithook.go b/go/libraries/doltcore/sqle/cluster/commithook.go index b917522b40..3dfb169fbd 100644 --- a/go/libraries/doltcore/sqle/cluster/commithook.go +++ b/go/libraries/doltcore/sqle/cluster/commithook.go @@ -43,6 +43,7 @@ type commithook struct { mu sync.Mutex wg sync.WaitGroup cond *sync.Cond + shutdown atomic.Bool nextHead hash.Hash lastPushedHead hash.Hash nextPushAttempt time.Time @@ -126,7 +127,7 @@ func (h *commithook) replicate(ctx context.Context) { h.mu.Lock() defer h.mu.Unlock() shouldHeartbeat := false - for { + for !h.shutdown.Load() { lgr := h.logger() // Shutdown for context canceled. if ctx.Err() != nil { @@ -371,7 +372,7 @@ func (h *commithook) tick(ctx context.Context) { defer h.wg.Done() ticker := time.NewTicker(1 * time.Second) defer ticker.Stop() - for { + for !h.shutdown.Load() { select { case <-ctx.Done(): return @@ -381,6 +382,11 @@ func (h *commithook) tick(ctx context.Context) { } } +func (h *commithook) databaseWasDropped() { + h.shutdown.Store(true) + h.cond.Signal() +} + func (h *commithook) recordSuccessfulRemoteSrvCommit() { h.mu.Lock() defer h.mu.Unlock() diff --git a/go/libraries/doltcore/sqle/cluster/controller.go b/go/libraries/doltcore/sqle/cluster/controller.go index 4d50d44480..a5bc5f8e0b 100644 --- a/go/libraries/doltcore/sqle/cluster/controller.go +++ b/go/libraries/doltcore/sqle/cluster/controller.go @@ -310,6 +310,27 @@ func (c *Controller) RegisterStoredProcedures(store procedurestore) { store.Register(newTransitionToStandbyProcedure(c)) } +func (c *Controller) DropDatabaseHook(dbname string) { + if c == nil { + return + } + c.mu.Lock() + defer c.mu.Unlock() + + j := 0 + for i := 0; i < len(c.commithooks); i++ { + if c.commithooks[i].dbname == dbname { + c.commithooks[i].databaseWasDropped() + continue + } + if j != i { + c.commithooks[j] = c.commithooks[i] + } + j += 1 + } + c.commithooks = c.commithooks[:j] +} + func (c *Controller) ClusterDatabase() sql.Database { if c == nil { return nil diff --git a/go/libraries/doltcore/sqle/database_provider.go b/go/libraries/doltcore/sqle/database_provider.go index 260b2ab600..224d599b46 100644 --- a/go/libraries/doltcore/sqle/database_provider.go +++ b/go/libraries/doltcore/sqle/database_provider.go @@ -48,6 +48,7 @@ type DoltDatabaseProvider struct { functions map[string]sql.Function externalProcedures sql.ExternalStoredProcedureRegistry InitDatabaseHook InitDatabaseHook + DropDatabaseHook DropDatabaseHook mu *sync.RWMutex defaultBranch string @@ -446,6 +447,7 @@ func (p DoltDatabaseProvider) CreateCollatedDatabase(ctx *sql.Context, name stri } type InitDatabaseHook func(ctx *sql.Context, pro DoltDatabaseProvider, name string, env *env.DoltEnv) error +type DropDatabaseHook func(name string) // ConfigureReplicationDatabaseHook sets up replication for a newly created database as necessary // TODO: consider the replication heads / all heads setting @@ -635,6 +637,12 @@ func (p DoltDatabaseProvider) DropDatabase(ctx *sql.Context, name string) error return err } + if p.DropDatabaseHook != nil { + // For symmetry with InitDatabaseHook and the names we see in + // MultiEnv initialization, we use `name` here, not `dbKey`. + p.DropDatabaseHook(name) + } + rootDbLoc, err := p.fs.Abs("") if err != nil { return err diff --git a/integration-tests/go-sql-server-driver/tests/sql-server-cluster.yaml b/integration-tests/go-sql-server-driver/tests/sql-server-cluster.yaml index 638747ffd3..8ffc7a8d0d 100644 --- a/integration-tests/go-sql-server-driver/tests/sql-server-cluster.yaml +++ b/integration-tests/go-sql-server-driver/tests/sql-server-cluster.yaml @@ -1417,3 +1417,68 @@ tests: - exec: 'call dolt_gc()' error_match: "must be the primary" - exec: 'call dolt_gc("--shallow")' +- name: dropped database no longer in dolt_cluster_status + multi_repos: + - name: server1 + with_files: + - name: server.yaml + contents: | + log_level: trace + listener: + host: 0.0.0.0 + port: 3309 + cluster: + standby_remotes: + - name: standby + remote_url_template: http://localhost:3852/{database} + bootstrap_role: primary + bootstrap_epoch: 1 + remotesapi: + port: 3851 + server: + args: ["--config", "server.yaml"] + port: 3309 + - name: server2 + with_files: + - name: server.yaml + contents: | + log_level: trace + listener: + host: 0.0.0.0 + port: 3310 + cluster: + standby_remotes: + - name: standby + remote_url_template: http://localhost:3851/{database} + bootstrap_role: standby + bootstrap_epoch: 1 + remotesapi: + port: 3852 + server: + args: ["--config", "server.yaml"] + port: 3310 + connections: + - on: server1 + queries: + - exec: 'create database repo1' + - exec: 'use repo1' + - exec: 'SET @@GLOBAL.dolt_cluster_ack_writes_timeout_secs = 10' + - exec: 'create table vals (i int primary key)' + - query: "select `database`, standby_remote, role, epoch, replication_lag_millis is not null as `replication_lag_millis`, current_error from dolt_cluster.dolt_cluster_status" + result: + columns: ["database","standby_remote","role","epoch","replication_lag_millis","current_error"] + rows: + - ["repo1", "standby", "primary", "1", "1", "NULL"] + - exec: 'use dolt_cluster' + - exec: 'drop database repo1' + - query: 'show databases' + result: + columns: ["Database"] + rows: + - ["dolt_cluster"] + - ["information_schema"] + - ["mysql"] + - query: "select `database`, standby_remote, role, epoch, replication_lag_millis is not null as `replication_lag_millis`, current_error from dolt_cluster.dolt_cluster_status" + result: + columns: ["database","standby_remote","role","epoch","replication_lag_millis","current_error"] + rows: [] From 74b6ba5f73c16db5b1ea3a1bbe9fe0e7ac2ab8cb Mon Sep 17 00:00:00 2001 From: fulghum Date: Wed, 20 Sep 2023 23:56:32 +0000 Subject: [PATCH 18/18] [ga-bump-release] Update Dolt version to 1.16.2 and release v1.16.2 --- go/cmd/dolt/dolt.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go/cmd/dolt/dolt.go b/go/cmd/dolt/dolt.go index 2d6ac96502..51c89d9070 100644 --- a/go/cmd/dolt/dolt.go +++ b/go/cmd/dolt/dolt.go @@ -63,7 +63,7 @@ import ( ) const ( - Version = "1.16.1" + Version = "1.16.2" ) var dumpDocsCommand = &commands.DumpDocsCmd{}