Commit graph

63956 commits

Author SHA1 Message Date
Sergey Vojtovich
33a9d9fa65 BUG#12402794 - 60976: CRASH, VALGRIND WARNING AND MEMORY
LEAK WITH PARTITIONED ARCHIVE TABLES

CHECK TABLE against archive table, when file descriptors
are exhausted, caused server crash.

Archive didn't handle errors when opening data file for
CHECK TABLE.
2011-05-18 14:01:43 +04:00
Sergey Glukhov
a7cd008e12 Bug#12403504 AFTER FIX FOR #11889186 : ASSERTION FAILED: DELSUM+(INT) Y/4-TEMP > 0
There are two problems:
1. There is a missing check for 'year' parameter(year can not be greater than 9999) in
   makedate function. fix: added check that year can not be greater than 9999.
2. There is a missing check for zero date in from_days() function.
   fix: added zero date check into Item_func_from_days::get_date()
   function.
2011-05-18 10:47:43 +04:00
Guilhem Bichot
25221cccd2 Fix for BUG#11755168 '46895: test "outfile_loaddata" fails (reproducible)'.
In sql_class.cc, 'row_count', of type 'ha_rows', was used as last argument for
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD which is
"Incorrect %-.32s value: '%-.128s' for column '%.192s' at row %ld".
So 'ha_rows' was used as 'long'.
On SPARC32 Solaris builds, 'long' is 4 bytes and 'ha_rows' is 'longlong' i.e. 8 bytes.
So the printf-like code was reading only the first 4 bytes.
Because the CPU is big-endian, 1LL is 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01
so the first four bytes yield 0. So the warning message had "row 0" instead of
"row 1" in test outfile_loaddata.test:
-Warning	1366	Incorrect string value: '\xE1\xE2\xF7' for column 'b' at row 1
+Warning	1366	Incorrect string value: '\xE1\xE2\xF7' for column 'b' at row 0

All error-messaging functions which internally invoke some printf-life function
are potential candidate for such mistakes.
One apparently easy way to catch such mistakes is to use
ATTRIBUTE_FORMAT (from my_attribute.h).
But this works only when call site has both:
a) the format as a string literal
b) the types of arguments.
So:
  func(ER(ER_BLAH), 10);
will silently not be checked, because ER(ER_BLAH) is not known at
compile time (it is known at run-time, and depends on the chosen
language).
And
  func("%s", a va_list argument);
has the same problem, as the *real* type of arguments is not
known at this site at compile time (it's known in some caller).
Moreover,
  func(ER(ER_BLAH));
though possibly correct (if ER(ER_BLAH) has no '%' markers), will not
compile (gcc says "error: format not a string literal and no format
arguments").

Consequences:
1) ATTRIBUTE_FORMAT is here added only to functions which in practice
take "string literal" formats: "my_error_reporter" and "print_admin_msg".
2) it cannot be added to the other functions: my_error(),
push_warning_printf(), Table_check_intact::report_error(),
general_log_print().

To do a one-time check of functions listed in (2), the following
"static code analysis" has been done:
1) replace
  my_error(ER_xxx, arguments for substitution in format)
with the equivalent
  my_printf_error(ER_xxx,ER(ER_xxx), arguments for substitution in
format),
so that we have ER(ER_xxx) and the arguments *in the same call site*
2) add ATTRIBUTE_FORMAT to push_warning_printf(),
Table_check_intact::report_error(), general_log_print()
3) replace ER(xxx) with the hard-coded English text found in
errmsg.txt (like: ER(ER_UNKNOWN_ERROR) is replaced with
"Unknown error"), so that a call site has the format as string literal
4) this way, ATTRIBUTE_FORMAT can effectively do its job
5) compile, fix errors detected by ATTRIBUTE_FORMAT
6) revert steps 1-2-3.
The present patch has no compiler error when submitted again to the
static code analysis above.
It cannot catch all problems though: see Field::set_warning(), in
which a call to push_warning_printf() has a variable error
(thus, not replacable by a string literal); I checked set_warning() calls
by hand though.

See also WL 5883 for one proposal to avoid such bugs from appearing
again in the future.

The issues fixed in the patch are:
a) mismatch in types (like 'int' passed to '%ld')
b) more arguments passed than specified in the format.
This patch resolves mismatches by changing the type/number of arguments,
not by changing error messages of sql/share/errmsg.txt. The latter would be wrong,
per the following old rule: errmsg.txt must be as stable as possible; no insertions
or deletions of messages, no changes of type or number of printf-like format specifiers,
are allowed, as long as the change impacts a message already released in a GA version.
If this rule is not followed:
- Connectors, which use error message numbers, will be confused (by insertions/deletions
of messages)
- using errmsg.sys of MySQL 5.1.n with mysqld of MySQL 5.1.(n+1)
could produce wrong messages or crash; such usage can easily happen if
installing 5.1.(n+1) while /etc/my.cnf still has --language=/path/to/5.1.n/xxx;
or if copying mysqld from 5.1.(n+1) into a 5.1.n installation.
When fixing b), I have verified that the superfluous arguments were not used in the format
in the first 5.1 GA (5.1.30 'bteam@astra04-20081114162938-z8mctjp6st27uobm').
Had they been used, then passing them today, even if the message doesn't use them
anymore, would have been necessary, as explained above.
2011-05-16 22:04:01 +02:00
Vinay Fisrekar
4731736320 Adding bug scenario for data types in main suite
Impementing Test Review Comment.
      
Bug test scenario:      
SELECT is not returning result set for "equal" (=) and "NULL safe equal
operator"  (<=>) on BIT data type. Extending this scenario for all data types
2011-05-14 21:44:49 +05:30
Bjorn Munch
db4ed17587 merge from 5.1-mtr 2011-05-13 13:04:01 +02:00
Bjorn Munch
dca22eb6f3 merge from 5.1 main 2011-05-12 14:08:47 +02:00
Tatjana Azundris Nuernberg
25abeed586 auto-merge 2011-05-12 05:43:53 +01:00
Tatjana Azundris Nuernberg
2683078d28 auto-merge Bug#11762799/Bug#55436 2011-05-12 03:41:51 +01:00
Serge Kozlov
f978c103bb automerge 2011-05-10 17:50:30 +04:00
Georgi Kodinov
ef2d701c00 weave merge mysql-5.0->mysql-5.1 2011-05-10 16:21:44 +03:00
Vasil Dimov
6209f47fd2 Increment InnoDB Plugin version from 1.0.16 to 1.0.17.
InnoDB Plugin 1.0.16 has been released with MySQL 5.1.57.
2011-05-10 15:43:30 +03:00
Serge Kozlov
e8b54a7ce9 WL#5867
Replaced the error code by error name
2011-05-09 23:14:24 +04:00
Sunanda Menon
78e73ec219 Merge from mysql-5.0.93-release 2011-05-06 10:36:30 +02:00
Karen Langford
74afcca8f2 Merge from mysql-5.1.57-release 2011-05-06 10:03:02 +02:00
Luis Soares
8cc75b2d1e BUG#12354268
Automerged bzr bundle from bug report:
luis.soares@oracle.com-20110505224815-6ob90n7suxsoizvs.bundle
2011-05-06 00:54:36 +01:00
Luis Soares
ed6aae83c3 BUG#11762616: BUG#55229: 'POSTION'
Fix for all "postion" in Oracle files (s/postion/position). 
Updated the copyright notices where needed.
2011-05-06 00:46:53 +01:00
Luis Soares
e367a789d1 BUG#12354268: MYSQLBINLOG --BASE64-OUTPUT=DECODE-ROWS DOES NOT
WORK WITH --START-POSITION
      
If setting --start-position to start after the FD event, mysqlbinlog
will output an error stating that it has not found an FD event.
However, its not that mysqlbinlog does not find it but rather that it
does not processes it in the regular way (i.e., it does not print it).
Given that one is using --base64-output=DECODE-ROWS then not printing
it is actually fine.
      
To fix this, we make mysqlbinlog not to complain when it has not
printed the FD event, is outputing in base64, but is decoding the
rows.
2011-05-05 23:48:15 +01:00
Tatiana Azundris Nurnberg
4e9e69e5f8 auto-merge conservative fix for Bug#55436/Bug#11762799 2011-05-05 06:39:38 +01:00
Alexander Nozdrin
ca6e7781ef Patch for Bug#12394306: the sever may crash if mysql.event is corrupted.
The problem was that wrong structure of mysql.event was not detected and
the server continued to use wrongly-structured data.

The fix is to check the structure of mysql.event after opening before
any use. That makes operations with events more strict -- some operations
that might work before throw errors now. That seems to be Ok.

Another side-effect of the patch is that if mysql.event is corrupted,
unrelated DROP DATABASE statements issue an SQL warning about inability
to open mysql.event table.
2011-05-04 16:59:24 +04:00
Jimmy Yang
ce2ed6197c Fix bug #11796673 address backward compatibility on index with
large prefix (>=768). Table with such large prefix index will not
be loaded into memory (for its metadata), unless innodb_force_recovery
is on.

rb://604 Approved by Marko
2011-05-04 03:06:21 -07:00
Bjorn Munch
b8fe42d127 Bug #11752142 43247: SUITE/<SUITE NAME>/INCLUDE: NO SUCH FILE OR DIRECTORY
The originally reported dirs have been removed
But found suite/bugs, removed from mysql-test/Makefile.am
2011-05-03 16:08:25 +02:00
Kent Boortz
4f666e8e81 Remove soft links in the build directory, not the source directory (Bug#43312) 2011-05-03 16:02:31 +02:00
Vasil Dimov
0451f7854c Merge mysql-5.1 -> mysql-5.1-innodb 2011-05-02 12:57:05 +03:00
Vasil Dimov
bc7bf937c5 Merge mysql-5.1-innodb -> mysql-5.1 2011-05-02 12:49:19 +03:00
Nirbhay Choubey
39f71a296a Bug#11757855 - 49967: built-in libedit doesn't read
.editrc on linux.

MySQL client when build with libedit support ignores
.editrc at startup.

The reason for this regression was the incluison of a
safety check, issetugid(), which is not available on
some linux platforms.

Fixed by adding an equivalent check for platforms which
have get[e][u|g]id() set of functions.
2011-04-29 18:52:46 +05:30
Bjorn Munch
c17ec079a2 merge from 5.1-mtr 2011-04-29 13:48:57 +02:00
Vasil Dimov
2e0e518f39 Sync 5.1 .inc file with 5.5 due to a missing changeset
Add extra codes to wait_until_disconnected.inc that are present in 5.5,
but not in 5.1. The missing codes cause innodb_bug59641 to fail in 5.1 on
Windows PB2 runs. The addition of those codes in 5.5 was done in
luis.soares@sun.com-20090930233215-aup3kxy4j6ltvjfp
2011-04-29 14:04:28 +03:00
Mattias Jonsson
f726c20722 bug#11765667: bug#58655: ASSERTION FAILED, SERVER CRASHES WITH MYSQLD GOT SIGNAL 6
The partitioning engine checked the auto_increment column even if it was not to be written,
triggering a DBUG_ASSERT.

Fixed by checking if table->write_set for that column was set.
2011-04-29 13:00:16 +02:00
Bjorn Munch
cc78ab77c9 merge from 5.1 main 2011-04-29 10:55:08 +02:00
Mattias Jonsson
3980482fd0 removed dead obsolete code 2011-04-29 09:48:26 +02:00
Mattias Jonsson
aefbea7d0b Post push fix for bug#11766249 bug#59316
Partitions can have different ref_length (position data length).
Removed DBUG_ASSERT which crashed debug builds when using
MAX_ROWS on some partitions.
2011-04-27 17:51:06 +02:00
Nirbhay Choubey
c08c4e1fd7 BUG#12329909 - BUILDING MYSQL WITH DEBUG SUPPORT
FAILS WITH LIBEDIT

Fixed by checking the return value of the write()
function calls and handling the open files and fd
appropriately.
2011-04-27 17:24:10 +05:30
Sergey Glukhov
735bab72c5 Bug#11889186 60503: CRASH IN MAKE_DATE_TIME WITH DATE_FORMAT / STR_TO_DATE COMBINATION
calc_daynr() function returns negative result
if malformed date with zero year and month is used.
Attempt to calculate week day on negative value
leads to crash. The fix is return NULL for
'W', 'a', 'w' specifiers if zero year and month is used.
Additional fix for calc_daynr():
--added assertion that result can not be negative
--return 0 if zero year and month is used
2011-04-27 11:35:57 +04:00
Guilhem Bichot
a014fd9367 merge from 5.1 2011-04-26 13:06:44 +02:00
Mattias Jonsson
1a352b8ecd merge 2011-04-26 12:07:14 +02:00
Mattias Jonsson
0ef0c541af post fix for werror build for bug#11766249. 2011-04-26 10:21:09 +02:00
Serge Kozlov
e7079a3235 BUG#12371924. Fxi test case 2011-04-25 23:49:56 +04:00
Mattias Jonsson
1f617e7418 merge 2011-04-23 16:57:24 +02:00
Sergey Glukhov
76f37a0235 Bug#11756928 48916: SERVER INCORRECTLY PROCESSING HAVING CLAUSES WITH AN ORDER BY CLAUSE
Before sorting HAVING condition is split into two parts,
first part is a table related condition and the rest of is
HAVING part. Extraction of HAVING part does not take into account
the fact that some of conditions might be non-const but
have 'used_tables' == 0 (independent subqueries)
and because of that these conditions are cut off by
make_cond_for_table() function.
The fix is to use (table_map) 0 instead of used_tables in
third argument for make_cond_for_table() function.
It allows to extract elements which belong to sorted
table and in addition elements which are independend
subqueries.
2011-04-22 11:20:55 +04:00
Vasil Dimov
b4a98699be Merge mysql-5.1 -> mysql-5.1-innodb 2011-04-21 11:08:05 +03:00
Mattias Jonsson
482c0b7d42 merge 2011-04-20 18:10:15 +02:00
Mattias Jonsson
002426a9eb merge 2011-04-20 18:00:50 +02:00
Mattias Jonsson
f6641998be Bug#11766249 bug#59316: PARTITIONING AND INDEX_MERGE MEMORY LEAK
Update for previous patch according to reviewers comments.

Updated the constructors for ha_partitions to use the common
init_handler_variables functions

Added use of defines for size and offset to get better readability for the code that reads
and writes the .par file. Also refactored the get_from_handler_file function.
2011-04-20 17:52:33 +02:00
Bjorn Munch
5cc7844b5c Bug #12379923 60907: MYSQL-TEST/LIB/MY/SAFEPROCESS/SAFE_PROCESS.PL USES HARDCODED SIGNAL NUMBE
Replaced the hardcoded 9 with 'KILL'
2011-04-20 14:58:53 +02:00
Jon Olav Hauglid
73ecffdb2f BUG#12377872 ASSERTION FAILED: !_ENTERED WHEN GETHOSTBYADDR_R
FAILS ON SOLARIS

This assertion was triggered if gethostbyaddr_r cannot do a
reverse lookup on an ip address. The reason was a missing
DBUG_RETURN macro. The problem affected only debug versions of
the server.

This patch fixes the problem by replacing return with DBUG_RETURN.
No test case added.
2011-04-20 11:32:28 +02:00
Sergey Glukhov
71bb332aa3 Bug#11765923 58937: MANY VALGRIND ERRORS AFTER GROUPING BY RESULT OF DECIMAL COLUMN FUNCTION
Bug#11764671  57533: UNINITIALISED VALUES IN COPY_AND_CONVERT (SQL_STRING.CC) WITH CERTAIN CHA
When ROUND evaluates decimal result it uses Item::decimal
value as fraction value for the result. In some cases
Item::decimal is greater than real result fraction value
and uninitialised memory of result(decimal) buffer can be
used in further calculations. Issue is introduced by
Bug33143 fix. The fix is to remove erroneous assignment.
2011-04-20 11:39:20 +04:00
Serge Kozlov
410ee93cde BUG#12371924
Update test case
2011-04-18 23:59:15 +04:00
Bjorn Munch
c346b0a483 Bug #12365486 MTR FAILS TO FIND WARNINGS IN SERVER LOG WITH --VALGRIND COMBINED WITH --DEBUG
With this combination, outoput was directed to .trace but not all
      parts of MTR was aware of this.
Replace .err with .trace at the earliest possible place
2011-04-18 15:35:14 +02:00
Sven Sandberg
5038060b3b test fails on more platforms, removed @freebsd from default.experimental. 2011-04-18 14:42:14 +02:00
Martin Hansson
7b4cafe9b9 Bug 11758558 - 50774: WRONG RESULTSET WHEN TIMESTAMP VALUES ARE APPENDED WITH
.0

The bug was fixed by the patch for bug number BUG 11763109 - 55779: SELECT
DOES NOT WORK PROPERLY IN MYSQL SERVER VERSION "5.1.42 SUSE MYSQL (Exact same
fix as was proposed for this bug.) Since the motivation for the two bug
reports was completely different, however, it still makes sense to push the
test case.

This patch contains only the test case.
2011-04-18 10:44:41 +02:00