1
0
mirror of https://github.com/MariaDB/server.git synced 2025-06-01 19:42:01 +03:00
mariadb/mysql-test/suite/encryption/t/innodb-spatial-index.test
Marko Mäkelä 2fb31821de MDEV-11984 Avoid accessing SYS_TABLESPACES unnecessarily
The following INFORMATION_SCHEMA views were unnecessarily retrieving
the data from the SYS_TABLESPACES table instead of directly fetching
it from the fil_system cache:

information_schema.innodb_tablespaces_encryption
information_schema.innodb_tablespaces_scrubbing

InnoDB always loads all tablespace metadata into memory at startup
and never evicts it while the tablespace exists.

With this fix, accessing these views will be much faster and use less
memory, and include data about all tablespaces, including undo
tablespaces.

The view information_schema.innodb_sys_tablespaces will still reflect
the contents of the SYS_TABLESPACES table.
2018-03-22 18:01:29 +02:00

78 lines
2.8 KiB
Plaintext

--source include/have_innodb.inc
--source include/have_file_key_management_plugin.inc
#
# MDEV-11974: MariaDB 10.2 encryption does not support spatial indexes
#
#
# (1) Do not allow creating table with ENCRYPTED=YES
#
#
--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
--error ER_CANT_CREATE_TABLE
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT,
c VARCHAR(256), coordinate POINT NOT NULL, SPATIAL index(coordinate)) ENGINE=INNODB
ENCRYPTED=YES;
#
# (2) Alter table
#
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT,
c VARCHAR(256), coordinate POINT NOT NULL, SPATIAL index(coordinate)) ENGINE=INNODB;
--error ER_ILLEGAL_HA_CREATE_OPTION
ALTER TABLE t1 ENCRYPTED=YES;
DROP TABLE t1;
#
# Index creation
#
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT,
c VARCHAR(256), coordinate POINT NOT NULL) ENCRYPTED=YES ENGINE=INNODB;
# FIXME: MDEV-13851 Encrypted table refuses some form of ALGORITHM=COPY,
# but allows rebuild by FORCE
--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
--error ER_CANT_CREATE_TABLE
ALTER TABLE t1 ADD SPATIAL INDEX b(coordinate), ALGORITHM=COPY;
--error ER_ILLEGAL_HA_CREATE_OPTION
ALTER TABLE t1 ADD SPATIAL INDEX b(coordinate), FORCE, ALGORITHM=INPLACE;
--error ER_ILLEGAL_HA_CREATE_OPTION
ALTER TABLE t1 ADD SPATIAL INDEX(coordinate);
--error ER_ILLEGAL_HA_CREATE_OPTION
CREATE SPATIAL INDEX b on t1(coordinate);
DROP TABLE t1;
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT,
c VARCHAR(256), coordinate POINT NOT NULL) ENCRYPTED=DEFAULT ENGINE=INNODB;
CREATE SPATIAL INDEX b on t1(coordinate);
INSERT INTO t1 values(1, 'secret', ST_GeomFromText('POINT(903994614 180726515)'));
ALTER TABLE t1 DROP INDEX b;
INSERT INTO t1 values(2, 'secret', ST_GeomFromText('POINT(903994614 180726515)'));
ALTER TABLE t1 ADD SPATIAL INDEX b(coordinate);
INSERT INTO t1 values(3, 'secret', ST_GeomFromText('POINT(903994614 180726515)'));
DROP TABLE t1;
#
# (3) Default encryption should still work
#
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT,
c VARCHAR(256), coordinate POINT NOT NULL, SPATIAL index(coordinate)) ENGINE=INNODB;
CREATE TABLE t2 (pk INT PRIMARY KEY AUTO_INCREMENT,
c VARCHAR(256), coordinate POINT NOT NULL, SPATIAL index(coordinate)) ENGINE=INNODB PAGE_COMPRESSED=YES;
INSERT INTO t1 values(1, 'secret', ST_GeomFromText('POINT(903994614 180726515)'));
INSERT INTO t2 values(1, 'secret', ST_GeomFromText('POINT(903994614 180726515)'));
--let $wait_timeout=600
--let $wait_condition=SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
--source include/wait_condition.inc
--echo # Success!
--sorted_result
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION > 0;
--sorted_result
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
DROP TABLE t1, t2;