Commit graph

25093 commits

Author SHA1 Message Date
Georgi Kodinov
b27465c28a auto-merge 2009-03-17 16:32:44 +02:00
Georgi Kodinov
9de51e418b Bug 22047: Time in SHOW PROCESSLIST for SQL thread in replication seems to
become negative

- merged the fix to 5.1
- extended to cover I_S.PROCESSLIST.TIME
- Changed the column type of I_S.PROCESSLIST.TIME from LOGNLONG
  UNSIGNED
  to LONG (to match the SHOW PROCESSLIST type)
- Added a test case
2009-03-17 16:29:16 +02:00
Ramil Kalimullin
44f6c2937d Code clean-up.
sql/sql_select.cc:
  the if() separate arguments checks are slightly faster.
2009-03-17 11:04:15 +04:00
Alexey Kopytov
15baa13f84 Manual merge of patch for bug #40552 into the team tree.
Replaced a call to load_defaults() in sql_plugin.cc with 
its thread-safe version.
2009-03-16 13:37:13 +03:00
Ramil Kalimullin
0fd7a359da Fix for bug #42957: no results from
select where .. (col=col and col=col) or ... (false expression)

Problem: optimizer didn't take into account a singular case 
when we eliminated all the predicates at the AND level of WHERE.
That may lead to wrong results.

Fix: replace (a=a AND a=a...) with TRUE if we eliminated all the
predicates.


mysql-test/r/select.result:
  Fix for bug #42957: no results from 
  select where .. (col=col and col=col) or ... (false expression)
    - test result.
mysql-test/t/select.test:
  Fix for bug #42957: no results from 
  select where .. (col=col and col=col) or ... (false expression)
    - test case.
sql/sql_select.cc:
  Fix for bug #42957: no results from 
  select where .. (col=col and col=col) or ... (false expression)
    - replacing equality predicates by multiple equality items check
  if we eliminate all the predicates at the AND level and 
  replace them with TRUE if so.
2009-03-16 09:02:10 +04:00
Georgi Kodinov
f35b4218ea Bug #22047 : Time in SHOW PROCESSLIST for SQL thread in replication
seems to become negative

THD::start_time has a dual meaning : it's either the time since the process
entered a given state or is the transaction time returned by e.g. NOW().
This causes problems, as sometimes THD::start_time may be set to a value
that is correct and needed when used as a base for NOW(), but these times
may be arbitrary (SET @@timestamp) or non-local (coming from the master 
through the replication feed).
If one such non-local time is set there's no way to return a correct value
for e.g. SHOW PROCESSLIST or SELECT ... FROM INFORMATION_SCHEMA.PROCESSLIST.
Fixed by making the Time column in SHOW PROCESSLIST SIGNED LONG instead of 
UNSIGNED LONG and doing the correct conversions.
      
Note that no reliable test suite can be constructed, since it would require
knowing the local time and can't be achieved by the means of the current test
suite.

sql/sql_show.cc:
  Bug #22047: make the Time in SHOW PROCESSLIST LONG from 
  LONG UNSIGNED
2009-03-13 15:51:25 +02:00
Sergey Glukhov
7b2d7bea5e compilation(embedded server) failure fix 2009-03-13 14:25:50 +04:00
Sergey Glukhov
a5dc03fb68 Bug#42610 Dynamic plugin broken in 5.1.31
--added ability to obtain plugin variables from my.cnf on INSTALL PLUGIN stage
--option 'ignore-builtin-innodb' disables all InnoDB builtin plugins
  (including I_S plugins)


sql/mysql_priv.h:
  --added ability to obtain plugin variables from my.cnf on INSTALL PLUGIN stage
sql/mysqld.cc:
  --added ability to obtain plugin variables from my.cnf on INSTALL PLUGIN stage
sql/sql_plugin.cc:
  --added ability to obtain plugin variables from my.cnf on INSTALL PLUGIN stage
  --option 'ignore-builtin-innodb' disables all InnoDB builtin plugins
    (including I_S plugins)
2009-03-13 12:51:25 +04:00
Tatiana A. Nurnberg
8370242323 manual merge for 40657 beautification 2009-03-12 17:55:10 +01:00
Tatiana A. Nurnberg
59fbffa45c Bug#40657: assertion with out of range variables and traditional sql_mode
normalize error-messages

mysql-test/r/variables.result:
  show that warning uses underscore
  (sysvar-name), not hyphens (option-name)
mysql-test/t/variables.test:
  show that warning uses underscore
  (sysvar-name), not hyphens (option-name)
sql/set_var.cc:
  normalize error-messages
2009-03-11 23:32:53 +01:00
Davi Arnaut
402bc523b2 Bug#36540: CREATE EVENT and ALTER EVENT statements fail with large server_id
The problem is that creating a event could fail if the value of
the variable server_id didn't fit in the originator column of
the event system table. The cause is two-fold: it was possible
to set server_id to a value outside the documented range (from
0 to 2^32-1) and the originator column of the event table didn't
have enough room for values in this range.

The log tables (general_log and slow_log) also don't have a proper
column type to store the server_id and having a large server_id
value could prevent queries from being logged.

The solution is to ensure that all system tables that store the
server_id value have a proper column type (int unsigned) and that
the variable can't be set to a value that is not within the range.

mysql-test/r/events_bugs.result:
  Add test case result for Bug#36540
mysql-test/r/log_tables.result:
  Update column type.
mysql-test/r/system_mysql_db.result:
  Update column type.
mysql-test/r/variables.result:
  Add test case result for server_id value range.
mysql-test/suite/sys_vars/r/server_id_basic_64.result:
  Update test case results.
mysql-test/t/events_bugs.test:
  Add test case for Bug#36540
mysql-test/t/log_tables.test:
  Fix column type.
mysql-test/t/variables.test:
  Add test case for server_id value range.
scripts/mysql_system_tables.sql:
  Columns that store the server_id value must be of type INT UNSIGNED,
  fix event (originator), general_log and slow_log (server_id) tables
  in accordance.
scripts/mysql_system_tables_fix.sql:
  Columns that store the server_id value must be of type INT UNSIGNED,
  fix event (originator), general_log and slow_log (server_id) tables
  in accordance.
sql/mysqld.cc:
  Set min and max values for the server_id variable.
  Unfortunately we can't easily change server_id variable type
  from ulong to uint32 because of the sys_var classes.
2009-03-11 17:30:56 -03:00
Georgi Kodinov
f79cb0de91 merge of bug 42434 to 5.1-bugteam 2009-03-11 18:13:42 +02:00
Georgi Kodinov
ba1b5eb4b5 merged bug 43354 to 5.1-bugteam 2009-03-11 14:29:59 +02:00
Georgi Kodinov
d3d6f4fdad Bug #43354: Use key hint can crash server in explain extended query
The copy of the original arguments of a aggregate function was not
initialized until after fix_fields().
Sometimes (e.g. when there's an error processing the statement)
the print() can be called with no corresponding fix_fields() call.
      
Fixed by adding a check if the Item is fixed before using the arguments
copy.

mysql-test/r/explain.result:
  Bug #43354: test case
mysql-test/t/explain.test:
  Bug #43354: test case
sql/item_sum.cc:
  Bug #43354: use the argument list copy only if it's initialized
2009-03-11 14:10:44 +02:00
Georgi Kodinov
3033ea85a2 Bug #42434: license of mysys MD5 implementation is not GPL-compatible
Took the Xfree implementation (based on the same rewrite as the NDB one)
and added it instead of the current implementation.
Added a macro to make the calls to MD5 more streamlined. 

client/mysqlmanager-pwgen.c:
  Bug #42434: changed to call the macro
include/my_md5.h:
  Bug #42434: use the Xfree implementation
mysys/md5.c:
  Bug #42434: use the Xfree implementation
sql/item_strfunc.cc:
  Bug #42434: changed to call the macro
sql/table.cc:
  Bug #42434: changed to call the macro
tools/mysqlmanager.c:
  Bug #42434: changed to call the macro
2009-03-09 20:57:03 +02:00
Georgi Kodinov
7541fec52d fixed a typo 2009-03-09 12:49:18 +02:00
Georgi Kodinov
56ae3bd155 fixed a win32 compile warning 2009-03-09 12:22:52 +02:00
Tatiana A. Nurnberg
cee070e1bb manual merge 2009-03-06 16:11:34 +01:00
Kristofer Pettersson
55c779cdbf Manual merge 2009-03-06 11:49:39 +01:00
Tatiana A. Nurnberg
13328b0f45 Bug#40657: assertion with out of range variables and traditional sql_mode
Some changes that make things more elegant in 6.0,
backported so the code is mostly the same in 5.1,
for easier maintainence.

sql/set_var.cc:
  Backporting some changes to 5.1 so the code is
  mostly the same in both versions. Less to learn!
2009-03-05 16:42:12 +01:00
Kristofer Pettersson
ac821c6570 Bug#40363 Bug 20023 is not fixed on 5.0
This is a back port from 5.1 to 5.0.

Fix for BUG 20023: mysql_change_user() resets the value
of SQL_BIG_SELECTS.
  
The bug was that SQL_BIG_SELECTS was not properly set
in COM_CHANGE_USER.
  
The fix is to update SQL_BIG_SELECTS properly.



sql/sql_class.cc:
  Update THD::options with the respect to SQL_BIG_SELECTS
  in COM_CHANGE_USER.
tests/mysql_client_test.c:
  Add a test case BUG#20023.
2009-03-05 13:37:46 +01:00
Davi Arnaut
53802ae6ca Bug#41465: confusing error message when comment is too long
The problem was that the server was trying to use the unknown
error format string (ER_UNKNOWN_ERROR) to print messages about
comments being too long, but the said format string does not
accept arguments and will always default to "Unknown error".

The solution is to introduce new error messages which are
specific to the error conditions so that server wants to
signal -- this also means that it's possible to translate
those messages.

mysql-test/r/strict.result:
  Update test case result.
mysql-test/t/strict.test:
  Update test case with new errors.
sql/share/errmsg.txt:
  Introduce new errors for long comments.
sql/unireg.cc:
  Use new errors.
2009-03-05 08:20:01 -03:00
Kristofer Pettersson
d40b1be906 Automerge 2009-03-06 10:52:43 +01:00
Narayanan V
e4fd72fa46 merging with mysql-5.1-bugteam tree 2009-03-06 10:45:46 +05:30
Luis Soares
5833903889 BUG#39753: Replication failure on MIXED + bit + myisam + no PK
When using mixed mode the record values stored inside the storage
engine differed from the ones computed from the row event. This
happened because the prepare_record function was calling
empty_record macro causing some don't care bits to be left set.
                          
Replacing the empty_record plus explicitly setting defaults with 
restore_record to restore the record default values fixes this.
2009-03-05 20:54:53 +01:00
Kristofer Pettersson
9db67e1cda Automerge 2009-03-05 15:30:59 +01:00
Kristofer Pettersson
ddaede8087 Bug#39843 DELETE requires write access to table in subquery in where clause
An unnecessarily restrictive lock were taken on sub-SELECTs during DELETE.

During parsing, a global structure is reused for sub-SELECTs and the attribute
keeping track of lock options were not reset properly.
This patch introduces a new attribute to keep track on the syntactical lock
option elements found in a sub-SELECT and then sets the lock options accordingly.

Now the sub-SELECTs will try to acquire a READ lock if possible
instead of a WRITE lock as inherited from the outer DELETE statement.


mysql-test/r/lock.result:
  Added test case for bug39843
mysql-test/t/lock.test:
  Added test case for bug39843
sql/sql_lex.cc:
  * Reset member variable lock_option on each new query.
sql/sql_lex.h:
  * Introduced new member variable 'lock_option' which is keeping track
    of the syntactical lock option of a (sub-)select query.
sql/sql_parse.cc:
  * Wrote comments to functions.
sql/sql_yacc.yy:
  * Introduced an attribute to keep track of syntactical lock options
    in sub-selects.
  * Made sure that the default value TL_READ_DEFAULT is at the begining
    of each subselect-rule.
2009-03-05 15:22:33 +01:00
Sergey Glukhov
abfe3437f7 removed unused variable 2009-03-05 17:23:16 +04:00
Sergey Glukhov
aa5441e1c6 automerge 2009-03-05 15:58:04 +04:00
Guangbao Ni
d65f6b54ca Auto merged 2009-03-05 19:01:46 +00:00
Guangbao Ni
4f0f021c33 BUG#41980 SBL, INSERT .. SELECT .. LIMIT = ERROR, even when @@SQL_LOG_BIN is 0 !
When binlog_format is STATEMENT and the statement is unsafe before,
the unsafe warning/error message was issued without checking
whether the SQL_LOG_BIN was turned on or not.
      
Fixed with adding a sql_log_bin_toplevel flag in THD to check
whether SQL_LOG_BIN is ON in current session whatever the current is in sp or not.


mysql-test/suite/binlog/r/binlog_unsafe.result:
  Test case result for unsafe warning/error message
mysql-test/suite/binlog/t/binlog_unsafe.test:
  Test case for unsafe message warning/error
sql/set_var.cc:
  Adding a function set_option_log_bin_bit() which specailly handles to
  the change of SQL_LOG_BIN bit in order to set sql_log_bin_toplevel
  according to SQL_LOG_BIN current value at the same time.
sql/sql_class.cc:
  Initialize the flag sql_log_bin_toplevel in THD::init(),
  and add the condition to check whether unsafe ror message was issued.
sql/sql_class.h:
  Add a sql_log_bin_toplevel flag in THD to indicate whether the toplevel SQL_LOG_BIN is
2009-03-05 18:39:02 +00:00
Sergey Glukhov
3ef86918a2 Bug#41030 Wrong meta data (incorrect fieldlen)
set user variable max length on
fix_length_and_dec() stage
using real value length.


mysql-test/r/variables.result:
  test result
mysql-test/t/variables.test:
  test case
sql/item_func.cc:
  set user variable max length on
  fix_length_and_dec() stage
  using real value length.
2009-03-05 15:34:02 +04:00
Sergey Glukhov
326de4957a Bug#42758 INFORMATION_SCHEMA.COLUMNS is inconsistent
remove 'unsigned', 'zerofill' attributes
from DATA_TYPE column value.


mysql-test/suite/funcs_1/r/is_columns_innodb.result:
  result fix
mysql-test/suite/funcs_1/r/is_columns_memory.result:
  result fix
mysql-test/suite/funcs_1/r/is_columns_myisam.result:
  result fix
sql/sql_show.cc:
  remove 'unsigned', 'zerofill' attributes 
  from DATA_TYPE column value.
2009-03-05 15:15:47 +04:00
Kristofer Pettersson
5c42a6cf54 Bug#37416 When SQL_NO_CACHE is used, MySQL still lookup into the query cache
The query cache module did not check for the SQL_NO_CACHE keyword before
attempting to query the hash lookup table. This had a small performance impact.

By introducing a check on the query string before obtaining the hash mutex
we can gain some performance if the SQL_NO_CACHE directive is used often.


sql/sql_cache.cc:
  * Introduced new helper function, has_no_cache_directive, for checking the
    existance of a SQL_NO_CACHE directive before actual parsing of the query.
2009-03-05 11:41:19 +01:00
He Zhenxing
b4fdb8aec1 BUG#37051 Replication rules not evaluated correctly
Backporting patch to 5.0.
2009-03-05 18:10:44 +08:00
Narayanan V
31443a6f73 Bug#42790 Test 'main.innodb' fails from "InnoDB: Error: in ALTER TABLE"
The problem here seem to be that when mysql
is redirecting stderr to a file, stderr becomes 
buffered, whereas it is unbuffered by definition.

The solution is to unbuffer it by setting buffer
to null.

sql/log.cc:
  use setbuf(stderr, NULL) to set the buffer to null.
sql/mysqld.cc:
  use setbuf(stderr, NULL) to set the buffer to null.
2009-03-05 15:18:03 +05:30
Staale Smedseng
f08d47b4f3 Addendum to previous patch for Bug#29458. A number
of system errnos when opening a table are masked 
as ER_FILE_NOT_FOUND. This patch handles this as
"Operation failed" as well.
2009-03-05 09:41:00 +01:00
Timothy Smith
c3fec5d22f Applying InnoDB snashot 5.0-ss4007, part 2. Fixes
Bug #18828: If InnoDB runs out of undo slots, it returns misleading 'table is full'

This is a backport of code already in 5.1+.  The error message change referred
to in the detailed revision comments is still pending.

Detailed revision comments:

r3937 | calvin | 2009-01-15 03:11:56 +0200 (Thu, 15 Jan 2009) | 17 lines
branches/5.0:

Backport the fix for Bug#18828. Return DB_TOO_MANY_CONCURRENT_TRXS
when we run out of UNDO slots in the rollback segment. The backport
is requested by MySQL under bug#41529 - Safe handling of InnoDB running
out of undo log slots.

This is a partial fix since the MySQL error code requested to properly
report the error condition back to the client has not yet materialized.
Currently we have #ifdef'd the error code translation in ha_innodb.cc.
This will have to be changed as and when MySQl add the new requested
code or an equivalent code that we can then use.

Given the above, currently we will get the old behavior, not the
"fixed" and intended behavior.

Approved by:	Heikki (on IM)
2009-03-02 17:57:09 -07:00
Leonard Zhou
63c9bb320f BUG#39526 sql_mode not retained in binary log for CREATE PROCEDURE
Set wrong sql_mode when creating a procedure. 
So that the sql_mode can't be writen into binary log correctly.
      
Restore the current session sql_mode right before generating the binlog event
when creating a procedure.

mysql-test/suite/binlog/r/binlog_sql_mode.result:
  Test result
mysql-test/suite/binlog/t/binlog_sql_mode.test:
  Test file for sql_mode testing
sql/sp.cc:
  Restore the current session sql_mode right before generating the binlog event.
2009-02-28 09:35:18 +08:00
Tatiana A. Nurnberg
fe09326edf automerge 2009-02-27 21:43:43 +01:00
Staale Smedseng
a2231e59c5 Commit after merge from 5.0-bugteam 2009-02-27 18:07:58 +02:00
Staale Smedseng
d61f114f7f Commit after merge from 5.1-bugteam 2009-02-27 18:03:32 +02:00
Georgi Kodinov
2bc070a05a merged the fix for bug 41610 to 5.1-bugteam 2009-02-27 17:07:27 +02:00
Staale Smedseng
8eb09f0149 Commit for merge and push 2009-02-27 17:06:23 +02:00
Staale Smedseng
97b68934bc Recommit for merging and pushing 2009-02-27 16:11:15 +02:00
Georgi Kodinov
15760fe9d8 Bug #41610: key_infix_len can be overwritten causing some group by queries to
return no rows

The algorithm of determining the best key for loose index scan is doing a loop
over the available indexes and selects the one that has the best cost.
It retrieves the parameters of the current index into a set of variables.
If the cost of using the current index is lower than the best cost so far it 
copies these variables into another set of variables that contain the 
information for the best index so far.
After having checked all the indexes it uses these variables (outside of the 
index loop) to create the table read plan object instance.
The was a single omission : the key_infix/key_infix_len variables were used 
outside of the loop without being preserved in the loop for the best index 
so far.
This causes these variables to get overwritten by the next index(es) checked.
Fixed by adding variables to hold the data for the current index, passing 
the new variables to the function that assigns values to them and copying 
the new variables into the existing ones when selecting a new current best 
index.
To avoid further such problems moved the declarations of the variables used 
to keep information about the current index inside the loop's compound 
statement.

mysql-test/r/group_min_max.result:
  Bug #41610: test case
mysql-test/t/group_min_max.test:
  Bug #41610: test case
sql/opt_range.cc:
  Bug #41610: copy the infix data for the current best index
2009-02-27 15:25:06 +02:00
Magnus Svensson
fd0aaee2b5 Merge 2009-02-27 11:26:55 +01:00
Tatiana A. Nurnberg
71913e350a Bug#40657: assertion with out of range variables and traditional sql_mode
In STRICT mode, out-of-bounds values caused an error message
to be queued (rather than just a warning), without any further
error-like processing happening. (The error is queued during
update, at which time it's too late. For it to be processed
properly, it would need to be queued during check-stage.)
The assertion rightfully complains that we're trying to send
an OK while having an error queued.

Changeset breaks a lot of tests out into check-stage. This also
allows us to send more correct warnings/error messages.

sql/set_var.cc:
  cleanup: fold get_unsigned() and fix_unsigned() into one,
  as well as all the semi-common code from the ::check
  functions.
2009-02-27 10:27:00 +01:00
Georgi Kodinov
f7f0e8b41f merged 5.0-bugteam -> 5.1-bugteam.
Fixed a warning in 5.1 caused by missing type cast.
2009-02-27 10:03:47 +02:00
Georgi Kodinov
a9d707037a Bug #41354: Access control is bypassed when all columns
of a view are selected by * wildcard

Backported a part of the fix for 36086 to 5.0

mysql-test/r/view_grant.result:
  Bug #41354: test case
mysql-test/t/view_grant.test:
  Bug #41354: test case
sql/sql_acl.cc:
  Bug #41354: return table error when no access and *
sql/sql_base.cc:
  Bug #41354: backported the check in bug 36086 to 5.0
2009-02-26 19:00:44 +02:00