Skip to content

Commit ec2ff9f

Browse files
committed
MDEV-35035 Assertion failure in ha_blackhole::position upon INSERT into blackhole table with vector index
let's allow ::position() and ::rnd_pos() in blackhole. ::position() can be called directly after insert, it doesn't need a search to happen, so it's possible. ::rnd_pos() can be called with a value that ::position() produced, so, possible too.
1 parent b44cde1 commit ec2ff9f

File tree

3 files changed

+36
-15
lines changed

3 files changed

+36
-15
lines changed

mysql-test/main/blackhole.result

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,38 @@ CREATE TABLE t2 (a INT UNSIGNED, b INT, UNIQUE KEY (a, b)) ENGINE=BLACKHOLE;
88
SELECT 1 FROM t1 WHERE a = ANY (SELECT a FROM t2);
99
1
1010
DROP TABLE t1, t2;
11+
#
12+
# Bug#19786309 - CRASH IN UNLOCK TABLES AFTER LOCKING AND TRUNCATING TEMPORARY TABLE.
13+
#
1114
create temporary table t1 (a int) engine=blackhole;
1215
lock table t1 write;
1316
truncate table t1;
1417
select * from t1;
1518
a
1619
unlock tables;
1720
drop temporary table t1;
18-
End of 5.5 tests
21+
# End of 5.5 tests
1922
#
2023
# Bug#13948247 DIVISION BY 0 IN GET_BEST_DISJUNCT_QUICK WITH FORCE INDEX GROUP BY
2124
#
2225
CREATE TABLE t1(a INT, b INT, c INT, KEY(c), UNIQUE(a)) ENGINE = BLACKHOLE;
2326
SELECT 0 FROM t1 FORCE INDEX FOR GROUP BY(a) WHERE a = 0 OR b = 0 AND c = 0;
2427
0
2528
DROP TABLE t1;
26-
End of 5.6 tests
29+
# End of 5.6 tests
30+
#
31+
# MDEV-24017 / bug 53588 test case.
32+
#
2733
CREATE TABLE `t` (
2834
`a` varchar(3000) NOT NULL default '',
2935
PRIMARY KEY (`a`)
3036
) ENGINE=BLACKHOLE CHARSET=latin1;
3137
DROP TABLE `t`;
32-
End of 10.1 tests
38+
# End of 10.1 tests
39+
#
40+
# MDEV-35035 Assertion failure in ha_blackhole::position upon INSERT into blackhole table with vector index
41+
#
42+
create table t (a int, v blob not null, vector index (v)) engine=blackhole;
43+
insert into t values (1,x'00000000');
44+
drop table t;
45+
# End of 11.7 tests

mysql-test/main/blackhole.test

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ SELECT 1 FROM t1 WHERE a = ANY (SELECT a FROM t2);
1717

1818
DROP TABLE t1, t2;
1919

20-
#
21-
# Bug#19786309 - CRASH IN UNLOCK TABLES AFTER LOCKING AND TRUNCATING TEMPORARY TABLE.
22-
#
20+
--echo #
21+
--echo # Bug#19786309 - CRASH IN UNLOCK TABLES AFTER LOCKING AND TRUNCATING TEMPORARY TABLE.
22+
--echo #
2323
create temporary table t1 (a int) engine=blackhole;
2424
lock table t1 write;
2525
truncate table t1;
2626
select * from t1;
2727
unlock tables;
2828
drop temporary table t1;
2929

30-
--echo End of 5.5 tests
30+
--echo # End of 5.5 tests
3131

3232
--echo #
3333
--echo # Bug#13948247 DIVISION BY 0 IN GET_BEST_DISJUNCT_QUICK WITH FORCE INDEX GROUP BY
@@ -37,11 +37,11 @@ CREATE TABLE t1(a INT, b INT, c INT, KEY(c), UNIQUE(a)) ENGINE = BLACKHOLE;
3737
SELECT 0 FROM t1 FORCE INDEX FOR GROUP BY(a) WHERE a = 0 OR b = 0 AND c = 0;
3838
DROP TABLE t1;
3939

40-
--echo End of 5.6 tests
40+
--echo # End of 5.6 tests
4141

42-
#
43-
# MDEV-24017 / bug 53588 test case.
44-
#
42+
--echo #
43+
--echo # MDEV-24017 / bug 53588 test case.
44+
--echo #
4545
# Create long enough index (between 1000 and 3500). 1000 is the old value,
4646
# 3500 is innodb value (see ha_innobase::max_supported_key_length()). Without
4747
# the fix the test will fail with "Specified key was too long" error.
@@ -53,4 +53,13 @@ CREATE TABLE `t` (
5353

5454
DROP TABLE `t`;
5555

56-
--echo End of 10.1 tests
56+
--echo # End of 10.1 tests
57+
58+
--echo #
59+
--echo # MDEV-35035 Assertion failure in ha_blackhole::position upon INSERT into blackhole table with vector index
60+
--echo #
61+
create table t (a int, v blob not null, vector index (v)) engine=blackhole;
62+
insert into t values (1,x'00000000');
63+
drop table t;
64+
65+
--echo # End of 11.7 tests

storage/blackhole/ha_blackhole.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,15 +148,14 @@ int ha_blackhole::rnd_next(uchar *buf)
148148
int ha_blackhole::rnd_pos(uchar * buf, uchar *pos)
149149
{
150150
DBUG_ENTER("ha_blackhole::rnd_pos");
151-
DBUG_ASSERT(0);
152-
DBUG_RETURN(0);
151+
DBUG_RETURN(HA_ERR_END_OF_FILE);
153152
}
154153

155154

156155
void ha_blackhole::position(const uchar *record)
157156
{
158157
DBUG_ENTER("ha_blackhole::position");
159-
DBUG_ASSERT(0);
158+
bzero(ref, ref_length);
160159
DBUG_VOID_RETURN;
161160
}
162161

0 commit comments

Comments
 (0)