polardb / polardb/polardbx-sql

mysqlbinlog基于cdc全局binlog恢复报Not supported variable for now 'pseudo_thread_id'

Open
#64 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.7k
Forks
337
PR merge metrics
No merged PRs in 30d

Description

用mysqlbinlog基于全局binlog恢复时报错,之后的insert 表数据sql未执行,数据不能恢复,示例:
mysql -f -hxxx -Pxxx -upolardbx_root -pxxx testdb<testdb.sql
ERROR 1193 (HY000) at line 14: [147a79b9c8003000][192.168.110.21:9540][testdb]Not supported variable for now 'pseudo_thread_id'
ERROR 3009 (HY000) at line 18: [147a79b9cac03000][192.168.110.21:9540][testdb]ERR-CODE: [PXC-4500][ERR_PARSER] statement com.alibaba.polardbx.druid.sql.dialect.mysql.ast.statement.MySqlHintStatement not supported

testdb.sql截取后的前部份内容如下(mysqlbinlog -v --base64-output=decode-rows --skip-gtids=true -d testdb --start-position=2907258 --stop-position=3243742 /tmp/binlog.000001 > testdb.sql):
/!50616 SET @@SESSION.GTID_NEXT='AUTOMATIC'//!/;

at 2906355

#220615 13:09:49 server id 1842087586 end_log_pos 2906999 CRC32 0x5afb9f3c Query thread_id=1 exec_time=1655432947 error_code=0
use testdb/!/;
SET TIMESTAMP=1655269789/!/;
SET @@session.pseudo_thread_id=1/!/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/!/;
SET @@session.sql_mode=1142947872/!/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/!/;
/!\C utf8mb3 //!/;
SET @@session.character_set_client=33,@@session.collation_connection=33,@@session.collation_server=33/!/;
SET @@session.time_zone='SYSTEM'/!/;
SET @@session.lc_time_names=0/!/;
SET @@session.collation_database=DEFAULT/!/;

POLARX_ORIGIN_SQL=CREATE TABLE t1 ( id bigint(11) NOT NULL AUTO_INCREMENT, name varchar(255) DEFAULT NULL, score bigint(11) DEFAULT NULL, PRIMA

RY KEY (id) ) ENGINE = InnoDB DEFAULT CHARSET = utf8 PARTITION BY HASH (id) PARTITIONS 9# POLARX_TSO=694270470023177836814737699134400184320000000000000000
create table t1 ( id bigint(11) not null auto_increment, name varchar(255) default null, score bigint(11) default null, primary key (id) ) engi
ne = innodb default charset = utf8 default character set = utf8 default collate = utf8_general_ci/!/;

at 2906999

at 2907082

#220615 13:09:49 server id 1842087586 end_log_pos 2907137 CRC32 0x4e1bf385 Query thread_id=0 exec_time=0 error_code=0
SET TIMESTAMP=1655269789/!/;
BEGIN
/!/;

at 2907137

at 2907207

#220615 13:09:49 server id 1842087586 end_log_pos 2907258 CRC32 0x010dbfa8 Table_map: testdb.t1 mapped to number 5

at 2907258

#220615 13:09:49 server id 1842087586 end_log_pos 2907315 CRC32 0x8eae71f8 Write_rows: table id 5 flags: STMT_END_F

INSERT INTO testdb.t1

"testdb.sql" 4358L, 65328C

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the mysqlbinlog recovery command against the supplied testdb.sql excerpt and inspect handling of SET @@session.pseudo_thread_id and the MySqlHintStatement parser error. Done means the generated SQL completes without these errors and the later INSERT statements restore successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, mysql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.