Bug #30484: Partitions: crash with self-referencing trigger

Two cases in ha_partition::extra() was missing
(HA_EXTRA_DELETE_CANNOT_BATCH and HA_EXTRA_UPDATE_CANNOT_BATCH)
which only is currently used by NDB (which not uses ha_partition)
parent 0a81f49b
...@@ -1259,6 +1259,10 @@ INSERT INTO t1 SELECT a + 8, b FROM t1; ...@@ -1259,6 +1259,10 @@ INSERT INTO t1 SELECT a + 8, b FROM t1;
ALTER TABLE t1 ADD PARTITION (PARTITION p1 VALUES LESS THAN (64)); ALTER TABLE t1 ADD PARTITION (PARTITION p1 VALUES LESS THAN (64));
ALTER TABLE t1 DROP PARTITION p1; ALTER TABLE t1 DROP PARTITION p1;
DROP TABLE t1; DROP TABLE t1;
create table t (s1 int) engine=myisam partition by key (s1);
create trigger t_ad after delete on t for each row insert into t values (old.s1);
insert into t values (1);
drop table t;
USE mysql; USE mysql;
SET GLOBAL general_log = 0; SET GLOBAL general_log = 0;
ALTER TABLE general_log ENGINE = MyISAM; ALTER TABLE general_log ENGINE = MyISAM;
......
...@@ -1480,6 +1480,15 @@ ALTER TABLE t1 DROP PARTITION p1; ...@@ -1480,6 +1480,15 @@ ALTER TABLE t1 DROP PARTITION p1;
DROP TABLE t1; DROP TABLE t1;
#
# Bug #30484: Partitions: crash with self-referencing trigger
#
create table t (s1 int) engine=myisam partition by key (s1);
create trigger t_ad after delete on t for each row insert into t values (old.s1);
insert into t values (1);
drop table t;
# #
# Bug #27816: Log tables ran with partitions crashes the server when logging # Bug #27816: Log tables ran with partitions crashes the server when logging
# is enabled. # is enabled.
......
...@@ -4546,6 +4546,8 @@ void ha_partition::get_dynamic_partition_info(PARTITION_INFO *stat_info, ...@@ -4546,6 +4546,8 @@ void ha_partition::get_dynamic_partition_info(PARTITION_INFO *stat_info,
4) Parameters only used by temporary tables for query processing 4) Parameters only used by temporary tables for query processing
5) Parameters only used by MyISAM internally 5) Parameters only used by MyISAM internally
6) Parameters not used at all 6) Parameters not used at all
7) Parameters only used by federated tables for query processing
8) Parameters only used by NDB
The partition handler need to handle category 1), 2) and 3). The partition handler need to handle category 1), 2) and 3).
...@@ -4812,6 +4814,15 @@ void ha_partition::get_dynamic_partition_info(PARTITION_INFO *stat_info, ...@@ -4812,6 +4814,15 @@ void ha_partition::get_dynamic_partition_info(PARTITION_INFO *stat_info,
HA_EXTRA_INSERT_WITH_UPDATE: HA_EXTRA_INSERT_WITH_UPDATE:
Inform handler that an "INSERT...ON DUPLICATE KEY UPDATE" will be Inform handler that an "INSERT...ON DUPLICATE KEY UPDATE" will be
executed. This condition is unset by HA_EXTRA_NO_IGNORE_DUP_KEY. executed. This condition is unset by HA_EXTRA_NO_IGNORE_DUP_KEY.
8) Parameters only used by NDB
------------------------------
HA_EXTRA_DELETE_CANNOT_BATCH:
HA_EXTRA_UPDATE_CANNOT_BATCH:
Inform handler that delete_row()/update_row() cannot batch deletes/updates
and should perform them immediately. This may be needed when table has
AFTER DELETE/UPDATE triggers which access to subject table.
These flags are reset by the handler::extra(HA_EXTRA_RESET) call.
*/ */
int ha_partition::extra(enum ha_extra_function operation) int ha_partition::extra(enum ha_extra_function operation)
...@@ -4896,6 +4907,13 @@ int ha_partition::extra(enum ha_extra_function operation) ...@@ -4896,6 +4907,13 @@ int ha_partition::extra(enum ha_extra_function operation)
/* Category 7), used by federated handlers */ /* Category 7), used by federated handlers */
case HA_EXTRA_INSERT_WITH_UPDATE: case HA_EXTRA_INSERT_WITH_UPDATE:
DBUG_RETURN(loop_extra(operation)); DBUG_RETURN(loop_extra(operation));
/* Category 8) Parameters only used by NDB */
case HA_EXTRA_DELETE_CANNOT_BATCH:
case HA_EXTRA_UPDATE_CANNOT_BATCH:
{
/* Currently only NDB use the *_CANNOT_BATCH */
break;
}
default: default:
{ {
/* Temporary crash to discover what is wrong */ /* Temporary crash to discover what is wrong */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment