diff options
author | Michael Widenius <monty@askmonty.org> | 2014-01-25 15:41:08 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2014-01-25 15:41:08 +0200 |
commit | 3d67c68ad1219fff48a341f2197709bbca14f84f (patch) | |
tree | 75c8d51d9083e6f825dc020c37c2050661c0d4ec /mysql-test/suite/maria | |
parent | 0ad8eaeb56a049df2947516d3d7ec49301d8d09d (diff) | |
download | mariadb-git-3d67c68ad1219fff48a341f2197709bbca14f84f.tar.gz |
Fixed MDEV-4970: Wrong result with Aria table populated with disabled keys
Problem was that ALTER TABLE DISABLE KEYS incremented create_trid for the table,
which made the new index entries invisible until the global trid catched up.
Fixed by only updating create_trid if we are rewriting all rows and indexes.
mysql-test/suite/maria/alter.result:
Added test case
mysql-test/suite/maria/alter.test:
Added test case
storage/maria/ha_maria.cc:
Only updating create_trid if we are doing a full repair (and thus rewriting all rows and indexes).
storage/maria/trnman.c:
More DBUG_PRINT
Diffstat (limited to 'mysql-test/suite/maria')
-rw-r--r-- | mysql-test/suite/maria/alter.result | 33 | ||||
-rw-r--r-- | mysql-test/suite/maria/alter.test | 27 |
2 files changed, 60 insertions, 0 deletions
diff --git a/mysql-test/suite/maria/alter.result b/mysql-test/suite/maria/alter.result new file mode 100644 index 00000000000..65e4cb74819 --- /dev/null +++ b/mysql-test/suite/maria/alter.result @@ -0,0 +1,33 @@ +drop table if exists t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE t1 (pk INT, d DATETIME, PRIMARY KEY(pk), KEY(d)) ENGINE=Aria; +ALTER TABLE t1 DISABLE KEYS; +INSERT INTO t1 VALUES (1,'2000-01-01 22:22:22'),(2,'2012-12-21 12:12:12'); +INSERT INTO t1 VALUES (3, '2008-07-24'); +ALTER TABLE t1 ENABLE KEYS; +SELECT t1a.pk FROM t1 AS t1a LEFT JOIN t1 AS t1b ON t1a.pk = t1b.pk; +pk +1 +2 +3 +SELECT * FROM t1 AS t1a LEFT JOIN t1 AS t1b ON t1a.pk = t1b.pk; +pk d pk d +1 2000-01-01 22:22:22 1 2000-01-01 22:22:22 +2 2012-12-21 12:12:12 2 2012-12-21 12:12:12 +3 2008-07-24 00:00:00 3 2008-07-24 00:00:00 +DROP TABLE t1; +CREATE TABLE t1 (pk INT PRIMARY KEY, i INT, KEY(i)) ENGINE=Aria; +ALTER TABLE t1 DISABLE KEYS; +INSERT INTO t1 VALUES (1,11); +INSERT INTO t1 VALUES (2,0),(3,33),(4,0),(5,55),(6,66),(7,0),(8,88),(9,99); +ALTER TABLE t1 ENABLE KEYS; +SELECT * FROM t1 WHERE i = 0 OR pk BETWEEN 6 AND 10; +pk i +2 0 +4 0 +6 66 +7 0 +8 88 +9 99 +DROP TABLE t1; diff --git a/mysql-test/suite/maria/alter.test b/mysql-test/suite/maria/alter.test new file mode 100644 index 00000000000..abca4865688 --- /dev/null +++ b/mysql-test/suite/maria/alter.test @@ -0,0 +1,27 @@ +# Testing of potential problems in Aria and alter table + +-- source include/have_maria.inc + +drop table if exists t1; + +# +# MDEV-4970 Wrong result with Aria table populated with disabled keys +# + +CREATE TABLE t1 (pk INT, d DATETIME, PRIMARY KEY(pk), KEY(d)) ENGINE=Aria; +ALTER TABLE t1 DISABLE KEYS; +INSERT INTO t1 VALUES (1,'2000-01-01 22:22:22'),(2,'2012-12-21 12:12:12'); +INSERT INTO t1 VALUES (3, '2008-07-24'); +ALTER TABLE t1 ENABLE KEYS; + +SELECT t1a.pk FROM t1 AS t1a LEFT JOIN t1 AS t1b ON t1a.pk = t1b.pk; +SELECT * FROM t1 AS t1a LEFT JOIN t1 AS t1b ON t1a.pk = t1b.pk; +DROP TABLE t1; + +CREATE TABLE t1 (pk INT PRIMARY KEY, i INT, KEY(i)) ENGINE=Aria; +ALTER TABLE t1 DISABLE KEYS; +INSERT INTO t1 VALUES (1,11); +INSERT INTO t1 VALUES (2,0),(3,33),(4,0),(5,55),(6,66),(7,0),(8,88),(9,99); +ALTER TABLE t1 ENABLE KEYS; +SELECT * FROM t1 WHERE i = 0 OR pk BETWEEN 6 AND 10; +DROP TABLE t1; |