rpl_deadlock.result
上传用户:romrleung
上传日期:2022-05-23
资源大小:18897k
文件大小:3k
源码类别:

MySQL数据库

开发平台:

Visual C++

  1. stop slave;
  2. drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
  3. reset master;
  4. reset slave;
  5. drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
  6. start slave;
  7. create table t1 (a int not null, key(a)) engine=innodb;
  8. create table t2 (a int not null, key(a)) engine=innodb;
  9. create table t3 (a int) engine=innodb;
  10. create table t4 (a int) engine=innodb;
  11. show variables like 'slave_transaction_retries';
  12. Variable_name Value
  13. slave_transaction_retries 0
  14. show create table t1;
  15. Table Create Table
  16. t1 CREATE TABLE `t1` (
  17.   `a` int(11) NOT NULL default '0',
  18.   KEY `a` (`a`)
  19. ) ENGINE=InnoDB DEFAULT CHARSET=latin1
  20. show create table t2;
  21. Table Create Table
  22. t2 CREATE TABLE `t2` (
  23.   `a` int(11) NOT NULL default '0',
  24.   KEY `a` (`a`)
  25. ) ENGINE=InnoDB DEFAULT CHARSET=latin1
  26. show variables like 'slave_transaction_retries';
  27. Variable_name Value
  28. slave_transaction_retries 2
  29. stop slave;
  30. begin;
  31. insert into t3 select * from t2 for update;
  32. insert into t1 values(1);
  33. commit;
  34. begin;
  35. select * from t1 for update;
  36. a
  37. start slave;
  38. insert into t2 values(22);
  39. commit;
  40. select * from t1;
  41. a
  42. 1
  43. select * from t2;
  44. a
  45. 22
  46. show slave status;
  47. Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
  48. # 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 13110 # # master-bin.000001 Yes Yes 0 0 13110 # None 0 No #
  49. stop slave;
  50. change master to master_log_pos=401;
  51. begin;
  52. select * from t2 for update;
  53. a
  54. 22
  55. start slave;
  56. commit;
  57. select * from t1;
  58. a
  59. 1
  60. 1
  61. select * from t2;
  62. a
  63. 22
  64. show slave status;
  65. Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
  66. # 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 13110 # # master-bin.000001 Yes Yes 0 0 13110 # None 0 No #
  67. set global max_relay_log_size=0;
  68. stop slave;
  69. change master to master_log_pos=401;
  70. begin;
  71. select * from t2 for update;
  72. a
  73. 22
  74. start slave;
  75. commit;
  76. select * from t1;
  77. a
  78. 1
  79. 1
  80. 1
  81. select * from t2;
  82. a
  83. 22
  84. show slave status;
  85. Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
  86. # 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 13110 # # master-bin.000001 Yes Yes 0 0 13110 # None 0 No #
  87. drop table t1,t2,t3,t4;