Skip to content

Commit

Permalink
Remove DEBUG printfs
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Lord <[email protected]>
  • Loading branch information
mattlord committed Dec 9, 2024
1 parent 748589d commit 0b2b9cf
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 24 deletions.
10 changes: 0 additions & 10 deletions go/mysql/binlog/binlog_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package binlog
import (
"bytes"
"encoding/binary"
"encoding/hex"
"fmt"
"math"
"strconv"
Expand All @@ -28,7 +27,6 @@ import (
"vitess.io/vitess/go/mysql/format"
"vitess.io/vitess/go/mysql/json"
"vitess.io/vitess/go/sqltypes"
"vitess.io/vitess/go/vt/log"
"vitess.io/vitess/go/vt/vterrors"

querypb "vitess.io/vitess/go/vt/proto/query"
Expand Down Expand Up @@ -76,7 +74,6 @@ func ParseBinaryJSON(data []byte) (*json.Value, error) {
// ParseBinaryJSONDiff provides the parsing function from the MySQL JSON
// diff representation to an SQL expression.
func ParseBinaryJSONDiff(data []byte) (sqltypes.Value, error) {
log.Errorf("DEBUG: json diff data hex: %s, string: %s", hex.EncodeToString(data), string(data))
pos := 0
opType := jsonDiffOp(data[pos])
pos++
Expand All @@ -92,19 +89,14 @@ func ParseBinaryJSONDiff(data []byte) (sqltypes.Value, error) {
}
diff.WriteString("%s, ") // This will later be replaced by the field name

log.Errorf("DEBUG: json diff opType: %d", opType)

pathLen, readTo, ok := readLenEncInt(data, pos)
if !ok {
return sqltypes.Value{}, fmt.Errorf("cannot read JSON diff path length")
}
pos = readTo

log.Errorf("DEBUG: json diff path length: %d", pathLen)

path := data[pos : uint64(pos)+pathLen]
pos += int(pathLen)
log.Errorf("DEBUG: json diff path: %s", string(path))
// We have to specify the unicode character set for the strings we
// use in the expression as the connection can be using a different
// character set (e.g. vreplication always uses set names binary).
Expand All @@ -120,13 +112,11 @@ func ParseBinaryJSONDiff(data []byte) (sqltypes.Value, error) {
return sqltypes.Value{}, fmt.Errorf("cannot read JSON diff path length")
}
pos = readTo
log.Errorf("DEBUG: json diff value length: %d", valueLen)

value, err := ParseBinaryJSON(data[pos : uint64(pos)+valueLen])
if err != nil {
return sqltypes.Value{}, fmt.Errorf("cannot read JSON diff value for path %s: %w", path, err)
}
log.Errorf("DEBUG: json diff value: %v", value)
if value.Type() == json.TypeString {
diff.WriteString("_utf8mb4")
}
Expand Down
3 changes: 0 additions & 3 deletions go/mysql/binlog/rbr.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"time"

"vitess.io/vitess/go/sqltypes"
"vitess.io/vitess/go/vt/log"
"vitess.io/vitess/go/vt/vterrors"

querypb "vitess.io/vitess/go/vt/proto/query"
Expand Down Expand Up @@ -682,12 +681,10 @@ func CellValue(data []byte, pos int, typ byte, metadata uint16, field *querypb.F
if typ == TypeJSON {
jsonData := data[pos : pos+l]
if partialJSON {
log.Errorf("DEBUG: partialJSON cell value: %s", string(jsonData))
val, err := ParseBinaryJSONDiff(jsonData)
if err != nil {
panic(err)
}
log.Errorf("DEBUG: decoded partialJSON cell value: %v", val)
return val, l + int(metadata), nil
}
jsonVal, err := ParseBinaryJSON(jsonData)
Expand Down
4 changes: 0 additions & 4 deletions go/mysql/binlog_event_rbr.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (

"vitess.io/vitess/go/mysql/binlog"
"vitess.io/vitess/go/mysql/collations"
"vitess.io/vitess/go/vt/log"
"vitess.io/vitess/go/vt/vterrors"

querypb "vitess.io/vitess/go/vt/proto/query"
Expand Down Expand Up @@ -370,15 +369,12 @@ func (ev binlogEvent) Rows(f BinlogFormat, tm *TableMap) (Rows, error) {
}

if ev.Type() == ePartialUpdateRowsEvent {
log.Errorf("DEBUG: PartialUpdateRowsEvent found with %d JSON columns", numJSONColumns)
// The first byte indicates whether or not any JSON values are partial.
// If it's 0 then there's nothing else to do.
partialJSON := uint8(data[pos])
log.Errorf("DEBUG: PartialJSON: %d", partialJSON)
pos++
if partialJSON == 1 {
row.JSONPartialValues, pos = newBitmap(data, pos, numJSONColumns)
log.Errorf("DEBUG: PartialUpdateRowsEvent: JSONPartialValues: %08b", row.JSONPartialValues)
}
}

Expand Down
4 changes: 0 additions & 4 deletions go/vt/vttablet/tabletmanager/vreplication/replicator_plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import (
"vitess.io/vitess/go/ptr"
"vitess.io/vitess/go/sqltypes"
"vitess.io/vitess/go/vt/binlog/binlogplayer"
"vitess.io/vitess/go/vt/log"
"vitess.io/vitess/go/vt/sqlparser"
"vitess.io/vitess/go/vt/vterrors"
"vitess.io/vitess/go/vt/vtgate/evalengine"
Expand Down Expand Up @@ -387,7 +386,6 @@ func (tp *TablePlan) applyChange(rowChange *binlogdatapb.RowChange, executor fun
var newVal *sqltypes.Value
var err error
if field.Type == querypb.Type_JSON {
log.Errorf("DEBUG: vplayer applyChange: field.Type == querypb.Type_JSON, val type: %v, vals[i]: %+v", vals[i].Type(), vals[i].RawStr())
switch {
case vals[i].IsNull(): // An SQL NULL and not an actual JSON value
newVal = &sqltypes.NULL
Expand All @@ -404,7 +402,6 @@ func (tp *TablePlan) applyChange(rowChange *binlogdatapb.RowChange, executor fun
return nil, err
}
}
log.Errorf("DEBUG: vplayer applyChange: field.Type == querypb.Type_JSON, newVal: %+v", newVal)
bindVar, err = tp.bindFieldVal(field, newVal)
jsonIndex++
} else {
Expand Down Expand Up @@ -596,7 +593,6 @@ func execParsedQuery(pq *sqlparser.ParsedQuery, bindvars map[string]*querypb.Bin
if err != nil {
return nil, err
}
log.Errorf("DEBUG: vplayer execParsedQuery: query: %s", query)
return executor(query)
}

Expand Down
3 changes: 0 additions & 3 deletions go/vt/vttablet/tabletserver/vstreamer/vstreamer.go
Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,6 @@ func (vs *vstreamer) extractRowAndFilter(plan *streamerPlan, data []byte, dataCo
partialJSON := false
if jsonPartialValues.Count() > 0 && plan.Table.Fields[colNum].Type == querypb.Type_JSON {
partialJSON = jsonPartialValues.Bit(jsonIndex)
log.Errorf("DEBUG: extractRowAndFilter: table: %s, column: %v, partialJSON: %v", plan.Table.Name, plan.Table.Fields[colNum], partialJSON)
jsonIndex++
}
value, l, err := mysqlbinlog.CellValue(data, pos, plan.TableMap.Types[colNum], plan.TableMap.Metadata[colNum], plan.Table.Fields[colNum], partialJSON)
Expand All @@ -1125,8 +1124,6 @@ func (vs *vstreamer) extractRowAndFilter(plan *streamerPlan, data []byte, dataCo
err, plan.Table.Name, colNum, plan.Table.Fields, values)
return false, nil, false, err
}
log.Errorf("DEBUG: extractRowAndFilter: table: %s, column: %v, type: %v, value: %v",
plan.Table.Name, plan.Table.Fields[colNum], plan.TableMap.Types[colNum], value)
pos += l

if !value.IsNull() { // ENUMs and SETs require no special handling if they are NULL
Expand Down

0 comments on commit 0b2b9cf

Please sign in to comment.