Skip to content

Commit

Permalink
mod: update tidb dependency to latest && fix incompatible problem (#1002
Browse files Browse the repository at this point in the history
)

* update tidb dependency to latest && fix incompatible problem
  • Loading branch information
3pointer authored Dec 28, 2020
1 parent 3475d28 commit 893b35c
Show file tree
Hide file tree
Showing 16 changed files with 589 additions and 124 deletions.
2 changes: 1 addition & 1 deletion drainer/collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type dummyStore struct {
kv.Storage
}

func (ds dummyStore) CurrentVersion() (kv.Version, error) {
func (ds dummyStore) CurrentVersion(string) (kv.Version, error) {
return kv.NewVersion(2), nil
}

Expand Down
2 changes: 1 addition & 1 deletion drainer/translator/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func deleteRowToRow(ptableinfo, tableInfo *model.TableInfo, raw []byte) (row *ob
columns := tableInfo.Columns

colsTypeMap := util.ToColumnTypeMap(tableInfo.Columns)
columnValues, err := tablecodec.DecodeRow(raw, colsTypeMap, time.Local)
columnValues, err := tablecodec.DecodeRowToDatumMap(raw, colsTypeMap, time.Local)
if err != nil {
return nil, errors.Annotate(err, "DecodeRow failed")
}
Expand Down
4 changes: 2 additions & 2 deletions drainer/translator/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func genMysqlDelete(schema string, table *model.TableInfo, row []byte) (names []
columns := table.Columns
colsTypeMap := util.ToColumnTypeMap(columns)

columnValues, err := tablecodec.DecodeRow(row, colsTypeMap, time.Local)
columnValues, err := tablecodec.DecodeRowToDatumMap(row, colsTypeMap, time.Local)
if err != nil {
return nil, nil, errors.Trace(err)
}
Expand Down Expand Up @@ -256,7 +256,7 @@ func formatData(data types.Datum, ft types.FieldType) (types.Datum, error) {
}

switch ft.Tp {
case mysql.TypeDate, mysql.TypeDatetime, mysql.TypeNewDate, mysql.TypeTimestamp, mysql.TypeDuration, mysql.TypeDecimal, mysql.TypeNewDecimal, mysql.TypeJSON:
case mysql.TypeDate, mysql.TypeDatetime, mysql.TypeNewDate, mysql.TypeTimestamp, mysql.TypeDuration, mysql.TypeNewDecimal, mysql.TypeJSON:
data = types.NewDatum(fmt.Sprintf("%v", data.GetValue()))
case mysql.TypeEnum:
data = types.NewDatum(data.GetMysqlEnum().Value)
Expand Down
2 changes: 1 addition & 1 deletion drainer/translator/pb.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func genDelete(schema string, table *model.TableInfo, row []byte) (event *pb.Eve
columns := table.Columns
colsTypeMap := util.ToColumnTypeMap(columns)

columnValues, err := tablecodec.DecodeRow(row, colsTypeMap, time.Local)
columnValues, err := tablecodec.DecodeRowToDatumMap(row, colsTypeMap, time.Local)
if err != nil {
return nil, errors.Annotatef(err, "table `%s`.`%s`", schema, table.Name)
}
Expand Down
2 changes: 1 addition & 1 deletion drainer/translator/translator.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func insertRowToDatums(table *model.TableInfo, row []byte) (pk types.Datum, datu
return types.Datum{}, nil, errors.Trace(err)
}

datums, err = tablecodec.DecodeRow(remain, colsTypeMap, time.Local)
datums, err = tablecodec.DecodeRowToDatumMap(remain, colsTypeMap, time.Local)
if err != nil {
return types.Datum{}, nil, errors.Trace(err)
}
Expand Down
8 changes: 3 additions & 5 deletions drainer/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"github.com/pingcap/tidb-binlog/drainer/checkpoint"
"github.com/pingcap/tidb/kv"
"github.com/pingcap/tidb/meta"
"github.com/pingcap/tidb/store/tikv/oracle"
"go.uber.org/zap"
)

Expand Down Expand Up @@ -169,14 +170,11 @@ func loadHistoryDDLJobs(tiStore kv.Storage) ([]*model.Job, error) {
}

func getSnapshotMeta(tiStore kv.Storage) (*meta.Meta, error) {
version, err := tiStore.CurrentVersion()
if err != nil {
return nil, errors.Trace(err)
}
snapshot, err := tiStore.GetSnapshot(version)
version, err := tiStore.CurrentVersion(oracle.GlobalTxnScope)
if err != nil {
return nil, errors.Trace(err)
}
snapshot := tiStore.GetSnapshot(version)
return meta.NewSnapshotMeta(snapshot), nil
}

Expand Down
37 changes: 22 additions & 15 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,46 @@ module github.com/pingcap/tidb-binlog

require (
github.com/BurntSushi/toml v0.3.1
github.com/DATA-DOG/go-sqlmock v1.3.0
github.com/DATA-DOG/go-sqlmock v1.5.0
github.com/Shopify/sarama v1.24.1
github.com/dgraph-io/ristretto v0.0.2 // indirect
github.com/dustin/go-humanize v1.0.0
github.com/go-sql-driver/mysql v1.5.0
github.com/gogo/protobuf v1.3.1
github.com/golang/mock v1.3.1
github.com/golang/mock v1.4.3
github.com/golang/protobuf v1.3.4
github.com/google/gofuzz v1.0.0
github.com/gorilla/mux v1.7.4
github.com/kami-zh/go-capturer v0.0.0-20171211120116-e492ea43421d
github.com/mattn/go-colorable v0.1.7 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/onsi/ginkgo v1.11.0 // indirect
github.com/onsi/gomega v1.8.1 // indirect
github.com/pingcap/check v0.0.0-20200212061837-5e12011dc712
github.com/pingcap/errors v0.11.5-0.20201029093017-5a7df2af2ac7
github.com/pingcap/kvproto v0.0.0-20200907074027-32a3a0accf7d
github.com/pingcap/errors v0.11.5-0.20201126102027-b0a155152ca3
github.com/pingcap/kvproto v0.0.0-20201215060142-f3dafca4c7fd
github.com/pingcap/log v0.0.0-20201112100606-8f1e84a3abc8
github.com/pingcap/parser v0.0.0-20201130080042-c3ddfec58248
github.com/pingcap/tidb v1.1.0-beta.0.20201214152324-ce2f365189d3
github.com/pingcap/tidb-tools v4.0.8+incompatible
github.com/pingcap/tipb v0.0.0-20200618092958-4fad48b4c8c3
github.com/pingcap/parser v0.0.0-20201222091346-02c8ff27d0bc
github.com/pingcap/tidb v1.1.0-beta.0.20201225085011-3e2ff1d16ce5
github.com/pingcap/tidb-tools v4.0.9-0.20201127090955-2707c97b3853+incompatible
github.com/pingcap/tipb v0.0.0-20201209065231-aa39b1b86217
github.com/prometheus/client_golang v1.5.1
github.com/prometheus/client_model v0.2.0
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a
github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563
github.com/samuel/go-zookeeper v0.0.0-20170815201139-e6b59f6144be
github.com/siddontang/go v0.0.0-20180604090527-bdc77568d726
github.com/soheilhy/cmux v0.1.4
github.com/syndtr/goleveldb v1.0.1-0.20190625010220-02440ea7a285
github.com/tikv/pd v1.1.0-beta.0.20200921100508-9ee41c4144f3
github.com/unrolled/render v0.0.0-20180914162206-b9786414de4d
go.etcd.io/etcd v0.5.0-alpha.5.0.20191023171146-3cf2f69b5738
github.com/tikv/pd v1.1.0-beta.0.20201125070607-d4b90eee0c70
github.com/unrolled/render v1.0.1
go.etcd.io/bbolt v1.3.5 // indirect
go.etcd.io/etcd v0.5.0-alpha.5.0.20200824191128-ae9734ed278b
go.uber.org/zap v1.16.0
golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208
golang.org/x/net v0.0.0-20200904194848-62affa334b73
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9
golang.org/x/sys v0.0.0-20200819171115-d785dc25833f
google.golang.org/grpc v1.26.0
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/grpc v1.27.1
)

go 1.13
Loading

0 comments on commit 893b35c

Please sign in to comment.