Skip to content

Commit

Permalink
MDEV-5800 InnoDB support for indexed vcols
Browse files Browse the repository at this point in the history
  * 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
  • Loading branch information
vuvova committed Dec 12, 2016
1 parent 7fca91f commit 1cae1af
Show file tree
Hide file tree
Showing 65 changed files with 7,371 additions and 1,110 deletions.
8 changes: 8 additions & 0 deletions mysql-test/include/have_innodb.combinations
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ innodb-locks
innodb-buffer-pool-stats
innodb-buffer-page
innodb-buffer-page-lru
innodb-sys-columns
innodb-sys-fields
innodb-sys-foreign
innodb-sys-foreign-cols
innodb-sys-indexes
innodb-sys-tables
innodb-sys-virtual
innodb-metrics

[xtradb_plugin]
Expand Down Expand Up @@ -54,6 +58,10 @@ innodb-metrics
innodb-buffer-pool-stats
innodb-buffer-page
innodb-buffer-page-lru
innodb-sys-columns
innodb-sys-fields
innodb-sys-foreign
innodb-sys-foreign-cols
innodb-sys-indexes
innodb-sys-tables
innodb-sys-virtual
2 changes: 1 addition & 1 deletion mysql-test/suite/gcol/inc/gcol_column_def_options.inc
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ ALTER TABLE t CHANGE c c varchar(10) as ('a');
ALTER TABLE t CHANGE dd d varchar(10);
if ($support_virtual_index)
{

# no RENAME INDEX yet
#ALTER TABLE t ADD INDEX idx(a), ADD INDEX idx1(c);
#ALTER TABLE t RENAME INDEX idx TO idx2, RENAME INDEX idx1 TO idx3;
#ALTER TABLE t DROP INDEX idx2, DROP INDEX idx3;
Expand Down
53 changes: 53 additions & 0 deletions mysql-test/suite/gcol/inc/innodb_v_large_col.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
--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;
Loading

0 comments on commit 1cae1af

Please sign in to comment.