Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a tool to parse and print relay log content #1009

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

csuzhangxc
Copy link
Member

@csuzhangxc csuzhangxc commented Nov 12, 2020

What problem does this PR solve?

add a tool (relayprinter) to parse and print relay log content

What is changed and how it works?

  • use binlogfile.OpenBinlogger to read binlog entities

some samples of output:

# at suffix:68 offset:309213
# commitTS:420762958799568899
# schema:db2 table:account_verify
create table account_verify(
    account_id bigint(19) unsigned NOT NULL primary key,
    currency int(3) unsigned NOT NULL,
    verify_date date NOT NULL,
    wrong_amount bigint(17) NOT NULL
)

# at suffix:68 offset:312343
# commitTS:420762964697808903
# schema: db2 table:institution
# INSERET
# values: map[name:institution 9 status:0 uid:9]
INSERT INTO `db2`.`institution`
  (`name`,`status`,`uid`)
VALUES
  (institution 9,0,9)

# schema: db2 table:account_number
# UPDATE
# old alues: map[account:5160 currency:1 number:3 number_type:2 update_time:2020-11-10]
# new values: map[account:5160 currency:1 number:4 number_type:2 update_time:2020-11-10]
UPDATE `db2`.`account_number` SET
  `account` = 5160,
  `currency` = 1,
  `number` = 4,
  `number_type` = 2,
  `update_time` = 2020-11-10
WHERE
  `account` = 5160 AND
  `currency` = 1 AND
  `number` = 3 AND
  `number_type` = 2 AND
  `update_time` = 2020-11-10

# at suffix:68 offset:313484
# commitTS:420762965169668098
# schema: db2 table:employee
# DELETE
# values: map[institution_id:1 status:0 uid:1000000006]
DELETE FROM `db2`.`employee` WHERE
  `institution_id` = 1 AND
  `status` = 0 AND
  `uid` = 1000000006

Check List

Tests

  • Manual test (add detailed scripts or steps below)

Code changes

  • Has exported function/method change
  • Has interface methods change

Side effects

Release note

  • No Release note.

@csuzhangxc
Copy link
Member Author

/run-all-tests tidb=release-4.0 tikv=release-4.0 pd=release-4.0

@ti-chi-bot
Copy link
Member

@csuzhangxc: PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ lichunzhu
❌ csuzhangxc
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants