summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorMattias Jonsson <mattias.jonsson@sun.com>2009-10-08 15:36:43 +0200
committerMattias Jonsson <mattias.jonsson@sun.com>2009-10-08 15:36:43 +0200
commit0186334ae86380935124c4e71f5887ce6dab59e9 (patch)
tree9383b1f3b7eae01a259d67f7ed7dd0b8e5743ef8 /mysql-test
parent64badb5f269850d0111aec29788aff7e181c195d (diff)
downloadmariadb-git-0186334ae86380935124c4e71f5887ce6dab59e9.tar.gz
Bug#46922: crash when adding partitions and open_files_limit
is reached Problem was bad error handling, leaving some new temporary partitions locked and initialized and some not yet initialized and locked, leading to a crash when trying to unlock the not yet initialized and locked partitions Solution was to unlock the already locked partitions, and not include any of the new temporary partitions in later unlocks mysql-test/r/partition_open_files_limit.result: Bug#46922: crash when adding partitions and open_files_limit is reached New test result mysql-test/t/partition_open_files_limit-master.opt: Bug#46922: crash when adding partitions and open_files_limit is reached New test opt-file for testing when open_files_limit is reached mysql-test/t/partition_open_files_limit.test: Bug#46922: crash when adding partitions and open_files_limit is reached New test case testing when open_files_limit is reached sql/ha_partition.cc: Bug#46922: crash when adding partitions and open_files_limit is reached When cleaning up the partitions already locked need to be unlocked, and not be unlocked/closed after cleaning up.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/partition_open_files_limit.result22
-rw-r--r--mysql-test/t/partition_open_files_limit-master.opt1
-rw-r--r--mysql-test/t/partition_open_files_limit.test19
3 files changed, 42 insertions, 0 deletions
diff --git a/mysql-test/r/partition_open_files_limit.result b/mysql-test/r/partition_open_files_limit.result
new file mode 100644
index 00000000000..1441ba4e78e
--- /dev/null
+++ b/mysql-test/r/partition_open_files_limit.result
@@ -0,0 +1,22 @@
+DROP TABLE IF EXISTS `t1`;
+# Bug#46922: crash when adding partitions and open_files_limit is reached
+CREATE TABLE t1 (a INT PRIMARY KEY)
+ENGINE=MyISAM PARTITION BY KEY () PARTITIONS 1;
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11);
+# if the bug exists, then crash will happen here
+ALTER TABLE t1 ADD PARTITION PARTITIONS 511;
+ERROR HY000: Out of resources when opening file '<partition file>' (Errcode: 24)
+SELECT * FROM t1;
+a
+1
+10
+11
+2
+3
+4
+5
+6
+7
+8
+9
+DROP TABLE t1;
diff --git a/mysql-test/t/partition_open_files_limit-master.opt b/mysql-test/t/partition_open_files_limit-master.opt
new file mode 100644
index 00000000000..4c1ed0c3da3
--- /dev/null
+++ b/mysql-test/t/partition_open_files_limit-master.opt
@@ -0,0 +1 @@
+--open-files-limit=5 --max_connections=2 --table_open_cache=1
diff --git a/mysql-test/t/partition_open_files_limit.test b/mysql-test/t/partition_open_files_limit.test
new file mode 100644
index 00000000000..92a9b18b573
--- /dev/null
+++ b/mysql-test/t/partition_open_files_limit.test
@@ -0,0 +1,19 @@
+--source include/have_partition.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS `t1`;
+--enable_warnings
+
+#
+--echo # Bug#46922: crash when adding partitions and open_files_limit is reached
+#
+CREATE TABLE t1 (a INT PRIMARY KEY)
+ENGINE=MyISAM PARTITION BY KEY () PARTITIONS 1;
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11);
+--echo # if the bug exists, then crash will happen here
+--replace_regex /file '.*'/file '<partition file>'/
+--error 23
+ALTER TABLE t1 ADD PARTITION PARTITIONS 511;
+--sorted_result
+SELECT * FROM t1;
+DROP TABLE t1;