Skip to content

Commit

Permalink
MDEV-20207: Assertion ! is_set() failed in Diagnostics_area::set_eof_…
Browse files Browse the repository at this point in the history
…status

upon HANDLER READ

Analysis: The error state is not stored while checking condition and key
name.
Fix: Return true while checking condition and key name if error is reported
because geometry object can't be created from the data in the index value
for HANDLER READ.
  • Loading branch information
mariadb-RuchaDeodhar committed Apr 26, 2022
1 parent 25ccf8f commit 9b2d366
Show file tree
Hide file tree
Showing 9 changed files with 145 additions and 1 deletion.
16 changes: 16 additions & 0 deletions mysql-test/suite/handler/aria.result
Original file line number Diff line number Diff line change
Expand Up @@ -1845,3 +1845,19 @@ a b
HANDLER t1 CLOSE;
DROP TABLE t1;
End of 5.1 tests
#
# 10.2 Test
#
# MDEV-20207: Assertion `! is_set()' failed in
# Diagnostics_area::set_eof_status upon HANDLER READ
#
DROP TABLE IF EXISTS t1;
Warnings:
Note 1051 Unknown table 'test.t1'
CREATE TABLE t1 (a POINT, KEY(a));
HANDLER t1 OPEN h;
HANDLER h READ a = (0);
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
HANDLER h CLOSE;
DROP TABLE t1;
# End of 10.2 Test
20 changes: 20 additions & 0 deletions mysql-test/suite/handler/aria.test
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,23 @@ HANDLER t1 CLOSE;
DROP TABLE t1;

--echo End of 5.1 tests

--echo #
--echo # 10.2 Test
--echo #
--echo # MDEV-20207: Assertion `! is_set()' failed in
--echo # Diagnostics_area::set_eof_status upon HANDLER READ
--echo #

DROP TABLE IF EXISTS t1;

CREATE TABLE t1 (a POINT, KEY(a));
HANDLER t1 OPEN h;

--error ER_CANT_CREATE_GEOMETRY_OBJECT
HANDLER h READ a = (0);

HANDLER h CLOSE;
DROP TABLE t1;

--echo # End of 10.2 Test
16 changes: 16 additions & 0 deletions mysql-test/suite/handler/innodb.result
Original file line number Diff line number Diff line change
Expand Up @@ -1748,3 +1748,19 @@ HANDLER t1 READ `PRIMARY` PREV;
f1 f2
3 3
DROP TABLE t1;
#
# 10.2 Test
#
# MDEV-20207: Assertion `! is_set()' failed in
# Diagnostics_area::set_eof_status upon HANDLER READ
#
DROP TABLE IF EXISTS t1;
Warnings:
Note 1051 Unknown table 'test.t1'
CREATE TABLE t1 (a POINT, KEY(a));
HANDLER t1 OPEN h;
HANDLER h READ a = (0);
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
HANDLER h CLOSE;
DROP TABLE t1;
# End of 10.2 Test
20 changes: 20 additions & 0 deletions mysql-test/suite/handler/innodb.test
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,23 @@ HANDLER t1 OPEN;
HANDLER t1 READ FIRST WHERE f2 <= 1;
HANDLER t1 READ `PRIMARY` PREV;
DROP TABLE t1;

--echo #
--echo # 10.2 Test
--echo #
--echo # MDEV-20207: Assertion `! is_set()' failed in
--echo # Diagnostics_area::set_eof_status upon HANDLER READ
--echo #

DROP TABLE IF EXISTS t1;

CREATE TABLE t1 (a POINT, KEY(a));
HANDLER t1 OPEN h;

--error ER_CANT_CREATE_GEOMETRY_OBJECT
HANDLER h READ a = (0);

HANDLER h CLOSE;
DROP TABLE t1;

--echo # End of 10.2 Test
16 changes: 16 additions & 0 deletions mysql-test/suite/handler/interface.result
Original file line number Diff line number Diff line change
Expand Up @@ -312,3 +312,19 @@ Note 1050 Table 'v' already exists
handler v read next;
ERROR 42S02: Unknown table 'v' in HANDLER
drop view v;
#
# 10.2 Test
#
# MDEV-20207: Assertion `! is_set()' failed in
# Diagnostics_area::set_eof_status upon HANDLER READ
#
DROP TABLE IF EXISTS t1;
Warnings:
Note 1051 Unknown table 'test.t1'
CREATE TABLE t1 (a POINT, KEY(a));
HANDLER t1 OPEN h;
HANDLER h READ a = (0);
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
HANDLER h CLOSE;
DROP TABLE t1;
# End of 10.2 Test
20 changes: 20 additions & 0 deletions mysql-test/suite/handler/interface.test
Original file line number Diff line number Diff line change
Expand Up @@ -354,3 +354,23 @@ execute stmt;
--error ER_UNKNOWN_TABLE
handler v read next;
drop view v;

--echo #
--echo # 10.2 Test
--echo #
--echo # MDEV-20207: Assertion `! is_set()' failed in
--echo # Diagnostics_area::set_eof_status upon HANDLER READ
--echo #

DROP TABLE IF EXISTS t1;

CREATE TABLE t1 (a POINT, KEY(a));
HANDLER t1 OPEN h;

--error ER_CANT_CREATE_GEOMETRY_OBJECT
HANDLER h READ a = (0);

HANDLER h CLOSE;
DROP TABLE t1;

--echo # End of 10.2 Test
14 changes: 14 additions & 0 deletions mysql-test/suite/handler/myisam.result
Original file line number Diff line number Diff line change
Expand Up @@ -1931,3 +1931,17 @@ test.t1 preload_keys status OK
HANDLER t1 READ FIRST;
ERROR 42S02: Unknown table 't1' in HANDLER
End of 5.1 tests
#
# 10.2 Test
#
# MDEV-20207: Assertion `! is_set()' failed in
# Diagnostics_area::set_eof_status upon HANDLER READ
#
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a POINT, KEY(a));
HANDLER t1 OPEN h;
HANDLER h READ a = (0);
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
HANDLER h CLOSE;
DROP TABLE t1;
# End of 10.2 Test
20 changes: 20 additions & 0 deletions mysql-test/suite/handler/myisam.test
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,23 @@ HANDLER t1 READ FIRST;


--echo End of 5.1 tests

--echo #
--echo # 10.2 Test
--echo #
--echo # MDEV-20207: Assertion `! is_set()' failed in
--echo # Diagnostics_area::set_eof_status upon HANDLER READ
--echo #

DROP TABLE IF EXISTS t1;

CREATE TABLE t1 (a POINT, KEY(a));
HANDLER t1 OPEN h;

--error ER_CANT_CREATE_GEOMETRY_OBJECT
HANDLER h READ a = (0);

HANDLER h CLOSE;
DROP TABLE t1;

--echo # End of 10.2 Test
4 changes: 3 additions & 1 deletion sql/sql_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -613,8 +613,10 @@ mysql_ha_fix_cond_and_key(SQL_HANDLER *handler,
if (!in_prepare)
{
MY_BITMAP *old_map= dbug_tmp_use_all_columns(table, &table->write_set);
(void) item->save_in_field(key_part->field, 1);
int res= item->save_in_field(key_part->field, 1);
dbug_tmp_restore_column_map(&table->write_set, old_map);
if (res)
return 1;
}
key_len+= key_part->store_length;
keypart_map= (keypart_map << 1) | 1;
Expand Down

0 comments on commit 9b2d366

Please sign in to comment.