diff options
| author | Sergei Golubchik <serg@mariadb.org> | 2018-02-23 20:00:32 +0100 |
|---|---|---|
| committer | Sergei Golubchik <serg@mariadb.org> | 2018-02-24 01:28:51 +0100 |
| commit | 8f9c64000eef21657b97be255639912277f3b303 (patch) | |
| tree | 794f5d96b2b64ed9caa72c9ae88a01465dbb024b | |
| parent | 22073cbf3b507969eccee09cf4282aa70cd4c914 (diff) | |
| download | mariadb-git-8f9c64000eef21657b97be255639912277f3b303.tar.gz | |
MDEV-15336 Server crashes in handler::print_error / ha_partition::print_error upon query timeout
set m_last_part to something meaningful when opening partitions
| -rw-r--r-- | mysql-test/suite/parts/r/print_error.result | 18 | ||||
| -rw-r--r-- | mysql-test/suite/parts/t/print_error.test | 29 | ||||
| -rw-r--r-- | sql/ha_partition.cc | 1 |
3 files changed, 48 insertions, 0 deletions
diff --git a/mysql-test/suite/parts/r/print_error.result b/mysql-test/suite/parts/r/print_error.result new file mode 100644 index 00000000000..74a13afeb46 --- /dev/null +++ b/mysql-test/suite/parts/r/print_error.result @@ -0,0 +1,18 @@ +CREATE TABLE t1 (i INT) ENGINE=InnoDB PARTITION BY HASH (i) PARTITIONS 2; +XA START 'xid'; +INSERT INTO t1 VALUES (1),(2),(3),(4); +connect con1,localhost,root,,test; +CREATE TABLE t2 SELECT * FROM t1;; +connect con2,localhost,root,,test; +SET max_statement_time= 1; +DELETE FROM t1 PARTITION (p1) ORDER BY i LIMIT 2; +ERROR 70100: Query execution was interrupted (max_statement_time exceeded) +disconnect con2; +connection default; +XA END 'xid'; +XA ROLLBACK 'xid'; +connection con1; +disconnect con1; +connection default; +call mtr.add_suppression('Sort aborted'); +DROP TABLE IF EXISTS t2, t1; diff --git a/mysql-test/suite/parts/t/print_error.test b/mysql-test/suite/parts/t/print_error.test new file mode 100644 index 00000000000..d410cc6856e --- /dev/null +++ b/mysql-test/suite/parts/t/print_error.test @@ -0,0 +1,29 @@ +# +# MDEV-15336 Server crashes in handler::print_error / ha_partition::print_error upon query timeout +# +--source include/have_innodb.inc +--source include/have_partition.inc + +CREATE TABLE t1 (i INT) ENGINE=InnoDB PARTITION BY HASH (i) PARTITIONS 2; +XA START 'xid'; +INSERT INTO t1 VALUES (1),(2),(3),(4); + +--connect (con1,localhost,root,,test) +--send CREATE TABLE t2 SELECT * FROM t1; + +--connect (con2,localhost,root,,test) +SET max_statement_time= 1; +--error ER_STATEMENT_TIMEOUT +DELETE FROM t1 PARTITION (p1) ORDER BY i LIMIT 2; + +# Cleanup +--disconnect con2 +--connection default +XA END 'xid'; +XA ROLLBACK 'xid'; +--connection con1 +--reap +--disconnect con1 +--connection default +call mtr.add_suppression('Sort aborted'); +DROP TABLE IF EXISTS t2, t1; diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 16b5e0e4b42..76e80711a22 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -8383,6 +8383,7 @@ int ha_partition::open_read_partitions(char *name_buff, size_t name_buff_size) if (error) goto err_handler; bitmap_set_bit(&m_opened_partitions, n_file); + m_last_part= n_file; } if (!m_file_sample && should_be_open) m_file_sample= *file; |
