Adding a new statement into scripts/sys_schema/before_setup.sql:
ALTER DATABASE sys CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci;
to fix db.opt in case:
- the database `sys` was altered to unexpected CHARACTER SET or COLLATE values
- or db.opt was erroneously removed
to make sure that sys objects are always recreated using utf8mb3_general_ci.
This is a follow-up for the initial MDEV-24486 commit. It renames
the view sys.table_privileges to sys.privileges_by_table_by_level
and adds some more tests displaying privilege levels GLOBAL and SCHEMA
The existing INFORMATION_SCHEMA.TABLE_PRIVILEGES displays only those
privileges that were specifically granted on the table level,
whereas it may be useful to see privileges granted at the database
and global level.
This commit adds a new view `table_privileges` to the `sys` schema
for that purpose. The view shows privileges on existing tables
and views, combining all possible levels:
- user_privileges
- schema_privileges
- table_privileges
* IS_USER_TEMP_TABLE() was misleading, name didn't match the code
* list of temp tables was rescanned number_of_databases times
* some temporary tables were not shown (from nonexistent databases)
* some temporary tables were shown more than once (e.g. after self-joins)
* sys.table_exists() - avoid querying I_S twice
* fix handling of temporary MERGE tables - it's pointless to fully open
them, they're not in thd->temporary_tables, so they simply fail to
open and are skipped. Relax the assertion instead.
- MDEV-28342 raised the error in case temporary table shadows base table
- Now we are allowed to shadow base tables with temporary tables and
`sys.create_synonym_db()` can easily check for existance of temporary table and
ignore view creation, since it is not supported to create view from
temporary table.
Reviewed-by: <monty@mariadb.org>,
<vicentiu@mariadb.org>
This commit updates sysschema to work with the new behaviour of show
tables and information_schema.tables table showing temporary tables for
current connection.
Co-authored-by: Monty <monty@mariadb.org>
Reviewer: <vicentiu@mariadb.org>
These are mainly internal files so is a low impact change.
The few scripts/mysql*sql where renames to mariadb_* prefix
on the name.
mysql-test renamed to mariadb-test in the final packages
* it isn't "pfs" function, don't call it Item_func_pfs,
don't use item_pfsfunc.*
* tests don't depend on performance schema, put in the main suite
* inherit from Item_str_ascii_func
* use connection collation, not utf8mb3_general_ci
* set result length in fix_length_and_dec
* do not set maybe_null
* use my_snprintf() where possible
* don't set m_value.ptr on every invocation
* update sys schema to use the format_pico_time()
* len must be size_t (compilation error on Windows)
* the correct function name for double->double is fabs()
* drop volatile hack
- This commit rely on MDEV-28391
- When temporary table shadows the base table, error is raised (it can be changed if needed),
since the procedure is relying on creating the views and view cannot be created from the temporary table.
- Reviewed by: <wlad@mariadb.com>
- When arguments to the procedure contain quote in the name, procedure fails with parsing error.
The reason was because additional quoting is done when testing TEMPORARY table with the same name.
- Reviewed by: <wlad@mariadb.com>
- The problem:
==============
- Commit f7216fa63d created the check function for
default temporary storage engine and in case the SE doesn't support temporary tables
the error `ER_ILLEGAL_HA_CREATE_OPTION` is raised.
Before that commit in such cases temporary tables were created by silently substituting
default SE (RocksDB, Connect, PerfSchema) with MyISAM.
- The test `pr_diagnostics.test` was modified in that commit with raising the error,
since I didn't check the root cause of test itself.
- The solution:
===============
- This commit update the root case: procedure `ps_setup_save()` that uses temporary
tables created from performance schema tables definition using `LIKE`, what is not supported.
The suggested fix is to use InnoDB table by using `AS SELECT`.
- Note that test `pr_diagnostics` will raise this error for `medium/full` third argument,
but not for `current` value of third argument.
- Additionally this patch updates the test case of commit f7216fa, by adding missing relation
between temporary tables and Performance schema in `perfschema.misc` test.
- Reviewed by: <wlad@mariadb.com>
In the case of a crash directly after a creation of an Aria table,
Aria recovery would think that the table was from another system and
require a repair of the table and inform that the table is 'zerofilled".
This would cause no harm, but was confusing to see when testing atomic
alter table.
Fixed by logging the create transaction id to the log.
Other things:
- Added "show table status from sys" to maria_empy_logs. This ensures one
does not get any zerofill warnings when sys/sys_config is used by other
tests.
- aria_chk --describe now prints a warning if the table was moved from
another system.
- Logging of truncate (maria_delete_all_rows) is changed to use the
current trid for the create table.
This is to ensure that we do not run into the same problem with truncate.
- Changed back sys_config table to Aria as this patch should fix the
"zerofill" problem in buildbot.
- Added scripts/mysql_sys_schema.sql to .gitignore
- Innodb is not always available, which means t is not always
possible to use innodb system variables, or innodb information schema
tables.
Thus creation of objects that use Innodb information_schema is enclosed
into BEGIN NOT ATOMIC blocks with dummy SQLEXCEPTION handler.
- sys_config table uses Aria, just like other system tables.
- several tables that exist in MySQL, do not exist in MariaDB
performance_schema.replication_applier_status, mysql.slave_master_info,
mysql.slave_relay_log_info