Skip to content

Commit

Permalink
Self-review
Browse files Browse the repository at this point in the history
Signed-off-by: Rohit Nayak <[email protected]>
  • Loading branch information
rohit-nayak-ps committed Mar 22, 2024
1 parent 9912af1 commit 801de3a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 27 deletions.
14 changes: 1 addition & 13 deletions go/vt/vttablet/tabletserver/vstreamer/helper_event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ import (
"strconv"
"strings"
"testing"
"vitess.io/vitess/go/mysql/collations/colldata"

"github.com/stretchr/testify/require"

"vitess.io/vitess/go/mysql/collations"
"vitess.io/vitess/go/mysql/collations/colldata"
"vitess.io/vitess/go/sqltypes"
"vitess.io/vitess/go/vt/log"
"vitess.io/vitess/go/vt/proto/query"
Expand All @@ -63,10 +63,6 @@ const (
lengthSet = 56
)

func getDefaultCollationID() int64 {
return 45 // utf8mb4_general_ci
}

var (
// noEvents is used to indicate that a query is expected to generate no events.
noEvents = []TestRowEvent{}
Expand Down Expand Up @@ -273,7 +269,6 @@ func (ts *TestSpec) Init() {
execStatement(ts.t, ts.ddls[i])
fe := ts.getFieldEvent(t)
ts.fieldEvents[t.Name()] = fe
log.Infof("field event for table %s: %v", t.Name(), fe)
var pkColumns []string
var hasPK bool
for _, index := range t.TableSpec.Indexes {
Expand Down Expand Up @@ -331,10 +326,7 @@ func (ts *TestSpec) getBindVarsForInsert(stmt sqlparser.Statement) (string, map[
func (ts *TestSpec) getBindVarsForUpdate(stmt sqlparser.Statement) (string, map[string]string) {
bv := make(map[string]string)
upd := stmt.(*sqlparser.Update)
// buf := sqlparser.NewTrackedBuffer(nil)
table := sqlparser.String(upd.TableExprs[0].(*sqlparser.AliasedTableExpr).Expr)
// upd.TableExprs[0].(*sqlparser.AliasedTableExpr).Expr.Format(buf)
// table := buf.String()
fe, ok := ts.fieldEvents[table]
require.True(ts.t, ok, "field event for table %s not found", table)
index := int64(0)
Expand Down Expand Up @@ -502,12 +494,8 @@ func (ts *TestSpec) getFieldEvent(table *schemadiff.CreateTableEntity) *TestFiel
if tc.dataTypeLowered == "char" && collation.IsBinary() {
tc.dataType = "BINARY"
}
if tc.dataTypeLowered == "char" && strings.Contains(tc.collationName, "bin") {
tc.dataType = "BINARY"
}
}
tc.colType = fmt.Sprintf("%s(%d)", tc.dataTypeLowered, l)
log.Infof(">>>>>>>> collation id is %d", tc.collationID)
case "blob":
tc.len = lengthBlob
tc.collationID = collations.CollationBinaryID
Expand Down
8 changes: 4 additions & 4 deletions go/vt/vttablet/tabletserver/vstreamer/vstreamer.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ import (
"vitess.io/vitess/go/vt/dbconfigs"
"vitess.io/vitess/go/vt/log"
"vitess.io/vitess/go/vt/logutil"
binlogdatapb "vitess.io/vitess/go/vt/proto/binlogdata"
querypb "vitess.io/vitess/go/vt/proto/query"
vtrpcpb "vitess.io/vitess/go/vt/proto/vtrpc"
vtschema "vitess.io/vitess/go/vt/schema"
"vitess.io/vitess/go/vt/sqlparser"
"vitess.io/vitess/go/vt/vterrors"
"vitess.io/vitess/go/vt/vttablet"
"vitess.io/vitess/go/vt/vttablet/tabletserver/schema"
"vitess.io/vitess/go/vt/vttablet/tabletserver/throttle/throttlerapp"

mysqlbinlog "vitess.io/vitess/go/mysql/binlog"
binlogdatapb "vitess.io/vitess/go/vt/proto/binlogdata"
querypb "vitess.io/vitess/go/vt/proto/query"
vtrpcpb "vitess.io/vitess/go/vt/proto/vtrpc"
vtschema "vitess.io/vitess/go/vt/schema"
)

const (
Expand Down
16 changes: 6 additions & 10 deletions go/vt/vttablet/tabletserver/vstreamer/vstreamer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,18 @@ import (
"time"

"github.com/prometheus/common/version"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"google.golang.org/protobuf/proto"

"vitess.io/vitess/go/mysql"
"vitess.io/vitess/go/mysql/collations"
"vitess.io/vitess/go/sqltypes"

"vitess.io/vitess/go/vt/vttablet/tabletserver/throttle/throttlerapp"
"vitess.io/vitess/go/vt/vttablet/tabletserver/vstreamer/testenv"

"google.golang.org/protobuf/proto"

"vitess.io/vitess/go/vt/log"
"vitess.io/vitess/go/vt/sqlparser"
"vitess.io/vitess/go/vt/vttablet/tabletserver/throttle/throttlerapp"
"vitess.io/vitess/go/vt/vttablet/tabletserver/vstreamer/testenv"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"vitess.io/vitess/go/mysql"
binlogdatapb "vitess.io/vitess/go/vt/proto/binlogdata"
)

Expand Down

0 comments on commit 801de3a

Please sign in to comment.