Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various test utils and small fixes #7872

Merged
merged 3 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,4 @@ require (

replace github.com/dolthub/dolt/go/gen/proto/dolt/services/eventsapi => ./gen/proto/dolt/services/eventsapi

go 1.22
go 1.22.2
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,14 @@ func (d *doltBinlogReplicaController) SetReplicationSourceOptions(ctx *sql.Conte
return err
}
replicaSourceInfo.ConnectRetryCount = uint64(intValue)
case "SOURCE_AUTO_POSITION":
intValue, err := getOptionValueAsInt(option)
if err != nil {
return err
}
if intValue < 1 {
return fmt.Errorf("SOURCE_AUTO_POSITION cannot be disabled")
}
default:
return fmt.Errorf("unknown replication source option: %s", option.Name)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,37 @@ func turnOnLimitDataToxic(t *testing.T) {
// More info at the end of this issue: https://github.com/jmoiron/sqlx/issues/225
func convertMapScanResultToStrings(m map[string]interface{}) map[string]interface{} {
for key, value := range m {
if bytes, ok := value.([]uint8); ok {
m[key] = string(bytes)
}
if i, ok := value.(int64); ok {
m[key] = strconv.FormatInt(i, 10)
switch v := value.(type) {
case []uint8:
m[key] = string(v)
case int64:
m[key] = strconv.FormatInt(v, 10)
case uint64:
m[key] = strconv.FormatUint(v, 10)
}
}

return m
}

// convertSliceScanResultToStrings returns a new slice, formed by converting each value in the slice |ss| into a string.
// This is necessary because SliceScan doesn't honor (or know about) the correct underlying SQL types –it
// gets results back as strings, typed as []byte, or as int64 values.
// More info at the end of this issue: https://github.com/jmoiron/sqlx/issues/225
func convertSliceScanResultToStrings(ss []any) []any {
row := make([]any, len(ss))
for i, value := range ss {
switch v := value.(type) {
case []uint8:
row[i] = string(v)
case int64:
row[i] = strconv.FormatInt(v, 10)
case uint64:
row[i] = strconv.FormatUint(v, 10)
default:
row[i] = v
}
}

return row
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestBinlogReplicationServerRestart(t *testing.T) {
time.Sleep(1000 * time.Millisecond)

var err error
doltPort, doltProcess, err = startDoltSqlServer(testDir)
doltPort, doltProcess, err = startDoltSqlServer(testDir, nil)
require.NoError(t, err)

// Check replication status on the replica and assert configuration persisted
Expand Down
Loading
Loading