In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
When I first joined the job, I encountered the problem of mysql deadlock. The details are as follows:
The web page has a function to count the number of visits, and then the number of visits num is int, and the number of visits to the web page is increased by 1. When the operator runs a batch task, the data volume field is deadlocked. Then DBA inquired about the cause of the deadlock and finally found out that my code caused the deadlock, and then I took the pot. How to solve this problem, I have not been aware of, because they did not ask to change the code. Since then I have been thinking about this question, exactly what caused the deadlock. Since it was impossible to reproduce the application scenarios and various service configurations at that time, I could not delve into this problem. Later, we can only seriously study the lock of mysql and the concurrency control of java.
N has not started to write for a long time, there is still a problem with expression. After I have sorted out my train of thought, I will write in detail the text in this respect. Today, I will simply write down two places that mysql should pay attention to on the innoDb line lock, and there are many other places that are needed. Here is only a simple record, which can only be called a simple record.
Let's start with the reality of innoDB row locking, which is achieved by locking index items on the index. This determines that the premise of using row-level locks is to retrieve data through index conditions, otherwise innoDB will use table-level locks. The second point to say is that even if index fields are used in the condition, it is up to mysql to decide whether or not to retrieve data by judging the cost of different execution plans. If the mysql task scans the whole table more efficiently, it will not use indexes, in which case innoDB will use table locks instead of row locks. So when analyzing the lock problem of mysql, it is sometimes necessary to use explain to check the execution plan of SQL.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
Rely on org.springframework.boot spring-boot-starter-data-jpa
© 2024 shulou.com SLNews company. All rights reserved.