Commit graph

23083 commits

Author SHA1 Message Date
mattiasj@witty.
5452a154d6 Merge witty.:/Users/mattiasj/clones/mysql-5.1-bug30822
into  witty.:/Users/mattiasj/clones/51to_push
2007-12-05 19:39:32 +01:00
mattiasj@witty.
1d7ac77479 Bug#30480: Falcon: searches fail if LIKE and key partition
(also fixes the bugs: Bug#29320, Bug#29493 and Bug#30536)

Problem: Partitioning did not handle unordered scans correctly
for engines with unordered read order.

Solution: do not stop scanning fi a recored is out of range, since
there can be more records within the range afterwards.

Note: this is the patch that fixes the bug, but since there are no
storage engines shipped with mysql 5.1 (falcon comes in 6.0) there
are no test cases (it is a separate patch that only goes into 6.0)
2007-12-03 16:12:25 +01:00
ramil/ram@ramil.myoffice.izhnet.ru
2b65845a99 Merge mysql.com:/home/ram/work/mysql-5.1-engines
into  mysql.com:/home/ram/work/b29258/b29258.5.1
2007-11-30 09:18:26 +04:00
ramil/ram@ramil.myoffice.izhnet.ru
6164613f18 Merge mysql.com:/home/ram/work/b32559/b32559.5.0
into  mysql.com:/home/ram/work/b32559/b32559.5.1
2007-11-29 10:23:30 +04:00
ramil/ram@ramil.myoffice.izhnet.ru
5d9f96af27 Merge mysql.com:/home/ram/work/b32676/b32676.5.0
into  mysql.com:/home/ram/work/b32676/b32676.5.1
2007-11-28 12:49:48 +04:00
istruewing@stella.local
da28f9eac4 Merge stella.local:/home2/mydev/mysql-5.1-amain
into  stella.local:/home2/mydev/mysql-5.1-axmrg
2007-11-27 19:29:10 +01:00
ramil/ram@ramil.myoffice.izhnet.ru
32f9164bb5 Merge mysql.com:/home/ram/work/b30495/b30495.5.0
into  mysql.com:/home/ram/work/b30495/b30495.5.1
2007-11-27 10:14:46 +04:00
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
ac034767c0 Fix for bug #32559: connection hangs on query with name_const
Problem: passing a non-constant name to the NAME_CONST function results in a crash.

Fix: check the NAME_CONST name argument; return fake item type if we got
non-constant argument(s).
2007-11-27 09:36:43 +04:00
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
5adf16e288 Fix for bug #32676: insert delayed crash with wrong column and function specified
Problem: using wrong local lock type value in the mysql_insert() results in a crash. 

Fix: use a proper value.
2007-11-26 13:29:26 +04:00
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
beff6193e0 Fix for bug #29258: Partitions: search fails for maximum unsigned bigint
Problems: 
  1. looking for a matching partition we miss the fact that the maximum 
     allowed value is in the PARTITION p LESS THAN MAXVALUE.
  2. one can insert maximum value if numeric maximum value is the last range.
     (should only work if LESS THAN MAXVALUE).
  3. one cannot have both numeric maximum value and MAXVALUE string as ranges 
    (the same value, but different meanings).

Fix: consider the maximum value as a supremum.
2007-11-26 10:28:25 +04:00
ramil/ram@ramil.myoffice.izhnet.ru
2bc1e74c55 Merge mysql.com:/home/ram/work/b32560/b32560.5.0
into  mysql.com:/home/ram/work/b32560/b32560.5.1
2007-11-23 16:43:49 +04:00
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
51ca3235b8 Fix for bug #32560: crash with interval function and count(*)
Problem: INTERVAL function implementation doesn't handle NULL range values.

Fix: skip NULL ranges looking for a proper one.
2007-11-23 16:30:06 +04:00
ramil/ram@ramil.myoffice.izhnet.ru
ce75b829ee Merge mysql.com:/home/ram/work/b32558/b32558.5.0
into  mysql.com:/home/ram/work/b32558/b32558.5.1
2007-11-23 12:35:02 +04:00
mkindahl@dl145h.mysql.com
0c7f3bdeba Merge dl145h.mysql.com:/data0/mkindahl/mysql-5.1
into  dl145h.mysql.com:/data0/mkindahl/mysql-5.1-rpl-merge
2007-11-21 21:15:33 +01:00
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
924bdf2c78 Fix for bug #32558: group by null-returning expression with rollup causes crash
Problem: setting Item_func_rollup_const::null_value property to argument's null_value
before (without) the argument evaluation may result in a crash due to wrong null_value.

Fix: use is_null() to set Item_func_rollup_const::null_value instead as it evaluates
the argument if necessary and returns a proper value.
2007-11-21 20:53:44 +04:00
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
b8f65ccf6f Fix for bug #32557: order by updatexml causes assertion in filesort
Problem: even if an Item_xml_str_func successor returns NULL, it doesn't have 
a corresponding property (maybe_null) set, that leads to a failed assertion.

Fix: set nullability property of Item_xml_str_func.
2007-11-21 16:00:09 +04:00
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
725b2d35f4 Fix for bug #30495: optimize table t1,t2,t3 extended errors
Problem: we have CHECK TABLE options allowed (by accident?) for
ANALYZE/OPTIMIZE TABLE.

Fix: disable them.

Note: it might require additional fixes in 5.1/6.0
2007-11-21 11:11:22 +04:00
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
92512e608a Fix for bug #32021: Using Date 000-00-01 in WHERE causes wrong result
Problem: caching 00000000-00000099 dates as integer values we're 
improperly shifting them up twice in the get_datetime_value().
  
Fix: don't shift cached DATETIME values up for the second time.
2007-11-21 08:01:00 +04:00
mattiasj@mattias-jonssons-macbook.local
eac847f39b Bug#30822: ALTER TABLE COALESCE PARTITION causes segmentation fault
Problem was for LINEAR HASH/KEY. Crashes because of wrong partition id
returned when creating the new altered partitions. (because of wrong
linear hash mask)

Solution: Update the linear hash mask before using it for the new
altered table.
2007-11-20 11:21:00 +01:00
istruewing@stella.local
81fc036f0c Merge stella.local:/home2/mydev/mysql-5.1-ateam
into  stella.local:/home2/mydev/mysql-5.1-axmrg
2007-11-19 11:08:02 +01:00
istruewing@stella.local
3dc725882f Merge bk-internal.mysql.com:/home/bk/mysql-5.1-engines
into  stella.local:/home2/mydev/mysql-5.1-bug26379-8
2007-11-18 23:17:54 +01:00
istruewing@stella.local
b6831e182b Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
corrupts a MERGE table

Post-pushbuild fix for a Valgrind warning.
2007-11-18 20:28:37 +01:00
istruewing@stella.local
89bb56cdbe Merge stella.local:/home2/mydev/mysql-5.1-ateam
into  stella.local:/home2/mydev/mysql-5.1-axmrg
2007-11-17 09:21:09 +01:00
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
11115f1bfd Fix for bug #32260: User variables in query cause server crash
Problem: there's no guarantee that the user variable item's result_field
is assigned when we're adjusting its table read map.
  
Fix: check the result_field before using it.
2007-11-17 11:20:50 +04:00
mkindahl@dl145h.mysql.com
6baad48043 Merge dl145h.mysql.com:/data0/mkindahl/mysql-5.1-new-rpl
into  dl145h.mysql.com:/data0/mkindahl/mysql-5.1-rpl-merge
2007-11-16 15:56:24 +01:00
mkindahl@dl145h.mysql.com
e0ae105055 Bug#32435:
DROP DATABASE statement writes changes to mysql.proc table under RBR

When replicating a DROP DATABASE statement with a database holding
stored procedures, the changes to the mysql.proc table was recorded
in the binary log under row-based replication.

With this patch, the thread uses statement-logging format for the
duration of the DROP DATABASE statement. The logging format is
(already) reset at the end of the statement, so no additional code
for resetting the logging format is necessary.
2007-11-16 15:55:22 +01:00
istruewing@stella.local
6d06272e8a Merge stella.local:/home2/mydev/mysql-5.1-amain
into  stella.local:/home2/mydev/mysql-5.1-axmrg
2007-11-16 14:07:59 +01:00
istruewing@stella.local
0605274155 Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
corrupts a MERGE table
Bug 26867 - LOCK TABLES + REPAIR + merge table result in
            memory/cpu hogging
Bug 26377 - Deadlock with MERGE and FLUSH TABLE
Bug 25038 - Waiting TRUNCATE
Bug 25700 - merge base tables get corrupted by
            optimize/analyze/repair table
Bug 30275 - Merge tables: flush tables or unlock tables
            causes server to crash
Bug 19627 - temporary merge table locking
Bug 27660 - Falcon: merge table possible
Bug 30273 - merge tables: Can't lock file (errno: 155)

The problems were:

Bug 26379 - Combination of FLUSH TABLE and REPAIR TABLE
                corrupts a MERGE table

  1. A thread trying to lock a MERGE table performs busy waiting while
     REPAIR TABLE or a similar table administration task is ongoing on
     one or more of its MyISAM tables.
  
  2. A thread trying to lock a MERGE table performs busy waiting until all
     threads that did REPAIR TABLE or similar table administration tasks
     on one or more of its MyISAM tables in LOCK TABLES segments do UNLOCK
     TABLES. The difference against problem #1 is that the busy waiting
     takes place *after* the administration task. It is terminated by
     UNLOCK TABLES only.
  
  3. Two FLUSH TABLES within a LOCK TABLES segment can invalidate the
     lock. This does *not* require a MERGE table. The first FLUSH TABLES
     can be replaced by any statement that requires other threads to
     reopen the table. In 5.0 and 5.1 a single FLUSH TABLES can provoke
     the problem.

Bug 26867 - LOCK TABLES + REPAIR + merge table result in
            memory/cpu hogging

  Trying DML on a MERGE table, which has a child locked and
  repaired by another thread, made an infinite loop in the server.

Bug 26377 - Deadlock with MERGE and FLUSH TABLE

  Locking a MERGE table and its children in parent-child order
  and flushing the child deadlocked the server.

Bug 25038 - Waiting TRUNCATE

  Truncating a MERGE child, while the MERGE table was in use,
  let the truncate fail instead of waiting for the table to
  become free.

Bug 25700 - merge base tables get corrupted by
            optimize/analyze/repair table

  Repairing a child of an open MERGE table corrupted the child.
  It was necessary to FLUSH the child first.

Bug 30275 - Merge tables: flush tables or unlock tables
            causes server to crash

  Flushing and optimizing locked MERGE children crashed the server.

Bug 19627 - temporary merge table locking

  Use of a temporary MERGE table with non-temporary children
  could corrupt the children.

  Temporary tables are never locked. So we do now prohibit
  non-temporary chidlren of a temporary MERGE table.

Bug 27660 - Falcon: merge table possible

  It was possible to create a MERGE table with non-MyISAM children.

Bug 30273 - merge tables: Can't lock file (errno: 155)

  This was a Windows-only bug. Table administration statements
  sometimes failed with "Can't lock file (errno: 155)".

These bugs are fixed by a new implementation of MERGE table open.

When opening a MERGE table in open_tables() we do now add the
child tables to the list of tables to be opened by open_tables()
(the "query_list"). The children are not opened in the handler at
this stage.

After opening the parent, open_tables() opens each child from the
now extended query_list. When the last child is opened, we remove
the children from the query_list again and attach the children to
the parent. This behaves similar to the old open. However it does
not open the MyISAM tables directly, but grabs them from the already
open children.

When closing a MERGE table in close_thread_table() we detach the
children only. Closing of the children is done implicitly because
they are in thd->open_tables.

For more detail see the comment at the top of ha_myisammrg.cc.

Changed from open_ltable() to open_and_lock_tables() in all places
that can be relevant for MERGE tables. The latter can handle tables
added to the list on the fly. When open_ltable() was used in a loop
over a list of tables, the list must be temporarily terminated
after every table for open_and_lock_tables().
table_list->required_type is set to FRMTYPE_TABLE to avoid open of
special tables. Handling of derived tables is suppressed.
These details are handled by the new function
open_n_lock_single_table(), which has nearly the same signature as
open_ltable() and can replace it in most cases.

In reopen_tables() some of the tables open by a thread can be
closed and reopened. When a MERGE child is affected, the parent
must be closed and reopened too. Closing of the parent is forced
before the first child is closed. Reopen happens in the order of
thd->open_tables. MERGE parents do not attach their children
automatically at open. This is done after all tables are reopened.
So all children are open when attaching them.

Special lock handling like mysql_lock_abort() or mysql_lock_remove()
needs to be suppressed for MERGE children or forwarded to the parent.
This depends on the situation. In loops over all open tables one
suppresses child lock handling. When a single table is touched,
forwarding is done.

Behavioral changes:
===================

This patch changes the behavior of temporary MERGE tables.
Temporary MERGE must have temporary children.
The old behavior was wrong. A temporary table is not locked. Hence
even non-temporary children were not locked. See
Bug 19627 - temporary merge table locking.

You cannot change the union list of a non-temporary MERGE table
when LOCK TABLES is in effect. The following does *not* work:
CREATE TABLE m1 ... ENGINE=MRG_MYISAM ...;
LOCK TABLES t1 WRITE, t2 WRITE, m1 WRITE;
ALTER TABLE m1 ... UNION=(t1,t2) ...;
However, you can do this with a temporary MERGE table.

You cannot create a MERGE table with CREATE ... SELECT, neither
as a temporary MERGE table, nor as a non-temporary MERGE table.
CREATE TABLE m1 ... ENGINE=MRG_MYISAM ... SELECT ...;
Gives error message: table is not BASE TABLE.
2007-11-15 20:25:43 +01:00
mkindahl@dl145h.mysql.com
60fa29c847 Merge dl145h.mysql.com:/data0/mkindahl/mysql-5.0-rpl-merge
into  dl145h.mysql.com:/data0/mkindahl/mysql-5.1-rpl-merge
2007-11-15 13:31:39 +01:00
mkindahl@dl145h.mysql.com
d7f570c056 Post-merge fixes. 2007-11-14 21:08:59 +01:00
mkindahl@dl145h.mysql.com
379b67b967 Merge mkindahl@bk-internal.mysql.com:/home/bk/mysql-5.0-rpl
into  dl145h.mysql.com:/data0/mkindahl/mysql-5.0-rpl
2007-11-14 15:41:33 +01:00
gluh@eagle.(none)
58336411c9 Merge mysql.com:/home/gluh/MySQL/Merge/5.1
into  mysql.com:/home/gluh/MySQL/Merge/5.1-opt
2007-11-14 17:30:16 +04:00
gluh@eagle.(none)
246c6c35a9 Merge mysql.com:/home/gluh/MySQL/Merge/5.0
into  mysql.com:/home/gluh/MySQL/Merge/5.0-opt
2007-11-14 17:26:22 +04:00
mkindahl@dl145h.mysql.com
23cd47e0e1 Reverting changes to debug printouts to ha_ndbcluster.cc. 2007-11-14 14:04:33 +01:00
gshchepa/uchum@gleb.loc
95e7cccfee Merge gleb.loc:/home/uchum/work/bk/5.1-opt-32034
into  gleb.loc:/home/uchum/work/bk/5.1-opt
2007-11-14 15:49:57 +04:00
mkindahl@dl145h.mysql.com
a8bbce6569 Merge dl145h.mysql.com:/data0/mkindahl/mysql-5.0
into  dl145h.mysql.com:/data0/mkindahl/mysql-5.0-rpl
2007-11-14 11:19:34 +01:00
mkindahl@dl145h.mysql.com
6b5cb11dba Merge dl145h.mysql.com:/data0/mkindahl/mysql-5.1
into  dl145h.mysql.com:/data0/mkindahl/mysql-5.1-new-rpl
2007-11-14 11:07:30 +01:00
gkodinov/kgeorge@magare.gmz
82ce901ded Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.1-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B31562-5.1-opt
2007-11-14 12:03:28 +02:00
gshchepa/uchum@gleb.loc
70f36562bc Fixed bug #32034: On 64bit platforms assigning values of
storage engine system variables was not validated and
unexpected value was assigned.

The check_func_enum function used subtraction from the uint
value with the probably negative result. That result of
type uint was compared with 0 after casting to signed long
type. On architectures where long type is longer than int
type the result of comparison was unexpected.
2007-11-14 13:48:21 +04:00
holyfoot/hf@hfmain.(none)
19c3bd89f8 Merge mysql.com:/home/hf/work/32067/my51-32067
into  mysql.com:/home/hf/work/31305/my51-31305
2007-11-13 23:16:48 +04:00
gkodinov/kgeorge@magare.gmz
70f9ec3c8d Merge magare.gmz:/home/kgeorge/mysql/autopush/B31562-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/work/B31562-5.1-opt
2007-11-13 19:15:49 +02:00
gkodinov/kgeorge@magare.gmz
eea70871f1 Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B31562-5.0-opt
2007-11-13 19:00:45 +02:00
evgen@moonbone.local
c406150f34 Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.1-opt
into  moonbone.local:/work/30081-bug-5.1-opt-mysql
2007-11-13 13:29:42 +00:00
evgen@moonbone.local
4fa7ee92e6 Bug#30081: "ON UPDATE CURRENT_TIMESTAMP" wasn't shown by the SHOW FIELDS
command and reported to a client.

The fact that a timestamp field will be set to NO on UPDATE wasn't shown 
by the SHOW COMMAND and reported to a client through connectors. This led to
problems in the ODBC connector and might lead to a user confusion.

A new filed flag called ON_UPDATE_NOW_FLAG is added. 
Constructors of the Field_timestamp set it when a field should be set to NOW
on UPDATE.

The get_schema_column_record function now reports whether a timestamp field
will be set to NOW on UPDATE.
2007-11-13 13:24:48 +00:00
gkodinov/kgeorge@magare.gmz
3384d3e96c Bug #31562: HAVING and lower case
The columns in HAVING can reference the GROUP BY and 
SELECT columns. There can be "table" prefixes when
referencing these columns. And these "table" prefixes
in HAVING use the table alias if available.
This means that table aliases are subject to the same
storage rules as table names and are dependent on 
lower_case_table_names in the same way as the table 
names are.
Fixed by :
1. Treating table aliases as table names
and make them lowercase when printing out the SQL
statement for view persistence.
2. Using case insensitive comparison for table 
aliases when requested by lower_case_table_names
2007-11-13 11:39:52 +02:00
mats@kindahl-laptop.dnsalias.net
6e1f5f6eed Elimination of warning for unused function code_name() in non-debug mode. 2007-11-13 09:43:29 +01:00
mats@kindahl-laptop.dnsalias.net
0cf6e38cb5 Fixes to eliminate warnings. 2007-11-13 09:01:42 +01:00
mats@kindahl-laptop.dnsalias.net
0f42488cb4 BUG#31793 (log event corruption causes crash):
Corrections to get_str_len_and_pointer().
2007-11-12 22:02:12 +01:00
mattiasj@mattiasj-laptop.(none)
f4c100135b Merge mattiasj-laptop.(none):/home/mattiasj/clones/mysql-5.0-main
into  mattiasj-laptop.(none):/home/mattiasj/clones/mysql-5.0-engines_with_main
2007-11-12 21:42:27 +01:00
mattiasj@mattiasj-laptop.(none)
32d7dd8679 Merge mattiasj-laptop.(none):/home/mattiasj/clones/mysql-5.1-main
into  mattiasj-laptop.(none):/home/mattiasj/clones/mysql-5.1-last_with_main
2007-11-12 21:09:48 +01:00