mariadb/mysql-test/suite/gcol/inc/innodb_v_large_col.inc
Sergei Golubchik 1cae1af6f9 MDEV-5800 InnoDB support for indexed vcols
* remove old 5.2+ InnoDB support for virtual columns
  * enable corresponding parts of the innodb-5.7 sources
  * copy corresponding test cases from 5.7
  * copy detailed Alter_inplace_info::HA_ALTER_FLAGS flags from 5.7
     - and more detailed detection of changes in fill_alter_inplace_info()
  * more "innodb compatibility hooks" in sql_class.cc to
     - create/destroy/reset a THD (used by background purge threads)
     - find a prelocked table by name
     - open a table (from a background purge thread)

  * different from 5.7:
    - new service thread "thd_destructor_proxy" to make sure all THDs are
      destroyed at the correct point in time during the server shutdown
    - proper opening/closing of tables for vcol evaluations in
       + FK checks (use already opened prelocked tables)
       + purge threads (open the table, MDLock it, add it to tdc, close
         when not needed)
    - cache open tables in vc_templ
    - avoid unnecessary allocations, reuse table->record[0] and table->s->default_values
    - not needed in 5.7, because it overcalculates:
      + tell the server to calculate vcols for an on-going inline ADD INDEX
      + calculate vcols for correct error messages

  * update other engines (mroonga/tokudb) accordingly
2016-12-12 20:27:42 +01:00

53 lines
1.5 KiB
SQL

--source include/have_innodb.inc
eval CREATE TABLE `t` (
`a` VARCHAR(10000), `b` VARCHAR(3000),
`c` VARCHAR(14000) GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL,
`d` VARCHAR(5000) GENERATED ALWAYS AS (b) VIRTUAL,
`e` INT(11) GENERATED ALWAYS AS (10) VIRTUAL,
`h` INT(11) NOT NULL,
PRIMARY KEY (`h`) ) ROW_FORMAT=$row_format ENGINE=InnoDB;
SHOW CREATE TABLE t;
INSERT INTO t VALUES (REPEAT('g', 10000), REPEAT('x', 2800), DEFAULT, DEFAULT, DEFAULT, 1);
INSERT INTO t VALUES (REPEAT('a', 9000), REPEAT('b', 2000), DEFAULT, DEFAULT, DEFAULT, 2);
INSERT INTO t VALUES (REPEAT('m', 8000), REPEAT('n', 3000), DEFAULT, DEFAULT, DEFAULT, 3);
CREATE INDEX idx ON t(c(100), d(20));
UPDATE t SET a = REPEAT(CAST(1 AS CHAR), 2000) WHERE h = 1;
delimiter |;
CREATE PROCEDURE UPDATE_t()
begin
DECLARE i INT DEFAULT 1;
WHILE (i <= 100) DO
UPDATE t SET a = REPEAT(CAST(i AS CHAR), 2000) WHERE h = 1;
SET i = i + 1;
END WHILE;
END|
CREATE PROCEDURE DELETE_insert_t()
begin
DECLARE i INT DEFAULT 1;
WHILE (i <= 100) DO
DELETE FROM t WHERE h = 1;
INSERT INTO t VALUES (REPEAT(CAST(i AS CHAR), 2000) , REPEAT('b', 2000), DEFAULT, DEFAULT, DEFAULT, 1);
SET i = i + 1;
END WHILE;
END|
delimiter ;|
CALL UPDATE_t();
CALL DELETE_insert_t();
UPDATE t SET a = NULL WHERE h=1;
START TRANSACTION;
CALL UPDATE_t();
ROLLBACK;
DROP PROCEDURE DELETE_insert_t;
DROP PROCEDURE UPDATE_t;
DROP TABLE t;