Failure cases due to improper isolation level and row log format setup

Source: Internet
Author: User
Tags mixed response code

The test platform that recently took over a new project uses the spring transaction mechanism, always prompts for authentication timeout when user authenticates login, and then looks at the corresponding application server logs and finds the reported exception:

Binary logging not possible. Message:transaction level ' read-committed ' in InnoDB isn't safe for Binlog mode ' STATEMENT ' ...

......

A front-end application server reported the following error:

{"Returnno": 0, "ListField": [{"Usercode": "admin", "NewPassword": "", "SessionKey": "", "Password": " 670B14728AD9902AECBA32E22FA4F6BD "," IP ":" 192.168.1.75 "}]," Returnobject ": null," Commondid ":" 8000 "}

Java.io.IOException:Server returned HTTP response code:500 for url:http://xxxxx/xxxxxx

At Sun.net.www.protocol.http.HttpURLConnection.getInputStream (httpurlconnection.java:1313)

In fact, through the top of the error can determine where the problem. Due to InnoDB and binlog incompatibility ... MySQL Recommendation: When setting the isolation level of read-commited must be set row log format for rows, now MySQL official also clearly stated that statement this has not been recommended!

The current system transaction ISOLATION level is: read-committed, the row log format is: STATEMENT

There are two ways to fix this:

One is to elevate the isolation level of repeatable-read, which is the default transaction isolation level of MySQL;

Mysql> set GLOBAL transaction ISOLATION level repeatable read;

One is to keep the current transaction isolation level and modify the row log format to MIXED or row.

This modifies the configuration file:

Binlog_format = row

#binlog_format = MIXED

Restart Service

One particular issue to note is that if Binlog_format is MIXED and the default isolation level Repeatable-read is used, it can result in inconsistent master and subordinate data.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.