diff --git a/go.mod b/go.mod index a3586b0958..03e46e8b88 100644 --- a/go.mod +++ b/go.mod @@ -6,11 +6,11 @@ require ( github.com/PuerkitoBio/goquery v1.8.1 github.com/cockroachdb/apd/v2 v2.0.3-0.20200518165714-d020e156310a github.com/cockroachdb/errors v1.7.5 - github.com/dolthub/dolt/go v0.40.5-0.20250217160730-872b69e2af01 + github.com/dolthub/dolt/go v0.40.5-0.20250225182956-1d253fbf6e12 github.com/dolthub/dolt/go/gen/proto/dolt/services/eventsapi v0.0.0-20241119094239-f4e529af734d github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2 github.com/dolthub/go-icu-regex v0.0.0-20241215010122-db690dd53c90 - github.com/dolthub/go-mysql-server v0.19.1-0.20250214230802-dc03db8b1d93 + github.com/dolthub/go-mysql-server v0.19.1-0.20250224212452-a3d336db732b github.com/dolthub/sqllogictest/go v0.0.0-20240618184124-ca47f9354216 github.com/dolthub/vitess v0.0.0-20250214225328-a0ed4612b41c github.com/fatih/color v1.13.0 diff --git a/go.sum b/go.sum index 1439f98443..3ca676cb24 100644 --- a/go.sum +++ b/go.sum @@ -214,8 +214,8 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/dolthub/dolt/go v0.40.5-0.20250217160730-872b69e2af01 h1:jYxiS8l5o5nCKaMURWh3YT+e7m2qjezw/v1dUlToCSA= -github.com/dolthub/dolt/go v0.40.5-0.20250217160730-872b69e2af01/go.mod h1:avbJMbn3PDVuFGFL20ggP/b+34lSM+orqmxs04Geq4o= +github.com/dolthub/dolt/go v0.40.5-0.20250225182956-1d253fbf6e12 h1:CL8yflfdfihfJFU5RWmOS8E5i89BRk9rJjBdn6mROYY= +github.com/dolthub/dolt/go v0.40.5-0.20250225182956-1d253fbf6e12/go.mod h1:XPnBzUbFsZXbLolK6aCWuLWa/J+OGTJw+3OeuKEnT0Q= github.com/dolthub/dolt/go/gen/proto/dolt/services/eventsapi v0.0.0-20241119094239-f4e529af734d h1:gO9+wrmNHXukPNCO1tpfCcXIdMlW/qppbUStfLvqz/U= github.com/dolthub/dolt/go/gen/proto/dolt/services/eventsapi v0.0.0-20241119094239-f4e529af734d/go.mod h1:L5RDYZbC9BBWmoU2+TjTekeqqhFXX5EqH9ln00O0stY= github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2 h1:u3PMzfF8RkKd3lB9pZ2bfn0qEG+1Gms9599cr0REMww= @@ -224,8 +224,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-20241215010122-db690dd53c90 h1:Sni8jrP0sy/w9ZYXoff4g/ixe+7bFCZlfCqXKJSU+zM= github.com/dolthub/go-icu-regex v0.0.0-20241215010122-db690dd53c90/go.mod h1:ylU4XjUpsMcvl/BKeRRMXSH7e7WBrPXdSLvnRJYrxEA= -github.com/dolthub/go-mysql-server v0.19.1-0.20250214230802-dc03db8b1d93 h1:RYb18gXSJFgch5pjwQTeacNm4S+PNKXutENF5wK5gqw= -github.com/dolthub/go-mysql-server v0.19.1-0.20250214230802-dc03db8b1d93/go.mod h1:JTlrabhq5TJqvlL+J3NKlm0EzTHQQugUAH6yAxWi4Ww= +github.com/dolthub/go-mysql-server v0.19.1-0.20250224212452-a3d336db732b h1:5/NOX/GNuXLYLJY5NPSgQaPW5M7aOr1wEmL4ataRI1o= +github.com/dolthub/go-mysql-server v0.19.1-0.20250224212452-a3d336db732b/go.mod h1:JTlrabhq5TJqvlL+J3NKlm0EzTHQQugUAH6yAxWi4Ww= github.com/dolthub/gozstd v0.0.0-20240423170813-23a2903bca63 h1:OAsXLAPL4du6tfbBgK0xXHZkOlos63RdKYS3Sgw/dfI= github.com/dolthub/gozstd v0.0.0-20240423170813-23a2903bca63/go.mod h1:lV7lUeuDhH5thVGDCKXbatwKy2KW80L4rMT46n+Y2/Q= github.com/dolthub/ishell v0.0.0-20240701202509-2b217167d718 h1:lT7hE5k+0nkBdj/1UOSFwjWpNxf+LCApbRHgnCA17XE= diff --git a/server/functions/array.go b/server/functions/array.go index abbbcc2ab7..b456edf458 100644 --- a/server/functions/array.go +++ b/server/functions/array.go @@ -189,7 +189,7 @@ var array_recv = framework.Function3{ } // The element data is everything from the offset to the next offset, excluding the null determinant nextOffset := binary.LittleEndian.Uint32(data[(i+2)*4:]) - o, err := baseType.DeserializeValue(data[offset+1 : nextOffset]) + o, err := baseType.DeserializeValue(ctx, data[offset+1:nextOffset]) if err != nil { return nil, err } @@ -230,7 +230,7 @@ var array_send = framework.Function1{ binary.LittleEndian.PutUint32(offsets[i*4:], currentOffset) // Handle serialization of the value // TODO: ARRAYs may be multidimensional, such as ARRAY[[4,2],[6,3]], which isn't accounted for here - serializedVal, err := baseType.SerializeValue(vals[i]) + serializedVal, err := baseType.SerializeValue(ctx, vals[i]) if err != nil { return nil, err } diff --git a/server/functions/domain.go b/server/functions/domain.go index 4cc772ebfe..f9dd18aeaf 100644 --- a/server/functions/domain.go +++ b/server/functions/domain.go @@ -55,6 +55,6 @@ var domain_recv = framework.Function3{ t := pgtypes.IDToBuiltInDoltgresType[id.Type(baseTypeOid)] typmod := val3.(int32) t = t.WithAttTypMod(typmod) - return t.DeserializeValue(data) + return t.DeserializeValue(ctx, data) }, } diff --git a/server/tables/dtables/ignore.go b/server/tables/dtables/ignore.go index f057d67f4b..67e009f583 100644 --- a/server/tables/dtables/ignore.go +++ b/server/tables/dtables/ignore.go @@ -20,7 +20,6 @@ import ( "github.com/cockroachdb/errors" "github.com/dolthub/dolt/go/libraries/doltcore/doltdb" - "github.com/dolthub/dolt/go/store/prolly/tree" "github.com/dolthub/dolt/go/store/val" "github.com/dolthub/go-mysql-server/sql" @@ -36,7 +35,7 @@ func getDoltIgnoreSchema() sql.Schema { } // convertTupleToIgnoreBoolean reads a boolean from a tuple and returns it. -func convertTupleToIgnoreBoolean(valueDesc val.TupleDesc, valueTuple val.Tuple) (bool, error) { +func convertTupleToIgnoreBoolean(ctx context.Context, valueDesc val.TupleDesc, valueTuple val.Tuple) (bool, error) { extendedTuple := val.NewTupleDescriptorWithArgs( val.TupleDescriptorArgs{Comparator: valueDesc.Comparator(), Handlers: valueDesc.Handlers}, val.Type{Enc: val.ExtendedEnc, Nullable: false}, @@ -48,7 +47,7 @@ func convertTupleToIgnoreBoolean(valueDesc val.TupleDesc, valueTuple val.Tuple) if !ok { return false, errors.Errorf("could not read boolean") } - val, err := valueDesc.Handlers[0].DeserializeValue(extended) + val, err := valueDesc.Handlers[0].DeserializeValue(ctx, extended) if err != nil { return false, err } @@ -60,7 +59,7 @@ func convertTupleToIgnoreBoolean(valueDesc val.TupleDesc, valueTuple val.Tuple) } // getIgnoreTablePatternKey reads the pattern key from a tuple and returns it. -func getIgnoreTablePatternKey(keyDesc val.TupleDesc, keyTuple val.Tuple, ns tree.NodeStore) (string, error) { +func getIgnoreTablePatternKey(ctx context.Context, keyDesc val.TupleDesc, keyTuple val.Tuple) (string, error) { extendedTuple := val.NewTupleDescriptorWithArgs( val.TupleDescriptorArgs{Comparator: keyDesc.Comparator(), Handlers: keyDesc.Handlers}, val.Type{Enc: val.ExtendedAddrEnc, Nullable: false}, @@ -74,13 +73,7 @@ func getIgnoreTablePatternKey(keyDesc val.TupleDesc, keyTuple val.Tuple, ns tree return "", fmt.Errorf("could not read pattern") } - var b []byte - b, err := tree.NewByteArray(keyAddr, ns).ToBytes(context.Background()) - if err != nil { - return "", err - } - - key, err := keyDesc.Handlers[0].DeserializeValue(b) + key, err := keyDesc.Handlers[0].DeserializeValue(ctx, keyAddr[:]) if err != nil { return "", err } diff --git a/server/types/type.go b/server/types/type.go index 31e9e0a3a2..67179a7136 100644 --- a/server/types/type.go +++ b/server/types/type.go @@ -17,6 +17,7 @@ package types import ( "bytes" "cmp" + "context" "fmt" "math" "reflect" @@ -588,7 +589,7 @@ func (t *DoltgresType) SendFuncName() string { } // SerializedCompare implements the types.ExtendedType interface. -func (t *DoltgresType) SerializedCompare(v1 []byte, v2 []byte) (int, error) { +func (t *DoltgresType) SerializedCompare(ctx context.Context, v1 []byte, v2 []byte) (int, error) { if len(v1) == 0 && len(v2) == 0 { return 0, nil } else if len(v1) > 0 && len(v2) == 0 { @@ -800,7 +801,7 @@ func (t *DoltgresType) Zero() interface{} { } // SerializeValue implements the types.ExtendedType interface. -func (t *DoltgresType) SerializeValue(val any) ([]byte, error) { +func (t *DoltgresType) SerializeValue(ctx context.Context, val any) ([]byte, error) { if val == nil { return nil, nil } @@ -821,7 +822,7 @@ func (t *DoltgresType) SerializeValue(val any) ([]byte, error) { } // DeserializeValue implements the types.ExtendedType interface. -func (t *DoltgresType) DeserializeValue(val []byte) (any, error) { +func (t *DoltgresType) DeserializeValue(ctx context.Context, val []byte) (any, error) { if len(val) == 0 { return nil, nil } diff --git a/servercfg/config.go b/servercfg/config.go index 5b2f9ce017..e7be894cc9 100755 --- a/servercfg/config.go +++ b/servercfg/config.go @@ -102,6 +102,14 @@ type DoltgresBehaviorConfig struct { DoltTransactionCommit *bool `yaml:"dolt_transaction_commit,omitempty" minver:"0.7.4"` } +// Implements dolt servercfg.AutoGCBehavior. +type DoltgresAutoGCBehavior struct { +} + +func (DoltgresAutoGCBehavior) Enable() bool { + return false +} + type DoltgresUserConfig struct { Name *string `yaml:"name,omitempty" minver:"0.7.4"` Password *string `yaml:"password,omitempty" minver:"0.7.4"` @@ -447,6 +455,10 @@ func (cfg *DoltgresConfig) EventSchedulerStatus() string { return "OFF" } +func (cfg *DoltgresConfig) AutoGCBehavior() servercfg.AutoGCBehavior { + return DoltgresAutoGCBehavior{} +} + func (cfg *DoltgresConfig) ValueSet(value string) bool { switch value { case readTimeoutKey: diff --git a/testing/go/enginetest/doltgres_engine_test.go b/testing/go/enginetest/doltgres_engine_test.go index a6515e3101..f3ea2c5d3d 100755 --- a/testing/go/enginetest/doltgres_engine_test.go +++ b/testing/go/enginetest/doltgres_engine_test.go @@ -454,7 +454,6 @@ func TestDeleteFrom(t *testing.T) { h := newDoltgresServerHarness(t).WithSkippedQueries([]string{ "DELETE FROM mytable ORDER BY i DESC LIMIT 1 OFFSET 1;", // offset is unsupported syntax "DELETE FROM mytable WHERE (i,s) = (1, 'first row');", // type error, needs investigation - "DELETE FROM mytable WHERE s = 'first row';", // index lookup error "with t (n) as (select (1) from dual) delete from mytable where i in (select n from t)", "with recursive t (n) as (select (1) from dual union all select n + 1 from t where n < 2) delete from mytable where i in (select n from t)", })