Skip to content

Commit

Permalink
Merge pull request #7872 from dolthub/fulghum/binlog-dev-1
Browse files Browse the repository at this point in the history
Various test utils and small fixes
  • Loading branch information
zachmu committed May 22, 2024
2 parents b091820 + 5ff76cd commit 688c02e
Show file tree
Hide file tree
Showing 9 changed files with 230 additions and 47 deletions.
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

0 comments on commit 688c02e

Please sign in to comment.