[MCOL-859] Running TRUNCATE on many tables in parallel seems to eventually deadlock Created: 2017-08-07 Updated: 2020-08-25 Resolved: 2017-10-26 |
|
| Status: | Closed |
| Project: | MariaDB ColumnStore |
| Component/s: | DDLProc |
| Affects Version/s: | 1.0.10 |
| Fix Version/s: | 1.0.12, 1.1.1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Andrew Hutchings (Inactive) | Assignee: | Daniel Lee (Inactive) |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Sprint: | 2017-18, 2017-19, 2017-20, 2017-21 |
| Description |
|
Reported by a customer who is doing parallel jobs of TRUNCATE followed by LOAD DATA. |
| Comments |
| Comment by Andrew Hutchings (Inactive) [ 2017-09-15 ] | |||||||||||||||
|
Got a test case to reproduce this. Create two tables:
Create a tab separated csv file:
Create two PHP files as follows (make one use mcol859a and the other mcol859b):
Run the two PHP scripts in parallel, reproduced in less than a minute. Both threads on the truncate command, things locked up so bad that the MariaDB client hangs on new connections. | |||||||||||||||
| Comment by Andrew Hutchings (Inactive) [ 2017-09-15 ] | |||||||||||||||
|
Cause is a DDLProc thread in system catalog deadlocking itself. colTypeDct locks lk3 at the end which is fDctTokenMapLock, this calls colType which calls checkSysCatVer, checkSysCatVer calls flushCache if the cached catalogue version is wrong which also locks fDctTokenMapLock. But the thread already has that lock with colTypeDct causing a deadlock. | |||||||||||||||
| Comment by Andrew Hutchings (Inactive) [ 2017-09-15 ] | |||||||||||||||
|
Switched the mutex in question to a recursive mutex and after half an hour of running I've not been able to reproduce it any more (it took 1 minute before the fix). Pull request for 1.0 and 1.1. Do not merge the 1.1 until after 1.1.0 is released. For QA: Please see my comment with the test | |||||||||||||||
| Comment by Daniel Lee (Inactive) [ 2017-10-26 ] | |||||||||||||||
|
Build verified: Github source for 1.0.12 /root/columnstore/mariadb-columnstore-server Merge pull request #69 from mariadb-corporation/ /root/columnstore/mariadb-columnstore-server/mariadb-columnstore-engine Merge pull request #297 from mariadb-corporation/ Build verified: Github source for 1.1.1 /root/columnstore/mariadb-columnstore-server Merge pull request #72 from mariadb-corporation/ /root/columnstore/mariadb-columnstore-server/mariadb-columnstore-engine Merge pull request #302 from mariadb-corporation/ Verified with my own test scripts: [root@localhost tests]# cat t1.sql [root@localhost tests]# cat t2.sql |