------------------------
LATEST detected DEADLOCK
------------------------
140824 1:01:24
(1) TRANSACTION:
TRANSACTION 110E, active starting SEC index Read # # transaction id=110E, active 73s
MySQL tables in use 1, locked 1
Lock WAIT 3 lock struct (s), Heap size 376, 2 row lock (s) # # There are 2 row locks
MySQL thread ID 1, OS thread handle 0x7
MySQL Deadlock case analysis and solutionsPhenomenon:Database query:SQL Statement Analysis:Mysql.Concurrent Delete same row record, occasional deadlock.Delete from x_table where id=? Deadlock Analysis:MySQL's transactional support is related to the storage engine, MyISAM does not support transactions, InnoDB supports transactions, and is used for row-level locks
Tags: when restart nod deadlock auto from change CTI MYSQA deadlock occurs after MySQL InnoDB locks are unlocked.[Error] Deadlock found when trying to get lock; Try restarting transactionOne thing to keep in mind is this: InnoDB's row lock and unlock are for primary key indexing. If the query is based on the index lock
Label:As a social App, we have a lot of things happening at the same time, in order to ensure the consistency of data, will take the database. For example, now we have a praise operation, like success, you need to change the heat of the article. The following is the SQL statement: INSERT into User_praise (uid,plan_id,stage_id) VALUES (123456,14456,10023); UPDATE plan_hot SET hot = hot + 1 WHERE plan_id = 14456; Here we need to use things to ensure that it is atomic, that is, either the two state
If you encounter a deadlock, how to solve it? Find the original lock ID, then kill the thread that has been held, but how many threads can find the thread ID that caused the deadlock? MySQL has developed to the present, has been very strong, this problem is very good to solve. Search directly from the data dictionary.
Let's take a demonstration.
Thread A, we us
MYSQL deadlock case
01 The following example shows how an error occurs when a lock request may cause a deadlock. The example contains two clients, A and B. 0203 first, Client A creates A table containing A row and starts A transaction. In this transaction, A gets the S lock on the row by selecting the row in the sharing mode: 0405
;SELECT * from ' ABCDEFG ' WHERE def=19 and ghi=19 and jkl=19;--Pause, wait for the first half of window B to execute the next sectionINSERT into ' ABCDEFG ' (ABC,DEF,GHI,JKL,MNP) VALUES (' 19 ', 19,19,19,1);COMMIT;Use Memdb;SHOW VARIABLES like '%autocommit% ';SET tx_isolation= ' SERIALIZABLE ';SHOW VARIABLES like '%tx% ';START TRANSACTION;SELECT * from ' ABCDEFG ' WHERE def=18 and ghi=18 and jkl=18;--Pause, etc. the first half of the a window is executed in the next section of theINSERT into '
);Withdrawapplydao.updateearlierapplytime (userid,earliertime);//Update redundant fieldsDeduct account balance, then write to Gold_log logInt J = Userdao.updateusergold (0-amount, userId);......So why is there a deadlock?This is the case, the user clicked too fast and submitted two withdrawal requestsThen it will open two transactionsTransaction 1 Insert an applyTransaction 2 also inserts an applyTransaction 1 performs update updateearlierapplytime, b
Deadlock (deadlock)
The so-called deadlock: refers to two or more than two processes in the implementation process, as a result of competing for resources caused by a mutual wait for the phenomenon, without external forces, they will not be able to push down. It is said that the system is in a deadlock state or the sy
Mysql uses the kill command to solve the deadlock problem (killing an SQL statement being executed)
When using mysql to run certain statements, the deadlock is caused by a large amount of data, which is not reflected. At this time, you need to kill a query statement that is consuming resources. The syntax format of th
;
[Sql]update Girl set age=29 where id=1;[ERR] 1213-deadlock found when trying to get lock; Try restarting transaction
The InnoDB storage engine detects the cyclic dependency of a deadlock and returns an error immediately.Well, I'm still but time old man!What if it does?There must be no end to the story, I have to think of ways to avoid conflict with the old time, so it!START TRANSACTION;UPDAT
when we frequently insert or update the database, it is possible to directly report SQL error 1205:lock wait timeout exceeded. The deadlock of the database. General InnoDB Database will automatically add transactions, when inserting or updating, if the last commit has not been completed, and a new commit commits, the system will report a SQL error 1205:lock wait timeout Exceeded. This is the MySQL deadlock.
Label:This essay is ready to keep track of the deadlock-related issues encountered in daily work on MySQL1) view MySQL current processing thread (connection) mysql> show processlist;2) Kill the corresponding connection mysql> kill connection_id;For example, kill 3 (kills Link 3)4) View the lock status in the databaseMy
IntroductionEngaged in MYSQL-DBA this is also a few years, want to say to the new person, in the analysis of deadlock problem should also consider that there is a "concept" called the request queue. ReasonThis is not because the novice does not know, but sometimes naturally unexpected.If you don't believe me, the example I'm going to say here is that every DBA knows to queue up.Session ATable int Primary Ke
In a large number of clients, updating the same row of a data table results in a significant decrease in the throughput of the database.Many of the database's predecessors and peers through the experiment and the source of methods, to locate the culprit----MySQL deadlock detectionExperimental method: http://blog.csdn.net/zhaiwx1987/article/details/6952285SOURCE mode: http://www.gpfeng.com/?p=426Please pay p
** The following is the deadlock information viewed using showinnodbstatus. all records are updated using the primary key index userId. No other indexes have any impact and should not cause deadlocks. Please help us to analyze the cause. ** Table indexes are as follows (... PRIMARYKEY (userId), UNIQUEKEYuserId_UNIQUE (userId), UNIQUEKEYuserName_UNIQUEUSINGBTREE (userName) ENGINEInnoDBAUTO_INCREMENT1DEFAULT... mysq
queried immediately.There is still a need to say that the MySQL for update caused the deadlock.After analysis, MySQL's InnoDB storage Engine practice Lock is a lock line, but it is the lock index, according to where conditions and the value of select whether only primary key or non-primary key index to determine how to lock, such as only the primary key, the lock primary key index, if only non-primary key, lock non-primary key index, If the primary k
After the mysql innodb row lock is unlocked, the result is 1213 dead, like Deadlock found when. To solve this problem, remember that innodb row locks and locks are for primary key indexes. If the table is locked Based on the index during the query, but it is not updated through the primary key during the update, the process waiting to unlock the query will report a 1213 error, and a null value instance may
The previous understanding of InnoDB on the occurrence of lock waiting, will be based on the configuration of the parameters Innodb_lock_wait_timeout, determine whether to do a timeout operation, this document describes in the presence of lock waiting time to view and analyze processing;Before InnoDB plugin, it is common to see the current database request through Show full processlist (it is difficult to find the locked line to record the problem) and the show Engine InnoDB status command. It t
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.