Skip to content

Commit

Permalink
change defaultBinlogItemCount to 8; revise /tests/status/run.sh to sk…
Browse files Browse the repository at this point in the history
…ip binlog by previous test case
  • Loading branch information
lichunzhu committed Sep 9, 2019
1 parent 04d71a1 commit 8a6124a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
5 changes: 5 additions & 0 deletions drainer/checkpoint/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ import (
"encoding/json"
"sync"

"github.com/ngaut/log"
"github.com/pingcap/errors"

// mysql driver
_ "github.com/go-sql-driver/mysql"
pkgsql "github.com/pingcap/tidb-binlog/pkg/sql"
Expand Down Expand Up @@ -98,6 +100,7 @@ func (sp *MysqlCheckPoint) Load() error {
switch {
case err == sql.ErrNoRows:
sp.CommitTS = sp.initialCommitTS
log.Infof("no checkpoint in downstream table, use initialCommitTS: %d", sp.initialCommitTS)
return nil
case err != nil:
return errors.Annotatef(err, "QueryRow failed, sql: %s", selectSQL)
Expand All @@ -107,6 +110,8 @@ func (sp *MysqlCheckPoint) Load() error {
return errors.Trace(err)
}

log.Infof("read checkpoint from downstream table: %d", sp.CommitTS)

return nil
}

Expand Down
2 changes: 1 addition & 1 deletion drainer/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const (

var (
maxBinlogItemCount int
defaultBinlogItemCount = 0
defaultBinlogItemCount = 8
supportedCompressors = [...]string{"gzip"}
newZKFromConnectionString = zk.NewFromConnectionString
)
Expand Down
11 changes: 10 additions & 1 deletion tests/status/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,17 @@ cd "$(dirname "$0")"
OUT_DIR=/tmp/tidb_binlog_test
STATUS_LOG="${OUT_DIR}/status.log"

# use latest ts as initial-commit-ts, so we can skip binlog by previous test case
ms=$(date +'%s')
ts=$(($ms*1000<<18))
args="-initial-commit-ts=$ts"
down_run_sql "DROP DATABASE IF EXISTS tidb_binlog"
rm -rf /tmp/tidb_binlog_test/data.drainer


# run drainer, and drainer's status should be online
run_drainer &
run_drainer "$args" &

sleep 2
echo "check drainer's status, should be online"
check_status drainers online
Expand Down

0 comments on commit 8a6124a

Please sign in to comment.