diff options
author | Tatiana A. Nurnberg <azundris@mysql.com> | 2009-07-31 14:38:18 +0200 |
---|---|---|
committer | Tatiana A. Nurnberg <azundris@mysql.com> | 2009-07-31 14:38:18 +0200 |
commit | 717d6054f516baa35e14ac11f0a06c630b9e9fd9 (patch) | |
tree | 5beb5e75fef8047c3da0acfcd0d96363fc790e3e /mysql-test/r/partition.result | |
parent | ead1ce94e61b0e4436def29515c2e15c95a9b1aa (diff) | |
download | mariadb-git-717d6054f516baa35e14ac11f0a06c630b9e9fd9.tar.gz |
Bug#40281, partitioning the general log table crashes the server
We disallow the partitioning of a log table. You could however
partition a table first, and then point logging to it. This is
not only against the docs, it also crashes the server.
We catch this case now.
mysql-test/r/partition.result:
results for 40281
mysql-test/t/partition.test:
test for 40281: show that trying to log to partitioned table fails rather
to crash the server
sql/ha_partition.cc:
Signal that we no longer support logging to partitioned tables,
as per the docs.
sql/sql_partition.cc:
Some commands like "USE ..." have no select, yet we may try
to parse partition info after their execution if user set a
partitioned table as log target. This shouldn't lead to a
NULL-deref/crash.
Diffstat (limited to 'mysql-test/r/partition.result')
-rw-r--r-- | mysql-test/r/partition.result | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index 8e3fbde1ea8..068d0d2a870 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -1991,5 +1991,39 @@ CREATE TABLE t1(id INT,KEY(id)) ENGINE=MYISAM PARTITION BY HASH(id) PARTITIONS 2; DROP TABLE t1; SET SESSION SQL_MODE=DEFAULT; + +Bug#40281: partitioning the general log table crashes the server + +--- set up partitioned log, and switch to it +USE mysql; +SET GLOBAL general_log =0; +CREATE TABLE gl_partitioned LIKE general_log; +ALTER TABLE gl_partitioned ENGINE=myisam; +ALTER TABLE gl_partitioned PARTITION BY HASH (thread_id) PARTITIONS 10; +ALTER TABLE general_log RENAME TO gl_nonpartitioned; +ALTER TABLE gl_partitioned RENAME TO general_log; +SELECT @@global.log_output INTO @old_glo; +SET GLOBAL log_output='table'; +SET GLOBAL general_log =1; +--- do some things to be logged to partitioned log, should fail +USE /* 1 */ test; +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (1); +SELECT * FROM t1; +i +1 +USE mysql; +SET GLOBAL general_log =0; +ALTER TABLE general_log RENAME TO gl_partitioned; +ALTER TABLE gl_nonpartitioned RENAME TO general_log; +--- show whether we actually logged anything (no) to general_log +SELECT COUNT(argument) FROM gl_partitioned; +COUNT(argument) +0 +DROP TABLE gl_partitioned; +SET GLOBAL log_output=@old_glo; +SET GLOBAL general_log =1; +USE /* 2 */ test; +DROP TABLE t1; End of 5.1 tests SET @@global.general_log= @old_general_log; |