Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
276d3dd2
Commit
276d3dd2
authored
Jul 31, 2009
by
Ignacio Galarza
Browse files
Options
Browse Files
Download
Plain Diff
Auto-merge
parents
008dd95f
e26350e0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
94 additions
and
1 deletion
+94
-1
mysql-test/r/partition.result
mysql-test/r/partition.result
+34
-0
mysql-test/t/partition.test
mysql-test/t/partition.test
+47
-0
sql/ha_partition.cc
sql/ha_partition.cc
+7
-0
sql/sql_partition.cc
sql/sql_partition.cc
+6
-1
No files found.
mysql-test/r/partition.result
View file @
276d3dd2
...
...
@@ -1997,5 +1997,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;
mysql-test/t/partition.test
View file @
276d3dd2
...
...
@@ -1998,6 +1998,53 @@ CREATE TABLE t1(id INT,KEY(id)) ENGINE=MYISAM
DROP
TABLE
t1
;
SET
SESSION
SQL_MODE
=
DEFAULT
;
--
echo
--
echo
Bug
#40281: partitioning the general log table crashes the server
--
echo
--
echo
---
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
;
--
echo
---
do
some
things
to
be
logged
to
partitioned
log
,
should
fail
USE
/* 1 */
test
;
CREATE
TABLE
t1
(
i
INT
);
connect
(
master
,
127.0
.
0.1
,
root
,,
test
,
$MASTER_MYPORT
,);
connection
master
;
INSERT
INTO
t1
VALUES
(
1
);
SELECT
*
FROM
t1
;
disconnect
master
;
connection
default
;
USE
mysql
;
SET
GLOBAL
general_log
=
0
;
ALTER
TABLE
general_log
RENAME
TO
gl_partitioned
;
ALTER
TABLE
gl_nonpartitioned
RENAME
TO
general_log
;
--
echo
---
show
whether
we
actually
logged
anything
(
no
)
to
general_log
SELECT
COUNT
(
argument
)
FROM
gl_partitioned
;
DROP
TABLE
gl_partitioned
;
SET
GLOBAL
log_output
=@
old_glo
;
SET
GLOBAL
general_log
=
1
;
USE
/* 2 */
test
;
DROP
TABLE
t1
;
--
echo
End
of
5.1
tests
SET
@@
global
.
general_log
=
@
old_general_log
;
sql/ha_partition.cc
View file @
276d3dd2
...
...
@@ -5414,6 +5414,13 @@ int ha_partition::extra(enum ha_extra_function operation)
/* Currently only NDB use the *_CANNOT_BATCH */
break
;
}
/*
http://dev.mysql.com/doc/refman/5.1/en/partitioning-limitations.html
says we no longer support logging to partitioned tables, so we fail
here.
*/
case
HA_EXTRA_MARK_AS_LOG_TABLE
:
DBUG_RETURN
(
ER_UNSUPORTED_LOG_ENGINE
);
default:
{
/* Temporary crash to discover what is wrong */
...
...
sql/sql_partition.cc
View file @
276d3dd2
...
...
@@ -3824,8 +3824,13 @@ bool mysql_unpack_partition(THD *thd,
Item_field objects.
This is not a nice solution since if the parser uses current_select
for anything else it will corrupt the current LEX object.
Also, we need to make sure there even is a select -- if the statement
was a "USE ...", current_select will be NULL, but we may still end up
here if we try to log to a partitioned table. This is currently
unsupported, but should still fail rather than crash!
*/
thd
->
lex
->
current_select
=
old_lex
->
current_select
;
if
(
!
(
thd
->
lex
->
current_select
=
old_lex
->
current_select
))
goto
end
;
/*
All Items created is put into a free list on the THD object. This list
is used to free all Item objects after completing a query. We don't
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment