[MDEV-17883] CREATE TABLE IF NOT EXISTS locking changes in 10.3.10 Created: 2018-11-30 Updated: 2019-05-08 Resolved: 2019-05-03 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Galera |
| Affects Version/s: | 10.2.18, 10.3.10, 10.1.37 |
| Fix Version/s: | 10.2.24, 10.1.41, 10.3.15, 10.4.5 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Chris Wilson | Assignee: | Jan Lindström (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Linux |
||
| Description |
|
I have a workload that does partitioning manually (largely because at the end of each day I want to 'optimize table' for the previous day's partition to address fragmentation). As a result there's a stored procedure, that prepares a statement of the form "create table if not exists table_20181130 like table_template" and runs it. This procedure is called rather a lot and >99% of the time the table already exists so this doesn't do anything. This has been working great up-to and including MariaDB 10.3.9. Upon upgrading to 10.3.10 (or 11) I find that performance of my system is abysmal. And this seems to be down to this procedure - the create table if not exists doesn't return immediately like it used to if the table exists and any other query has the table open. I can work around this by looking in information_schema.TABLES and avoiding the 'create table if not exists' if the table already exists - however this feels like a regression to me rather than an intentional change, especially as I don't see anything obviously related in the 10.3.10 ChangeLog. To recreate; in one terminal execute:
... and in another:
In anything before 10.3.10 the second terminal will complete immediately, but in 10.3.10 (or 11) the second terminal will only complete once the select in the first terminal has done so. |
| Comments |
| Comment by Chris Wilson [ 2018-11-30 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Additionally: this doesn't seem to be specific to a particular storage engine. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2018-12-07 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks for the report. Particularly by this change:
Here is a test for reproducing purposes only. It needs to be improved before adding it to the regression suite, and we also need to find out why existing tests didn't catch it.
The test passes either way, but on a good version it passes with the expected output
Please keep in mind that the test is not 100% reliable, it can create false negatives. Don't trust the first pass. while on a broken version it also produces a wait timeout and hence mismatch:
For 10.1 / 10.2 it was done by a separate commit: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Mario Karuza (Inactive) [ 2019-04-26 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Fix is done in PR associated with this ticket. Please retest. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jan Lindström (Inactive) [ 2019-05-03 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Failed to find reliable test case. |