
BUG#11763382 Assertion 'inited==INDEX' on SELECT MAX(...)

CREATE TABLE t(i INT NOT NULL PRIMARY KEY, f INT) ENGINE = InnoDB;
INSERT INTO t VALUES (1,1),(2,2);
BEGIN;
UPDATE t SET f=100 WHERE i=2;
set optimizer_switch='semijoin=off,subquery_materialization_cost_based=off';
SET DEBUG_SYNC='before_index_end_in_subselect WAIT_FOR callit';
SELECT f FROM t WHERE i IN ( SELECT i FROM t );
SELECT MAX(i) FROM t FOR UPDATE;
SELECT MAX(i) FROM t FOR UPDATE;
SET DEBUG_SYNC='now SIGNAL callit';
COMMIT;
f
1
2
SET DEBUG_SYNC='RESET';
MAX(i)
2
MAX(i)
2
DROP TABLE t;
# End of BUG#56080
#
# Bug #13536661: VALGRIND: DEFINITELY LOST: 552 BYTES IN 1 BLOCKS IN
# CREATE_TMP_TABLE AND HIGHER
#
CREATE TABLE t1 ( a INT, b INT );
INSERT INTO t1 VALUES (4, 40), (1, 10), (2, 20), (2, 20), (3, 30);
SET debug_sync = "tmp_table_created SIGNAL parked WAIT_FOR go";
# This should not leak memory.
SELECT b, COUNT(DISTINCT b) FROM t1 GROUP BY b ORDER BY -b;
SET debug_sync = "now WAIT_FOR parked";
# Set locally to shadow the global variable.
SET debug = '';
SET GLOBAL debug = '+d,simulate_out_of_memory';
SET debug_sync = "now SIGNAL go";
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
SET GLOBAL debug = '';
DROP TABLE t1;
