Commit graph

71213 commits

Author SHA1 Message Date
Marko Mäkelä
c85f51f92a Follow-up fix to Bug#14628410: Remove the Windows InnoDB Plugin specific
implementation of innobase_mysql_tmpfile() from MySQL 5.5 onwards.
2012-12-13 17:12:21 +02:00
Satya Bodapati
bf42e842e5 Merge fix for Bug#14628410 from mysql-5.1 to mysql-5.5 2012-12-13 18:56:47 +05:30
Satya Bodapati
b0213a2b3a Bug#14628410 - ASSERTION `! IS_SET()' FAILED IN DIAGNOSTICS_AREA::SET_OK_STATUS
The error code returned from Merge file/Temp file creation functions are
ignored.

Use the return codes of the row_merge_file_create() and innobase_mysql_tmpfile()
to return the error to caller if file creation fails.

Approved by Marko. rb#1618
2012-12-13 18:53:16 +05:30
Harin Vadodaria
ff73218be4 Bug#15965288: BUFFER OVERFLOW IN YASSL FUNCTION
DOPROCESSREPLY()

Description: Merge from 5.1 to 5.5
2012-12-13 10:19:14 +05:30
Harin Vadodaria
cbc9373f36 Bug#15965288: BUFFER OVERFLOW IN YASSL FUNCTION
DOPROCESSREPLY()

Description: Function DoProcessReply() calls function
             decrypt_message() in a while loop without
             performing a check on available buffer
             space. This can cause buffer overflow and
             crash the server. This patch is fix provided
             by Sawtooth to resolve the issue.
2012-12-13 10:17:26 +05:30
Nirbhay Choubey
fc311cc623 Bug#13639125 DELIMITER STRIPS THE NEXT NEW LINE
IN A SQL STATEMENT

While processing each lines entered at the prompt,
mysql client appends a '\n' to all the lines except
for delimiter commands. However the same logic must
not apply if 'delimiter' is part of a string or a
comment, for which a '\n' should be added.

Fixed by adding appropriate checks.

Added a test case.
2012-12-12 22:31:03 +05:30
unknown
e10d25ef8f upmerge 14737171 5.1=>5.5 2012-12-12 15:10:47 +05:30
unknown
72343da4b6 Bug #14737171:MTR DOES NOT PRESERVE TEST CASE LOGS ON RETRY-FAIL 2012-12-12 15:09:31 +05:30
Dmitry Lenev
4235e46ea2 Bug #15954872 "MAKE MDL SUBSYSTEM AND TABLE DEFINITION CACHE
ROBUST AGAINST BUGS IN CALLERS".

Both MDL subsystems and Table Definition Cache code assume
that callers ensure that names of objects passed to them are
not longer than NAME_LEN bytes. Unfortunately due to bugs in
callers this assumption might be broken in some cases. As
result we get nasty bugs causing buffer overruns when we
construct MDL key or TDC key from object names.

This patch makes MDL and TDC code more robust against such
bugs by ensuring that we always checking size of result
buffer when constructing MDL and TDC keys. This doesn't
free its callers from ensuring that both db and table names
are shorter than NAME_LEN bytes. But at least these steps
prevents buffer overruns in case of bug in caller, replacing
them with less harmful behavior.

This is 5.5-only version of patch.

Changed code of MDL_key::mdl_key_init() to take into account
size of buffer for the key.

Introduced new version of create_table_def_key() helper function
which constructs TDC key without risk of result buffer overrun.
Places in code that construct TDC keys were changed to use this
function.

Also changed rm_temporary_table() and open_new_frm() functions
to avoid use of "unsafe" strmov() and strxmov() functions and
use safer strnxmov() instead.
2012-12-11 22:04:30 +04:00
Dmitry Lenev
2e10e7c38e Bug #15954872 "MAKE MDL SUBSYSTEM AND TABLE DEFINITION CACHE
ROBUST AGAINST BUGS IN CALLERS".

Both MDL subsystems and Table Definition Cache code assume 
that callers ensure that names of objects passed to them are 
not longer than NAME_LEN bytes. Unfortunately due to bugs in 
callers this assumption might be broken in some cases. As
result we get nasty bugs causing buffer overruns when we
construct MDL key or TDC key from object names.

This patch makes TDC code more robust against such bugs by 
ensuring that we always checking size of result buffer when
constructing TDC keys. This doesn't free its callers from 
ensuring that both db and table names are shorter than 
NAME_LEN bytes. But at least this steps prevents buffer 
overruns in case of bug in caller, replacing them with less 
harmful behavior.

This is 5.1-only version of patch.

This patch introduces new version of create_table_def_key()
helper function which constructs TDC key without risk of
result buffer overrun. Places in code that construct TDC keys 
were changed to use this function.

Also changed rm_temporary_table() and open_new_frm() functions
to avoid use of "unsafe" strmov() and strxmov() functions and 
use safer strnxmov() instead.
2012-12-11 22:00:51 +04:00
unknown
897f497f74 upmerge 14737171 5.1 => 5.5 2012-12-11 18:35:52 +05:30
unknown
a172c21265 Bug #14737171: MTR DOES NOT PRESERVE TEST CASE LOGS ON RETRY-FAIL 2012-12-11 18:34:04 +05:30
Joerg Bruehe
8c7308108d Merge ULN RPM stuff to main branch. 2012-12-11 11:30:58 +01:00
Annamalai Gurusami
2f7295575d Merging from mysql-5.1 to mysql-5.5. 2012-12-11 10:51:24 +05:30
Annamalai Gurusami
d426504b9e Bug #14200010 NEWLY CREATED TABLE DOESN'T ALLOW FOR LOOSE INDEX SCANS
Problem:

Before the ALTER TABLE statement, the array
dict_index_t::stat_n_diff_key_vals had proper values calculated
and updated.  But after the ALTER TABLE statement, all the values
of this array is 0.  

Because of this statistics returned by innodb_rec_per_key() is
different before and after the ALTER TABLE statement. Running the
ANALYZE TABLE command populates the statistics correctly.

Solution:

After ALTER TABLE statement, set the flag dict_table_t::stat_initialized
correctly so that the table statistics will be recalculated properly when
the table is next loaded.  But note that we still don't choose the loose
index scans.  This fix only ensures that an ALTER TABLE does not change
the optimizer plan.

rb://1639 approved by Marko and Jimmy.
2012-12-11 10:11:24 +05:30
Joerg Bruehe
0a925f7317 RPMs for ULN do not build in MySQL 5.6: Patches + libmysqld.so
Bug #15972480

This is the change for 5.5:
    a cleanup in the way "libmysqld.so" is created.
(Patches were adapted for 5.5 previously.)

Originally, the ".so" was created by taking all modules in
"libmysqld.a", after removing some few which caused unresolved
references.
This is no good idea, rather "ld" should be used to follow all
references from some few start modules.

At the same time, the ".so" version needed to be corrected:
The original "0.0.1" is both wrong and risky.
Rather, the server version is used to identify the ".so" file,
but for linkage the first two levels are sufficient (so upgrades
are possible without re-building the embedded application).
2012-12-10 09:42:18 +01:00
Shivji Kumar Jha
07a5b266fb BUG#12359942 - REPLICATION TEST FROM ENGINE SUITE RPL_ROW_UNTIL TIMES OUT
patch to fix post push falures in pb2
             bzr merge 5.1->5.5

BUG#15872504 - REMOVE MYSQL-TEST/INCLUDE/GET_BINLOG_DUMP_THREAD_ID.INC
             bzr merge 5.1->5.6
2012-12-09 17:26:44 +05:30
Shivji Kumar Jha
6b3dad83c9 BUG#12359942 - REPLICATION TEST FROM ENGINE SUITE PL_ROW_UNTIL TIMES OUT
patch to fix post push falures in pb2 

BUG#15872504 - REMOVE MYSQL-TEST/INCLUDE/GET_BINLOG_DUMP_THREAD_ID.INC
            
=== Problem ===
            
The file named "mysql-test/include/get_binlog_dump_thread_id.inc" is not 
used anywhere. In any case, this file does wrong things in the wrong way:
1) The file seems to assume there is only one dump thread, but there may 
   be many.
2) you can get this information in a much easier way using the command:
   "select thread_id from threads where processlist_command="Binlog Dump";"

=== Fix ===
          
removed file 'mysql-test/include/get_binlog_dump_thread_id.inc'
2012-12-09 17:21:51 +05:30
Shivji Kumar Jha
51d43baa66 BUG#12359942 - REPLICATION TEST FROM ENGINE SUITE
RPL_ROW_UNTIL TIMES OUT
 
 patch to fix post push falures in pb2 

mysql-test/suite/rpl/r/rpl_row_until.result:
  changes to account for the changes made in
  corresponding test file.
mysql-test/suite/rpl/t/disabled.def:
  disabled test in macosx
mysql-test/suite/rpl/t/rpl_row_until.test:
  replaced static relayy log file by an mtr variable
  which saves the name of relay log file.
2012-12-09 15:50:32 +05:30
Akhila Maddukuri
b74a229c23 Bug #15930494 MYSQLDUMP TEST SOMETIMES FAILS DUE TO MIXING STDOUT AND
STDERR

      Fix: Added a destination file to mysqldump.
2012-12-07 18:26:02 +05:30
unknown
b3b59f75d2 2012-12-07 15:41:49 +05:30
Harin Vadodaria
aec9ca5da4 Bug#15912213: BUFFER OVERFLOW IN ACL_GET()
Description: A very large database name causes buffer
             overflow in functions acl_get() and
             check_grant_db() in sql_acl.cc. It happens
             due to an unguarded string copy operation.
             This puts required sanity checks before
             copying db string to destination buffer.
2012-12-06 16:53:02 +05:30
Dmitry Shulga
54769c281e This patch fixes bug#14729757 - MY_HASH_SEARCH(&XID_CACHE,
XID_STATE->XID.KEY(),
                                XID_STATE->XID.KEY_LENGTH())==0
  
This bug is a regression of bug#11759534 - 51855: RACE CONDITION
                                           IN XA START.
  
The reason for regression is that the changes that fixes the original
bug wasn't merged from mysql-5.1 into mysql-5.5 and mysql-trunk.
Only null-merge was done for the patch changeset.
  
To incorporate lost changes the manual merge have been done.
  
Additionally the call of trans_rolback() was added into trans_xa_start()
in case if xid_cache_insert is failed() after transaction has been started.
If we don't call trans_rollback() we would never reset the flag
SERVER_STATUS_IN_TRANS in THD::server_status and therefore all subsequent
attempts to execute XA START in the connection where the error was occurred
will be failed since thd->in_active_multi_stmt_transaction() will return
the true every time when trans_xa_start is called.
  
The latest changes were absent in patch for mysql-5.1
2012-12-06 15:59:15 +06:00
Gleb Shchepa
46cfbf35f8 Bug #15948123: SERVER WORKS INCORRECT WITH LONG TABLE ALIASES
Post-push cleanup: removal of unneeded assertions.
2012-12-05 20:41:29 +04:00
Dmitry Lenev
db2a045f0e Merged fix for bug #15954896 "SP, MULTI-TABLE DELETE AND LONG ALIAS"
into 5.5 tree.
2012-12-05 19:50:02 +04:00
Dmitry Lenev
095e8271b7 Bug #15954896 "SP, MULTI-TABLE DELETE AND LONG ALIAS".
Using too long table aliases in stored routines might
have caused server crashes.

Code in sp_head::merge_table_list() which is responsible 
for collecting information about tables used in stored
routine was not aware of the fact that table alias might
have arbitrary length. I.e. it assumed that table alias
can't be longer than NAME_LEN bytes and allocated buffer
for a key identifying table accordingly.

This patch fixes the issue by ensuring that we use
dynamically allocated buffer for table key when table
alias is too long. By default stack based buffer is used
in which NAME_LEN bytes are reserved for table alias.
2012-12-05 19:26:56 +04:00
unknown
2c64d0a58d 2012-12-05 16:16:32 +01:00
Bjorn Munch
997748e850 Remove moot --unit-test option for mtr in collections 2012-12-05 15:14:08 +01:00
Gleb Shchepa
70cb820e2d Bug #15948123: SERVER WORKS INCORRECT WITH LONG TABLE ALIASES
Code in MDL subsystem assumes that identifiers of objects can't
be longer than NAME_LEN characters. This assumption was broken
when one tried to construct MDL_key based on table alias, which
can have arbitrary length. Since MDL_key's (and MDL locks) are
not really used for table aliases this patch changes code to
not initialize MDL_key object for table list element representing
aliases.
2012-12-05 16:53:33 +04:00
Shivji Kumar Jha
195e731edb BUG#12359942 - REPLICATION TEST FROM ENGINE SUITE RPL_ROW_UNTIL TIMES OUT
bzr merge 5.1->5.5
2012-12-05 10:24:45 +05:30
Shivji Kumar Jha
055cffb4c8 BUG#12359942 - REPLICATION TEST FROM ENGINE SUITE RPL_ROW_UNTIL TIMES OUT
=== Problem ===
      
The test is dependent on binlog positions and checks
to see if the command 'START SLAVE' functions correctly
with the 'UNTIL' clause added to it. The 'UNTIL' clause
is added to specify that the slave should start and run
until the SQL thread reaches a given point in the master
binary log or in the slave relay log.
      
The test uses hard coded values for MASTER_LOG_POS and
RELAY_LOG_POS, instead of extracting it using
query_get_value() function. There is a test
'rpl.rpl_row_until' which does the similar thing but uses 
query_get_value() function to set the values of
MASTER_LOG_POS/ RELAY_LOG_POS. To be precise,
rpl.rpl_row_until is a modified version of
engines/func.rpl_row_until.test.
      
The use of hard coded values may lead the slave to stop at a position
which may differ from the expected position in the binlog file,
an example being the failure of engines/funcs.rpl_row_until in 
mysql-5.1 given as: 
"query 'select * from t2' failed. Table 'test.t2' doesn't exist".
In this case, the slave actually ran a couple of extra commands
as a result of which the slave first deleted the table and then
ran a select query on table, leading to the above mentioned failure.
      
=== Fix ===
    
1) Fixed the code for failure seen in rpl.rpl_row_until.
   This test was also failing although the symptoms of
   failure were different.
2) Copied the contents from rpl.rpl_row_until into
   into engines/funcs.rpl.rpl_row_until.
3) Updated engines/funcs.rpl_row_until.result accordingly.

mysql-test/suite/engines/funcs/r/rpl_row_until.result:
  modified to accomodate the changes in corresponding
  test file.
mysql-test/suite/engines/funcs/t/disabled.def:
  removed from the list of disabled tests.
mysql-test/suite/engines/funcs/t/rpl_row_until.test:
  fixed rpl.rpl_row_until and copied its content to
  engines/funcs.rpl_row_until. The reason being both
  are same tests but rpl.rpl_row_until is an
  updated version.
mysql-test/suite/rpl/t/disabled.def:
  removed from the list of disabled tests.
sql/sql_repl.cc:
  Added a check to catch an improper combination
  of arguements passed to 'START SLAVE UNTIL'. Earlier,
  START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001',
  MASTER_LOG_POS=561, RELAY_LOG_POS=12;
  passed. It is now detected and an error is reported.
2012-12-05 10:17:53 +05:30
Pedro Gomes
86718b969c Bug#13545447 RPL_ROTATE_LOGS FAILS DUE TO CONCURRENCY ISSUES IN REP. CODE
RPL_ROTATE_LOGS has been failing sporadically in what seems a
problem related to routines that update the coordinates. However,
the test lacks proper assert statments and because of this the
debug information upon failure simply points to the content
mismatch between the test and the result file.

Not as a solution, but as a improvement to the test to better
debug this failure, new assert statments were added to the test.

@rpl_rotate_logs.test
  Added new assert statments reducing the
  dependency on the result file.

@rpl_rotate_logs.result
  Added new content to the result file to
  match the test changes
2012-12-04 16:09:48 +00:00
Manish Kumar
14b18b2785 BUG#13812374 - RPL.RPL_REPORT_PORT FAILS OCCASIONALLY ON PB2
Problem: The problem with the test is that the slave returns 
         from start_slave.inc call too early before the list
         is actually actualised. This caused the slave stale 
         data to be reported.

Fix: Added a wait in the test till the slave's IO status is 
     changed to "Waiting for master to send event" which 
     which ensures the list is correctly updated.
2012-12-04 18:14:01 +05:30
Yasufumi Kinoshita
859ff1ec36 UNIV_DEBUG build of some environments needs
#include "read0read.h"
for srv0srv.c and trx0rec.c.
This is only for mysql-5.5
2012-12-04 12:32:58 +09:00
Mattias Jonsson
4148bec151 merge mysql-5.1 -> mysql-5.5 2012-12-01 09:17:56 +01:00
Mattias Jonsson
63b0cbe396 merge of bug#14589559 to mysql-5.5 2012-12-01 09:12:05 +01:00
Mattias Jonsson
b6249e510b merge of bug#14589559 into mysql-5.1 2012-12-01 09:07:03 +01:00
Libing Song
775b5c0269 Auto Merge 2012-12-01 08:06:45 +08:00
Libing Song
bdfc4dc6c6 Bug#11764602 ASSERTION IN
FORMAT_DESCRIPTION_LOG_EVENT::CALC_SERVER_VERSION_SPLIT

Problem: When reading a Format_description_log_event, it supposes MySQL
version is always valid and DBUG_ASSERTION is used check the version number.
However, user may give a wrong binlog offset, even give a faked binary event
which includes an invalid MySQL version. This will cause server crash.

Fix: The assertions are removed and an error will be reported if MySQL
version in Format_description_log_event is invalid.
2012-12-01 08:04:33 +08:00
Mattias Jonsson
17076f8cd3 bug#14589559: ASSERTION `FILE_ENTRY_BUF[2] == 0' FAILED
IN DEACTIVATE_DDL_LOG_ENTRY

Update of comments according to reviewers request.
2012-11-30 16:17:38 +01:00
Inaam Rana
a418755a1a merge from 5.1 2012-11-30 16:28:58 +05:00
Inaam Rana
60fff18d77 Reverting fix for bug#14329288
revid that is being reverted: marko.makela@oracle.com-20121128070024-hb56t41limja8edz
2012-11-30 16:19:30 +05:00
Shivji Kumar Jha
07ffa9c767 BUG#12359942 - REPLICATION TEST FROM ENGINE SUITE RPL_ROW_UNTIL TIMES OUT
=== Problem ===

The test is dependent on binlog positions and checks
to see if the command 'START SLAVE' functions correctly
with the 'UNTIL' clause added to it. The 'UNTIL' clause
is added to specify that the slave should start and run
until the SQL thread reaches a given point in the master
binary log or in the slave relay log.

The test uses hard coded values for MASTER_LOG_POS and
RELAY_LOG_POS, instead of extracting it using
query_get_value() function. There is a test
'rpl.rpl_row_until' which does the similar thing but uses 
query_get_value() function to set the values of
MASTER_LOG_POS/ RELAY_LOG_POS. To be precise,
rpl.rpl_row_until is a modified version of
engines/func.rpl_row_until.test.

The use of hard coded values may lead the slave to stop at a position
which may differ from the expected position in the binlog file,
an example being the failure of engines/funcs.rpl_row_until in 
mysql-5.1 given as: 
"query 'select * from t2' failed. Table 'test.t2' doesn't exist".
In this case, the slave actually ran a couple of extra commands
as a result of which the slave first deleted the table and then
ran a select query on table, leading to the above mentioned failure.

=== Fix ===

1) Fixed the code for failure seen in rpl.rpl_row_until.
   This test was also failing although the symptoms of
   failure were different.
2) Copied the contents from rpl.rpl_row_until into
   into engines/funcs.rpl.rpl_row_until.
3) Updated engines/funcs.rpl_row_until.result accordingly.

mysql-test/suite/engines/funcs/r/rpl_row_until.result:
  modified to accomodate the changes in corresponding
  test file.
mysql-test/suite/engines/funcs/t/disabled.def:
  removed from the list of disabled tests.
mysql-test/suite/engines/funcs/t/rpl_row_until.test:
  fixed rpl.rpl_row_until and copied its content to
  engines/funcs.rpl_row_until. The reason being both
  are same tests but rpl.rpl_row_until is an
  updated version.
mysql-test/suite/rpl/t/disabled.def:
  removed from the list of disabled tests.
sql/sql_repl.cc:
  Added a check to catch an improper combination
  of arguements passed to 'START SLAVE UNTIL'. Earlier,
  START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001',
  MASTER_LOG_POS=561, RELAY_LOG_POS=12;
  passed. It is now detected and an error is reported.
2012-11-30 12:12:33 +05:30
Tor Didriksen
6cbbe2392f Bug#11754279 SIGNIFICANT INACCURACY IN DECIMAL MULTIPLICATION CALCULATIONS
frac is the number of decimal digits after the point
For each multiplication in the expression, decimal_mul() does this:
  to->frac= from1->frac + from2->frac;              /* store size in digits */
which will eventually overflow.
The code for handling the overflow, will truncate the two digits in "1.75" to "1"

Solution:
Truncate to 31 significant fractional digits, when doing decimal multiplication.
2012-11-29 17:21:36 +01:00
Venkatesh Duggirala
fe4fe4e1cc BUG#15888454: SLAVE CRASHES WHEN DML REQUIRES CONVERSION & TABLE HAS
LESS COLUMNS THAN MASTER

Problem:
========
If DML operation requires a converstion at slave and if slave contains
less number of columns than master, slave is crashing.

Fix:
====
When Slave applies any DML operation, it sees if any of the columns 
requires conversion. If yes, it creates conversion table. 
While creating the coversion table, it should look into the actual number 
of columns required to create the table instead of getting the number
of columns from Master (size()). Columns would have dropped or added
at Slave. So the value should be min(columns@master, columns@slave)

sql/rpl_utility.cc:
  loop through only correct number of columns
2012-11-29 17:33:06 +05:30
Harin Vadodaria
37bbffa775 Bug#15912213: BUFFER OVERFLOW IN ACL_GET()
Description: Null merge.
2012-11-29 17:24:15 +05:30
Harin Vadodaria
c1f9f122d5 Bug#15912213: BUFFER OVERFLOW IN ACL_GET()
Description: A very large database name causes buffer
             overflow in functions acl_get() and
             check_grant_db() in sql_acl.cc. It happens
             due to an unguarded string copy operation.
             This puts required sanity checks before
             copying db string to destination buffer.
2012-11-29 17:23:23 +05:30
unknown
92f7dc41b5 2012-11-28 19:01:59 +05:30
Yasufumi Kinoshita
ddf518c567 Bug#59354 : Bug #12659252 : ASSERT !OTHER_LOCK AT LOCK_REC_ADD_TO_QUEUE DURING A DELETE OPERATION
The converted implicit lock should wait for the prior conflicting lock if found.

rb://1437 approved by Marko
2012-11-28 17:07:02 +09:00
Yasufumi Kinoshita
8dd87e690d Bug#59354 : Bug #12659252 : ASSERT !OTHER_LOCK AT LOCK_REC_ADD_TO_QUEUE DURING A DELETE OPERATION
The converted implicit lock should wait for the prior conflicting lock if found.

rb://1437 approved by Marko
2012-11-28 17:05:23 +09:00