[MDEV-13015] After restart, InnoDB wrongly thinks that a SEQUENCE is a TABLE Created: 2017-06-06 Updated: 2018-01-15 Resolved: 2017-06-15 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Sequences, Storage Engine - InnoDB |
| Affects Version/s: | 10.3 |
| Fix Version/s: | 10.3.1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Elena Stepanova | Assignee: | Marko Mäkelä |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||||||
| Description |
|
Also reproducible on bb-10.2-ext 3d428e017dbc. |
| Comments |
| Comment by Marko Mäkelä [ 2017-06-07 ] | |||||||||||||||||||||||||
|
The problem is that InnoDB is not storing the NO_ROLLBACK flag to SYS_TABLES.TYPE. This is because dict_sys_tables_type_to_tf() and dict_tf_to_sys_tables_type() are clearing all flags except the following:
In addition to the NO_ROLLBACK flag that was introduced in The PAGE_ENCRYPTION flags are not being written to SYS_TABLES.TYPE in MariaDB 10.1 either. It looks like these flags should be removed or moved to DICT_TF2 or directly to a bitfield of dict_table_t. So, to fix this bug properly, we need to refactor the flags a bit, to ensure that backward and forward compatibility with regard to SYS_TABLES.TYPE is guaranteed. With this quick&dirty fix the test case passes:
| |||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2017-06-07 ] | |||||||||||||||||||||||||
|
Pushed to bb-10.3-marko. I would backport the removal of the flags also to 10.2 in order to clean up the code there already. Also, 10.2 should prevent access to SEQUENCEs. | |||||||||||||||||||||||||
| Comment by Jan Lindström (Inactive) [ 2017-06-08 ] | |||||||||||||||||||||||||
|
ok to push. | |||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2017-06-08 ] | |||||||||||||||||||||||||
|
Thanks! There was an inconsistency in the patch. I revised it with the introduction of DICT_TF_MASK_NO_ROLLBACK. I will push the applicable parts of it already to 10.2 along with a test that edits some flags in SYS_TABLES.TYPE while the server is offline. | |||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2017-06-12 ] | |||||||||||||||||||||||||
|
There is a further compatibility problem: In MariaDB 10.2.2 (with the merge of MySQL 5.7.9), the SYS_TABLES.TYPE was made incompatible with MariaDB 10.1. MySQL 5.7 introduced the SHARED_SPACE flag for indicating that a table uses an explicit TABLESPACE attribute. MariaDB 10.2 does not support CREATE TABLESPACE for InnoDB tables. In the above-mentioned commit, the existing MariaDB fields PAGE_COMPRESSION, PAGE_COMPRESSION_LEVEL, ATOMIC_WRITES were shifted by 1, making the flags incompatible with 10.1 and earlier versions. The proper fix seems to be to remove the SHARED_SPACE flag from 10.2 and 10.3, and to move PAGE_COMPRESSION, PAGE_COMPRESSION_LEVEL, ATOMIC_WRITES to their original position. Unfortunately this may mean that if any tables were created with the page_compression flag in the 10.2.6 GA release, those tables will be unreadable by other versions of MariaDB. Import/export is not affected, because these flags are only persisted in SYS_TABLES.TYPE, which resides in the InnoDB system tablespace. | |||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2017-06-15 ] | |||||||||||||||||||||||||
|
Finally, I fixed this together with the merge of |