[MDEV-24545] Sequence created by one connection remains invisible to another Created: 2021-01-07 Updated: 2021-04-27 Resolved: 2021-04-27 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Sequences, Storage Engine - InnoDB |
| Affects Version/s: | 10.3, 10.4, 10.5 |
| Fix Version/s: | 10.3.29, 10.4.19, 10.5.10, 10.6.1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Elena Stepanova | Assignee: | Marko Mäkelä |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
In the test case above, connection default throws ER_NO_SUCH_TABLE upon NEXTVAL(s1) twice. The first time is a relatively minor offence. The connection is inside a transaction (with the default transaction isolation level) when the sequence s1 is created by another connection, and is still within the same transaction when it runs NEXTVAL(s1); if it were not a sequence but a select from a normal table, it would have failed anyway, only with ER_TABLE_DEF_CHANGED instead. But then, the transaction is committed, the sequence should become visible and readable from, but it is not, it still causes ER_NO_SUCH_TABLE. That's a real problem.
The important part in the test case is FLUSH TABLES issued after CREATE SEQUENCE. Without it, everything works as expected – inside the transaction NEXTVAL causes ER_TABLE_DEF_CHANGED, and outside the transaction it works. |
| Comments |
| Comment by Anel Husakovic [ 2021-01-07 ] | ||||||||||||||||||||||||||||
|
maybe related to MDEV-23831 ? | ||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2021-01-07 ] | ||||||||||||||||||||||||||||
|
Here is another representation of the described problem.
RENAME TABLE here, contrary to NEXTVAL in the initial test case, causes ER_TABLE_EXISTS_ERROR which seems to be reasonable.
| ||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2021-01-07 ] | ||||||||||||||||||||||||||||
|
And now after this commit
the RENAME above causes the added assertion failure. I don't consider it a regression since the underlying problem obviously existed before.
| ||||||||||||||||||||||||||||
| Comment by Michael Widenius [ 2021-04-06 ] | ||||||||||||||||||||||||||||
|
This is what happens in the code for SELECT NEXTVAL(s1);
| ||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2021-04-26 ] | ||||||||||||||||||||||||||||
|
This seems to fix the problem for me:
|