diff --git a/go/vt/vttablet/grpctabletconn/conn.go b/go/vt/vttablet/grpctabletconn/conn.go index 2399420a8d0..775118aee73 100644 --- a/go/vt/vttablet/grpctabletconn/conn.go +++ b/go/vt/vttablet/grpctabletconn/conn.go @@ -188,7 +188,7 @@ func (conn *gRPCQueryClient) StreamExecute(ctx context.Context, target *querypb. fields = ser.Result.Fields } if err := callback(sqltypes.CustomProto3ToResult(fields, ser.Result)); err != nil { - if err == nil || err == io.EOF { + if err == io.EOF { return nil } return err @@ -537,7 +537,7 @@ func (conn *gRPCQueryClient) BeginStreamExecute(ctx context.Context, target *que fields = ser.Result.Fields } if err := callback(sqltypes.CustomProto3ToResult(fields, ser.Result)); err != nil { - if err == nil || err == io.EOF { + if err == io.EOF { return state, nil } return state, err @@ -583,7 +583,7 @@ func (conn *gRPCQueryClient) MessageStream(ctx context.Context, target *querypb. fields = msr.Result.Fields } if err := callback(sqltypes.CustomProto3ToResult(fields, msr.Result)); err != nil { - if err == nil || err == io.EOF { + if err == io.EOF { return nil } return err @@ -640,7 +640,7 @@ func (conn *gRPCQueryClient) StreamHealth(ctx context.Context, callback func(*qu return tabletconn.ErrorFromGRPC(err) } if err := callback(shr); err != nil { - if err == nil || err == io.EOF { + if err == io.EOF { return nil } return err @@ -924,7 +924,7 @@ func (conn *gRPCQueryClient) ReserveBeginStreamExecute(ctx context.Context, targ fields = ser.Result.Fields } if err := callback(sqltypes.CustomProto3ToResult(fields, ser.Result)); err != nil { - if err == nil || err == io.EOF { + if err == io.EOF { return state, nil } return state, err @@ -1029,7 +1029,7 @@ func (conn *gRPCQueryClient) ReserveStreamExecute(ctx context.Context, target *q fields = ser.Result.Fields } if err := callback(sqltypes.CustomProto3ToResult(fields, ser.Result)); err != nil { - if err == nil || err == io.EOF { + if err == io.EOF { return state, nil } return state, err @@ -1092,7 +1092,7 @@ func (conn *gRPCQueryClient) GetSchema(ctx context.Context, target *querypb.Targ return tabletconn.ErrorFromGRPC(err) } if err := callback(shr); err != nil { - if err == nil || err == io.EOF { + if err == io.EOF { return nil } return err diff --git a/go/vt/vttablet/onlineddl/executor.go b/go/vt/vttablet/onlineddl/executor.go index 2c78069e962..3b2dd30c9f6 100644 --- a/go/vt/vttablet/onlineddl/executor.go +++ b/go/vt/vttablet/onlineddl/executor.go @@ -778,7 +778,7 @@ func (e *Executor) cutOverVReplMigration(ctx context.Context, s *VReplStream) er defer tmClient.Close() // sanity checks: - vreplTable, err := getVreplTable(ctx, s) + vreplTable, err := getVreplTable(s) if err != nil { return err } @@ -1422,7 +1422,7 @@ func (e *Executor) initVreplicationRevertMigration(ctx context.Context, onlineDD return nil, err } - vreplTableName, err := getVreplTable(ctx, revertStream) + vreplTableName, err := getVreplTable(revertStream) if err != nil { return nil, err } diff --git a/go/vt/vttablet/onlineddl/vrepl.go b/go/vt/vttablet/onlineddl/vrepl.go index 7934aed6af1..5cdb24ae5e4 100644 --- a/go/vt/vttablet/onlineddl/vrepl.go +++ b/go/vt/vttablet/onlineddl/vrepl.go @@ -659,16 +659,16 @@ func (v *VRepl) generateStartStatement(ctx context.Context) (string, error) { ) } -func getVreplTable(ctx context.Context, s *VReplStream) (string, error) { +func getVreplTable(s *VReplStream) (string, error) { // sanity checks: if s == nil { - return "", vterrors.Errorf(vtrpcpb.Code_UNKNOWN, "No vreplication stream migration %s", s.workflow) + return "", vterrors.Errorf(vtrpcpb.Code_UNKNOWN, "No vreplication stream migration") } if s.bls.Filter == nil { return "", vterrors.Errorf(vtrpcpb.Code_UNKNOWN, "No binlog source filter for migration %s", s.workflow) } if len(s.bls.Filter.Rules) != 1 { - return "", vterrors.Errorf(vtrpcpb.Code_UNKNOWN, "Cannot detect filter rules for migration/vreplication %+v", s.workflow) + return "", vterrors.Errorf(vtrpcpb.Code_UNKNOWN, "Cannot detect filter rules for migration/vreplication %s", s.workflow) } vreplTable := s.bls.Filter.Rules[0].Match return vreplTable, nil diff --git a/go/vt/vttablet/tabletmanager/vdiff/action.go b/go/vt/vttablet/tabletmanager/vdiff/action.go index 59ee79077f7..ded232bf3c7 100644 --- a/go/vt/vttablet/tabletmanager/vdiff/action.go +++ b/go/vt/vttablet/tabletmanager/vdiff/action.go @@ -232,9 +232,6 @@ func (vde *Engine) handleCreateResumeAction(ctx context.Context, dbClient binlog if qr.RowsAffected == 0 { msg := fmt.Sprintf("no completed or stopped vdiff found for UUID %s on tablet %v", req.VdiffUuid, vde.thisTablet.Alias) - if err != nil { - msg = fmt.Sprintf("%s (%v)", msg, err) - } return fmt.Errorf(msg) } } diff --git a/go/vt/vttablet/tabletmanager/vreplication/queryhistory/sequenced_expectation_set.go b/go/vt/vttablet/tabletmanager/vreplication/queryhistory/sequenced_expectation_set.go index 9ab0bf99043..95b2c3e4f67 100644 --- a/go/vt/vttablet/tabletmanager/vreplication/queryhistory/sequenced_expectation_set.go +++ b/go/vt/vttablet/tabletmanager/vreplication/queryhistory/sequenced_expectation_set.go @@ -12,7 +12,7 @@ type sequencedExpectationSet map[SequencedExpectation]any func (ses *sequencedExpectationSet) Add(expectation SequencedExpectation) { if ses == nil { - *ses = make(sequencedExpectationSet) + ses = new(sequencedExpectationSet) } (*ses)[expectation] = true } @@ -27,7 +27,7 @@ func (ses *sequencedExpectationSet) Contains(expectation SequencedExpectation) b func (ses *sequencedExpectationSet) Slice() []SequencedExpectation { s := make([]SequencedExpectation, 0) - if len(*ses) == 0 { + if ses == nil || len(*ses) == 0 { return s } for se := range *ses {