Commit graph

1491 commits

Author SHA1 Message Date
ramil/ram@ramil.myoffice.izhnet.ru
bc15820d32 Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-5.1-maint
into  mysql.com:/home/ram/work/b29980/b29980.5.1
2007-07-27 21:17:05 +05:00
kostja@bodhi.(none)
11c57540f7 A fix and a test case for Bug#24918 drop table and lock / inconsistent
between perm and temp tables. Review fixes.

The original bug report complains that if we locked a temporary table
with LOCK TABLES statement, we would not leave LOCK TABLES mode
when this temporary table is dropped.

Additionally, the bug was escalated when it was discovered than
when a temporary transactional table that was previously
locked with LOCK TABLES statement was dropped, futher actions with
this table, such as UNLOCK TABLES, would lead to a crash.

The problem originates from incomplete support of transactional temporary
tables. When we added calls to handler::store_lock()/handler::external_lock()
to operations that work with such tables, we only covered the normal
server code flow and did not cover LOCK TABLES mode. 
In LOCK TABLES mode, ::external_lock(LOCK) would sometimes be called without
matching ::external_lock(UNLOCK), e.g. when a transactional temporary table
was dropped. Additionally, this table would be left in the list of LOCKed 
TABLES.

The patch aims to address this inadequacy. Now, whenever an instance
of 'handler' is destroyed, we assert that it was priorly
external_lock(UNLOCK)-ed. All the places that violate this assert
were fixed.

This patch introduces no changes in behavior -- the discrepancy in
behavior will be fixed when we start calling ::store_lock()/::external_lock()
for all tables, regardless whether they are transactional or not, 
temporary or not.
2007-07-27 16:37:29 +04:00
malff/marcsql@weblab.(none)
c7bbd8917c WL#3984 (Revise locking of mysql.general_log and mysql.slow_log)
Bug#25422 (Hang with log tables)
Bug 17876 (Truncating mysql.slow_log in a SP after using cursor locks the
          thread)
Bug 23044 (Warnings on flush of a log table)
Bug 29129 (Resetting general_log while the GLOBAL READ LOCK is set causes
           a deadlock)

Prior to this fix, the server would hang when performing concurrent
ALTER TABLE or TRUNCATE TABLE statements against the LOG TABLES,
which are mysql.general_log and mysql.slow_log.

The root cause traces to the following code:
in sql_base.cc, open_table()
  if (table->in_use != thd)
  {
    /* wait_for_condition will unlock LOCK_open for us */
    wait_for_condition(thd, &LOCK_open, &COND_refresh);
  }
The problem with this code is that the current implementation of the
LOGGER creates 'fake' THD objects, like
- Log_to_csv_event_handler::general_log_thd
- Log_to_csv_event_handler::slow_log_thd
which are not associated to a real thread running in the server,
so that waiting for these non-existing threads to release table locks
cause the dead lock.

In general, the design of Log_to_csv_event_handler does not fit into the
general architecture of the server, so that the concept of general_log_thd
and slow_log_thd has to be abandoned:
- this implementation does not work with table locking
- it will not work with commands like SHOW PROCESSLIST
- having the log tables always opened does not integrate well with DDL
operations / FLUSH TABLES / SET GLOBAL READ_ONLY

With this patch, the fundamental design of the LOGGER has been changed to:
- always open and close a log table when writing a log
- remove totally the usage of fake THD objects
- clarify how locking of log tables is implemented in general.

See WL#3984 for details related to the new locking design.

Additional changes (misc bugs exposed and fixed):

1)

mysqldump which would ignore some tables in dump_all_tables_in_db(),
 but forget to ignore the same in dump_all_views_in_db().

2)

mysqldump would also issue an empty "LOCK TABLE" command when all the tables
to lock are to be ignored (numrows == 0), instead of not issuing the query.

3)

Internal errors handlers could intercept errors but not warnings
(see sql_error.cc).

4)

Implementing a nested call to open tables, for the performance schema tables,
exposed an existing bug in remove_table_from_cache(), which would perform:
  in_use->some_tables_deleted=1;
against another thread, without any consideration about thread locking.
This call inside remove_table_from_cache() was not required anyway,
since calling mysql_lock_abort() takes care of aborting -- cleanly -- threads
that might hold a lock on a table.
This line (in_use->some_tables_deleted=1) has been removed.
2007-07-27 00:31:06 -06:00
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
13358407e0 Fix for bug #29980: 5.1.20 ate my table
Problem: trying to repair an old (e.g. with "old" varstring fields) corrupted 
table with use_frm option we don't actually repair the table, just altering it
which may couse data loss.

Fix: if use_frm repair option is set, do repair instead of altering even 
if the table needs upgrade.
2007-07-26 13:07:01 +05:00
tsmith@ramayana.hindu.god
8a671513da Merge ramayana.hindu.god:/home/tsmith/m/bk/51
into  ramayana.hindu.god:/home/tsmith/m/bk/maint/jul24/51
2007-07-24 16:16:16 -06:00
tsmith@ramayana.hindu.god
9524c9670d Merge ramayana.hindu.god:/home/tsmith/m/bk/50
into  ramayana.hindu.god:/home/tsmith/m/bk/maint/jul24/50
2007-07-24 16:12:23 -06:00
istruewing@chilla.local
7c7ccc2f52 Merge chilla.local:/home/mydev/mysql-5.0-amain
into  chilla.local:/home/mydev/mysql-5.0-axmrg
2007-07-22 19:08:25 +02:00
istruewing@chilla.local
3a33c745f1 Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  chilla.local:/home/mydev/mysql-5.1-axmrg
2007-07-21 03:13:59 +02:00
istruewing@chilla.local
d9bd5f2364 Merge chilla.local:/home/mydev/mysql-5.1-ateam
into  chilla.local:/home/mydev/mysql-5.1-axmrg
2007-07-21 03:10:23 +02:00
svoj@june.mysql.com
bc1f8d49ba Merge mysql.com:/home/svoj/devel/mysql/BUG28838/mysql-5.0-engines
into  mysql.com:/home/svoj/devel/mysql/BUG28838/mysql-5.1-engines
2007-07-20 11:08:31 +05:00
ramil/ram@ramil.myoffice.izhnet.ru
e6550a65f4 Merge mysql.com:/home/ram/work/b28125/b28125.5.0
into  mysql.com:/home/ram/work/b28125/b28125.5.1
2007-07-20 10:30:40 +05:00
gshchepa/uchum@gleb.loc
35a2a20160 Merge gleb.loc:/home/uchum/work/bk/5.1
into  gleb.loc:/home/uchum/work/bk/5.1-opt
2007-07-19 20:01:13 +05:00
svoj@mysql.com/june.mysql.com
17d5af9922 BUG#28838 - duplicate external_lock in mysql_alter_table
Removed duplicate call to handler::external_lock() when
ALTER TABLE that doesn't need to copy a table (quick
ALTER TABLE) was executed.

Also quick ALTER TABLE doesn't hold LOCK_open anymore when
it enables/disables indexes.
2007-07-18 15:39:13 +05:00
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
100faf97c4 Fix for bug #28125: ERROR 2013 when adding index.
Problem: we may break a multibyte char sequence using a key 
reduced to maximum allowed length for a storage engine
(that leads to failed assertion in the innodb code, 
see also #17530). 

Fix: align truncated key length to multibyte char boundary.
2007-07-18 12:13:45 +05:00
kostja@bodhi.(none)
f5267530d9 A follow up after the patch for Bug#21074 - even though
we now have exclusive name lock on the table name in mysql_rm_table_part2,
we still should keep LOCK_open - some storage engines are not
ready for locking scope change and assume that LOCK_open is kept.
Still, the binary logging and query cache invalidation calls
moved out of LOCK_open scope.
Fixes some of the broken 5.1-runtime tests (tests break on asserts).
2007-07-14 02:04:48 +04:00
gkodinov/kgeorge@magare.gmz
49285e96d9 Merge magare.gmz:/home/kgeorge/mysql/work/B29325-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/work/B29325-5.1-opt
2007-07-11 11:57:49 +03:00
gkodinov/kgeorge@magare.gmz
015e1290a1 Bug #29325:
By default MyISAM overwrites .MYD and .MYI files no 
DATA DIRECTORY option is used. This can lead to two tables
using the same .MYD and .MYI files (that can't be dropped).

To prevent CREATE TABLE from overwriting a file a new option
is introduced : keep_files_on_create
When this is on the CREATE TABLE throws an error if either
the .MYD or .MYI exists for a MyISAM table.
The option is off by default (resulting in compatible behavior).
2007-07-11 10:49:54 +03:00
thek@adventure.(none)
08e7d2d312 Merge adventure.(none):/home/thek/Development/cpp/bug21074/my51-bug21074
into  adventure.(none):/home/thek/Development/cpp/mysql-5.1-runtime
2007-07-02 21:03:10 +02:00
thek@adventure.(none)
863e882785 Bug#21074 Large query_cache freezes mysql server sporadically under heavy load
Invaldating a subset of a sufficiently large query cache can take a long time.
During this time the server is efficiently frozen and no other operation can
be executed. This patch addresses this problem by moving the locks which cause
the freezing and also by temporarily disable the query cache while the 
invalidation takes place.
2007-07-02 19:14:48 +02:00
cmiller@zippy.cornsilk.net
681ee9694b Merge mysqldev@production.mysql.com:my/mysql-5.0-release
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
2007-07-02 10:46:46 -04:00
kostja@bodhi.(none)
68632318dc Manual merge. 2007-06-19 15:02:08 +04:00
istruewing@chilla.local
875cac1ffb Merge chilla.local:/home/mydev/mysql-5.1-amain
into  chilla.local:/home/mydev/mysql-5.1-axmrg
2007-06-15 20:23:20 +02:00
malff/marcsql@weblab.(none)
7e36d37eb0 Merge weblab.(none):/home/marcsql/TREE/mysql-5.1-base
into  weblab.(none):/home/marcsql/TREE/mysql-5.1-rt-merge
2007-06-15 11:36:31 -06:00
istruewing@chilla.local
676ea58252 Merge chilla.local:/home/mydev/mysql-5.0-amain
into  chilla.local:/home/mydev/mysql-5.0-axmrg
2007-06-15 17:47:02 +02:00
holyfoot/hf@hfmain.(none)
1e9373fd60 Merge bk@192.168.21.1:mysql-5.1
into  mysql.com:/d2/hf/mrg/mysql-5.1-opt
2007-06-14 16:42:43 +05:00
holyfoot/hf@hfmain.(none)
8ccc50b303 Merge bk@192.168.21.1:mysql-5.0
into  mysql.com:/d2/hf/mrg/mysql-5.0-opt
2007-06-14 16:41:10 +05:00
bar@mysql.com/bar.myoffice.izhnet.ru
6d2ffe7b8e Bug#26402 Server crashes with old-style named table
Problem: crash on attempt to open a table
  having "#mysql50#" prefix in db or table name.
  Fix: This prefix is reserved for "mysql_upgrade"
  to access 5.0 tables  whose file names are not encoded
  according to "5.1 tablename to filename encoded".
  Don't try open tables whose db name or table name
  has this prefix.
2007-06-14 16:28:33 +05:00
gkodinov/kgeorge@magare.gmz
72f395a559 Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.1-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B27816-5.1-opt
2007-06-12 19:24:48 +03:00
malff/marcsql@weblab.(none)
e6f9d712aa Merge weblab.(none):/home/marcsql/TREE/mysql-5.1-base
into  weblab.(none):/home/marcsql/TREE/mysql-5.1-rt-merge
2007-06-11 15:57:59 -06:00
evgen@moonbone.local
24ea0909c9 Merge moonbone.local:/mnt/gentoo64/work/test-5.0-opt-mysql
into  moonbone.local:/mnt/gentoo64/work/test-5.1-opt-mysql
2007-06-11 17:14:16 +04:00
kostja@bodhi.(none)
6c352d16d9 Follow up after work on Bug 4968
Coding style: classes start with a capital letter.
Rename some classes related to parsing:
create_field -> Create_field
foreign_key -> Foreign_key
key_part_spec -> Key_part_spec
2007-06-10 14:43:57 +04:00
gkodinov/kgeorge@magare.gmz
949d96f175 Bug #27816: Log tables ran with partitions crashes the server
when logging is enabled.
Currently the partition engine doesn't allow log tables to
be partitioned. But this was not checked and the server crashed.
Fixed by adding a check in ALTER TABLE to disable partitioning the
log tables.
While working on the cause of the problem improved the way the log
thread structures are initialized before opening the log tables.
2007-06-08 17:12:42 +03:00
gkodinov/kgeorge@magare.gmz
d12fbdd8d0 Bug #28754: RPM builds differ from tar.gz in "ALTER ... RENAME" on views
When constructing the path to the original .frm file ALTER .. RENAME
 was unnecessary (and incorrectly) lowercasing the whole path when not 
 on a case-insensitive filesystem.
 This path should not be modified because of lower_case_table_names
 as it is already in the correct case according to that setting.
 Fixed by removing the lowercasing.
 Unfortunately testing this would require running the tests on a case
 sensitive filesystem in a directory that has uppercase letters.
 This cannot be guaranteed in all setups so no test case added.
2007-06-08 13:42:10 +03:00
svoj@mysql.com/june.mysql.com
a1529d92d1 BUG#26976 - Missing table in merge not noted in related error msg +
SHOW CREATE TABLE fails

After merge fixes.
2007-06-08 11:20:50 +05:00
svoj@june.mysql.com
d0a044a0bf Merge mysql.com:/home/svoj/devel/mysql/BUG26976/mysql-5.0-engines
into  mysql.com:/home/svoj/devel/mysql/BUG26976/mysql-5.1-engines
2007-06-07 13:53:23 +05:00
svoj@june.mysql.com
c45b4cf893 Merge 81.176.158.240:devel/mysql/BUG26976/mysql-5.0-engines
into  mysql.com:/home/svoj/devel/mysql/BUG26976/mysql-5.0-engines
2007-06-07 12:07:41 +05:00
holyfoot/hf@mysql.com/hfmain.(none)
a155d1f926 merging fix 2007-06-06 14:23:56 +05:00
svoj@mysql.com/april.(none)
bd8f81f470 BUG#26976 - Missing table in merge not noted in related error msg +
SHOW CREATE TABLE fails

Underlying table names, that merge engine fails to open were not
reported.

With this fix CHECK TABLE issued against merge table reports all
underlying table names that it fails to open. Other statements
are unaffected, that is underlying table names are not included
into error message.

This fix doesn't solve SHOW CREATE TABLE issue.
2007-06-06 04:42:41 +05:00
tsmith@quadxeon.mysql.com
0ca0984f59 Merge tsmith@bk-internal.mysql.com:/home/bk/mysql-5.1
into  quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/maint/jun05/51
2007-06-05 23:06:43 +02:00
tsmith@quadxeon.mysql.com
d2fe24d1ef Merge tsmith@bk-internal.mysql.com:/home/bk/mysql-5.0
into  quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/maint/jun05/50
2007-06-05 23:04:40 +02:00
holyfoot/hf@hfmain.(none)
c571b6e0f9 Merge bk@192.168.21.1:mysql-5.1-opt
into  mysql.com:/home/hf/work/28477/my51-28477
2007-06-06 00:20:01 +05:00
tsmith@quadxeon.mysql.com
4b93804592 Merge quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/51
into  quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/maint/jun05/51
2007-06-05 17:51:30 +02:00
tsmith@quadxeon.mysql.com
502320ef05 Merge quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/50
into  quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/maint/jun05/50
2007-06-05 17:28:49 +02:00
gkodinov/kgeorge@magare.gmz
0c0201c9a7 Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.1-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B28488-5.1-opt
2007-06-05 10:42:47 +03:00
gkodinov/kgeorge@macbook.gmz
f081188fcb Bug #28488: Incorrect information in file: './test/t1_test#.frm'
While executing ALTER TABLE ... PARTITION the server uses 
a temporary "shadow" table to create the updated table.
This shadow table then gets renamed as the original table.
The shadow table was not prefixed with the special prefix that
marks temporary tables so it was picked up by SHOW TABLE STATUS.
Fixed by isolating the code to create the shadow table name in a
separate function and prefixing the shadow table name with the
special prefix to exclude it from the list of user tables.
See bug 18775 and WL1324 for details.
2007-06-04 18:56:29 +03:00
igor@olga.mysql.com
31c57a1efc Post-merge fix. 2007-06-04 03:03:15 -07:00
igor@olga.mysql.com
ca49b83d5a Merge olga.mysql.com:/home/igor/mysql-5.1
into  olga.mysql.com:/home/igor/mysql-5.1-opt-merge
2007-06-03 22:52:02 -07:00
ramil/ram@ramil.myoffice.izhnet.ru
a4e6061a4c Merge mysql.com:/home/ram/work/b28652/b28652.5.0
into  mysql.com:/home/ram/work/b28652/b28652.5.1
2007-06-04 10:14:28 +05:00
sergefp@mysql.com
ad18c4b95c BUG#28427: fix typo, s/bool/uint/ 2007-06-02 21:43:04 +04:00
ibabaev@bk-internal.mysql.com
4bc1738be0 Merge bk-internal.mysql.com:/data0/bk/mysql-5.0
into  bk-internal.mysql.com:/data0/bk/mysql-5.0-opt
2007-06-02 00:57:25 +02:00
evgen@moonbone.local
fc01b0995d Bug#28427: Columns were renamed instead of moving by ALTER TABLE.
To avoid unnecessary work the mysql_alter_table function takes the
list of table fields and applies all changes to it (drops/moves/renames/etc).
Then this function compares the new list and the old one. If the changes
require only .frm to be modified then the actual data isn't copied. To detect
changes all columns attributes but names are compared. When a column has been
moved and has replaced another column with the same attributes except name
the mysql_alter_table function wrongly decides that two fields has been just
renamed. As a result the data from the moved column and from all columns
after it is not copied.

Now the mysql_alter_table function forces table data copying by setting
the need_copy_table flag when it finds a moved column. The flag is set at
the stage when the modified fields are created.
2007-06-02 01:21:18 +04:00
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
2b2a80733d Fix for bug #28652: MySQL (with-debug=full) asserts when alter table operations
Problem: we may create a deadlock committing changes in the mysql_alter_table() when 
LOCK_open is set. Moreover, "in some variants of the ALTER TABLE commit
happens earlier, outside of LOCK_open, in other later - inside. It's no good, a storage 
engine code that is called in between could expect a consistency - either there is a 
transaction or there is not".
Fix: move the commit to happen earlier and outside of the LOCK_open.
2007-06-01 22:53:50 +05:00
holyfoot/hf@mysql.com/hfmain.(none)
c17b48fb7b Bug #28477 innodb assertion and crash during alter table to add/drop partition.
The bug was repeated on MyISAM tables, so isn't InnoDB specific.
Reason of the bug is that partition-related members of TABLE_SHARE
wasn't properly updated after ALTER command. So if other thread doesn't
reread frm file, and just uses cached SHARE, it uses wrong data
2007-06-01 19:44:09 +05:00
kostja@bodhi.(none)
679a264357 A post-merge fix. 2007-06-01 13:33:57 +04:00
kostja@bodhi.(none)
16633169e4 Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  bodhi.(none):/opt/local/work/mysql-5.1-runtime
2007-06-01 12:12:06 +04:00
ibabaev@bk-internal.mysql.com
d460dc700a Merge bk-internal.mysql.com:/data0/bk/mysql-5.1
into  bk-internal.mysql.com:/data0/bk/mysql-5.1-opt
2007-06-01 06:33:37 +02:00
kostja@vajra.(none)
568bf9e38a Fix a compile-time warning. 2007-05-28 16:31:16 +04:00
kostja@vajra.(none)
c759487769 5.1 version of a fix and test cases for bugs:
Bug#4968 ""Stored procedure crash if cursor opened on altered table"
Bug#6895 "Prepared Statements: ALTER TABLE DROP COLUMN does nothing"
Bug#19182 "CREATE TABLE bar (m INT) SELECT n FROM foo; doesn't work from 
stored procedure."
Bug#19733 "Repeated alter, or repeated create/drop, fails"
Bug#22060 "ALTER TABLE x AUTO_INCREMENT=y in SP crashes server"
Bug#24879 "Prepared Statements: CREATE TABLE (UTF8 KEY) produces a 
growing key length" (this bug is not fixed in 5.0)

Re-execution of CREATE DATABASE, CREATE TABLE and ALTER TABLE 
statements in stored routines or as prepared statements caused
incorrect results (and crashes in versions prior to 5.0.25).

In 5.1 the problem occured only for CREATE DATABASE, CREATE TABLE
SELECT and CREATE TABLE with INDEX/DATA DIRECTOY options).
  
The problem of bugs 4968, 19733, 19282 and 6895 was that functions
mysql_prepare_table, mysql_create_table and mysql_alter_table are not
re-execution friendly: during their operation they modify contents
of LEX (members create_info, alter_info, key_list, create_list),
thus making the LEX unusable for the next execution.
In particular, these functions removed processed columns and keys from
create_list, key_list and drop_list. Search the code in sql_table.cc 
for drop_it.remove() and similar patterns to find evidence.
  
The fix is to supply to these functions a usable copy of each of the
above structures at every re-execution of an SQL statement. 
  
To simplify memory management, LEX::key_list and LEX::create_list
were added to LEX::alter_info, a fresh copy of which is created for
every execution.
  
The problem of crashing bug 22060 stemmed from the fact that the above 
metnioned functions were not only modifying HA_CREATE_INFO structure 
in LEX, but also were changing it to point to areas in volatile memory
of the execution memory root.
   
The patch solves this problem by creating and using an on-stack
copy of HA_CREATE_INFO in mysql_execute_command.

Additionally, this patch splits the part of mysql_alter_table
that analizes and rewrites information from the parser into
a separate function - mysql_prepare_alter_table, in analogy with
mysql_prepare_table, which is renamed to mysql_prepare_create_table.
2007-05-28 15:30:01 +04:00
ibabaev@bk-internal.mysql.com
faf19f9d60 Merge bk-internal.mysql.com:/data0/bk/mysql-5.1
into  bk-internal.mysql.com:/data0/bk/mysql-5.1-opt
2007-05-28 06:25:03 +02:00
igor@olga.mysql.com
48fe280271 Post-merge fix. 2007-05-27 20:14:50 -07:00
kostja@vajra.(none)
0162745cff Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  vajra.(none):/opt/local/work/mysql-5.1-runtime
2007-05-24 19:34:14 +04:00
jani@linux-th5m.site
f1807e1f25 Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-5.1
into  linux-th5m.site:/home/my/mysql-5.1-marvel
2007-05-24 15:26:10 +03:00
jani@a88-113-38-195.elisa-laajakaista.fi
fc3b3a0a86 Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-5.1
into  a88-113-38-195.elisa-laajakaista.fi:/home/my/bk/mysql-5.1-marvel
2007-05-24 13:24:36 +03:00
evgen@moonbone.local
c65b50378a sql_table.cc:
After merge fix.
2007-05-23 15:45:37 +04:00
dlenev@mockturtle.local
8e8f4c05cc 5.1 version of fix for:
Bug #23667 "CREATE TABLE LIKE is not isolated from alteration
              by other connections"
  Bug #18950 "CREATE TABLE LIKE does not obtain LOCK_open"
As well as:
  Bug #25578 "CREATE TABLE LIKE does not require any privileges
              on source table".

The first and the second bugs resulted in various errors and wrong
binary log order when one tried to execute concurrently CREATE TABLE LIKE
statement and DDL statements on source table or DML/DDL statements on its
target table.

The problem was caused by incomplete protection/table-locking against
concurrent statements implemented in mysql_create_like_table() routine.
We solve it by simply implementing such protection in proper way.
Most of actual work for 5.1 was already done by fix for bug 20662 and
preliminary patch changing locking in ALTER TABLE.

The third bug allowed user who didn't have any privileges on table create
its copy and therefore circumvent privilege check for SHOW CREATE TABLE.

This patch solves this problem by adding privilege check, which was missing.

Finally it also removes some duplicated code from mysql_create_like_table()
and thus fixes bug #26869 "TABLE_LIST::table_name_length inconsistent with
TABLE_LIST::table_name".
2007-05-23 15:26:16 +04:00
dlenev@mockturtle.local
c07b3670d7 5.0 version of fix for:
Bug #23667 "CREATE TABLE LIKE is not isolated from alteration
             by other connections"
 Bug #18950 "CREATE TABLE LIKE does not obtain LOCK_open"
As well as:
 Bug #25578 "CREATE TABLE LIKE does not require any privileges
             on source table".

The first and the second bugs resulted in various errors and wrong
binary log order when one tried to execute concurrently CREATE TABLE LIKE
statement and DDL statements on source table or DML/DDL statements on its
target table.

The problem was caused by incomplete protection/table-locking against
concurrent statements implemented in mysql_create_like_table() routine.
We solve it by simply implementing such protection in proper way (see
comment for sql_table.cc for details).

The third bug allowed user who didn't have any privileges on table create
its copy and therefore circumvent privilege check for SHOW CREATE TABLE.

This patch solves this problem by adding privilege check, which was missing.

Finally it also removes some duplicated code from mysql_create_like_table().

Note that, altough tests covering concurrency-related aspects of CREATE TABLE
LIKE behaviour will only be introduced in 5.1, they were run manually for
this patch as well.
2007-05-23 15:22:13 +04:00
evgen@moonbone.local
349f1023bf Merge moonbone.local:/mnt/gentoo64/work/bk-trees/mysql-5.0-opt
into  moonbone.local:/mnt/gentoo64/work/test-5.1-opt-mysql
2007-05-23 13:46:10 +04:00
svoj@june.mysql.com
442969fd16 Merge mysql.com:/home/svoj/devel/bk/mysql-5.1
into  mysql.com:/home/svoj/devel/mysql/merge/mysql-5.1-engines
2007-05-23 12:41:30 +05:00
igor@olga.mysql.com
b50d17a9b5 Added initializations to avoid compiler warnings. 2007-05-21 16:44:36 -07:00
evgen@moonbone.local
90aa02715d Bug#27507: Wrong DATETIME value was allowed by ALTER TABLE in the NO_ZERO_DATE
mode.

When a new DATE/DATETIME field without default value is being added by the
ALTER TABLE the '0000-00-00' value is used as the default one. But it wasn't
checked whether such value was allowed by the set sql mode. Due to this
'0000-00-00' values was allowed for DATE/DATETIME fields even in the
NO_ZERO_DATE mode.

Now the mysql_alter_table() function checks whether the '0000-00-00' value
is allowed for DATE/DATETIME fields by the set sql mode.
The new error_if_not_empty flag is used in the mysql_alter_table() function
to indicate that it should abort if the table being altered isn't empty.
The new new_datetime_field field is used in the mysql_alter_table() function
for error throwing purposes. 
The new error_if_not_empty parameter is added to the copy_data_between_tables()
function to indicate the it should return error if the source table isn't empty.
2007-05-22 00:22:53 +04:00
dlenev@mockturtle.local
b0dfdc2b83 Patch changing how ALTER TABLE implementation handles table locking
and invalidation in the most general case (non-temporary table and
not simple RENAME or ENABLE/DISABLE KEYS or partitioning command).

See comment for sql/sql_table.cc for more information.

These changes are prerequisite for 5.1 version of fix for bug #23667
"CREATE TABLE LIKE is not isolated from alteration by other connections"
2007-05-19 10:49:56 +04:00
kostja@vajra.(none)
0a061c902b Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  vajra.(none):/opt/local/work/mysql-5.1-runtime
2007-05-15 17:54:11 +04:00
dlenev@mockturtle.local
d748e4dedd Fix for bug #28415 "Some ALTER TABLE statements no longer work under LOCK
TABLES" and failures of alter_table.test on Windows which occured after
pushing fix for bugs #20662, #20903, #24508, #24738 (various problems
with CREATE TABLE SELECT).

ALTER TABLE statements which were handled using "fast" alter table
optimization were not properly working under LOCK TABLES if table
was transactional (for all table types under Windows).

Code implementing "fast" version of ALTER TABLE tried to open and
lock table using open_ltable() after renaming .FRM files (which
corresponds to renaming tables in normal case) in some cases
(for transactional tables or on Windows). This caused problems
under LOCK TABLES and conflicted with name-lock taken by 
ALTER TABLE RENAME on target tables.

This patch solves this issue by using reopen_name_locked_table()
instead of open_ltable().
2007-05-14 22:38:26 +04:00
dlenev@mockturtle.local
4cafc8eeec Fix for:
Bug #20662 "Infinite loop in CREATE TABLE IF NOT EXISTS ... SELECT
              with locked tables"
  Bug #20903 "Crash when using CREATE TABLE .. SELECT and triggers"
  Bug #24738 "CREATE TABLE ... SELECT is not isolated properly"
  Bug #24508 "Inconsistent results of CREATE TABLE ... SELECT when
              temporary table exists"

Deadlock occured when one tried to execute CREATE TABLE IF NOT
EXISTS ... SELECT statement under LOCK TABLES which held
read lock on target table.
Attempt to execute the same statement for already existing
target table with triggers caused server crashes.
Also concurrent execution of CREATE TABLE ... SELECT statement
and other statements involving target table suffered from
various races (some of which might've led to deadlocks).
Finally, attempt to execute CREATE TABLE ... SELECT in case
when a temporary table with same name was already present
led to the insertion of data into this temporary table and
creation of empty non-temporary table.
 
All above problems stemmed from the old implementation of CREATE
TABLE ... SELECT in which we created, opened and locked target
table without any special protection in a separate step and not
with the rest of tables used by this statement.
This underminded deadlock-avoidance approach used in server
and created window for races. It also excluded target table
from prelocking causing problems with trigger execution.

The patch solves these problems by implementing new approach to
handling of CREATE TABLE ... SELECT for base tables.
We try to open and lock table to be created at the same time as
the rest of tables used by this statement. If such table does not
exist at this moment we create and place in the table cache special
placeholder for it which prevents its creation or any other usage
by other threads.
We still use old approach for creation of temporary tables.

Note that we have separate fix for 5.0 since there we use slightly
different less intrusive approach.
2007-05-11 21:51:03 +04:00
dlenev@mockturtle.local
8b93e52e92 Fix for:
Bug #20662 "Infinite loop in CREATE TABLE IF NOT EXISTS ... SELECT
              with locked tables"
  Bug #20903 "Crash when using CREATE TABLE .. SELECT and triggers"
  Bug #24738 "CREATE TABLE ... SELECT is not isolated properly"
  Bug #24508 "Inconsistent results of CREATE TABLE ... SELECT when
              temporary table exists"
 
Deadlock occured when one tried to execute CREATE TABLE IF NOT
EXISTS ... SELECT statement under LOCK TABLES which held
read lock on target table.
Attempt to execute the same statement for already existing
target table with triggers caused server crashes.
Also concurrent execution of CREATE TABLE ... SELECT statement
and other statements involving target table suffered from
various races (some of which might've led to deadlocks).
Finally, attempt to execute CREATE TABLE ... SELECT in case
when a temporary table with same name was already present
led to the insertion of data into this temporary table and
creation of empty non-temporary table.
 
All above problems stemmed from the old implementation of CREATE
TABLE ... SELECT in which we created, opened and locked target
table without any special protection in a separate step and not
with the rest of tables used by this statement.
This underminded deadlock-avoidance approach used in server
and created window for races. It also excluded target table
from prelocking causing problems with trigger execution.
  
The patch solves these problems by implementing new approach to
handling of CREATE TABLE ... SELECT for base tables.
We try to open and lock table to be created at the same time as
the rest of tables used by this statement. If such table does not
exist at this moment we create and place in the table cache special
placeholder for it which prevents its creation or any other usage
by other threads.

We still use old approach for creation of temporary tables.

Also note that we decided to postpone introduction of some tests
for concurrent behaviour of CREATE TABLE ... SELECT till 5.1.
The main reason for this is absence in 5.0 ability to set @@debug
variable at runtime, which can be circumvented only by using several
test files with individual .opt files. Since the latter is likely
to slowdown test-suite unnecessary we chose not to push this tests
into 5.0, but run them manually for this version and later push
their optimized version into 5.1
2007-05-11 20:33:13 +04:00
istruewing@chilla.local
e2fa2becfc Merge bk-internal.mysql.com:/home/bk/mysql-5.1-engines
into  chilla.local:/home/mydev/mysql-5.1-bug17332
2007-05-10 17:30:50 +02:00
monty@mysql.com/narttu.mysql.fi
088e2395f1 WL#3817: Simplify string / memory area types and make things more consistent (first part)
The following type conversions was done:

- Changed byte to uchar
- Changed gptr to uchar*
- Change my_string to char *
- Change my_size_t to size_t
- Change size_s to size_t

Removed declaration of byte, gptr, my_string, my_size_t and size_s. 

Following function parameter changes was done:
- All string functions in mysys/strings was changed to use size_t
  instead of uint for string lengths.
- All read()/write() functions changed to use size_t (including vio).
- All protocoll functions changed to use size_t instead of uint
- Functions that used a pointer to a string length was changed to use size_t*
- Changed malloc(), free() and related functions from using gptr to use void *
  as this requires fewer casts in the code and is more in line with how the
  standard functions work.
- Added extra length argument to dirname_part() to return the length of the
  created string.
- Changed (at least) following functions to take uchar* as argument:
  - db_dump()
  - my_net_write()
  - net_write_command()
  - net_store_data()
  - DBUG_DUMP()
  - decimal2bin() & bin2decimal()
- Changed my_compress() and my_uncompress() to use size_t. Changed one
  argument to my_uncompress() from a pointer to a value as we only return
  one value (makes function easier to use).
- Changed type of 'pack_data' argument to packfrm() to avoid casts.
- Changed in readfrm() and writefrom(), ha_discover and handler::discover()
  the type for argument 'frmdata' to uchar** to avoid casts.
- Changed most Field functions to use uchar* instead of char* (reduced a lot of
  casts).
- Changed field->val_xxx(xxx, new_ptr) to take const pointers.

Other changes:
- Removed a lot of not needed casts
- Added a few new cast required by other changes
- Added some cast to my_multi_malloc() arguments for safety (as string lengths
  needs to be uint, not size_t).
- Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done
  explicitely as this conflict was often hided by casting the function to
  hash_get_key).
- Changed some buffers to memory regions to uchar* to avoid casts.
- Changed some string lengths from uint to size_t.
- Changed field->ptr to be uchar* instead of char*. This allowed us to
  get rid of a lot of casts.
- Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar
- Include zlib.h in some files as we needed declaration of crc32()
- Changed MY_FILE_ERROR to be (size_t) -1.
- Changed many variables to hold the result of my_read() / my_write() to be
  size_t. This was needed to properly detect errors (which are
  returned as (size_t) -1).
- Removed some very old VMS code
- Changed packfrm()/unpackfrm() to not be depending on uint size
  (portability fix)
- Removed windows specific code to restore cursor position as this
  causes slowdown on windows and we should not mix read() and pread()
  calls anyway as this is not thread safe. Updated function comment to
  reflect this. Changed function that depended on original behavior of
  my_pwrite() to itself restore the cursor position (one such case).
- Added some missing checking of return value of malloc().
- Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow.
- Changed type of table_def::m_size from my_size_t to ulong to reflect that
  m_size is the number of elements in the array, not a string/memory
  length.
- Moved THD::max_row_length() to table.cc (as it's not depending on THD).
  Inlined max_row_length_blob() into this function.
- More function comments
- Fixed some compiler warnings when compiled without partitions.
- Removed setting of LEX_STRING() arguments in declaration (portability fix).
- Some trivial indentation/variable name changes.
- Some trivial code simplifications:
  - Replaced some calls to alloc_root + memcpy to use
    strmake_root()/strdup_root().
  - Changed some calls from memdup() to strmake() (Safety fix)
  - Simpler loops in client-simple.c
2007-05-10 12:59:39 +03:00
tomas@whalegate.ndb.mysql.com
19a2814f47 Merge whalegate.ndb.mysql.com:/home/tomas/mysql-5.1-opt
into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.1-single-user
2007-05-10 08:06:09 +02:00
gni@dev3-221.dev.cn.tlan
305d0eaf02 Merge dev3-221.dev.cn.tlan:/home/ngb/mysql/mysql-5.1/mysql-5.1-new-ndb-bj
into  dev3-221.dev.cn.tlan:/home/ngb/mysql/mysql-5.1/mysql-5.1-new-ndb
2007-05-08 09:52:27 +08:00
cmiller@zippy.cornsilk.net
79d652408d Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.1-unified02
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.1-comeng-unification
2007-05-07 16:59:03 -04:00
acurtis/antony@ltamd64.xiphis.org
a4dbc0990c Merge xiphis.org:/home/antony/work2/mysql-5.1-engines
into  xiphis.org:/home/antony/work2/mysql-5.1-engines.merge
2007-05-04 23:35:14 -07:00
tsmith@quadxeon.mysql.com
13cfd9471d Merge quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/maint/50
into  quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/maint/51
2007-05-01 10:38:19 +02:00
tsmith@quadxeon.mysql.com
44af4144e6 Bug #27653: Temp table can't be created if lower_case_table_names=1 and
tmpdir has uppercase

Fix: don't convert mysql_tmpdir to lower case when building the path to a
temporary table
2007-04-30 23:16:46 +02:00
cmiller@zippy.cornsilk.net
71a0ecee6e Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-enterprise-formergecomm
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.1-unified02
2007-04-27 16:45:01 -04:00
istruewing@chilla.local
e327818c28 Merge bk-internal.mysql.com:/home/bk/mysql-5.1-engines
into  chilla.local:/home/mydev/mysql-5.1-wl2936-two
2007-04-27 19:09:39 +02:00
cmiller@zippy.cornsilk.net
c9cbc1e7f3 Merge mysqldev@production.mysql.com:my/mysql-5.0-release
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
2007-04-26 11:51:37 -04:00
cmiller@zippy.cornsilk.net
9dd7812fec Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-formerge51
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-enterprise-formergecomm
2007-04-25 08:14:46 -04:00
msvensson@pilot.blaudden
6e4acae645 Merge pilot.blaudden:/home/msvensson/mysql/bug25262/my50-bug25262
into  pilot.blaudden:/home/msvensson/mysql/mysql-5.0-maint
2007-04-25 12:08:39 +02:00
msvensson@pilot.blaudden
5fdd4112eb Merge pilot.blaudden:/home/msvensson/mysql/bug25262/my51-bug25262
into  pilot.blaudden:/home/msvensson/mysql/mysql-5.1-maint
2007-04-25 11:13:41 +02:00
gni@dev3-221.dev.cn.tlan
1869b2c4d0 Merge dev3-221.dev.cn.tlan:/home/ngb/mysql/mysql-5.1/mysql-5.1-new-ndb-bj
into  dev3-221.dev.cn.tlan:/home/ngb/mysql/mysql-5.1/bug18676
2007-04-24 17:34:36 +08:00
iggy@recycle.(none)
e251139c80 Merge recycle.(none):/src/mysql-5.1-maint
into  recycle.(none):/src/mysql-5.1-maint_25141
2007-04-23 17:04:24 -04:00
iggy@recycle.(none)
2a54abd582 Bug#25141 Crash Server on Partitioning command
- The function build_table_filename() builds up a string unconditionally 
using the forward slash as a path separator. Later, when the string is 
searched for FN_LIBCHAR by the set_up_table_before_create() function, a 
null pointer is returned that is finally used by strlen in the 
append_file_to_dir() function which causes the crash.
2007-04-23 13:50:34 -04:00
jamppa@bk-internal.mysql.com
82e4afb89f Merge bk-internal.mysql.com:/data0/bk/mysql-5.0
into  bk-internal.mysql.com:/data0/bk/mysql-5.0-marvel
2007-04-17 15:52:03 +02:00
jamppa@bk-internal.mysql.com
b465b30847 Merge bk-internal.mysql.com:/data0/bk/mysql-5.1
into  bk-internal.mysql.com:/data0/bk/mysql-5.1-marvel
2007-04-17 15:45:35 +02:00
serg@janus.mylan
00479a441d wl#2936 post-merge fixes 2007-04-16 18:16:17 +02:00
serg@sergbook.mysql.com
6bc9bc92df Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  sergbook.mysql.com:/usr/home/serg/Abk/mysql-5.1-wl2936
2007-04-16 10:37:50 +02:00
gni/root@dev3-221.dev.cn.tlan
648b03aa14 BUG#18676 In order to coincide with 5.0 mysqld error code after bug#18676, Map the 4009 ndb error code to 157 mysql error code 2007-04-16 15:15:47 +08:00
jani@ua141d10.elisa.omakaista.fi
335153121b Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-5.0
into  ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.0-marvel
2007-04-12 12:50:02 +03:00
igor@olga.mysql.com
e04289704d Merge olga.mysql.com:/home/igor/mysql-5.0-opt
into  olga.mysql.com:/home/igor/mysql-5.1-opt
2007-04-11 15:12:49 -07:00
jani@ua141d10.elisa.omakaista.fi
b4ba815967 Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-5.1
into  ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.1-marvel
2007-04-10 16:28:47 +03:00
gluh@mysql.com/eagle.(none)
6b2cb10a04 Merge sgluhov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  mysql.com:/home/gluh/MySQL/Bugs/5.0.27069
2007-04-10 15:02:04 +05:00
gluh@mysql.com/eagle.(none)
b80d373b6a Bug#27069 set with identical elements are created(additional fix)
issue an error in strict mode
if enum|set column has duplicates members in 'create table'
2007-04-10 15:01:04 +05:00
holyfoot/hf@hfmain.(none)
33ed2ead2a Merge bk@192.168.21.1:mysql-5.1
into  mysql.com:/d2/hf/mrg/mysql-5.1-opt
2007-04-09 11:07:20 +05:00
holyfoot/hf@mysql.com/hfmain.(none)
65535824ba Merge bk@192.168.21.1:mysql-5.0
into  mysql.com:/d2/hf/mrg/mysql-5.0-opt
2007-04-09 11:06:28 +05:00
kent@kent-amd64.(none)
a16289d550 Merge kboortz@bk-internal.mysql.com:/home/bk/mysql-5.1
into  mysql.com:/home/kent/bk/tmp4/mysql-5.1-engines
2007-04-08 20:48:07 +02:00
kent@mysql.com/kent-amd64.(none)
c282dd3715 Merge kboortz@bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/kent/bk/tmp4/mysql-5.0-engines
2007-04-08 20:46:40 +02:00
holyfoot/hf@hfmain.(none)
ce426dd622 Merge bk@192.168.21.1:mysql-5.1-opt
into  mysql.com:/d2/hf/mrg/mysql-5.1-opt
2007-04-07 14:59:53 +05:00
holyfoot/hf@mysql.com/hfmain.(none)
2a5bcc3f3e Merge bk@192.168.21.1:mysql-5.0
into  mysql.com:/d2/hf/mrg/mysql-5.0-opt
2007-04-07 11:36:02 +05:00
acurtis/antony@xiphis.org/ltamd64.xiphis.org
d0e79056b1 Merge acurtis@bk-internal:/home/bk/mysql-5.0-engines
into  xiphis.org:/home/antony/work2/mysql-5.0-engines.merge
2007-04-06 18:07:02 +00:00
acurtis/antony@ltamd64.xiphis.org
78734f145d Merge acurtis@bk-internal.mysql.com:/home/bk/mysql-5.1-engines
into  xiphis.org:/home/antony/work2/mysql-5.1-engines.merge
2007-04-06 17:18:26 +00:00
holyfoot/hf@hfmain.(none)
d08216f1b7 Merge mysql.com:/d2/hf/mrg/mysql-5.0-opt
into  mysql.com:/d2/hf/mrg/mysql-5.1-opt
2007-04-06 12:45:07 +05:00
Justin.He/justin.he@dev3-240.dev.cn.tlan
c7da27b5b2 Merge dev3-240.dev.cn.tlan:/home/justin.he/mysql/mysql-5.0/mysql-5.0-ndb
into  dev3-240.dev.cn.tlan:/home/justin.he/mysql/mysql-5.0/mysql-5.0-ndb-bj.merge
2007-04-05 11:30:19 +08:00
Justin.He/justin.he@dev3-240.dev.cn.tlan
fdf57c7ac2 Merge dev3-240.dev.cn.tlan:/home/justin.he/mysql/mysql-5.1/mysql-5.1-new-ndb
into  dev3-240.dev.cn.tlan:/home/justin.he/mysql/mysql-5.1/mysql-5.1-new-ndb-bj.merge
2007-04-05 10:47:40 +08:00
gni/root@dev3-221.dev.cn.tlan
888fcd6f7e recovery from 5.0 merge for bug18676 2007-04-04 15:22:37 +08:00
gni/root@dev3-221.dev.cn.tlan
99895eb6c3 Merge dev3-221.dev.cn.tlan:/home/ngb/mysql/mysql-5.0/bug18676
into  dev3-221.dev.cn.tlan:/home/ngb/mysql/mysql-5.1/bug18676
2007-04-04 14:30:12 +08:00
cmiller@zippy.cornsilk.net
5f4dfdd5fe Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
2007-04-03 09:20:22 -04:00
jamppa@bk-internal.mysql.com
cbfd66e754 Merge bk-internal.mysql.com:/data0/bk/mysql-5.0
into  bk-internal.mysql.com:/data0/bk/mysql-5.0-marvel
2007-04-03 13:55:20 +02:00
jani@ua141d10.elisa.omakaista.fi
e4fde44948 Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-5.1-marvel
into  ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.1-marvel
2007-04-03 14:51:32 +03:00
gluh@mysql.com/eagle.(none)
2d47f0cb1b Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte 2007-04-03 16:13:27 +05:00
gni/root@dev3-221.dev.cn.tlan
98e5757618 BUG#18676 when cluster storage engine is down, misleading error message on create table with 4009. 2007-04-03 18:44:29 +08:00
Justin.He/justin.he@dev3-240.dev.cn.tlan
cd1919321a Bug#25875, Newly created table through CREATE TABLE .. LIKE has no ndb_dd attributes 2007-04-03 16:40:16 +08:00
gluh@mysql.com/eagle.(none)
54bc9c3d77 Bug#27069 set with identical elements are created
added the check for unique elements count in SET
2007-04-02 15:01:19 +05:00
svoj@april.(none)
51710387ab Merge mysql.com:/home/svoj/devel/bk/mysql-5.0-engines
into  mysql.com:/home/svoj/devel/mysql/BUG26138/mysql-5.1-engines
2007-03-31 17:29:40 +05:00
evgen@moonbone.local
f470ac2000 Merge moonbone.local:/mnt/gentoo64/work/bk-trees/mysql-5.0-opt
into  moonbone.local:/mnt/gentoo64/work/bk-trees/mysql-5.1-opt
2007-03-31 02:42:40 +04:00
evgen@sunlight.local
7c42232d1d Bug#23233: 0 as LAST_INSERT_ID() after INSERT .. ON DUPLICATE in the
NO_AUTO_VALUE_ON_ZERO mode.

In the NO_AUTO_VALUE_ON_ZERO mode the table->auto_increment_field_not_null
variable is used to indicate that a non-NULL value was specified by the user
for an auto_increment column. When an INSERT .. ON DUPLICATE updates the
auto_increment field this variable is set to true and stays unchanged for the
next insert operation. This makes the next inserted row sometimes wrongly have
0 as the value of the auto_increment field.

Now the fill_record() function resets the table->auto_increment_field_not_null
variable before filling the record.
The table->auto_increment_field_not_null variable is also reset by the
open_table() function for a case if we missed some auto_increment_field_not_null
handling bug.
Now the table->auto_increment_field_not_null is reset at the end of the
mysql_load() function.

Reset the table->auto_increment_field_not_null variable after each
write_row() call in the copy_data_between_tables() function.
2007-03-30 18:13:33 +04:00
svoj@mysql.com/june.mysql.com
556de62f8d BUG#26138 - REPAIR TABLE with option USE_FRM erases all records in
ARCHIVE table
ARCHIVE table was truncated by REPAIR TABLE ... USE_FRM statement.
The table handler returned its file name extensions in a wrong order.
REPAIR TABLE believed it has to use the meta file to create a new table
from it.

With the fixed order, REPAIR TABLE does now use the data file to create
a new table. So REPAIR TABLE ... USE_FRM works well with ARCHIVE engine
now.

This issue affects 5.0 only, since in 5.1 ARCHIVE engine stores meta
information and data in the same file.
2007-03-30 13:00:21 +05:00
jani@ua141d10.elisa.omakaista.fi
1c7beca65e Merge ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.0-marvel
into  ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.1-marvel
2007-03-29 17:27:42 +03:00
serg@sergbook.mysql.com
237ed0c3e5 Merge bk-internal.mysql.com:/home/bk/mysql-5.0-marvel
into  sergbook.mysql.com:/usr/home/serg/Abk/mysql-5.0
2007-03-24 17:16:53 +02:00
aelkin/elkin@andrepl.(none)
2afa90b5c5 Bug #27395 OPTION_STATUS_NO_TRANS_UPDATE is not preserved at the end of SF()
thd->options' OPTION_STATUS_NO_TRANS_UPDATE bit was not restored at the end of SF() invocation, where
SF() modified non-ta table.
As the result of this artifact it was not possible to detect whether there were any side-effects when
top-level query ends. 
If the top level query table was not modified and the bit is lost there would be no binlogging.

Fixed with preserving the bit inside of thd->no_trans_update struct. The struct agregates two bool flags
telling whether the current query and the current transaction modified any non-ta table.
The flags stmt, all are dropped at the end of the query and the transaction.
2007-03-23 17:12:58 +02:00
msvensson@pilot.blaudden
fb892abd1f Merge pilot.blaudden:/home/msvensson/mysql/bug25262/my50-bug25262
into  pilot.blaudden:/home/msvensson/mysql/bug25262/my51-bug25262
2007-03-21 18:38:08 +01:00
istruewing@chilla.local
0282c199a0 Merge chilla.local:/home/mydev/mysql-5.1-bug17332-old
into  chilla.local:/home/mydev/mysql-5.1-bug17332
2007-03-20 17:59:09 +01:00
kostja@bodhi.local
bdb10baec1 Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  bodhi.local:/opt/local/work/mysql-5.1-runtime
2007-03-20 00:42:11 +03:00
kostja@bodhi.local
a9065201d5 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  bodhi.local:/opt/local/work/mysql-5.0-runtime
2007-03-19 23:59:53 +03:00
malff/marcsql@weblab.(none)
62247621b0 Merge weblab.(none):/home/marcsql/TREE/mysql-5.0-runtime
into  weblab.(none):/home/marcsql/TREE/mysql-5.1-26503-merge
2007-03-14 15:36:11 -06:00
gkodinov/kgeorge@magare.gmz
5e2e4161d9 Bug #26794: fixed valgrind warning 2007-03-14 17:07:48 +02:00
gkodinov/kgeorge@magare.gmz
2525db66fa Bug #26794: fixed valgrind warning 2007-03-14 15:58:14 +02:00
gkodinov/kgeorge@magare.gmz
03df3bf6db Bug #26794: 5.1 part
It was syntactically correct to define 
 spatial keys over parts of columns (e.g.
 ALTER TABLE t1 ADD x GEOMETRY NOT NULL, 
   ADD SPATIAL KEY (x(32))).
 This may lead to undefined results and/or
 interpretation.
 Fixed by not allowing partial column 
 specification in a SPATIAL index definition.
2007-03-14 12:20:34 +02:00
gkodinov/kgeorge@magare.gmz
8c1f70aef6 Bug #26794:
Different set of conditions is used to verify
the validity of index definitions over a GEOMETRY
column in ALTER TABLE and CREATE TABLE. 
The difference was on how sub-keys notion validity
is checked.
Fixed by extending the CREATE TABLE condition to
support the cases allowed in ALTER TABLE.
Made the SHOW CREATE TABLE not to display spatial
indexes using the sub-key notion.
2007-03-14 11:54:20 +02:00
gkodinov/kgeorge@magare.gmz
3542315de6 Merge magare.gmz:/home/kgeorge/mysql/work/B26794-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/work/B26794-5.1-opt
2007-03-12 17:08:42 +02:00
gkodinov/kgeorge@magare.gmz
36d2a231e3 Bug #26794:
Different set of conditions is used to verify
the validity of index definitions over a GEOMETRY
column in ALTER TABLE and CREATE TABLE. 
The difference was on how sub-keys notion validity
is checked.
Fixed by extending the CREATE TABLE condition to
support the cases allowed in ALTER TABLE.
Made the SHOW CREATE TABLE not to display spatial
indexes using the sub-key notion.
2007-03-12 16:57:00 +02:00
anozdrin/alik@booka.opbmk
c666e2f276 Polishing: use constants instead of magic numbers. 2007-03-09 08:05:08 +03:00
antony@ppcg5.local
dc24473cb2 WL#2936
"Server Variables for Plugins"
  Implement support for plugins to declare server variables.
  Demonstrate functionality by removing InnoDB specific code from sql/*
  New feature for HASH - HASH_UNIQUE flag
  New feature for DYNAMIC_ARRAY - initializer accepts preallocated ptr.
  Completed support for plugin reference counting.
2007-03-02 08:43:45 -08:00
msvensson@pilot.blaudden
61140f0446 Bug#25262 Auto Increment lost when changing Engine type
- Try to copy the autoincrement value when altering the table
2007-03-01 13:43:04 +01:00
cmiller@zippy.cornsilk.net
06e3f77901 Merge mysqldev@production.mysql.com:my/build-200702201448-5.0.36/mysql-5.0-release/
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
2007-02-27 17:07:08 -05:00
monty@mysql.com/narttu.mysql.fi
cfef5d04b3 Remove compiler warnings 2007-02-27 19:31:49 +02:00
jani@a88-113-38-195.elisa-laajakaista.fi
6163508f85 Fixes for compiler warnings. 2007-02-27 11:27:04 +02:00
monty@mysql.com/narttu.mysql.fi
520d1b4144 Fixed compilations problems and warnings on windows 2007-02-23 22:48:15 +02:00
monty@mysql.com/narttu.mysql.fi
f0ae3ce9b9 Fixed compiler warnings
Fixed compile-pentium64 scripts
Fixed wrong estimate of update_with_key_prefix in sql-bench
Merge bk-internal.mysql.com:/home/bk/mysql-5.1 into mysql.com:/home/my/mysql-5.1
Fixed unsafe define of uint4korr()
Fixed that --extern works with mysql-test-run.pl
Small trivial cleanups
This also fixes a bug in counting number of rows that are updated when we have many simultanous queries
Move all connection handling and command exectuion main loop from sql_parse.cc to sql_connection.cc
Split handle_one_connection() into reusable sub functions.
Split create_new_thread() into reusable sub functions.
Added thread_scheduler; Preliminary interface code for future thread_handling code.

Use 'my_thread_id' for internal thread id's
Make thr_alarm_kill() to depend on thread_id instead of thread
Make thr_abort_locks_for_thread() depend on thread_id instead of thread
In store_globals(), set my_thread_var->id to be thd->thread_id.
Use my_thread_var->id as basis for my_thread_name()
The above changes makes the connection we have between THD and threads more soft.

Added a lot of DBUG_PRINT() and DBUG_ASSERT() functions
Fixed compiler warnings
Fixed core dumps when running with --debug
Removed setting of signal masks (was never used)
Made event code call pthread_exit() (portability fix)
Fixed that event code doesn't call DBUG_xxx functions before my_thread_init() is called.
Made handling of thread_id and thd->variables.pseudo_thread_id uniform.
Removed one common 'not freed memory' warning from mysqltest
Fixed a couple of usage of not initialized warnings (unlikely cases)
Suppress compiler warnings from bdb and (for the moment) warnings from ndb
2007-02-23 13:13:55 +02:00
cmiller@zippy.cornsilk.net
6e096ee8d9 Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE

Profiling is only partially functional on some architectures.  Where 
there is no getrusage() system call, presently Null values are 
returned where it would be required.  Notably, Windows needs some love 
applied to make it as useful.

  Syntax this adds:
  
  SHOW PROFILES
  
  SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
   where "n" is an integer
   and "types" is zero or many (comma-separated) of
      "CPU"
      "MEMORY" (not presently supported)
      "BLOCK IO"
      "CONTEXT SWITCHES"
      "PAGE FAULTS"
      "IPC"
      "SWAPS"
      "SOURCE"
      "ALL"

It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by 
default.

This patch abstracts setting THDs' "proc_info" behind a macro that 
can be used as a hook into the profiling code when profiling 
support is compiled in.  All future code in this line should use
that mechanism for setting thd->proc_info.

---

Tests are now set to omit the statistics.

---

Adds an Information_schema table, "profiling" for access to 
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.  

Updated test results.
---
Include more thorough profiling tests.

Improve support for prepared statements.

Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.

Limit the size of captured query text.

No longer log queries that are zero length.
2007-02-22 10:03:08 -05:00
monty@mysql.com/narttu.mysql.fi
26aa385bc5 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/my/mysql-5.0
2007-02-21 14:07:08 +02:00
istruewing@chilla.local
48a596edac Bug#17332 - changing key_buffer_size on a running server
can crash under load

Resizing a key cache while it was in heavy use could crash the
server. There were several race conditions.

I reworked some of the algorithms to fix the race conditions.

No test case. Repeating the crashes requires heavy concurrent
load on the key cache. A test script is attached to the bug report.

More explanations to the changes are contained in a text file
attached to the bug report.
2007-01-31 18:49:07 +01:00
monty@narttu.mysql.fi
bb464613ce Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  mysql.com:/home/my/mysql-5.1
2007-01-29 01:57:07 +02:00
monty@mysql.com/narttu.mysql.fi
410fc81a72 After merge fixes
Removed a lot of compiler warnings
Removed not used variables, functions and labels
Initialize some variables that could be used unitialized (fatal bugs)
%ll -> %l
2007-01-29 01:47:35 +02:00
monty@narttu.mysql.fi
8a80e36ac3 Merge mysql.com:/home/my/mysql-5.0
into  mysql.com:/home/my/mysql-5.1
Merge of 'remove compiler warnings when using -Wshadow'
2007-01-27 03:46:45 +02:00
gluh@eagle.(none)
67db27537b Merge mysql.com:/home/gluh/MySQL/Merge/5.1-opt
into  mysql.com:/home/gluh/MySQL/Merge/5.1
2007-01-26 16:46:01 +04:00
gluh@mysql.com/eagle.(none)
45f61a06fb Merge mysql.com:/home/gluh/MySQL/Merge/5.0-opt
into  mysql.com:/home/gluh/MySQL/Merge/5.0
2007-01-26 16:36:50 +04:00
dlenev@mockturtle.local
631d3c9c1f Merge bk-internal.mysql.com:/home/bk/mysql-5.1-marvel
into  mockturtle.local:/home/dlenev/src/mysql-5.1-merge
2007-01-25 14:58:45 +03:00
gluh@eagle.(none)
7b291e36cf Merge mysql.com:/home/gluh/MySQL/Merge/5.1
into  mysql.com:/home/gluh/MySQL/Merge/5.1-opt
2007-01-24 19:54:40 +04:00
gkodinov/kgeorge@macbook.gmz
17a0207ece Merge macbook.gmz:/Users/kgeorge/mysql/work/mysql-5.0-opt
into  macbook.gmz:/Users/kgeorge/mysql/work/merge-5.1-opt
2007-01-23 12:34:50 +02:00
gluh@mysql.com/eagle.(none)
e34b0056f2 Merge mysql.com:/home/gluh/MySQL/Merge/5.0
into  mysql.com:/home/gluh/MySQL/Merge/5.0-opt
2007-01-23 14:08:58 +04:00
monty@narttu.mysql.fi
7df1dbcd74 Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  mysql.com:/home/my/mysql-5.1
2007-01-22 19:18:22 +02:00
monty@mysql.com/narttu.mysql.fi
2dcc7110c9 Give warnings for unused objects
Changed error message to be compatible with old error file
Added new error message for new DUP_ENTRY syntax
2007-01-22 18:42:52 +02:00
monty@mysql.com/narttu.mysql.fi
a04157fbb3 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/my/mysql-5.0
2007-01-22 14:04:40 +02:00
dlenev@mockturtle.local
92704745f7 Merge bk-internal.mysql.com:/home/bk/mysql-5.0-runtime
into  mockturtle.local:/home/dlenev/src/mysql-5.0-bg25044
2007-01-20 14:10:20 +03:00
dlenev@mockturtle.local
83bcfa2541 Merge mockturtle.local:/home/dlenev/src/mysql-5.0-bg25044
into  mockturtle.local:/home/dlenev/src/mysql-5.1-bg25044
2007-01-19 23:23:45 +03:00
dlenev@mockturtle.local
7b1a94ef78 Fix for bug #25044 "ALTER TABLE ... ENABLE KEYS acquires global 'opening
tables' lock."

Execution of ALTER TABLE ... ENABLE KEYS on a table (which can take rather
long time) prevented concurrent execution of all statements using tables.

The problem was caused by the fact that we were holding LOCK_open mutex
during whole duration of this statement and particularly during call
to handler::enable_indexes(). This behavior was introduced as part of the
fix for bug 14262 "SP: DROP PROCEDURE|VIEW (maybe more) write to binlog
too late (race cond)"

The patch simply restores old behavior. Note that we can safely do this as
this operation takes exclusive lock (similar to name-lock) which blocks both
DML and DDL on the table being altered.

It also introduces mysql-test/include/wait_show_pattern.inc helper script
which is used to make test-case for this bug robust enough.
2007-01-19 23:15:59 +03:00
evgen@moonbone.local
d7d5db64ec Bug#25172: Not checked buffer size leads to a server crash.
After fix for bug#21798 JOIN stores the pointer to the buffer for sorting
fields. It is used while sorting for grouping and for ordering. If ORDER BY
clause has more elements then the GROUP BY clause then a memory overrun occurs.

Now the length of the ORDER BY list is always passed to the 
make_unireg_sortorder() function and it allocates buffer big enough to be
used for bigger list.
2007-01-19 18:34:09 +03:00
kostja@bodhi.local
d7a63c0f6a Manual merge. 2007-01-15 13:10:07 +03:00
kostja@bodhi.local
d53072d190 Merge bk-internal.mysql.com:/home/bk/mysql-4.1-runtime
into  bodhi.local:/opt/local/work/mysql-4.1-4968-to-push
2007-01-15 13:03:21 +03:00
malff/marcsql@weblab.(none)
f043c7c4bf Merge malff@bk-internal.mysql.com:/home/bk/mysql-5.1-runtime
into  weblab.(none):/home/marcsql/TREE/mysql-5.1-25183
2007-01-11 09:15:44 -07:00
cmiller@zippy.cornsilk.net
68428545a5 Merge bk-internal.mysql.com:/home/bk/mysql-5.0-community
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
2007-01-03 18:24:28 -05:00
cmiller@zippy.cornsilk.net
10cdf90bd3 Bug#24795: Add SHOW PROFILE
Patch contributed by Jeremy Cole.  CLA received Oct 2006 by Kaj Arnö

Add rudimentary query profiling support.
2007-01-03 17:15:10 -05:00
tomas@poseidon.
044c410968 Merge tulin@bk-internal.mysql.com:/home/bk/mysql-5.1
into  poseidon.:/home/tomas/mysql-5.1-new-ndb
2006-12-27 11:01:54 +01:00
kent@kent-amd64.(none)
be15e3bc15 Merge mysql.com:/home/kent/bk/main/mysql-5.0
into  mysql.com:/home/kent/bk/main/mysql-5.1
2006-12-23 20:20:40 +01:00
kent@mysql.com/kent-amd64.(none)
226a5c833f Many files:
Changed header to GPL version 2 only
2006-12-23 20:17:15 +01:00
mskold/marty@mysql.com/linux.site
3587ee8e4e bug#24667 After ALTER TABLE operation ndb_dd table becomes regular ndb: ALTER TABLE must specify STORAGE explicitely to change it, + post review changes 2006-12-19 23:20:43 +01:00
malff/marcsql@weblab.(none)
f2347e402d Bug#25183 (Compiler warnings in the sql directory (GCC 4.1))
Fixed compiler warnings.

In set_var.cc, the code was not properly returning an error code
if close_cached_tables() failed.

In sql_tables.cc, the code was not returning properly an error code
if lock_table_names() failed.

Both cases are bugs, introduced in 5.1 only by recent changes.
2006-12-19 15:02:37 -07:00
mskold/marty@mysql.com/linux.site
dab48d5df2 bug#24667 After ALTER TABLE operation ndb_dd table becomes regular ndb: copy tablespace from old table in copying alter table 2006-12-19 15:53:46 +01:00
monty@mysql.com/narttu.mysql.fi
9d3fda77c8 After merge fixes:
- Remove compiler warnings
- Fix merge errors
- Indentation fixes
2006-12-15 06:21:15 +02:00
monty@mysql.com/narttu.mysql.fi
a6481aa4c7 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/my/mysql-5.0
2006-12-15 01:01:52 +02:00
monty@mysql.com/narttu.mysql.fi
88dd873de0 Fixed compiler warnings detected by option -Wshadow and -Wunused:
- Removed not used variables and functions
- Added #ifdef around code that is not used
- Renamed variables and functions to avoid conflicts
- Removed some not used arguments

Fixed some class/struct warnings in ndb
Added define IS_LONGDATA() to simplify code in libmysql.c

I did run gcov on the changes and added 'purecov' comments on almost all lines that was not just variable name changes
2006-12-15 00:51:37 +02:00
kostja@bodhi.local
92f1c76236 Post-merge fixes for Bug#4968 "Stored procedure crash if cursor opened
on altered table" and Bug#19733 "Repeated alter, or repeated 
create/drop, fails"
2006-12-12 01:50:12 +03:00
kostja@bodhi.local
758404b238 Merge bodhi.local:/opt/local/work/mysql-4.1-4968
into  bodhi.local:/opt/local/work/mysql-5.0-4968-pull-from-4.1
2006-12-12 01:23:30 +03:00
pgalbraith@bk-internal.mysql.com
23f0c6d765 Merge bk-internal.mysql.com:/data0/bk/mysql-5.1
into  bk-internal.mysql.com:/data0/bk/mysql-5.1-arch
2006-12-09 02:34:42 +01:00
kostja@bodhi.local
90072e69b3 A fix and test cases for
Bug#4968 "Stored procedure crash if cursor opened on altered table"
Bug#19733 "Repeated alter, or repeated create/drop, fails"
Bug#19182 "CREATE TABLE bar (m INT) SELECT n FROM foo; doesn't work from 
stored procedure."
Bug#6895 "Prepared Statements: ALTER TABLE DROP COLUMN does nothing"
Bug#22060 "ALTER TABLE x AUTO_INCREMENT=y in SP crashes server"

Test cases for bugs 4968, 19733, 6895 will be added in 5.0.

Re-execution of CREATE DATABASE, CREATE TABLE and ALTER TABLE 
statements in stored routines or as prepared statements caused
incorrect results (and crashes in versions prior to 5.0.25).
In 5.1 the problem occured only for CREATE DATABASE, CREATE TABLE
SELECT and CREATE TABLE with INDEX/DATA DIRECTOY options).

The problem of bugs 4968, 19733, 19282 and 6895 was that functions
mysql_prepare_table, mysql_create_table and mysql_alter_table were not
re-execution friendly: during their operation they used to modify contents
of LEX (members create_info, alter_info, key_list, create_list),
thus making the LEX unusable for the next execution.
In particular, these functions removed processed columns and keys from
create_list, key_list and drop_list. Search the code in sql_table.cc 
for drop_it.remove() and similar patterns to find evidence.

The fix is to supply to these functions a usable copy of each of the
above structures at every re-execution of an SQL statement. 

To simplify memory management, LEX::key_list and LEX::create_list
were added to LEX::alter_info, a fresh copy of which is created for
every execution.

The problem of crashing bug 22060 stemmed from the fact that the above 
metnioned functions were not only modifying HA_CREATE_INFO structure in 
LEX, but also were changing it to point to areas in volatile memory of 
the execution memory root.
 
The patch solves this problem by creating and using an on-stack
copy of HA_CREATE_INFO (note that code in 5.1 already creates and
uses a copy of this structure in mysql_create_table()/alter_table(),
but this approach didn't work well for CREATE TABLE SELECT statement).
2006-12-08 02:20:09 +03:00
andrey@example.com
12a68db3d3 Additional fix for bug#22369 2006-12-07 13:57:39 +01:00
msvensson@neptunus.(none)
23a059b224 Merge bk-internal:/home/bk/mysql-5.1-maint
into  neptunus.(none):/home/msvensson/mysql/mysql-5.1-maint
2006-12-05 10:54:17 +01:00
msvensson@neptunus.(none)
971c783f7d Merge neptunus.(none):/home/msvensson/mysql/mysql-5.1
into  neptunus.(none):/home/msvensson/mysql/mysql-5.1-maint
2006-12-04 19:11:55 +01:00
andrey@example.com
44656a234c Merge ahristov@bk-internal.mysql.com:/home/bk/mysql-5.1-maint
into  example.com:/work/bug22369-v2/my51
2006-12-04 18:31:24 +01:00
andrey@example.com
e6a4727779 Fix for bug#22369: Alter table rename combined
with other alterations causes lost tables

Using RENAME clause combined with other clauses of ALTER TABLE led to
data loss (the data was there but not accessible). This could happen if the
changes do not change the table much. Adding and droppping of fields and
indices was safe. Renaming a column with MODIFY or CHANGE was unsafe operation,
if the actual column didn't change (changing from int to int, which is a noop)
  
Depending on the storage engine (SE) the behavior is different:
1)MyISAM/MEMORY - the ALTER TABLE statement completes
  without any error but next SELECT against the new table fails.
2)InnoDB (and every other transactional table) - The ALTER TABLE statement
  fails. There are the the following files in the db dir -
  `new_table_name.frm` and a temporary table's frm. If the SE is file
  based, then the data and index files will be present but with the old
  names. What happens is that for InnoDB the table is not renamed in the
  internal DDIC.

Fixed by adding additional call to mysql_rename_table() method, which should
not include FRM file rename, because it has been already done during file
names juggling.
2006-12-04 18:22:38 +01:00
baker@bk-internal.mysql.com
dbe5f0acc5 Merge bk-internal.mysql.com:/data0/bk/mysql-5.1
into  bk-internal.mysql.com:/data0/bk/mysql-5.1-arch
2006-12-03 21:19:35 +01:00
brian@zim.(none)
31d67280f7 This finishes the work (someone) started to remove FIELD_ types and use the Enum MYSQL types. The second part to this is to actually deprecate the FIELD defines in mysql_com.h 2006-12-01 17:26:52 -08:00
andrey@example.com
b5e44560f6 Merge ahristov@bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into  example.com:/work/bug24395-v2/my50
2006-12-02 00:30:10 +01:00
mskold/marty@linux.site
6f0e7a2631 Merge mysql.com:/windows/Linux_space/MySQL/mysql-5.1
into  mysql.com:/windows/Linux_space/MySQL/mysql-5.1-new-ndb
2006-12-01 21:12:13 +01:00
andrey@example.com
8fcf14210d Merge ahristov@bk-internal.mysql.com:/home/bk/mysql-5.1-maint
into  example.com:/work/bug24395-v2/my51
2006-12-01 16:27:48 +01:00
andrey@example.com
afb930947d Merge example.com:/work/bug24395-v2/my50
into  example.com:/work/bug24395-v2/my51
2006-12-01 11:37:33 +01:00
andrey@example.com
dec1ebf6e3 Merge example.com:/work/bug24395-v2/my41
into  example.com:/work/bug24395-v2/my50

fix for bug#24395 merged into 5.0
2006-11-30 18:36:15 +01:00
mskold/marty@linux.site
d7e375680a Merge mysql.com:/windows/Linux_space/MySQL/mysql-5.1
into  mysql.com:/windows/Linux_space/MySQL/mysql-5.1-new-ndb
2006-11-30 15:31:20 +01:00
monty@mysql.com/narttu.mysql.fi
3a35c30027 Fixed compiler warnings (Mostly VC++):
- Removed not used variables
- Changed some ulong parameters/variables to ulonglong (possible serious bug)
- Added casts to get rid of safe assignment from longlong to long (and similar)
- Added casts to function parameters
- Fixed signed/unsigned compares
- Added some constructores to structures
- Removed some not portable constructs

Better fix for bug Bug #21428 "skipped 9 bytes from file: socket (3)" on "mysqladmin shutdown"
(Added new parameter to net_clear() to define when we want the communication buffer to be emptied)
2006-11-30 03:40:42 +02:00
msvensson@shellback.(none)
7ddc43e305 Merge shellback.(none):/home/msvensson/mysql/mysql-5.1
into  shellback.(none):/home/msvensson/mysql/mysql-5.1-maint
2006-11-29 15:44:09 +01:00
msvensson@neptunus.(none)
04d5a42bbf Merge neptunus.(none):/home/msvensson/mysql/mysql-5.0
into  neptunus.(none):/home/msvensson/mysql/mysql-5.0-maint
2006-11-28 20:59:57 +01:00
andrey@example.com
100dd45ec4 Fix for bug#24395:
ALTER TABLE DISABLE KEYS doesn't work when modifying the table
  
ENABLE|DISABLE KEYS combined with another ALTER TABLE option, different
than RENAME TO did nothing. Also, if the table had disabled keys
and was ALTER-ed then the end table was with enabled keys.
  
Fixed by checking whether the table had disabled keys and enabling them
in the copied table.
2006-11-28 18:27:32 +01:00
gkodinov@dl145s.mysql.com
32c9e11df9 Merge bk-internal:/home/bk/mysql-5.1
into  dl145s.mysql.com:/data0/bk/team_tree_merge/MERGE/mysql-5.1-opt
2006-11-28 17:14:16 +01:00
monty@nosik.monty.fi
313f23a93a Merge bk-internal.mysql.com:/home/bk/mysql-5.1-marvel
into  mysql.com:/home/my/mysql-5.1
2006-11-27 14:07:52 +02:00
monty@mysql.com/nosik.monty.fi
fa81a82e7f Fixed a LOT of compiler warnings
Added missing DBUG_RETURN statements (in mysqldump.c)
Added missing enums
Fixed a lot of wrong DBUG_PRINT() statements, some of which could cause crashes
Removed usage of %lld and %p in printf strings as these are not portable or produces different results on different systems.
2006-11-27 01:47:38 +02:00
holyfoot/hf@deer.(none)
7d190dd6b1 Merge bk@192.168.21.1:mysql-5.1-opt
into  mysql.com:/home/hf/work/mysql-5.1-mrg
2006-11-17 19:01:35 +04:00
holyfoot/hf@mysql.com/deer.(none)
e95e23b0f3 Merge bk@192.168.21.1:mysql-5.0-opt
into  mysql.com:/home/hf/work/mysql-5.0-0mrg
2006-11-17 10:30:16 +04:00
andrey@example.com
8b947e265b Merge ahristov@bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into  example.com:/work/bug24219/my50
2006-11-16 16:37:07 +01:00
andrey@example.com
ebe1abf062 Merge example.com:/work/bug24219/my50
into  example.com:/work/bug24219/my51
2006-11-16 14:16:32 +01:00
andrey@example.com
5bf475376e Fix for bug#24219 ALTER TABLE ... RENAME TO ... , DISABLE KEYS leads to crash
(this is the 5.0 patch, because 4.1 differs)
  
There was an improper order of doing chained operations.
  
To the documentor: ENABLE|DISABLE KEYS combined with RENAME TO, and no other
ALTER TABLE clause, leads to server crash independent of the presence of
indices and data in the table.
2006-11-16 14:01:51 +01:00
jani@ua141d10.elisa.omakaista.fi
596f64d91a Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-5.1-marvel
into  ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.1-lex-string
2006-11-16 14:38:45 +02:00
andrey@example.com
de904f54bf Fix for bug#24219 ALTER TABLE ... RENAME TO ... , DISABLE KEYS leads to crash
There was an improper order of doing chained operations.

To the documentor: ENABLE|DISABLE KEYS combined with RENAME TO, and no other
ALTER TABLE clause, leads to server crash independent of the presence of
indices and data in the table.
2006-11-16 13:18:37 +01:00
mskold/marty@mysql.com/linux.site
a4ae99533c bug #24301 Next command hangs in mysql after creating new NDB table via LIKE operation.: Locked mutex LOCK_open during operation 2006-11-15 12:05:05 +01:00
holyfoot/hf@deer.(none)
938ba3e11e Merge mysql.com:/home/hf/work/mysql-5.0.clean
into  mysql.com:/home/hf/work/mysql-5.1.clean
2006-11-08 19:09:39 +04:00
cmiller@zippy.cornsilk.net
b074e13483 Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.1-maint
2006-11-02 17:51:59 -05:00
cmiller@zippy.cornsilk.net
af5acac047 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-maint
2006-11-02 17:39:52 -05:00
igor@rurik.mysql.com
79abdb38f8 Merge rurik.mysql.com:/home/igor/mysql-5.0-opt
into  rurik.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug21727
2006-11-01 14:50:14 -08:00
igor@rurik.mysql.com
2a7acba7e1 Fixed bug #21727.
This is a performance issue for queries with subqueries evaluation
of which requires filesort.
Allocation of memory for the sort buffer at each evaluation of a
subquery may take a significant amount of time if the buffer is rather big.
With the fix we allocate the buffer at the first evaluation of the
subquery and reuse it at each subsequent evaluation.
2006-10-31 17:31:56 -08:00
kostja@bodhi.local
8143148bc1 Cleanup. 2006-10-30 11:36:30 +03:00
petr/cps@mysql.com/owlet.local
f01df1fd0a fix test failures in the runtime tree 2006-10-25 12:54:59 +04:00
tsmith/tim@siva.hindu.god
3af2089b13 Merge siva.hindu.god:/usr/home/tim/m/bk/g50
into  siva.hindu.god:/usr/home/tim/m/bk/50
2006-10-24 14:42:08 -06:00
petr/cps@owlet.local
eda71e24c3 Merge pchardin@bk-internal.mysql.com:/home/bk/mysql-5.1-runtime
into  mysql.com:/home/cps/mysql/devel/5.1-rename-bug
2006-10-24 17:00:23 +04:00
tsmith/tim@siva.hindu.god
aeced431e3 Merge siva.hindu.god:/usr/home/tim/m/bk/g51
into  siva.hindu.god:/usr/home/tim/m/bk/51
2006-10-23 23:41:07 -06:00
gkodinov@dl145s.mysql.com
a0c0bbd8ae sql_rename.cc, sql_table.cc, type_decimal.result, mix2_myisam.result:
merge fixes
2006-10-20 10:12:38 +02:00
gkodinov@dl145s.mysql.com
aaed398254 Merge dl145s.mysql.com:/data/bk/team_tree_merge/MERGE/mysql-5.0-opt
into  dl145s.mysql.com:/data/bk/team_tree_merge/MERGE/mysql-5.1-opt
2006-10-19 16:43:46 +02:00
gkodinov@dl145s.mysql.com
892495acaf Merge dl145s.mysql.com:/data/bk/team_tree_merge/mysql-5.0
into  dl145s.mysql.com:/data/bk/team_tree_merge/MERGE/mysql-5.0-opt
2006-10-19 14:37:49 +02:00
jani@ua141d10.elisa.omakaista.fi
8dd0b2d0ae Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-5.1
into  ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.1-lex-string
2006-10-17 19:54:44 +03:00
cmiller@zippy.cornsilk.net
184467a2cc Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.1-maint
2006-10-17 11:23:07 -04:00
gkodinov/kgeorge@macbook.gmz
a64ae1844d Merge bk-internal:/home/bk/mysql-5.0-opt
into  macbook.gmz:/Users/kgeorge/mysql/work/B21798-5.0-opt-merge
2006-10-17 16:36:44 +03:00
gkodinov/kgeorge@macbook.gmz
f7b8937661 Bug#21798: memory leak during query execution with subquery in column
list using a function
When executing dependent subqueries they are re-inited and re-exec() for 
each row of the outer context.
The cause for the bug is that during subquery reinitialization/re-execution,
the optimizer reallocates JOIN::join_tab, JOIN::table in make_simple_join()
and the local variable in 'sortorder' in create_sort_index(), which is
allocated by make_unireg_sortorder().
Care must be taken not to allocate anything into the thread's memory pool
while re-initializing query plan structures between subquery re-executions.
All such items mush be cached and reused because the thread's memory pool
is freed at the end of the whole query.
Note that they must be cached and reused even for queries that are not 
otherwise cacheable because otherwise it will grow the thread's memory 
pool every time a cacheable query is re-executed. 
We provide additional members to the JOIN structure to store references 
to the items that need to be cached.
2006-10-17 16:20:26 +03:00
mikael/pappa@dator5.(none)
4a7cd3a1cb Merge dator5.(none):/home/pappa/clean-mysql-5.1
into  dator5.(none):/home/pappa/bug18198
2006-10-16 15:40:40 -04:00
jani@ua141d10.elisa.omakaista.fi
02f29377fd Changed several char* to LEX_STRING*. 2006-10-16 19:57:33 +03:00
evgen@moonbone.local
2b474898dc Bug#14959: ALTER TABLE isn't able to rename a view
The mysql_alter_table() was able to rename only a table.

The view/table renaming code is moved from the function rename_tables 
to the new function called do_rename().
The mysql_alter_table() function calls it when it needs to rename a view.
2006-10-13 21:59:52 +04:00
petr/cps@mysql.com/owlet.local
6846f8d9c4 Fix for Bug #17544 "Cannot do atomic log rotate",
Bug #21785 "Server crashes after rename of the log table" and
Bug #21966 "Strange warnings on create like/repair of the log
            tables"

According to the patch, from now on, one should use RENAME to
perform a log table rotation (this should also be reflected in
the manual).

Here is a sample:

use mysql;
CREATE TABLE IF NOT EXISTS general_log2 LIKE general_log;
RENAME TABLE general_log TO general_log_backup, general_log2 TO general_log;

The rules for Rename of the log tables are following:
      IF   1. Log tables are enabled
      AND  2. Rename operates on the log table and nothing is being
              renamed to the log table.
      DO   3. Throw an error message.
      ELSE 4. Perform rename.
 
The very RENAME query will go the the old (backup) table. This is
consistent with the behavoiur we have with binlog ROTATE LOGS
statement.

Other problems, which are solved by the patch are:

1) Now REPAIR of the log table is exclusive operation (as it should be), this
   also eliminates lock-related warnings. and
2) CREATE LIKE TABLE now usese usual read lock on the source table rather
   then name lock, which is too restrictive. This way we get rid of another
   log table-related warning, which occured because of the above fact
   (as a side-effect, name lock resulted in a warning).
2006-10-13 17:26:46 +04:00
cmiller@zippy.cornsilk.net
87ba07e832 Merge bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into  zippy.cornsilk.net:/home/cmiller/work/mysql/bug14262/my50-bug14262
2006-10-13 08:57:15 -04:00
cmiller@zippy.cornsilk.net
1279acd975 Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug14262/my50-bug14262
into  zippy.cornsilk.net:/home/cmiller/work/mysql/bug14262/my51
2006-10-11 16:49:59 -04:00
cmiller@zippy.cornsilk.net
5512100c6a Bug #14262: SP: DROP PROCEDURE|VIEW (maybe more) write to binlog too late \
(race cond)

It was possible for one thread to interrupt a Data Definition Language 
statement and thereby get messages to the binlog out of order.  Consider:

Connection 1: Drop Foo x
Connection 2: Create or replace Foo x
Connection 2: Log "Create or replace Foo x"
Connection 1: Log "Drop Foo x"

Local end would have Foo x, but the replicated slaves would not.

The fix for this is to wrap all DDL and logging of a kind in the same mutex.  
Since we already use mutexes for the various parts of altering the server, 
this only entails moving the logging events down close to the action, inside 
the mutex protection.
2006-10-03 13:38:25 -04:00
dlenev@mockturtle.local
5c2a51292d Merge mockturtle.local:/home/dlenev/src/mysql-5.0-rt-merge
into  mockturtle.local:/home/dlenev/src/mysql-5.1-rt-merge
2006-09-29 19:39:15 +04:00
dlenev@mockturtle.local
76c5979f9e Merge mockturtle.local:/home/dlenev/src/mysql-4.1-bg22338-2
into  mockturtle.local:/home/dlenev/src/mysql-5.0-rt-merge
2006-09-29 12:36:12 +04:00
mikael/pappa@dator5.(none)
fef3cb337c Merge dator5.(none):/home/pappa/clean-mysql-5.1-kt
into  dator5.(none):/home/pappa/bug18198
2006-09-28 06:16:16 -04:00
mikael/pappa@dator5.(none)
c7a3df765d Merge dator5.(none):/home/pappa/clean-mysql-5.1
into  dator5.(none):/home/pappa/bug18198
2006-09-28 06:10:28 -04:00
petr/cps@owlet.local
64c2c0cb19 Merge pchardin@bk-internal.mysql.com:/home/bk/mysql-5.1
into  mysql.com:/home/cps/mysql/trees/5.1-runtime-new
2006-09-28 04:44:55 +04:00
petr/cps@mysql.com/owlet.local
6cb96bb8b4 Remove unused error messages (no release contains them
at the moment, so we can safely do that). Update an error
mesage to make it translateable.
2006-09-27 17:48:00 +04:00
mikael/pappa@dator5.(none)
de9001d3c4 Merge dator5.(none):/home/pappa/clean-mysql-5.1
into  dator5.(none):/home/pappa/bug18198
2006-09-26 01:49:14 -04:00
mikael/pappa@dator5.(none)
ea9014043b Close the DDL log from 2 places => put into separate method
Needed to close ddl log in recovery before deleting it
2006-09-19 11:40:21 -04:00
brian@zim.(none)
7194b6d75a This changes the order of the universe, black is now the new white.
In practice this means that handlerton is now created by the server and is passed to the engine. Plugin startups can now also control how plugins are inited (and can optionally pass values). Bit more flexibility to those who want to write plugin interfaces to the database.
2006-09-15 10:28:00 -07:00
petr/cps@owlet.local
2fe744c878 Merge pchardin@bk-internal.mysql.com:/home/bk/mysql-5.1-runtime
into  mysql.com:/home/cps/mysql/trees/5.1-runtime-new
2006-09-15 17:24:13 +04:00
petr/cps@mysql.com/owlet.local
f6663df6d8 Post-review fixes for
Bug #18559 "log tables cannot change engine, and
            gets deadlocked when dropping w/ log on":
1) Add more generic error messages
2) Add new handlerton flag for engines, which support
   log tables
3) Remove (log-tables related) mutex lock in myisam to
   improve performance
2006-09-15 13:07:23 +04:00
cmiller@zippy.cornsilk.net
843c55763e Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-maint
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.1-maint
2006-09-05 17:50:07 -04:00
cmiller@zippy.cornsilk.net
869be90372 Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-maint
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.1-maint
2006-09-05 17:27:24 -04:00