先测试下mysql的
session1:
mysql> begin;
Query OK, 0 rows affected (0.00 sec)
mysql> insert into bai values(1,'a',10);
Query OK, 1 row affected (0.00 sec)
不提交,开始等待会话2提交
mysql> commit;
Query OK, 0 rows affected (0.00 sec)
session2:
mysql> begin;
Query OK, 0 rows affected (0.00 sec)
mysql> insert into bai values(2,'bb',11);
Query OK, 1 row affected (0.00 sec)
mysql> commit;
Query OK, 0 rows affected (0.00 sec)
开始提交session1
看binlog日志内容,看到是先记录的会话2的时间
BEGIN
/*!*/;
# at 351
#180110 16:13:23 server id 503333 end_log_pos 401 CRC32 0xb5a1984a Table_map: `test`.`bai` mapped to number 70
# at 401
#180110 16:13:23 server id 503333 end_log_pos 448 CRC32 0x05875047 Write_rows: table id 70 flags: STMT_END_F
### INSERT INTO `test`.`bai`
### SET
### @1=2 /* INT meta=0 nullable=0 is_null=0 */
### @2='bb' /* VARSTRING(60) meta=60 nullable=1 is_null=0 */
### @3=11 /* INT meta=0 nullable=0 is_null=0 */
# at 448
#180110 16:13:25 server id 503333 end_log_pos 479 CRC32 0x29fb4565 Xid = 38599
COMMIT/*!*/;
# at 479
#180110 16:13:28 server id 503333 end_log_pos 527 CRC32 0xcb8f59cf GTID [commit=yes]
SET @@SESSION.GTID_NEXT= 'ea24d53c-5315-11e7-b5fa-5254005bf35b:8075'/*!*/;
# at 527
#180110 16:13:05 server id 503333 end_log_pos 599 CRC32 0xb1c3647e Query thread_id=12757 exec_time=0 error_code=0
SET TIMESTAMP=1515571985/*!*/;
BEGIN
/*!*/;
# at 599
#180110 16:13:05 server id 503333 end_log_pos 649 CRC32 0x5e94c3a5 Table_map: `test`.`bai` mapped to number 70
# at 649
#180110 16:13:05 server id 503333 end_log_pos 695 CRC32 0x1c22224e Write_rows: table id 70 flags: STMT_END_F
### INSERT INTO `test`.`bai`
### SET
### @1=1 /* INT meta=0 nullable=0 is_null=0 */
### @2='a' /* VARSTRING(60) meta=60 nullable=1 is_null=0 */
### @3=10 /* INT meta=0 nullable=0 is_null=0 */
# at 695
#180110 16:13:28 server id 503333 end_log_pos 726 CRC32 0xb50d7718 Xid = 38597
COMMIT/*!*/;
基于stoptime的时间点恢复,如果stop时间制定到–stop-datetime=”2018-01-10 16:13:25”时看不到任何记录的,指定到–stop-datetime=”2018-01-10 16:13:26”能看到第二个会话提交的记录。指定到–stop-datetime=”2018-01-10 16:13:29”才能看到2个会话的记录。