Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

Commit

Permalink
Merge branch 'master' into reparse-relay-gtid
Browse files Browse the repository at this point in the history
  • Loading branch information
lance6716 authored Mar 24, 2021
2 parents d64224d + c819b09 commit 3ed9b0a
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion debug-tools/binlog-event-blackhole/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func readEventsWithoutGoMySQL(ctx context.Context, conn *client.Conn) (uint64, u
log.L().Warn("receive EOF packet, retrying")
continue
default:
log.L().Warn("invalid stream header, retrying", zap.Uint8("header", uint8(data[0])))
log.L().Warn("invalid stream header, retrying", zap.Uint8("header", data[0]))
continue
}
}
Expand Down
2 changes: 1 addition & 1 deletion dm/master/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ func (s *Server) GetSubTaskCfg(ctx context.Context, req *pb.GetSubTaskCfgRequest
Msg: err.Error(),
}, nil
}
cfgs = append(cfgs, string(cfgBytes))
cfgs = append(cfgs, cfgBytes)
}

return &pb.GetSubTaskCfgResponse{
Expand Down
4 changes: 2 additions & 2 deletions pkg/binlog/event/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func GenFormatDescriptionEvent(header *replication.EventHeader, latestPos uint32

// mysql-server version, 50 bytes
serverVer := make([]byte, mysqlVersionLen)
copy(serverVer, []byte(mysqlVersion))
copy(serverVer, mysqlVersion)
err = binary.Write(payload, binary.LittleEndian, serverVer)
if err != nil {
return nil, terror.ErrBinlogWriteBinaryData.AnnotateDelegate(err, "write mysql-server version %v", serverVer)
Expand Down Expand Up @@ -825,7 +825,7 @@ func GenDummyEvent(header *replication.EventHeader, latestPos uint32, eventSize
)
copy(nameBytes, dummyUserVarName)
// name_length, 4 bytes
err := binary.Write(payload, binary.LittleEndian, uint32(nameLen))
err := binary.Write(payload, binary.LittleEndian, nameLen)
if err != nil {
return nil, terror.ErrBinlogWriteBinaryData.AnnotateDelegate(err, "write USER_VAR_EVENT name length %d", nameLen)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/binlog/event/event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ func (t *testEventSuite) TestGenDummyEvent(c *C) {
verifyHeader(c, userVarEv.Header, expectedHeader, replication.USER_VAR_EVENT, latestPos, uint32(len(userVarEv.RawData)))
// verify the body
nameStart := uint32(eventHeaderLen + 4)
nameEnd := uint32(eventSize-1) - crc32Len
nameEnd := eventSize - 1 - crc32Len
nameLen := nameEnd - nameStart
c.Assert(nameLen, Equals, uint32(1)) // name-length==1
c.Assert(userVarEv.RawData[nameStart:nameEnd], DeepEquals, dummyUserVarName[:nameLen])
Expand All @@ -774,7 +774,7 @@ func (t *testEventSuite) TestGenDummyEvent(c *C) {
c.Assert(queryEvBody.StatusVars, DeepEquals, []byte{})
c.Assert(queryEvBody.Schema, DeepEquals, []byte{})
queryStart := uint32(eventHeaderLen + 4 + 4 + 1 + 2 + 2 + 1)
queryEnd := uint32(eventSize) - crc32Len
queryEnd := eventSize - crc32Len
queryLen := queryEnd - queryStart
c.Assert(queryEvBody.Query, HasLen, int(queryLen))
if queryLen <= dummyQueryLen {
Expand Down
2 changes: 1 addition & 1 deletion pkg/utils/relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func GenFakeRotateEvent(nextLogName string, logPos uint64, serverID uint32) (*re

// body
binary.LittleEndian.PutUint64(rawData[headerLen:], logPos)
copy(rawData[headerLen+8:], []byte(nextLogName))
copy(rawData[headerLen+8:], nextLogName)

// decode header
h := &replication.EventHeader{}
Expand Down
2 changes: 1 addition & 1 deletion relay/writer/file_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (t *testFileUtilSuite) TestCheckBinlogHeaderExist(c *check.C) {
// invalid data
invalidData := make([]byte, len(replication.BinLogFileHeader))
copy(invalidData, replication.BinLogFileHeader)
invalidData[0] = uint8(invalidData[0]) + 1
invalidData[0] = invalidData[0] + 1
err = ioutil.WriteFile(filename, invalidData, 0644)
c.Assert(err, check.IsNil)
exist, err = checkBinlogHeaderExist(filename)
Expand Down
2 changes: 1 addition & 1 deletion syncer/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (s *testDBSuite) SetUpSuite(c *C) {

func (s *testDBSuite) resetBinlogSyncer(c *C) {
cfg := replication.BinlogSyncerConfig{
ServerID: uint32(s.cfg.ServerID),
ServerID: s.cfg.ServerID,
Flavor: "mysql",
Host: s.cfg.From.Host,
Port: uint16(s.cfg.From.Port),
Expand Down
4 changes: 2 additions & 2 deletions syncer/dml.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,15 +340,15 @@ func columnValue(value interface{}, ft *types.FieldType) string {
case int32:
data = strconv.FormatInt(int64(v), 10)
case int64:
data = strconv.FormatInt(int64(v), 10)
data = strconv.FormatInt(v, 10)
case uint8:
data = strconv.FormatUint(uint64(v), 10)
case uint16:
data = strconv.FormatUint(uint64(v), 10)
case uint32:
data = strconv.FormatUint(uint64(v), 10)
case uint64:
data = strconv.FormatUint(uint64(v), 10)
data = strconv.FormatUint(v, 10)
case float32:
data = strconv.FormatFloat(float64(v), 'f', -1, 32)
case float64:
Expand Down
2 changes: 1 addition & 1 deletion syncer/syncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ func (s *testSyncerSuite) resetEventsGenerator(c *C) {
latestGTIDStr := "3ccc475b-2343-11e7-be21-6c0b84d59f30:14"
latestGTID, err := gtid.ParserGTID(s.cfg.Flavor, latestGTIDStr)
c.Assert(err, IsNil)
s.eventsGenerator, err = event.NewGenerator(s.cfg.Flavor, uint32(s.cfg.ServerID), 0, latestGTID, previousGTIDSet, 0)
s.eventsGenerator, err = event.NewGenerator(s.cfg.Flavor, s.cfg.ServerID, 0, latestGTID, previousGTIDSet, 0)
if err != nil {
c.Fatal(err)
}
Expand Down

0 comments on commit 3ed9b0a

Please sign in to comment.