[MDEV-7363] bulk engine-independent index stats manipulation restricted due to ER_WRONG_LOCK_OF_SYSTEM_TABLE Created: 2014-12-23 Updated: 2022-09-12 Resolved: 2022-09-12 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | OTHER |
| Affects Version/s: | 10.0 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Minor |
| Reporter: | Daniel Black | Assignee: | Sergei Petrunia |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | eits | ||
| Issue Links: |
|
||||||||||||||||
| Description |
|
I've been trying to get engine-independent-index-stats from an inactive server to an active server. ANALYZE TABLE is a little to invasive to do on a production server so running it on an offline slave is desirable. ANALYZE LOCAL TABLE is desirable to run on an inactive master in a master<->master (both replicating off each other) set up so the ANALYZE TABLE doesn't hit the active master. It does however not replicate any of the mysql. {table|column|index}_stats updates either which would be quite useful as an option (and the flush tables {table|column|index}_stats) . With what we have right now this leads to the case where engine independent index stats can be generated with mysqlanalyze --skip-write-binlog --all-databases (effectively SQL_LOG_BIN=0). If it was an inactive master we could replicate it using:
So the 1428 ER_WRONG_LOCK_OF_SYSTEM_TABLE error occurs as a result of locking a system and non-system table at the same time. Most other SQL variants of the same things resulted in the same error. While the page suggests that editing statistics is possible https://mariadb.com/kb/en/mariadb/documentation/optimization-and-tuning/query-optimizations/statistics-for-optimizing-queries/engine-independent-table-statistics/ it would be useful if some editing beyond manual row(s) at a time was possible. I even considered doing this on a slave to allow a forced connection to the master where it could be pushed up, however I failed on the (previously) undocumented limitations of the connect engine.
Which leads me to the only single table solution I could think of:
The engine-independent stats tables where explicitly set to TABLE_CATEGORY_SYSTEM in sql/table.cc:is_system_table_name however the innodb ones where not. Is there a need for this to occur? Is the sql/lock.cc:lock_tables_check returning ER_WRONG_LOCK_OF_SYSTEM_TABLE still a valid thing to do? Regardless of the reason, bulk manipulation of engine-independent index statistics is limited by this error. |
| Comments |
| Comment by Elena Stepanova [ 2015-11-01 ] | ||||||||||||||||||||||||||
|
I'm not exactly sure what is the bug here, but the behavior is certainly as described, thus confirming. | ||||||||||||||||||||||||||
| Comment by Daniel Black [ 2015-11-02 ] | ||||||||||||||||||||||||||
|
the bug/misunderstanding is why does TABLE_CATEGORY_SYSTEM exist on engine independent statistics tables The table.h definition is:
If engine independent stats are documented to be user editable is this category applicable? | ||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2015-12-04 ] | ||||||||||||||||||||||||||
|
Confirm. Attempting to insert data by first putting it into a temporary table doesn't work either (it produces the same error). Besides LOAD DATA, one can use an SP:
| ||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2015-12-04 ] | ||||||||||||||||||||||||||
|
But not all tables in mysql.* are system tables. table.cc: is_system_table_name() says that these tables are system:
why mysql.proc is a system table while mysql.func is not? No idea, will discuss this on the next optimizer call. Checked is_system_table_name | ||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2022-09-12 ] | ||||||||||||||||||||||||||
|
10.0 was EOLed in March 2019 |