Commit graph

58157 commits

Author SHA1 Message Date
Alfranio Correia
d871bef758 auto-merge mysql-5.1-bugteam (local) --> mysql-5.1-bugteam 2009-07-28 23:39:58 +01:00
Davi Arnaut
1df8ad6c14 If running the mysql_upgrade test case with Valgrind, the resource
consumption (CPU) for upgrading a large log table can be intense.
Therefore, truncate the general_log table beforehand if running
mysql_upgrade test with Valgrind.

mysql-test/t/mysql_upgrade.test:
  Truncate log table if running with Valgrind.
2009-07-28 16:59:38 -03:00
Joerg Bruehe
ecc3042fcd Upmerge of a merge changeset from 5.0-build to 5.1-build,
no code change.
2009-07-28 21:39:07 +02:00
Alexey Kopytov
879162d336 Automerge. 2009-07-28 23:15:52 +04:00
Alexey Kopytov
fd3b0066f9 Automerge. 2009-07-28 23:14:24 +04:00
Alexey Kopytov
bac18522e6 Automerge. 2009-07-28 23:14:04 +04:00
Alexey Kopytov
f9437bd769 Manual merge. 2009-07-28 22:44:28 +04:00
Alexey Kopytov
baefaa1e58 Bug #45031: invalid memory reads in my_real_read using protocol
compression 
 
Since uint3korr() may read 4 bytes depending on build flags and 
platform, allocate 1 extra "safety" byte in the network buffer 
for cases when uint3korr() in my_real_read() is called to read
last 3 bytes in the buffer. 
 
It is practically hard to construct a reliable and reasonably 
small test case for this bug as that would require constructing 
input stream such that a certain sequence of bytes in a 
compressed packet happens to be the last 3 bytes of the network 
buffer. 


sql/net_serv.cc:
  Allocate 1 extra "safety" byte in the network buffer for cases 
  when uint3korr() is used to read last 3 bytes in the buffer.
2009-07-28 22:35:55 +04:00
Alfranio Correia
043e09b543 BUG#41166 stored function requires "deterministic" if binlog_format is "statement"
If the log_bin_trust_function_creators option is not defined, creating a stored
function requires either one of the modifiers DETERMINISTIC, NO SQL, or READS
SQL DATA. Executing a stored function should also follows the same rules if in
STATEMENT mode. However, this was not happening and a wrong error was being
printed out: ER_BINLOG_ROW_RBR_TO_SBR.

The patch makes the creation and execution compatible and prints out the correct
error ER_BINLOG_UNSAFE_ROUTINE when a stored function without one of the modifiers
above is executed in STATEMENT mode.
2009-07-28 18:44:38 +01:00
Davi Arnaut
e265609834 Bug#46385: [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted t
The maximum value of the max_join_size variable is set by converting
a signed type (long int) with negative value (-1) to a wider unsigned
type (unsigned long long), which yields the largest possible value of
the wider unsigned type -- as per the language conversion rules. But,
depending on build options, the type of the max_join_size might be a
shorter type (ha_rows - unsigned long) which causes the warning to be
thrown once the large value is truncated to fit.

The solution is to ensure that the maximum value of the variable is
always set to the maximum value of integer type of max_join_size.

Furthermore, it would be interesting to always have a fixed type for
this variable, but this would incur in a change of behavior which is
not acceptable for a GA version. See Bug#35346.

sql/mysqld.cc:
  Set max value for type.
2009-07-27 20:31:48 -03:00
Davi Arnaut
f8158fb5d2 Post-merge fix for Bug#43587: Handle failures to execute a statement
during bootstrap on a embedded server.

libmysqld/lib_sql.cc:
  Handle a failure during bootstrap.
2009-07-27 16:03:48 -03:00
Davi Arnaut
c721cef54f Merge from mysql-5.0-bugteam. 2009-07-27 15:24:43 -03:00
Davi Arnaut
d5e84db34c Bug#20023: mysql_change_user() resets the value of SQL_BIG_SELECTS
Post-merge fix: test case could fail due to a conversion of the
max_join_size value to a integer. Fixed by preserving the value
as a string for comparison purposes.

tests/mysql_client_test.c:
  Preserve max_join_size value as a string instead of converting
  it to a integer -- value can be larger then the type used.
2009-07-27 12:31:28 -03:00
Anurag Shekhar
3912c2177d Bug #30102 rename table does corrupt tables with partition files on failure.
One of the tests introduced for this bug was failing 
because of path size restriction in windows.
Moved the test case to a new test which is disabled under windows.

mysql-test/r/partition_not_embedded.result:
  updated test results after removing a test case.
mysql-test/r/partition_rename_longfilename.result:
  Test result for partition_rename_longfilename
mysql-test/t/partition_not_embedded.test:
  Removed the test case which tests renaming partition table such that
  the file name is 255 char long.
mysql-test/t/partition_rename_longfilename.test:
  Test case to test renaming partition table such that
  the file name is 255 char long.
  Moved from partition_no_embedded.
2009-07-27 16:50:43 +05:30
Satya B
9bad65ea45 merge mysql-5.0-bugteam to mysql-5.1-bugteam 2009-07-27 11:54:29 +05:30
Satya B
2478d51032 merging with mysql-5.1-bugteam branch 2009-07-27 11:50:13 +05:30
Satya B
e8a97ae267 merging with mysql-5.0-bugteam 2009-07-27 11:49:28 +05:30
Luis Soares
cf505e4494 BUG#43046: mixed mode switch to row format with temp table lead
to wrong result
      
When using MIXED mode and issuing 'CREATE TEMPORARY TABLE t_tmp',
the statement is logged if the current binlogging mode is
STATEMENT. This causes the slave to replay the instruction and
create the temporary table as well. If there is no switch to ROW
mode, and later on a 'DROP TEMPORARY TABLE t_tmp' is issued, then
this statement will also be logged and the slave will
remove/close the temporary table.
      
However, if there is a switch to ROW mode between the CREATE and
DROP TEMPORARY table, the DROP statement will not be logged,
leaving the slave with a dangling temporary table.
      
This patch addresses this, by always logging a DROP TEMPORARY
TABLE IF EXISTS when in mixed mode and a drop statement is issued
for temporary table(s).

mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result:
  Updated result file.
mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test:
  Added test case.
sql/sql_table.cc:
  When dropping table(s) in mixed mode and current statement 
  logging is ROW, builds an extra DROP TEMPORARY TABLE IF 
  EXISTS for temporary tables that are being dropped. Later, 
  it logs the extra drop statement.
2009-07-26 22:48:24 +01:00
Davi Arnaut
8ec2f3d0d1 Bug#43587: Putting event_scheduler=1 in init SQL file crashes
mysqld

The problem was that enabling the event scheduler inside a init
file caused the server to crash upon start-up. The crash occurred
because the event scheduler wasn't being initialized before the
commands in the init-file are processed.

The solution is to initialize the event scheduler before the init
file is read. The patch also disables the event scheduler during
bootstrap and makes the bootstrap operation robust in the
presence of background threads.

mysql-test/std_data/init_file.dat:
  Add test case for Bug#43587
sql/event_scheduler.cc:
  Signal that the thread_count has been decremented.
sql/events.cc:
  Disable the event scheduler during bootstrap.
sql/mysql_priv.h:
  Export variable.
sql/mysqld.cc:
  Initialize the event scheduler before commands are executed.
sql/sql_parse.cc:
  Signal that the bootstrap thread is done.
2009-07-24 15:45:42 -03:00
Konstantin Osipov
b4bf7dd31e Code review for Bug#43587 Putting event_scheduler=1 in init SQL file crashes
mysqld
2009-07-24 20:20:46 +04:00
Gleb Shchepa
2bc6b6a800 Merge from 5.0
******
manual merge 5.0-bugteam --> 5.1-bugteam (bug 38816)
2009-07-24 21:04:55 +05:00
Gleb Shchepa
dc0a87fdc2 Bug #38816: kill + flush tables with read lock + stored
procedures causes crashes!

The problem of that bugreport was mostly fixed by the
patch for bug 38691.
However, attached test case focused on another crash or
valgrind warning problem: SHOW PROCESSLIST query accesses
freed memory of SP instruction that run in a parallel
connection.

Changes of thd->query/thd->query_length in dangerous
places have been guarded with the per-thread
LOCK_thd_data mutex (the THD::LOCK_delete mutex has been
renamed to THD::LOCK_thd_data).


sql/ha_myisam.cc:
  Bug #38816: kill + flush tables with read lock + stored
              procedures causes crashes!
  
  Modification of THD::query/query_length has been guarded
  with the a THD::set_query() method call/LOCK_thd_data
  mutex.
  Unnecessary locking with the global LOCK_thread_count
  mutex has been removed.
sql/log_event.cc:
  Bug #38816: kill + flush tables with read lock + stored
              procedures causes crashes!
  
  Modification of THD::query/query_length has been guarded
  with the THD::set_query()) method call/LOCK_thd_data
  mutex.
sql/slave.cc:
  Bug #38816: kill + flush tables with read lock + stored
              procedures causes crashes!
  
  Modification of THD::query/query_length has been guarded
  with the THD::set_query() method call/LOCK_thd_data mutex.
  
  The THD::LOCK_delete mutex has been renamed to
  THD::LOCK_thd_data.
sql/sp_head.cc:
  Bug #38816: kill + flush tables with read lock + stored
              procedures causes crashes!
  
  Modification of THD::query/query_length has been guarded
  with the a THD::set_query() method call/LOCK_thd_data
  mutex.
sql/sql_class.cc:
  Bug #38816: kill + flush tables with read lock + stored
              procedures causes crashes!
  
  The new THD::LOCK_thd_data mutex and THD::set_query()
  method has been added to guard modifications of THD::query/
  THD::query_length fields, also the Statement::set_statement()
  method has been overloaded in the THD class.
  
  The THD::LOCK_delete mutex has been renamed to
  THD::LOCK_thd_data.
sql/sql_class.h:
  Bug #38816: kill + flush tables with read lock + stored
              procedures causes crashes!
  
  The new THD::LOCK_thd_data mutex and THD::set_query()
  method has been added to guard modifications of THD::query/
  THD::query_length fields, also the Statement::set_statement()
  method has been overloaded in the THD class.
  
  The THD::LOCK_delete mutex has been renamed to
  THD::LOCK_thd_data.
sql/sql_insert.cc:
  Bug #38816: kill + flush tables with read lock + stored
              procedures causes crashes!
  
  Modification of THD::query/query_length has been guarded
  with the a THD::set_query() method call/LOCK_thd_data
  mutex.
sql/sql_parse.cc:
  Bug #38816: kill + flush tables with read lock + stored
              procedures causes crashes!
  
  Modification of THD::query/query_length has been guarded
  with the a THD::set_query() method call/LOCK_thd_data mutex.
sql/sql_repl.cc:
  Bug #38816: kill + flush tables with read lock + stored
              procedures causes crashes!
  
  The THD::LOCK_delete mutex has been renamed to
  THD::LOCK_thd_data.
sql/sql_show.cc:
  Bug #38816: kill + flush tables with read lock + stored
              procedures causes crashes!
  
  Inter-thread read of THD::query/query_length field has
  been protected with a new per-thread LOCK_thd_data
  mutex in the mysqld_list_processes function.
2009-07-24 20:58:58 +05:00
Alexey Kopytov
c24cccabdd Automerge. 2009-07-24 16:15:56 +04:00
Alexey Kopytov
8b4352782a Automerge. 2009-07-24 16:14:14 +04:00
Alexey Kopytov
85c97e6c69 Automerge. 2009-07-24 16:13:31 +04:00
Alexey Kopytov
498dc4d32d Manual merge. 2009-07-24 16:09:35 +04:00
Alexey Kopytov
885292e424 Bug #46075: Assertion failed: 0, file .\protocol.cc, line 416
In create_myisam_from_heap() mark all errors as fatal except 
HA_ERR_RECORD_FILE_FULL for a HEAP table.

Not doing so could lead to problems, e.g. in a case when a
temporary MyISAM table gets overrun due to its MAX_ROWS limit
while executing INSERT/REPLACE IGNORE ... SELECT. 
The SELECT execution was aborted, but the error was 
converted to a warning due to IGNORE clause, so neither 'ok' 
nor 'error' packet could be sent back to the client. This 
condition led to hanging client when using 5.0 server, or 
assertion failure in 5.1.


mysql-test/r/insert_select.result:
  Added a test case for bug #46075.
mysql-test/t/insert_select.test:
  Added a test case for bug #46075.
sql/sql_select.cc:
  In create_myisam_from_heap() mark all errors as fatal except 
  HA_ERR_RECORD_FILE_FULL for a HEAP table.
2009-07-24 15:50:45 +04:00
Anurag Shekhar
21c2e21dd1 merging with local branch. 2009-07-24 16:02:17 +05:30
Anurag Shekhar
0498988b48 Bug#30102: Rename table does corrupt tables with partition files on failure
Problem was that a failing rename just left the partitions at the state
it was at the failure.

Solution was to try to revert the started rename if a failure occured.

mysql-test/r/partition_not_embedded.result:
  Bug#30102: Rename table does corrupt tables with partition files on failure
  
  New result file
mysql-test/t/partition_not_embedded.test:
  Bug#30102: Rename table does corrupt tables with partition files on failure
  
  New test file
  (list_files does not report the files in embedded)
sql/ha_partition.cc:
  Bug#30102: Rename table does corrupt tables with partition files on failure
  
  Better error handling for rename partitions (reverting the started rename
  operation)
  
  Different order of files for delete.
sql/handler.cc:
  Bug#30102: Rename table does corrupt tables with partition files on failure
  
  Tries to remove as many table files as possible
  if the first delete succeeds.
2009-07-24 15:41:23 +05:30
V Narayanan
3669be6167 merging with mysql-5.1-bugteam 2009-07-24 12:56:27 +05:30
V Narayanan
74d4c3315c merging with mysql-5.0-bugteam 2009-07-24 12:28:17 +05:30
Satya B
30441aeadf merge 5.0-bugteam to 5.1-bugteam 2009-07-24 12:15:06 +05:30
Alexander Barkov
c6771e7bde Backporting "WL#3332 Korean Enhancements" and
"WL#4584 New euckr characters" from 5.4.
(as agreed on ServerPT meeting on July 8).
2009-07-24 11:27:23 +05:00
Satya B
559e2f1c1e merge to mysql-5.0-bugteam 2009-07-24 11:15:31 +05:30
Bjorn Munch
a80bd0b5d7 Bug #46212 safe_process: FATAL ERROR, Unknown option: --nocore
Also fixed mysqld.cc to avoid popup-boxes
2009-07-23 19:01:24 +02:00
Staale Smedseng
9c708fdf1e Merge from 5.0 2009-07-23 13:53:28 +02:00
Staale Smedseng
1e32574c65 Bug #45770 errors reading server SSL files are printed, but
not logged
        
Errors encountered during initialization of the SSL subsystem
are printed to stderr, rather than to the error log.
        
This patch adds a parameter to several SSL init functions to
report the error (if any) out to the caller. The function
init_ssl() in mysqld.cc is moved after the initialization of
the log subsystem, so that any error messages can be logged to
the error log. Printing of messages to stderr has been 
retained to get diagnostic output in a client context.


include/violite.h:
  Adding an enumeration for the various errors that can
  occur during initialization of the SSL module.
sql/mysqld.cc:
  Adding more logging of SSL init errors, and moving
  init_ssl() till after initialization of logging 
  subsystem.
vio/viosslfactories.c:
  Define error strings, provide an access method for these
  strings, and maintain an error parameter in several funcs
  to return the error (if any) to the caller.
2009-07-23 13:38:11 +02:00
Konstantin Osipov
2d716209e6 Add a comment for thd->proc_info. 2009-07-22 13:44:19 +04:00
MySQL Build Team
924ce2292a Backport into build-200907211706-5.0.82sp1
> ------------------------------------------------------------
> revno: 2792
> revision-id: sergey.glukhov@sun.com-20090703083500-jq8vhw0tqr37j7te
> parent: bernt.johnsen@sun.com-20090703083610-o7l4s8syz05rc4w0
> committer: Sergey Glukhov <Sergey.Glukhov@sun.com>
> branch nick: mysql-5.0-bugteam
> timestamp: Fri 2009-07-03 13:35:00 +0500
> message:
>   Bug#45806 crash when replacing into a view with a join!
>   The crash happend because for views which are joins
>   we have table_list->table == 0 and 
>   table_list->table->'any method' call leads to crash.
>   The fix is to perform table_list->table->file->extra()
>   method for all tables belonging to view.
2009-07-21 20:00:26 +02:00
MySQL Build Team
f6435cbff1 Backport into build-200907211706-5.0.82sp1
> ------------------------------------------------------------
> revno: 2772
> revision-id: joro@sun.com-20090615133815-eb007p5793in33p5
> parent: joro@sun.com-20090612140659-4hj1tta9p8wvcw4k
> committer: Georgi Kodinov <joro@sun.com>
> branch nick: B44810-5.0-bugteam
> timestamp: Mon 2009-06-15 16:38:15 +0300
> message:
>   Bug #44810: index merge and order by with low sort_buffer_size
>   crashes server!
>   
>   The problem affects the scenario when index merge is followed by a filesort
>   and the sort buffer is not big enough for all the sort keys.
>   In this case the filesort function will read the data to the end through the 
>   index merge quick access method (and thus closing the cursor etc), 
>   but will leave the pointer to the quick select method in place.
>   It will then create a temporary file to hold the results of the filesort and
>   will add it as a sort output file (in sort.io_cache).
>   Note that filesort will copy the original 'sort' structure in an automatic
>   variable and restore it after it's done.
>   As a result at exiting filesort() we have a sort.io_cache filled in and 
>   nothing else (as a result of close of the cursors at end of reading data 
>   through index merge).
>   Now create_sort_index() will note that there is a select and will clean it up
>   (as it's been used already by filesort() reading the data in). While doing that
>   a special case in the index merge destructor will clean up the sort.io_cache,
>   assuming it's an output of the index merge method and is not needed anymore.
>   As a result the code that tries to read the data back from the filesort output 
>   will get no data in both memory and disk and will crash.
>         
>   Fixed similarly to how filesort() does it : by copying the sort.io_cache structure
>   to a local variable, removing the pointer to the io_cache (so that it's not freed 
>   by QUICK_INDEX_MERGE_SELECT::~QUICK_INDEX_MERGE_SELECT) and restoring the original 
>   structure (together with the valid pointer) after the cleanup is done.
>   This is a safe thing to do because all the structures are already cleaned up by
>   hitting the end of the index merge's read method (QUICK_INDEX_MERGE_SELECT::get_next()) 
>   and the cleanup code being written in a way that tolerates repeating cleanups.
2009-07-21 19:59:04 +02:00
MySQL Build Team
ae2380452f Backport into build-200907211706-5.0.82sp1
> ------------------------------------------------------------
> revno: 2763
> revision-id: sergey.glukhov@sun.com-20090602063813-33mh88cz5vpa2jqe
> parent: alexey.kopytov@sun.com-20090601124224-zgt3yov9wou590e9
> committer: Sergey Glukhov <Sergey.Glukhov@sun.com>
> branch nick: mysql-5.0-bugteam
> timestamp: Tue 2009-06-02 11:38:13 +0500
> message:
>   Bug#45152 crash with round() function on longtext column in a derived table
>   The crash happens due to wrong max_length value which is set on
>   Item_func_round::fix_length_and_dec() stage. The value is set to
>   args[0]->max_length which is too big in case of LONGTEXT(LONGBLOB) fields.
>   The fix is to set max_length using float_length() function.
2009-07-21 19:56:35 +02:00
MySQL Build Team
ce72b2ddc5 Backport into build-200907211706-5.0.82sp1
> ------------------------------------------------------------
> revno: 2733
> revision-id: gshchepa@mysql.com-20090430192037-9p1etcynkglte2j3
> parent: aelkin@mysql.com-20090430143246-zfqaz0t7uoluzdz2
> committer: Gleb Shchepa <gshchepa@mysql.com>
> branch nick: mysql-5.0-bugteam
> timestamp: Fri 2009-05-01 00:20:37 +0500
> message:
>   Bug #37362: Crash in do_field_eq
>   
>   EXPLAIN EXTENDED of nested query containing a error:
>   
>      1054 Unknown column '...' in 'field list'
>   
>   may cause a server crash.
>   
>   
>   Parse error like described above forces a call to
>   JOIN::destroy() on malformed subquery.
>   That JOIN::destroy function closes and frees temporary
>   tables. However, temporary fields of these tables
>   may be listed in st_select_lex::group_list of outer
>   query, and that st_select_lex may not cleanup them
>   properly. So, after the JOIN::destroy call that
>   st_select_lex::group_list may have Item_field
>   objects with dangling pointers to freed temporary
>   table Field objects. That caused a crash.
2009-07-21 19:55:33 +02:00
unknown
a5c7edf7bc Set version number for mysql-5.0.82sp1 release 2009-07-21 19:50:50 +02:00
Joerg Bruehe
886c982730 Merge the bug fix for 37808 ("make_binary_distribution.sh")
into 5.0-build.
2009-07-21 19:37:28 +02:00
Joerg Bruehe
35d6a155a9 Merge the fix for bug#37808 into 5.1-build. 2009-07-21 18:49:42 +02:00
Joerg Bruehe
9e13f3bffc Merge 5.0-build up into 5.1-build.
This is just about a merge changeset, no code changes.
2009-07-21 18:25:38 +02:00
Joerg Bruehe
64c7dff6f5 Upmerge a bug fix from 5.0 to 5.1:
bug#37808
"make_binary_distribution" does not always generate correct names

Successfully tested on 5.1 sources.
2009-07-21 09:36:43 +02:00
Evgeny Potemkin
381ca8f58d auto-merge mysql-5.1-bugteam (local) -> mysql-5.1-bugteam. 2009-07-19 16:58:02 +04:00
Evgeny Potemkin
bc016c54ca Merged fix for the bug#46051. 2009-07-19 16:49:40 +04:00
Alfranio Correia
216b2fbf6a auto-merge mysql-5.1-bugteam (local) --> mysql-5.1-bugteam 2009-07-19 09:19:15 +01:00