Skip to content

Commit

Permalink
Remove debug log lines and minor nits
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Lord <[email protected]>
  • Loading branch information
mattlord committed Feb 25, 2024
1 parent 8f6f957 commit a77d394
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
8 changes: 3 additions & 5 deletions go/mysql/binlog_event_rbr.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,11 @@ func (ev binlogEvent) TableMap(f BinlogFormat) (*TableMap, error) {
pos = read

// Read any text based column collation values provided in the optional metadata.
//log.Errorf("DEBUG: Remaining optional metadata bytes for %s: %v", result.Name, data[pos:])
// The binlog_row_metadata only contains this info for text based columns.
var err error
if result.ColumnCollationIDs, err = readColumnCollationIDs(data, pos, int(columnCount)); err != nil {
return nil, err
}
//log.Errorf("DEBUG: table %s; ColumnCollationIDs: %+v", result.Name, result.ColumnCollationIDs)

return result, nil
}
Expand Down Expand Up @@ -228,7 +227,8 @@ func metadataWrite(data []byte, pos int, typ byte, value uint16) int {
// https://dev.mysql.com/doc/refman/en/replication-options-binary-log.html#sysvar_binlog_row_metadata
// and the table definition.
// We only care about any collation IDs in the optional metadata and
// this info is provided in all binlog_row_metadata formats.
// this info is provided in all binlog_row_metadata formats. Note that
// this info is only provided for text based columns.
func readColumnCollationIDs(data []byte, pos, count int) ([]collations.ID, error) {
collationIDs := make([]collations.ID, 0, count)
for pos < len(data) {
Expand All @@ -244,7 +244,6 @@ func readColumnCollationIDs(data []byte, pos, count int) ([]collations.ID, error
fieldVal := data[pos : pos+int(fieldLen)]
pos += int(fieldLen)

//log.Errorf("DEBUG: Optional Metadata Field Type: %v, Length: %v, Value: %v", fieldType, fieldLen, fieldVal)
if fieldType == tableMapDefaultCharset || fieldType == tableMapColumnCharset { // It's one or the other
for i := uint64(0); i < fieldLen; i++ {
v := uint16(fieldVal[i])
Expand All @@ -253,7 +252,6 @@ func readColumnCollationIDs(data []byte, pos, count int) ([]collations.ID, error
i += 2
}
collationIDs = append(collationIDs, collations.ID(v))
//log.Errorf("DEBUG: charset idx %d: %v", i, v)
}
}
}
Expand Down
1 change: 0 additions & 1 deletion go/vt/vttablet/tabletserver/vstreamer/helper_event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,6 @@ func (ts *TestSpec) getFieldEvent(table *schemadiff.CreateTableEntity) *TestFiel
tc.collationID = testenv.DefaultCollationID
} else {
tc.collationID = testenv.CollationEnv.LookupByName(collationName)
//log.Errorf("DEBUG: SchemaDiff provided collation for %s.%s: %s:%d", tfe.table, tc.name, collationName, tc.collationID)
}
collation := colldata.Lookup(tc.collationID)
switch tc.dataTypeLowered {
Expand Down
4 changes: 1 addition & 3 deletions go/vt/vttablet/tabletserver/vstreamer/testenv/testenv.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ import (
vttestpb "vitess.io/vitess/go/vt/proto/vttest"
)

const (
DBName = "vttest"
)
const DBName = "vttest"

var (
// These are exported to coordinate on version specific
Expand Down
11 changes: 6 additions & 5 deletions go/vt/vttablet/tabletserver/vstreamer/vstreamer.go
Original file line number Diff line number Diff line change
Expand Up @@ -762,19 +762,20 @@ func (vs *vstreamer) buildTablePlan(id uint64, tm *mysql.TableMap) (*binlogdatap

func (vs *vstreamer) buildTableColumns(tm *mysql.TableMap) ([]*querypb.Field, error) {
var fields []*querypb.Field
var charFieldIdx int
var txtFieldIdx int
for i, typ := range tm.Types {
t, err := sqltypes.MySQLToType(typ, 0)
if err != nil {
return nil, fmt.Errorf("unsupported type: %d, position: %d", typ, i)
}
// Use the the collation inherited or the one specified explicitly for the
// column if one was provided in the event's optional metadata.
// column if one was provided in the event's optional metadata (MySQL only
// provides this for text based columns).
var coll collations.ID
switch {
case sqltypes.IsText(t) && len(tm.ColumnCollationIDs) > charFieldIdx:
coll = tm.ColumnCollationIDs[charFieldIdx]
charFieldIdx++
case sqltypes.IsText(t) && len(tm.ColumnCollationIDs) > txtFieldIdx:
coll = tm.ColumnCollationIDs[txtFieldIdx]
txtFieldIdx++
case t == sqltypes.TypeJSON:
// JSON is a blob at this (storage) layer -- vs the connection/query serving
// layer which CollationForType seems primarily concerned about and JSON at
Expand Down

0 comments on commit a77d394

Please sign in to comment.