Skip to content

the Gtidset mismatch in the XidEvent and the binary log #176

@ruiaylin

Description

@ruiaylin

I use go-mysql package to do some test like this :
the client below as a slave with semi sync on .

func main() {	cfg := replication.BinlogSyncerConfig{	ServerID: 110,	Flavor: "mysql",	Host: "127.0.0.1",	Port: 3306,	User: "xxxx",	Password: "xxxxx",	SemiSyncEnabled: true,	}	syncer := replication.NewBinlogSyncer(cfg)	gtidSet, _ := mysql.ParseMysqlGTIDSet("28f1056e-b88f-11e7-a7be-70c589624d5e:1-225")	streamer, _ := syncer.StartSyncGTID(gtidSet)	for {	ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)	ev, err := streamer.GetEvent(ctx)	cancel()	if err == context.DeadlineExceeded {	// meet timeout	continue	}	// if ev.Header.EventType.String() == "GTIDEvent" {	//	ev.Dump(os.Stdout)	// }	if ev.Header.EventType.String() == "XIDEvent" {	ev.Dump(os.Stdout)	}	} } 

Master Side

execute two insert sql .

mysql> mysql> insert into test values (null, 'yyyyyyyxxxxsxxxxasdfsadfa ;ttt') Query OK, 1 row affected (0.02 sec) mysql> insert into test values (null, 'yyyyyyyxxxxsxxxxasdfsadfastttt') ; Query OK, 1 row affected (0.02 sec) 

Client's OutPut

=== XIDEvent === Date: 2017-10-25 10:36:14 Log position: 7154577 Event size: 31 XID: 94696 GTIDSet: 28f1056e-b88f-11e7-a7be-70c589624d5e:1-4528 === XIDEvent === Date: 2017-10-25 10:36:19 Log position: 7154867 Event size: 31 XID: 94697 GTIDSet: 28f1056e-b88f-11e7-a7be-70c589624d5e:1-4528 

The GTIDSet are the same . I think there are something wrong . And i check the event in binlog file.
the conent is :

# at 7154287 #171025 10:36:14 server id 10000 end_log_pos 7154352 CRC32 0x15fa372a	GTID	last_committed=4267	sequence_number=4268	rbr_only=yes /*!50718 SET TRANSACTION ISOLATION LEVEL READ COMMITTED*//*!*/; SET @@SESSION.GTID_NEXT= '28f1056e-b88f-11e7-a7be-70c589624d5e:4529'/*!*/; # at 7154352 #171025 10:36:14 server id 10000 end_log_pos 7154424 CRC32 0xbcb7e183	Query	thread_id=4	exec_time=0	error_code=0 SET TIMESTAMP=1508898974/*!*/; BEGIN /*!*/; # at 7154424 #171025 10:36:14 server id 10000 end_log_pos 7154474 CRC32 0xa1fcfc39	Table_map: `test`.`test` mapped to number 229 # at 7154474 #171025 10:36:14 server id 10000 end_log_pos 7154546 CRC32 0x99406905	Write_rows: table id 229 flags: STMT_END_F BINLOG ' nvjvWRMQJwAAMgAAACorbQAAAOUAAAAAAAEABHRlc3QABHRlc3QAAgMPApABAjn8/KE= nvjvWR4QJwAASAAAAHIrbQAAAOUAAAAAAAEAAgAC//xsAAAAHgB5eXl5eXl5eHh4eHN4eHh4YXNk ZnNhZGZhc3R0dHQFaUCZ '/*!*/; ### INSERT INTO `test`.`test` ### SET ### @1=108 /* INT meta=0 nullable=0 is_null=0 */ ### @2='yyyyyyyxxxxsxxxxasdfsadfastttt' /* VARSTRING(400) meta=400 nullable=1 is_null=0 */ # at 7154546 #171025 10:36:14 server id 10000 end_log_pos 7154577 CRC32 0xc93b1652	Xid = 94696 COMMIT/*!*/; # at 7154577 #171025 10:36:19 server id 10000 end_log_pos 7154642 CRC32 0xb5646927	GTID	last_committed=4268	sequence_number=4269	rbr_only=yes /*!50718 SET TRANSACTION ISOLATION LEVEL READ COMMITTED*//*!*/; SET @@SESSION.GTID_NEXT= '28f1056e-b88f-11e7-a7be-70c589624d5e:4530'/*!*/; # at 7154642 #171025 10:36:19 server id 10000 end_log_pos 7154714 CRC32 0xca4eaa90	Query	thread_id=4	exec_time=0	error_code=0 SET TIMESTAMP=1508898979/*!*/; BEGIN /*!*/; # at 7154714 #171025 10:36:19 server id 10000 end_log_pos 7154764 CRC32 0x6dc84a70	Table_map: `test`.`test` mapped to number 229 # at 7154764 #171025 10:36:19 server id 10000 end_log_pos 7154836 CRC32 0xf3629375	Write_rows: table id 229 flags: STMT_END_F BINLOG ' o/jvWRMQJwAAMgAAAEwsbQAAAOUAAAAAAAEABHRlc3QABHRlc3QAAgMPApABAnBKyG0= o/jvWR4QJwAASAAAAJQsbQAAAOUAAAAAAAEAAgAC//xtAAAAHgB5eXl5eXl5eHh4eHN4eHh4YXNk ZnNhZGZhc3R0dHR1k2Lz '/*!*/; ### INSERT INTO `test`.`test` ### SET ### @1=109 /* INT meta=0 nullable=0 is_null=0 */ ### @2='yyyyyyyxxxxsxxxxasdfsadfastttt' /* VARSTRING(400) meta=400 nullable=1 is_null=0 */ # at 7154836 #171025 10:36:19 server id 10000 end_log_pos 7154867 CRC32 0x7b3af790	Xid = 94697 COMMIT/*!*/; SET @@SESSION.GTID_NEXT= 'AUTOMATIC' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; 

Maybe a Bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions