[MDEV-7410] Temporary table name conflict between sessions Created: 2015-01-05 Updated: 2015-01-13 Resolved: 2015-01-13 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data Definition - Alter Table, Data Definition - Procedure |
| Affects Version/s: | 5.1.67, 5.2.14, 5.3.12, 5.5, 10.0, 10.1 |
| Fix Version/s: | 5.5.42, 10.0.16 |
| Type: | Bug | Priority: | Major |
| Reporter: | Leo Kwan | Assignee: | Sergei Golubchik |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | upstream-fixed | ||
| Environment: |
RHEL 6 |
||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Description |
|
If we create a temporary table with the same name within a store procedure, and try to drop some columns in two different sessions running at the same moment, error " Unknown column" may pop. Although this is documented in https://mariadb.com/kb/en/mariadb/documentation/sql-commands/data-definition/create/create-table/ "Temporary table names are specific to your session. They may conflict with other temporary tables from other sessions or shadow names of non-temporary tables." But this is different behavior with Mysql http://dev.mysql.com/doc/refman/5.5/en/create-table.html This means that two different sessions can use the same temporary table name without conflicting with each other or with an existing non-TEMPORARY table of the same name. (The existing table is hidden until the temporary table is dropped.) This is stopper if using Mariadb as a drop in replacement for Mysql, as this require rewrite all SPs with alter temporary statement. |
| Comments |
| Comment by Elena Stepanova [ 2015-01-06 ] | |||||||||||||||||||||||||||
|
You chose 10.0.15-galera as an affected version. Did you really mean this, are you using a Galera cluster? If not, could you please
Thanks. Also, regarding the quote from the documentation, I don't think it was meant as an opposite to what MySQL manual says, but I agree it sounds weird. After we figure out why you are getting the error, we'll get the documentation fixed as well. | |||||||||||||||||||||||||||
| Comment by Leo Kwan [ 2015-01-06 ] | |||||||||||||||||||||||||||
|
General Log | |||||||||||||||||||||||||||
| Comment by Leo Kwan [ 2015-01-06 ] | |||||||||||||||||||||||||||
|
Test SP | |||||||||||||||||||||||||||
| Comment by Leo Kwan [ 2015-01-06 ] | |||||||||||||||||||||||||||
|
I am testing on 10.0.15-MariaDB-wsrep-log, and it is a three nodes testing cluster. The general log is attached, I've also attached the store procedure. I open 4 sessions and run the same SP on the same node, the first round ran without error, but error came on the second rounds on 2 out of 4 sessions. This is the exact error message Session 1 Session 2 Thanks | |||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2015-01-09 ] | |||||||||||||||||||||||||||
|
Thanks for the data, I was able to reproduce it now. It's a conflict not between sessions, but between several executions of the stored procedures. It's easily repeatable in a single session:
It used to be an upstream bug, fixed in 5.6.6 by the following revision:
| |||||||||||||||||||||||||||
| Comment by Leo Kwan [ 2015-01-10 ] | |||||||||||||||||||||||||||
|
Thank you so much on spending time to reproduce this issue and find the root cause. Since there will be relatively long time before 10.1 become production ready. Are there any work around available on this issue so the server may not generate error or random crash? Thanks. | |||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2015-01-10 ] | |||||||||||||||||||||||||||
|
There are no crashes, as far as I understand, aren't there? | |||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2015-01-10 ] | |||||||||||||||||||||||||||
|
Okay, I will do a simple workaround for 5.5 and 10.0 branches. | |||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2015-01-10 ] | |||||||||||||||||||||||||||
I didn't observe any crashes while experimenting with it. |