Commit graph

325 commits

Author SHA1 Message Date
Alexander Nozdrin
ca08f10ccd Manual merge from mysql-trunk-merge. 2009-10-14 12:25:39 +04:00
Guilhem Bichot
528ab7bb11 Backport of the fix for BUG#33730 "Full table scan instead selected partitions for query more than 10 partitions"
from 6.0, made in sergefp@mysql.com-20090205190644-q8632sniogedhtsu
2009-10-05 22:59:19 +02:00
Mikael Ronstrom
70cb38ec82 Merge to mysql-next-mr 2009-09-28 09:39:50 +02:00
Staale Smedseng
8b9843408d Bug #43414 Parenthesis (and other) warnings compiling MySQL
with gcc 4.3.2

Cleaning up warnings not present in 5.0.
2009-09-23 15:21:29 +02:00
Mikael Ronstrom
7158ae635b Automerge 2009-09-10 11:18:50 +02:00
Mikael Ronstrom
ff1df12a20 WL#4444 Added TRUNCATE partition support, fixes bug#19405 and bug #35111 2009-09-10 11:15:39 +02:00
Mikael Ronstrom
28eb7825ef WL#4571, Enable Key cache defined for a partition to enable more scalability on partitioned MyISAM tables among other things 2009-09-10 11:14:23 +02:00
Georgi Kodinov
7d9f97f5ee fixed a valgrind warning in partitioning code 2009-09-02 15:20:47 +03:00
Mattias Jonsson
2c5e227875 Manual merge between bug#46362 and bug#20577. 2009-08-28 12:55:59 +02:00
Mattias Jonsson
401fb7c6fb Bug#20577: Partitions: use of to_days() function leads to selection failures
Problem was that the partition containing NULL values
was pruned away, since '2001-01-01' < '2001-02-00' but
TO_DAYS('2001-02-00') is NULL.

Added the NULL partition for RANGE/LIST partitioning on TO_DAYS()
function to be scanned too.

Also fixed a bug that added ALLOW_INVALID_DATES to sql_mode
(SELECT * FROM t WHERE date_col < '1999-99-99' on a RANGE/LIST
partitioned table would add it).
2009-08-26 12:59:49 +02:00
Mattias Jonsson
89b9fbd451 Bug#46478: timestamp field incorrectly defaulted
when partition is reoganized.

Problem was that table->timestamp_field_type was not changed
before copying rows between partitions.

fixed by setting it to TIMESTAMP_NO_AUTO_SET as the first thing
in fast_alter_partition_table, so that all if-branches is covered.
2009-08-06 14:28:39 +02:00
Tatiana A. Nurnberg
f6b8b9d2f8 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.
2009-07-31 14:38:18 +02:00
Georgi Kodinov
7c28ec97a9 Addendum to the fix for bug 45807 : initialize a member needed in
Item_field::fix_fields()
2009-07-08 13:12:27 +03:00
Georgi Kodinov
5572f8e7de Bug #45807: crash accessing partitioned table and sql_mode
contains ONLY_FULL_GROUP_BY

The partitioning code needs to issue a Item::fix_fields()
on the partitioning expression in order to prepare 
it for being evaluated.
It does this by creating a special table and a table list 
for the scope of the partitioning expression.
But when checking ONLY_FULL_GROUP_BY the 
Item_field::fix_fields() was relying that there always be
cached_table set and was trying to use it to get the 
select_lex of the SELECT the field's table is in.
But the cached_table was not set by the partitioning code
that creates the artificial TABLE_LIST used to resolve the
partitioning expression and this resulted in a crash.
 
Fixed by rectifying the following errors :
1. Item_field::fix_fields() : the code that check for 
ONLY_FULL_GROUP_BY relies on having tables with 
cacheable_table set. This is mostly true, the only 
two exceptions being the partitioning context table
and the trigger context table.
Fixed by taking the current parsing context if no pointer
to the TABLE_LIST instance is present in the cached_table.

2. fix_fields_part_func() : 

2a. The code that adds the table being created to the 
scope for the partitioning expression is mostly a copy 
of the add_table_to_list and friends with one exception :
it was not marking the table as cacheable (something that
normal add_table_to_list is doing). This caused the 
problem in the check for ONLY_FULL_GROUP_BY in 
Item_field::fix_fields() to appear.
Fixed by setting the correct members to make the table
cacheable.
The ideal structural fix for this is to use a unified 
interface for adding a table to a table list 
(add_table_to_list?) : noted in a TODO comment

2b. The Item::fix_fields() was called with a NULL destination
pointer. This causes uninitalized memory reads in the 
overloaded ::fix_fields() function (namely 
Item_field::fix_fields()) as it expects a non-zero pointer 
there. Fixed by passing the source pointer similarly to how 
it's done in JOIN::prepare().
2009-07-02 17:42:00 +03:00
Sergey Glukhov
c92abdc2a0 Bug#44834 strxnmov is expected to behave as you'd expect
The problem: described in the bug report.
The fix:
--increase buffers where it's necessary
  (buffers which are used in stxnmov)
--decrease buffer lengths which are used
2009-06-19 13:24:43 +05:00
Ramil Kalimullin
a26f8d91aa Fix for bug#42944: partition not pruned correctly
Problem: we don't prune a LESS THAN partition if MAXVALUE is given and
given value is equal to a LESS THAN value.

Fix: prune partitions in such cases.
2009-04-01 10:34:59 +05:00
Mattias Jonsson
b43b8c2479 Bug#40972: Partition pruning can lead to crash for bad dates
post push fix, added test found a valgrind warning
2009-01-09 14:18:08 +01:00
Mattias Jonsson
f1ab632391 merge 2009-01-07 23:28:49 +01:00
Georgi Kodinov
8c25823f94 merged 5.1-main -> 5.1-bugteam 2009-01-05 18:10:20 +02:00
Mattias Jonsson
7ac7726509 Bug#40972: some sql execution lead the whole databse crashing
Problem was an errornous date that lead to end partition
was before the start, leading to a crash.

Solution was to check greater or equal instead of only
equal between start and end partition.

NOTE: partitioning pruning handles incorrect dates
differently than index lookup, which can give different
results in a partitioned table versus a non partitioned
table for queries having 'bad' dates in the where clause.
2008-12-28 12:33:49 +01:00
Mattias Jonsson
7ce5c00c7b merge 2008-12-10 09:06:58 +01:00
Mattias Jonsson
8f39d2584b Bug#40389: REORGANIZE PARTITION crashes when only using one partition
The non documented command 'ALTER PARTITION t REORGANIZE PARTITION'
(without any partitions!) which only make sense for nativly
partitioned engines, such as NDB, crashes the server if there was
no change of number of partitions.

The problem was wrong usage of fast_end_partition function,
which led to usage of a non initialized variable.
2008-12-02 11:18:01 +01:00
timothy.smith@sun.com
abd8574914 Merge from mysql-5.1.30-release 2008-11-27 00:02:10 +01:00
Mattias Jonsson
deaa2c3059 Bug#38784: Mysql server crash if table is altered with partition changes.
Occurred with EXTRA_DEBUG on windows.

Problem was insufficient length of a local variable that stored path names.

Solution was to use the correct length.
2008-11-12 13:36:53 +01:00
Build Team
366adeab08 Added "Sun Microsystems, Inc." to copyright headers on files modified
since Oct 1st
2008-11-10 21:21:49 +01:00
Mattias Jonsson
01a61865a6 merge 2008-11-04 09:36:56 +01:00
Mattias Jonsson
2c7d4e80a2 merge 2008-11-04 08:55:43 +01:00
Mattias Jonsson
abd09620db Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
The partitioning clause is only a very long single line, which is very
hard to interpret for a human. This patch breaks the partitioning
syntax into one line for the partitioning type, and one line per
partition/subpartition.
2008-11-04 08:43:21 +01:00
Mattias Jonsson
b52aa0a792 merge 2008-10-29 21:30:04 +01:00
Mattias Jonsson
f113311d4b Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work
on non-partitioned table

Problem was that partitioning specific commands was accepted
for non partitioned tables and treated like
ANALYZE/CHECK/OPTIMIZE/REPAIR TABLE, after bug-20129 was fixed,
which changed the code path from mysql_alter_table to
mysql_admin_table.

Solution was to check if the table was partitioned before
trying to execute the admin command
2008-10-10 20:12:38 +02:00
Alexey Botchkov
4be617cbe4 keep compiler happy 2008-10-06 18:40:53 +05:00
Alexey Botchkov
79a66a9763 Bug#38083 Error-causing row inserted into partitioned table despite error 2008-10-06 17:22:38 +05:00
Mattias Jonsson
8f64bf94ad Bug#37453: Dropping/creating index on partitioned table with
InnoDB Plugin locks table

The fast/on-line add/drop index handler calls was not implemented
whithin the partitioning.

This implements it in the partitioning handler.

Since this is only used by the not included InnoDB plugin, there
is no test case. (Have tested it manually with the plugin, and
it does not allow unique indexes not including partitioning
function, or removal of pk, which in innodb generates a new pk,
which is not in the partitioning function.)

NOTE: This introduces a new handler method, and because of that
changes the storage engine api. (One cannot use a handlerton to
see the capabilities of a table's handler if it is partitioned.
So I added a wrapper function in the handler that defaults to
the handlerton function, which the partitioning handler overrides.
2008-10-05 00:40:30 +02:00
Mattias Jonsson
07e9a6dc2a Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
partition is corrupt

The main problem was that ALTER TABLE t ANALYZE/CHECK/OPTIMIZE/REPAIR
PARTITION took another code path (over mysql_alter_table instead of
mysql_admin_table) which differs in two ways:
1) alter table opens the tables in a different way than admin tables do
   resulting in returning with error before it tried the command
2) alter table does not start to send any diagnostic rows to the client
   which the lower admin functions continue to use -> resulting in
   assertion crash

The fix:
Remapped ALTER TABLE t ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION to use
the same code path as ANALYZE/CHECK/OPTIMIZE/REPAIR TABLE t.
Adding check in mysql_admin_table to setup the partition list for
which partitions that should be used.


Partitioned tables will still not work with
REPAIR TABLE/PARTITION USE_FRM, since that requires moving partitions
to tables, REPAIR TABLE t USE_FRM, and check that the data still
fulfills the partitioning function and then move the table back to
being a partition.

NOTE: I have removed the following functions from the handler
interface:
analyze_partitions, check_partitions, optimize_partitions,
repair_partitions
Since they are not longer needed.
THIS ALTERS THE STORAGE ENGINE API
2008-08-11 20:02:03 +02:00
Marc Alff
566e3389c2 Bug#35577, manual merge mysql-5.0-bugteam -> mysql-5.1-bugteam 2008-07-14 19:43:12 -06:00
antony@pcg5ppc.xiphis.org
820068f1b7 Merge pcg5ppc.xiphis.org:/Network/Servers/anubis.xiphis.org/home/antony/work/mysql-5.1-engines
into  pcg5ppc.xiphis.org:/Network/Servers/anubis.xiphis.org/home/antony/work/merge.20080307/mysql-5.1
2008-03-07 13:46:29 -08:00
mattiasj@witty.
2e3ed6a216 Post push fix
Fixed a missed case in the patch for Bug#31931.
Also makes Bug#33722 a duplicate of Bug#31931.
Added tests for better coverage.
Replaced some legacy function calls.
2008-02-25 21:18:50 +01:00
mattiasj@witty.
2bf256f8dd Merge witty.:/Users/mattiasj/clones/mysql-5.1-bug20129.2
into  witty.:/Users/mattiasj/clones/topush-51
2008-02-24 17:48:57 +01:00
mattiasj@witty.
d3937fd63c Merge witty.:/Users/mattiasj/clones/mysql-5.1-bug31931.2
into  witty.:/Users/mattiasj/clones/topush-51
2008-02-24 16:46:35 +01:00
kostja@dipika.(none)
f106d9738a Rename send_ok to my_ok. Similarly to my_error, it only records the status,
does not send it to the client.
2008-02-19 15:45:21 +03:00
kostja@dipika.(none)
acf9b1f346 A fix and a test case for Bug#12713 "Error in a stored function called from
a SELECT doesn't cause ROLLBACK of statem".

The idea of the fix is to ensure that we always commit the current
statement at the end of dispatch_command(). In order to not issue
redundant disc syncs, an optimization of the two-phase commit
protocol is implemented to bypass the two phase commit if
the transaction is read-only.
2008-02-19 14:43:01 +03:00
mikael@dator6.(none)
e1820b2e77 Merge dator6.(none):/home/mikael/mysql_clones/bug32943
into  dator6.(none):/home/mikael/mysql_clones/mysql-5.1-engines
2008-02-13 11:29:50 +01:00
mikael@dator6.(none)
2bff6fd22a Added comments on why we do reopen
Handle error case of not being able to reopen which
requires us to remove table from thread's open list
and table_cache.
2008-02-13 11:26:24 +01:00
mattiasj@client-10-129-10-147.upp.off.mysql.com
2335bfaa5b Bug#20129: ALTER TABLE ... ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION
Problem was that it did not work with corrupted/crashed tables.

Solution is to disable these commands until WL#4176 is completed
2008-02-11 11:32:46 +01:00
mikael@dator6.(none)
159b509cab BUG#33429: No check for maxvalue before adding partition 2008-01-28 16:11:43 +01:00
mikael@dator6.(none)
53546f51f5 BUG#32943: Fixed buggy lock handling of ALTER TABLE for partitioning 2008-01-28 15:20:55 +01:00
mattiasj@client-10-129-10-137.upp.off.mysql.com
a6a9774849 Bug#31931 Partitions: unjustified 'mix of handlers' error message
Problem was that the mix of handlers was not consistent between
CREATE and ALTER

changed so that it works like:
    - All partitions must use the same engine
      AND it must be the same as the table.
    - if one does NOT specify an engine on the table level
      then one must either NOT specify any engine on any
      partition/subpartition OR for ALL partitions/subpartitions

Note: that after a table have been created, the storage engine
is specified for all parts of the table (table/partition/subpartition)
and so when using alter, one does not need to specify it (unless one
wants to change the storage engine, then one have to specify it on the
table level)
2008-01-09 13:15:50 +01:00
kostja@bodhi.(none)
dfe685e6fc A pre-requisite for the fix for Bug#12713 "Error in a stored function
called from a SELECT doesn't cause ROLLBACK of state"
Make private all class handler methods (PSEA API) that may modify
data. Introduce and deploy public ha_* wrappers for these methods in 
all sql/.
This necessary to keep track of all data modifications in sql/,
which is in turn necessary to be able to optimize two-phase
commit of those transactions that do not modify data.
2007-12-20 21:16:55 +03:00
anozdrin/alik@station.
151444c626 Merge station.:/mnt/raid/alik/MySQL/devel/5.1
into  station.:/mnt/raid/alik/MySQL/devel/5.1-rt
2007-12-14 16:30:22 +03:00
gluh@eagle.(none)
4f5868114a Merge mysql.com:/home/gluh/MySQL/Merge/5.1
into  mysql.com:/home/gluh/MySQL/Merge/5.1-opt
2007-12-13 15:56:04 +04:00