MySQL服务器的常规日志在插入表后显示一条记录“查询回滚”,但记录仍在表中。谁能解释这里发生的事情。
将销售交易插入到称为交易表的表中。日志显示如下
2018-09-12T04:17:34.215985Z 14 Query SHOW GLOBAL STATUS
2018-09-12T04:17:37.223987Z 14 Query SHOW GLOBAL STATUS
2018-09-12T04:17:38.565372Z 29 Connect root@localhost on nevro using TCP/IP
2018-09-12T04:17:38.565796Z 29 Query /* mysql-connector-java-8.0.12 (Revision: 24766725dc6e017025532146d94c6e6c488fb8f1) */SELECT @@session.auto_increment_increment AS auto_increment_increment, @@character_set_client AS character_set_client, @@character_set_connection AS character_set_connection, @@character_set_results AS character_set_results, @@character_set_server AS character_set_server, @@collation_server AS collation_server, @@init_connect AS init_connect, @@interactive_timeout AS interactive_timeout, @@license AS license, @@lower_case_table_names AS lower_case_table_names, @@max_allowed_packet AS max_allowed_packet, @@net_write_timeout AS net_write_timeout, @@sql_mode AS sql_mode, @@system_time_zone AS system_time_zone, @@time_zone AS time_zone, @@transaction_isolation AS transaction_isolation, @@wait_timeout AS wait_timeout
2018-09-12T04:17:38.566227Z 29 Query SET NAMES utf8mb4
2018-09-12T04:17:38.566388Z 29 Query SET character_set_results = NULL
2018-09-12T04:17:38.566568Z 29 Query SET autocommit=1
2018-09-12T04:17:38.566791Z 29 Query SET autocommit=0
2018-09-12T04:17:38.568687Z 29 Query insert into transactions (ID,CUSTOMER_ID,CUSTOMER_NAME,CUSTOMER_TYPE,PAYMENT_TYPE,TRANSACTION_DATE,USER,USER_NAME,TOTAL_VALUE,TIME,CANCEL) values(0,9999,'GUEST CUSTOMER','GUEST','Cash','2018-09-12',100007,'Nick',1940.0,'09:47:38',0)
2018-09-12T04:17:38.570476Z 29 Query commit
2018-09-12T04:17:38.682805Z 29 Query rollback
2018-09-12T04:17:38.682990Z 29 Quit
即使已回滚(2018-09-12T04:17:38.682805Z 29查询回滚)表中也存在相关记录。
请解释一下这里到底发生了什么。
答案 0 :(得分:1)
rollback
之前是commit
。回滚仅“撤消”仅未提交的更改。
也就是说,commit
完成了更改;发出rollback
时,没有任何未提交的回滚更改。