A simple master-to-slave replication is currently being used. This information is extracted from the SHOW SLAVE STATUS output:
Last_SQL_Error: Error ‘Duplicate entry ‘8’ for key ‘PRIMARY’ ‘ on query. Default database: ‘mydb’.
Query: ‘insert into mytable VALUES (‘8’, ‘George’) ‘
Skip_Counter: 0
Retrieved_Gtid_Set: 5da6b4f5-6f60-11e8-b2d6-0010e05f3e06: 1-8
Executed_Gtid_Set: 0 25da6b4f5-6f60-11e8-b2d6-0010e05f3e06: 0 21-7
62706329-6f60-11e8-b64f-0010e05f3e06: 1
Auto-Position: 1
You execute a ‘SHOW CREATE TABLE mytable” on the slave:
CREATE TABLE ‘mytable’ (
‘ID’ int (11) NOT NULL DEFAULT ‘0’ ,
‘name’ char (10) DEFAULT NULL,
PRIMARY KEY (‘ID’)
)
The table mytable on the slave contains:
You have issued a STOP SLAVE command. You have determined that it is safe to skip the transaction in this case. One or more statements are required before you can issue a START
SLAVE command to resolve the duplicate key error. Which statement should be used?
A. SET GTID_NEXT=”CONSISTENCY”; BEGIN; COMMIT; SET GTID_NEXT=”AUTOMATIC”;
B. SET GTID_NEXT=”5da6b4f5-6f60-11e8-b2d6-0010e05f3e06:8”; BEGIN; COMMIT; SET GTID_NEXT=”AUTOMATIC”;
C. SET GLOBAL SQL_SKIP_SLAVE_COUNTER=1
D. SET GLOBAL enforce_gtid_consistency=ON
E. SET GTID_EXECUTED=”5da6b4f5-6f60-11e8-b2d6-0010e05f3e06:8”;
Answer: B
版权声明:本文为博主原创文章,未经博主允许不得转载。
MYSQL