after querying the current thread, it was found that multiple threads were running at the same time…
to view all currently running transactions:
SELECT * FROM information_schema.INNODB_TRX;
you can find three transactions all running at the same time… So you can find the direct cause of the error reported by the shopkeeper here is:
before the stored procedure (which opened the transaction) ran for half a day, MySQL was manually closed without any response… Didn’t make it commit… And the subsequent deletion of data in the same transaction creates a transaction lock…
The fundamental reason is that MySQL USES the Innodb engine by default, and the default parameter of Innodb: innodb_lock_wait_timeout, which sets the maximum time for transactions to wait for acquiring resources (default 50s). Once the maximum time is exceeded, it will report errors such as questions without obtaining resources.
Well, now that the cause of the error has been identified, there are three solutions:
Find the thread of the current transaction, kill the thread; Enlarge this parameter: innodb_lock_wait_TIMEOUT wait time; Optimize stored procedures.
Here the shopkeeper takes the first approach, killing the redundant threads and then checking all the currently running transactions again:
find something strange?The killed thread Number 10 is still working??Its current state is “ROLLING BACK,” which means that the transaction that was killed a while ago has been in a rollback state. So the shopkeeper continued to look up materials and found that such a situation occurred because although the kill command was triggered, it took a long time to terminate the kill logic, and it was also affected by IO resources. Therefore, rollback occurred even though the kill was executed.
Solutions:
One is to wait for it to roll back; Another is to restart the MySQL, but restart MySQL, the transaction will roll back, so in general is actually etc. It can be rolled back end 😂!
waited for about seven or eight minutes before everything was cleared, and all transactions were over:
and then delete again:
Centos 7 | mariadb/mysql | [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
The article directories
Error overview solution
Error in
2020-06-29 0:17:42 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2020-06-29 0:17:43 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
2020-06-29 0:17:43 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2020-06-29 0:17:44 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
2020-06-29 0:17:44 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2020-06-29 0:17:45 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
2020-06-29 0:17:45 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2020-06-29 0:17:46 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
2020-06-29 0:17:46 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2020-06-29 0:17:47 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
2020-06-29 0:17:47 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2020-06-29 0:17:48 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
2020-06-29 0:17:48 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2020-06-29 0:17:49 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
2020-06-29 0:17:49 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2020-06-29 0:17:49 0 [Note] InnoDB: Unable to open the first data file
2020-06-29 0:17:49 0 [ERROR] InnoDB: Operating system error number 11 in a file operation.
2020-06-29 0:17:49 0 [ERROR] InnoDB: Error number 11 means 'Resource temporarily unavailable'
2020-06-29 0:17:49 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2020-06-29 0:17:49 0 [ERROR] InnoDB: Cannot open datafile './ibdata1'
2020-06-29 0:17:49 0 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
2020-06-29 0:17:49 0 [ERROR] InnoDB: Plugin initialization aborted with error Cannot open a file
2020-06-29 0:17:49 0 [Note] InnoDB: Starting shutdown...
2020-06-29 0:17:50 0 [ERROR] Plugin 'InnoDB' init function returned error.
2020-06-29 0:17:50 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2020-06-29 0:17:50 0 [Note] Plugin 'FEEDBACK' is disabled.
2020-06-29 0:17:50 0 [ERROR] Unknown/unsupported storage engine: InnoDB
2020-06-29 0:17:50 0 [ERROR] Aborting
The solution
Website query Error code 11
Operating System Error Codes – MariaDB Knowledge Base
https://mariadb.com/kb/en/operating-system-error-codes
Number | Error Code | Description |
---|---|---|
11 | EAGAIN | Try again |
It’s no use trying again
An attempt was made to remove the deleted error file
cd /var/lib/mysql
ll
total 188492
-rw-rw---- 1 mysql mysql 16384 Jun 28 22:43 aria_log.00000001
-rw-rw---- 1 mysql mysql 52 Jun 28 22:43 aria_log_control
-rw-rw---- 1 mysql mysql 7007 Jun 28 22:43 ib_buffer_pool
-rw-rw---- 1 mysql mysql 79691776 Jun 28 22:49 ibdata1
-rw-rw---- 1 mysql mysql 50331648 Jun 28 23:18 ib_logfile0
-rw-rw---- 1 mysql mysql 50331648 Jun 22 09:17 ib_logfile1
-rw-rw---- 1 root root 12582912 Jun 28 23:18 ibtmp1
-rw-rw---- 1 mysql mysql 0 Jun 22 09:28 multi-master.info
drwx------ 2 mysql mysql 4096 Jun 22 09:17 mysql
-rw-rw---- 1 mysql mysql 351 Jun 28 21:52 mysql-bin.000001
-rw-rw---- 1 mysql mysql 351 Jun 28 22:19 mysql-bin.000002
-rw-rw---- 1 mysql mysql 351 Jun 28 22:31 mysql-bin.000003
-rw-rw---- 1 mysql mysql 351 Jun 28 22:32 mysql-bin.000004
-rw-rw---- 1 mysql mysql 351 Jun 28 22:43 mysql-bin.000005
-rw-rw---- 1 mysql mysql 95 Jun 28 22:32 mysql-bin.index
-rw-rw---- 1 mysql mysql 0 Jun 28 22:43 mysql-bin.state
drwx------ 2 mysql mysql 4096 Jun 22 09:17 performance_schema
Remove or delete the following three files :(note the backup)
ibdata1、ib_logfile0、ib_logfile1
Restart the mariadb/mysql