Commit graph

25136 commits

Author SHA1 Message Date
Michael Widenius
945fa0d913 Merge with mysql-maria tree
mysql-test/t/variables.test:
  Reset delay_key_write, otherwise maria.maria test may fail
sql/set_var.cc:
  Reset ha_open_options if one resets the delay_key_write variable.
  Before there was no way to reset it without restarting mysqld, which caused some tests to fail
2009-02-19 11:01:25 +02:00
Michael Widenius
a8fdaa6f2c Merge with base MySQL 5.1
Contains fixes for test cases
Changed release tag to beta

configure.in:
  change release tag to beta
2009-02-15 12:58:34 +02:00
Guilhem Bichot
704b4845aa merge of 5.1-main into 5.1-maria. Myisam->Maria change propagation will follow.
There were so many changes into mtr (this is the new mtr coming) that I rather
copied mtr from 6.0-main here (at least this one knows how to run Maria tests).
I also fixed suite/maria tests to be accepted by the new mtr.

mysys/thr_mutex.c:
  adding DBUG_PRINT here, so that we can locate where the warning is issued.
2009-02-12 15:08:56 +01:00
Michael Widenius
115efe100d Merge with old maria tree 2009-02-01 14:02:29 +02:00
Michael Widenius
bd4e65515f Fixed compiler warnings found by gcc 4.3.2
- Added braces around expressions with &&, ||, & and |
- Added empty line before ; for empty while and for loops
- Added () around if with assignments
- Removed const before function returning simple type

Changed BUILD scripts to not build with NDB 


BUILD/SETUP.sh:
  By default, don't build ndb with --max in Maria tree.
  NDB is not kept up to date anyway in 5.1
client/mysql.cc:
  Added braces around && to get rid of compiler warnings
sql/event_db_repository.cc:
  Added braces around && to get rid of compiler warnings
sql/events.cc:
  Added braces around && to get rid of compiler warnings
sql/field.cc:
  Added braces around && to get rid of compiler warnings
  Fixed for loops
sql/field.h:
  Added braces around & to get rid of compiler warnings
sql/field_conv.cc:
  Added braces around && to get rid of compiler warnings
  Fixed bug when copying between DATETIME fields and strict dates are used
  Removed not needeed else
sql/gstream.cc:
  Added braces around && to get rid of compiler warnings
sql/ha_ndbcluster.cc:
  Added braces around && to get rid of compiler warnings
  Added {} to get rid of compiler warnings
sql/handler.cc:
  Added braces around && to get rid of compiler warnings
sql/item.cc:
  Added braces around && to get rid of compiler warnings
sql/item_cmpfunc.cc:
  Added braces around && to get rid of compiler warnings
  Removed some not needed space
sql/item_func.cc:
  Added braces around && to get rid of compiler warnings
sql/item_strfunc.cc:
  Added braces around && to get rid of compiler warnings
sql/item_subselect.cc:
  Added braces around && to get rid of compiler warnings
sql/item_sum.cc:
  Added braces around && to get rid of compiler warnings
sql/item_timefunc.cc:
  Added braces around && to get rid of compiler warnings
sql/item_xmlfunc.cc:
  Added empty line before ; for empty while and for loops
sql/log.cc:
  Added braces around && to get rid of compiler warnings
sql/log_event.cc:
  Added braces around && to get rid of compiler warnings
  Removed not needed else
sql/log_event_old.cc:
  Added braces around && to get rid of compiler warnings
sql/opt_range.cc:
  Added braces around && to get rid of compiler warnings
sql/opt_sum.cc:
  Added braces around && to get rid of compiler warnings
sql/set_var.cc:
  Added empty line before ; for empty while and for loops
  Added () around if with assignments
sql/slave.cc:
  Added braces around && to get rid of compiler warnings
  Added empty line before ; for empty while and for loops
sql/spatial.h:
  Added braces around && to get rid of compiler warnings
sql/sql_acl.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_analyse.cc:
  Added empty line before ; for empty while and for loops
sql/sql_base.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_connect.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_db.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_delete.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_help.cc:
  Added empty line before ; for empty while and for loops
sql/sql_insert.cc:
  Added braces around && to get rid of compiler warnings
  Added () around if with assignments
sql/sql_lex.cc:
  Cast char array references to uchar; Fixed wrong array referencing when using characters > ASCII 128 in SQL statments
  Added empty line before ; for empty while and for loops
  Trivial indent fixes
  Added braces around && to get rid of compiler warnings
sql/sql_load.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_parse.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_partition.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_plugin.cc:
  Fixed bug in detecing if option variable should be readonly
  Added empty line before ; for empty while and for loops
sql/sql_prepare.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_select.cc:
  Added braces around && to get rid of compiler warnings
  Added () around if with assignments
  Added empty line before ; for empty while and for loops
sql/sql_show.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_table.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_trigger.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_update.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_yacc.yy:
  Added braces around && to get rid of compiler warnings
sql/table.cc:
  Added braces around && to get rid of compiler warnings
sql/table.h:
  Added braces around && to get rid of compiler warnings
sql/time.cc:
  Added braces around && to get rid of compiler warnings
sql/tztime.cc:
  Added braces around && to get rid of compiler warnings
sql/uniques.cc:
  Added braces around && to get rid of compiler warnings
storage/federated/ha_federated.cc:
  Fixed bug in testing of variable to ha_info() (Not critical)
storage/heap/ha_heap.cc:
  Added braces around && to get rid of compiler warnings
storage/maria/ha_maria.cc:
  Fixed bug: Mark that maria_log_dir_path is readonly
  Added braces around && to get rid of compiler warnings
storage/ndb/include/ndbapi/NdbEventOperation.hpp:
  Removed const before function returning simple type
storage/ndb/include/ndbapi/NdbOperation.hpp:
  Removed const before function returning simple type
storage/ndb/src/ndbapi/Ndb.cpp:
  Added empty line before ; for empty while and for loops
storage/ndb/src/ndbapi/NdbEventOperation.cpp:
  Removed const before function returning simple type
storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp:
  Removed const before function returning simple type
storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp:
  Removed const before function returning simple type
storage/ndb/src/ndbapi/NdbRecAttr.cpp:
  Added empty line before ; for empty while and for loops
storage/ndb/src/ndbapi/TransporterFacade.hpp:
  Added braces around && to get rid of compiler warnings
2009-01-31 23:22:44 +02:00
Tatiana A. Nurnberg
2f47c306dd auto-merge 2009-01-31 02:08:41 +01:00
Tatiana A. Nurnberg
518cfea483 auto-merge 2009-01-31 02:07:36 +01:00
Tatiana A. Nurnberg
ce563480b7 Bug#41370: TIMESTAMP field does not accepts NULL from FROM_UNIXTIME()
When storing a NULL to a TIMESTAMP NOT NULL DEFAULT ...,
NULL returned from some functions threw a 'cannot be NULL error.'

NULL-returns now correctly result in the timestamp-field being
assigned its default value.

mysql-test/r/type_timestamp.result:
  Show that for TIMESTAMP NOT NULL DEFAULT, NULL function returns
  set default now.
mysql-test/t/type_timestamp.test:
  Show that for TIMESTAMP NOT NULL DEFAULT, NULL function returns
  set default now.
sql/item.cc:
  When storing a returned NULL (from a time- or date-related
  function), make sure to apply NULL-means-DEFAULT magic where
  applicable.
2009-01-30 17:12:24 +01:00
Georgi Kodinov
87eb2cb938 merged 5.1-main -> 5.1-bugteam 2009-01-30 15:44:49 +02:00
Georgi Kodinov
b367d2fd1f merged 35396 to 5.0-bugteam 2009-01-29 14:45:24 +02:00
Georgi Kodinov
37e88536e3 Bug #35396: Abnormal query times in slow query log
If the system time is adjusted back during a query execution
(resulting in the end time being earlier than the start time)
the code that prints to the slow query log gets confused and 
prints unsigned negative numbers.
            
Fixed by not logging the statements that would have negative
execution time due to time shifts.
No test case since this would involve changing the system time.

sql/sql_parse.cc:
  Bug #35396: don't log queries with negative execution times 
  (due to shifts in system time).
2009-01-29 14:40:48 +02:00
Alfranio Correia
ba4a5e8c3c merge 5.1-bugteam --> 5.1-bugteam (local) 2009-01-29 11:30:02 +00:00
Sergey Petrunia
8731a7c276 Merge 2009-01-28 22:21:14 +03:00
Sergey Petrunia
a9608b196d BUG#37822: Correlated subquery with IN and IS UNKNOWN provides wrong result
Item_in_optimizer::is_null() evaluated "NULL IN (SELECT ...)" to NULL regardless of
whether subquery produced any records, this was a documented limitation.

The limitation has been removed (see bugs 8804, 24085, 24127) now
Item_in_optimizer::val_int() correctly handles all cases with NULLs. Make
Item_in_optimizer::is_null() invoke val_int() to return correct values for
"NULL IN (SELECT ...)".


mysql-test/r/subselect.result:
  BUG#37822: Correlated subquery with IN and IS UNKNOWN provides wrong result
  - Testcase
mysql-test/t/subselect.test:
  BUG#37822: Correlated subquery with IN and IS UNKNOWN provides wrong result
  - Testcase
2009-01-28 22:18:27 +03:00
Gleb Shchepa
b135bcabe5 automerge 5.0-bugteam --> 5.1-bugteam (bug 39069) 2009-01-28 22:48:41 +04:00
Gleb Shchepa
334e249f91 Bug #39069: <row constructor> IN <table-subquery> seriously
messed up

"ROW(...) IN (SELECT ... FROM DUAL)" always returned TRUE.

Item_in_subselect::row_value_transformer rewrites "ROW(...)
IN SELECT" conditions into the "EXISTS (SELECT ... HAVING ...)"
form.
For a subquery from the DUAL pseudotable resulting HAVING
condition is an expression on constant values, so further
transformation with optimize_cond() eliminates this HAVING
condition and resets JOIN::having to NULL.
Then JOIN::exec treated that NULL as an always-true-HAVING
and that caused a bug.

To distinguish an optimized out "HAVING TRUE" clause from
"HAVING FALSE" we already have the JOIN::having_value flag.
However, JOIN::exec() ignored JOIN::having_value as described
above as if it always set to COND_TRUE.

The JOIN::exec method has been modified to take into account
the value of the JOIN::having_value field.


mysql-test/r/subselect3.result:
  Added test case for bug #39069.
mysql-test/t/subselect3.test:
  Added test case for bug #39069.
sql/sql_select.cc:
  Bug #39069: <row constructor> IN <table-subquery> seriously
              messed up
  
  The JOIN::exec method has been modified to take into account
  the value of the JOIN::having_value field.
2009-01-28 22:46:45 +04:00
Alfranio Correia
23d032c34e BUG#35583 mysqlbinlog replay fails with ERROR 1146 when temp tables are used
When using CREATE TEMPORARY TABLE LIKE to create a temporary table, 
or using TRUNCATE to delete all rows of a temporary table, they 
did not set the tmp_table_used flag, and cause the omission of
"SET @@session.pseudo_thread_id" when dumping binlog with mysqlbinlog,
and cause error when replay the statements.
      
This patch fixed the problem by setting tmp_table_used in these two
cases. (Done by He Zhenxing 2009-01-12)


mysql-test/suite/binlog/r/binlog_tmp_table.result:
  Add test case for BUG#35583
mysql-test/suite/binlog/t/binlog_tmp_table.test:
  Add test case for BUG#35583
sql/sql_delete.cc:
  set thd->tmp_table_used when truncate temporary table
sql/sql_table.cc:
  set thd->tmp_table_used when using create like to create temporary tables
2009-01-28 14:35:12 +00:00
Satya B
fe75e52c25 Fix for BUG#39886 - Table full for MEMORY table is not written into error log
When a MEMORY table is full the error is returned to client but not written
to error log.

Fixed the handler api to write the error mesage to error log when the table is
full.

Note: No TestCase included as testing the error log is non-trivial.


sql/handler.cc:
  Fixed handler::print_error() to write the error message to error log
  when the table is full.
2009-01-28 17:22:53 +05:30
Magnus Svensson
8a73a4beca Merge 2009-01-27 15:10:15 +01:00
Chad MILLER
d81f6d6104 Merge from team tree. 2009-01-26 12:34:55 -05:00
Magnus Svensson
0618b83622 WL#4189 mtr.pl v2
- Suppress intentional safemalloc dump warnings
 - add fflush(stdout) to make sure that the "End safemalloc memory dump." marker is flushed.
2009-01-26 16:39:00 +01:00
Chad MILLER
34dabc062f Merge fix for bug 38145 from 5.0. 2009-01-26 10:27:51 -05:00
Gleb Shchepa
93991b6be9 Bug#42188: crash and/or memory corruption with user variables
in trigger

Interchangeable calls to the mysql_change_user client function
and invocations of a trigger changing some user variable caused
a memory corruption and a crash.

The mysql_change_user API call forces TDH::cleanup() on a server
that frees user variable entries.
However it didn't reset Item_func_set_user_var::entry to NULL
because Item_func_set_user_var::cleanup() was not overloaded.
So, Item_func_set_user_var::entry held a pointer to freed memory,
that caused a crash.

The Item_func_set_user_var::cleanup method has been overloaded
to cleanup the Item_func_set_user_var::entry field.


mysql-test/r/user_var.result:
  Added test case for bug #42188.
mysql-test/t/user_var.test:
  Added test case for bug #42188.
sql/item_func.cc:
  Bug#42188: crash and/or memory corruption with user variables
             in trigger
  
  The Item_func_set_user_var::cleanup method has been overloaded
  to cleanup the Item_func_set_user_var::entry field.
sql/item_func.h:
  Bug#42188: crash and/or memory corruption with user variables
             in trigger
  
  The Item_func_set_user_var::cleanup method has been overloaded
  to cleanup the Item_func_set_user_var::entry field.
2009-01-23 22:18:02 +04:00
Andrei Elkin
00ca9099e6 merge from 5.1-bt to a local tree. 2009-01-23 19:10:13 +02:00
Luis Soares
df8543868d merge: 5.1 -> 5.1-rpl
conflicts:
  Text conflict in client/mysqltest.cc
  Text conflict in mysql-test/include/wait_until_connected_again.inc
  Text conflict in mysql-test/lib/mtr_report.pm
  Text conflict in mysql-test/mysql-test-run.pl
  Text conflict in mysql-test/r/events_bugs.result
  Text conflict in mysql-test/r/log_state.result
  Text conflict in mysql-test/r/myisam_data_pointer_size_func.result
  Text conflict in mysql-test/r/mysqlcheck.result
  Text conflict in mysql-test/r/query_cache.result
  Text conflict in mysql-test/r/status.result
  Text conflict in mysql-test/suite/binlog/r/binlog_index.result
  Text conflict in mysql-test/suite/binlog/r/binlog_innodb.result
  Text conflict in mysql-test/suite/rpl/r/rpl_packet.result
  Text conflict in mysql-test/suite/rpl/t/rpl_packet.test
  Text conflict in mysql-test/t/disabled.def
  Text conflict in mysql-test/t/events_bugs.test
  Text conflict in mysql-test/t/log_state.test
  Text conflict in mysql-test/t/myisam_data_pointer_size_func.test
  Text conflict in mysql-test/t/mysqlcheck.test
  Text conflict in mysql-test/t/query_cache.test
  Text conflict in mysql-test/t/rpl_init_slave_func.test
  Text conflict in mysql-test/t/status.test
2009-01-23 13:22:05 +01:00
Andrei Elkin
8c3389f386 Bug #31240 load data infile replication between (4.0 or 4.1) and 5.1 fails
It's a regression issue.
The reason of the bug appeared to be an error introduced into 5.1 source code.
A piece of code in Create_file_log_event::do_apply_event() did not have test
coverage which made make test and pb unaware.
      
Fixed with inverting the old value of the return value from 
Create_file_log_event::do_apply_event().
The rpl test suite is extended with `rpl_cross_version' the file to hold 
regression cases similar to the current.


mysql-test/suite/rpl/r/rpl_cross_version.result:
  new results file
mysql-test/suite/rpl/t/rpl_cross_version-master.opt:
  options to the server to be able to start replication to itself
mysql-test/suite/rpl/t/rpl_cross_version.test:
  regression test for bug#31240.
sql/log_event.cc:
  Correcting the return value from  Create_file_log_event::do_apply_event()
2009-01-22 16:55:14 +02:00
Davi Arnaut
6157433b2a Merge test case of Bug#40264 to mysql-5.1-bugteam
sql/sql_cache.cc:
  Assert that results are always complete.
2009-01-22 09:22:26 -02:00
Davi Arnaut
ecfdc3560c Bug#40264: Aborted cached query causes query to hang indefinitely on next cache hit
The problem is that the query cache was storing partial results
if the statement failed when sending the results to the client.
This could cause clients to hang when trying to read the results
from the cache as they would, for example, wait indefinitely for
a eof packet that wasn't saved.

The solution is to always discard the caching of a query that
failed to send its results to the associated client.

mysql-test/r/query_cache_notembedded.result:
  Add test case result for Bug#40264
mysql-test/t/query_cache_notembedded.test:
  Add test case for Bug#40264
sql/sql_cache.cc:
  Abort if a unreported error was raised.
2009-01-22 08:28:01 -02:00
Sergei Golubchik
60f3a340ab merged
trnman_get_state/trnman_set_state renamed to trnman_get/set_flags
TRN::state - to TRN::flags accordingly
2009-01-16 17:18:17 +01:00
Georgi Kodinov
4d8e73c818 merged 5.0-bugteam -> 5.1-bugteam 2009-01-16 17:38:38 +02:00
Georgi Kodinov
bdec5458ae auto merge 2009-01-16 16:48:41 +02:00
Georgi Kodinov
b385a2d8a5 merged 5.0-bugteam -> 5.1-bugtteam 2009-01-16 12:45:17 +02:00
Michael Widenius
364f8611b0 Fixed issues in last push found by pushbuild
sql/sql_insert.cc:
  Removed DBUG_ASSERT() that is triggered by deadlock-innodb test
storage/maria/ma_loghandler.c:
  Removed compiler warnings
storage/maria/trnman_public.h:
  Fixed wrong code from last push
2009-01-16 11:38:02 +02:00
Michael Widenius
3fca23902c Log queries to maria_log if compiled with EXTRA_DEBUG
Added DBUG_ASSERT() to unlikely error senario
Don't use errno == 0 in maria_create() / myisam_create()

sql/sql_insert.cc:
  Added DBUG_ASSERT() for case that should never happen in real life
  Added my_error() to avoid assert if mysql_lock() or postlock() doesn't call my_error()
storage/maria/ha_maria.cc:
  Log queries to maria_log if compiled with EXTRA_DEBUG
storage/maria/ma_create.c:
  Don't use errno == 0
storage/maria/ma_loghandler.c:
  Added logging of debug info to maria_log
storage/maria/ma_loghandler.h:
  Added logging of debug info to maria_log
storage/maria/ma_recovery.c:
  Added printing of debug info from maria_log
storage/maria/trnman.c:
  Added functions to read/store state in TRN
storage/maria/trnman.h:
  Added functions to read/store state in TRN
storage/maria/trnman_public.h:
  Added state in TRN to remmeber if we have already logged the query
storage/myisam/mi_create.c:
  Don't use errno == 0
2009-01-16 00:25:53 +02:00
Sergei Golubchik
9c96fde120 post-review fixes
include/atomic/generic-msvc.h:
  prevent possible compiler warnings
include/lf.h:
  comments, better definition for LF_HASH_OVERHEAD
include/maria.h:
  define MARIA_CANNOT_ROLLBACK here
include/my_pthread.h:
  avoid possible name clash
include/waiting_threads.h:
  comments, const, move WT_RESOURCE to waiting_threads.c
mysql-test/suite/maria/r/maria_notembedded.result:
  new test
mysql-test/suite/maria/t/maria_notembedded.test:
  new test - 5-way deadlock
mysys/lf_hash.c:
  better definition for LF_HASH_OVERHEAD
mysys/my_static.c:
  comment
mysys/my_thr_init.c:
  casts
mysys/waiting_threads.c:
  comments, asserts, etc
server-tools/instance-manager/parse.cc:
  fix my_init_dynamic_array() to follow new calling conventions
sql/mysqld.cc:
  call wt_init after set_proper_floating_point_mode
sql/sql_class.h:
  comment
storage/maria/ha_maria.cc:
  move MARIA_CANNOT_ROLLBACK to a common header
storage/maria/ma_commit.c:
  comment
storage/maria/ma_write.c:
  comments, check for HA_ERR_FOUND_DUPP_KEY
storage/maria/trnman.c:
  comments, assert
storage/maria/trnman.h:
  comments
storage/maria/unittest/trnman-t.c:
  be paranoid
unittest/mysys/lf-t.c:
  comments
unittest/mysys/waiting_threads-t.c:
  comments, safety, memory leak
2009-01-15 22:27:36 +01:00
Georgi Kodinov
683542698f merged Bug 38795 to 5.0-bugteam 2009-01-15 16:15:38 +02:00
Davi Arnaut
e48c7178f7 Merge from 5.0-bugteam 2009-01-15 08:28:10 -02:00
Alexander Nozdrin
852d1d66f6 Pull from 5.0-bugteam 2009-01-15 13:10:20 +03:00
Alexander Nozdrin
9a6e05d8b9 Backport patch for Bug#31222 (com_% global status counters behave randomly
with mysql_change_user) to 5.0.
2009-01-15 12:36:34 +03:00
Chad MILLER
9b1b1d507e Merge from dev tree. 2009-01-14 11:15:11 -05:00
Chad MILLER
e85a3f7bc2 Bug#38145: .frm file isn't sync'd with sync_frm enabled
Views weren't sync()d the same way other structures were.

In creating the FRM for views, obey the same rules for variable 
"sync_frm" as for everything else.
2009-01-14 11:11:31 -05:00
Chad MILLER
73688c5e21 Fix comment. Boolean function returns true/false, not zero/one. 2009-01-14 11:10:36 -05:00
Ramil Kalimullin
53e42d9ee4 Fix for
bug#33094: Error in upgrading from 5.0 to 5.1 when table contains
triggers
and
#41385: Crash when attempting to repair a #mysql50# upgraded table
with triggers.

Problem:
1. trigger code didn't assume a table name may have
a "#mysql50#" prefix, that may lead to a failing ASSERT().
2. "ALTER DATABASE ... UPGRADE DATA DIRECTORY NAME" failed
for databases with "#mysql50#" prefix if any trigger.
3. mysqlcheck --fix-table-name didn't use UTF8 as a default
character set that resulted in (parsing) errors for tables with
non-latin symbols in their names and definitions of triggers.

Fix:
1. properly handle table/database names with "#mysql50#" prefix.
2. handle --default-character-set mysqlcheck option;
if mysqlcheck is launched with --fix-table-name or --fix-db-name
set default character set to UTF8 if no --default-character-set
option given.

Note: if given --fix-table-name or --fix-db-name option,
without --default-character-set mysqlcheck option
default character set is UTF8.


client/mysqlcheck.c:
  Fix for
  bug#33094: Error in upgrading from 5.0 to 5.1 when table contains
  triggers
  and
  #41385: Crash when attempting to repair a #mysql50# upgraded table
  with triggers.
    - check and set default charset if --default-character-set option
      given.
    - set default charset to "utf8" if there's
      --fix-table-name or --fix-db-name and no --default-character-set.
mysql-test/r/mysqlcheck.result:
  Fix for
  bug#33094: Error in upgrading from 5.0 to 5.1 when table contains
  triggers
  and
  #41385: Crash when attempting to repair a #mysql50# upgraded table
  with triggers.
    - test result.
mysql-test/t/mysqlcheck.test:
  Fix for
  bug#33094: Error in upgrading from 5.0 to 5.1 when table contains
  triggers
  and
  #41385: Crash when attempting to repair a #mysql50# upgraded table
  with triggers.
    - test case.
sql/mysql_priv.h:
  Fix for
  bug#33094: Error in upgrading from 5.0 to 5.1 when table contains
  triggers
  and
  #41385: Crash when attempting to repair a #mysql50# upgraded table
  with triggers.
    - check_n_cut_mysql50_prefix() introduced.
sql/sql_table.cc:
  Fix for
  bug#33094: Error in upgrading from 5.0 to 5.1 when table contains
  triggers
  and
  #41385: Crash when attempting to repair a #mysql50# upgraded table
  with triggers.
    - tablename_to_filename() code split into 2 parts
    - check_n_cut_mysql50_prefix() introduced to cut #mysql50# prefixes,
      used in the trigger code as well.
sql/sql_trigger.cc:
  Fix for
  bug#33094: Error in upgrading from 5.0 to 5.1 when table contains
  triggers
  and
  #41385: Crash when attempting to repair a #mysql50# upgraded table
  with triggers.
    - Table_triggers_list::check_n_load() - checking triggers assume
      a table/database name given may have "#mysql50#" prefix in some cases.
    - Table_triggers_list::change_table_name_in_triggers() -
      create .TRG file in new database directory and delete it in old one,
      as they may differ in case of
      "ALTER DATABASE ... UPGRADE DATA DIRECTORY NAME"
    - Table_triggers_list::change_table_name_in_trignames() - remove stale .TRN
      files in #mysql50#dbname directory in case of database upgrade
    - Table_triggers_list::change_table_name() - allow changing trigger's
      database in case of its upgrading
sql/sql_trigger.h:
  Fix for
  bug#33094: Error in upgrading from 5.0 to 5.1 when table contains
  triggers
  and
  #41385: Crash when attempting to repair a #mysql50# upgraded table
  with triggers.
    - new old_db_name parameter added in
      Table_triggers_list::change_table_name_in_trignames() and
      Table_triggers_list::change_table_name_in_triggers()
2009-01-14 18:50:51 +04:00
He Zhenxing
45140a8ea3 Auto merge 2009-01-14 17:32:25 +08:00
He Zhenxing
f2c122bf90 BUG#41986 Replication slave does not pick up proper AUTO_INCREMENT value for Innodb tables
The next number (AUTO_INCREMENT) field of the table for write
rows events are not initialized, and cause some engines (innodb)
not correctly update the tables's auto_increment value.

This patch fixed this problem by honor next number fields if present.

mysql-test/extra/rpl_tests/rpl_auto_increment.test:
  Add test code for BUG#41986
mysql-test/suite/rpl/r/rpl_auto_increment.result:
  update test result file for BUG#41986
sql/log_event.cc:
  set next_number_field before writing rows, and reset next_number_field after finished writing rows
2009-01-14 16:27:32 +08:00
Davi Arnaut
3d6cea324a Bug#36326: nested transaction and select
The problem is that the query cache stores packets containing
the server status of the time when the cached statement was run.
This might lead to a wrong transaction status in the client side
if a statement is cached during a transaction and is later served
outside a transaction context (and vice-versa).

The solution is to take into account the transaction status when
storing in and serving from the query cache.

mysql-test/r/innodb_cache.result:
  Update test case result.
mysql-test/r/query_cache.result:
  Add test case result for Bug#36326
mysql-test/t/query_cache.test:
  Add test case for Bug#36326
sql/mysql_priv.h:
  Add new flags.
sql/sql_cache.cc:
  Remember the transaction and autocommit status stored in the packet.
tests/mysql_client_test.c:
  Add test case for Bug#36326
2009-01-13 20:07:06 -02:00
Georgi Kodinov
ba47e3bc4d Bug #38795: Automatic search depth and nested join's results in server crash
The greedy optimizer tracks the current level of nested joins and the position
inside these by setting and maintaining a state that's global for the whole FROM
clause.
This state was correctly maintained inside the selection of the next partial plan
table (in best_extension_by_limited_search()). 
greedy_search() also moves the current position by adding the last partial match 
table when there's not enough tables in the partial plan found by 
best_extension_by_limited_search().
This may require update of the global state variables that describe the current
position in the plan if the last table placed by greedy_search is not a top-level 
join table.
Fixed by updating the state after placing the partial plan table in greedy_search()
in the same way this is done on entering the best_extension_by_limited_search().
Fixed the signature of the function called to update the state : 
check_interleaving_with_nj

mysql-test/r/greedy_optimizer.result:
  Bug #38795: test case
mysql-test/t/greedy_optimizer.test:
  Bug #38795: test case
sql/sql_select.cc:
  Bug #38795: correctly update current position when placing
  the next partial plan table in greedy_search().
2009-01-13 13:09:12 +02:00
Georgi Kodinov
b91bbba2df Fixed a warning in sql_profile.cc 2009-01-12 18:17:15 +02:00
Georgi Kodinov
e0df7f1cd5 merged 41453 to 5.1-bugteam 2009-01-12 17:52:46 +02:00
Tatiana A. Nurnberg
95e0d3bd06 Bug#31177: Server variables can't be set to their current values
Bounds-checks and blocksize corrections were applied to user-input,
but constants in the server were trusted implicitly. If these values
did not actually meet the requirements, the user could not set change
a variable, then set it back to the (wonky) factory default or maximum
by explicitly specifying it (SET <var>=<value> vs SET <var>=DEFAULT).

Now checks also apply to the server's presets. Wonky values and maxima
get corrected at startup. Consequently all non-offsetted values the user
sees are valid, and users can set the variable to that exact value if
they so desire.

mysql-test/r/read_buffer_size_basic.result:
  test sets out of bounds value; we now throw a warning for this.
  This is a side-effect: before, the maximum was higher than the
  value we set here. The value was corrected to block-size, the
  maximum was not, hence the value was smaller than the maximum
  in this particular case. Now that we align the maxima at startup,
  the value in SET is larger than the (corrected) maximum, and we
  see a warning in this particular case. "This means we're doing it right."
mysql-test/r/read_rnd_buffer_size_basic.result:
  test sets out of bounds value; we now throw a warning for this.
  This is a side-effect: before, the maximum was higher than the
  value we set here. The value was corrected to block-size, the
  maximum was not, hence the value was smaller than the maximum
  in this particular case. Now that we align the maxima at startup,
  the value in SET is larger than the (corrected) maximum, and we
  see a warning in this particular case. "This means we're doing it right."
mysys/my_getopt.c:
  Do bounds-checking at start-up time so we'll catch and correct
  wonky default values and upper limits.
sql/mysqld.cc:
  If 0 is a legal value per the docs, not to mention the default, we shouldn't give 1 as
  the lower limit.
storage/innobase/handler/ha_innodb.cc:
  We are setting upper bounds here.
  ~0L gives -1. That is NOT what we want!
2009-01-12 06:32:49 +01:00