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
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.
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.
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.
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)
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.
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
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.
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
*with --with-charset=utf8*
Problem: wrong LONG TEXT field length is sent to a client
when multibyte server character set used.
Fix: always limit field length sent to a client to 2^32,
as we store it in 4 byte slot.
Note: mysql_client_test changed accordingly.
sql/protocol.cc:
Fix for bug#19829:make test Failed in mysql_client_test
*with --with-charset=utf8*
- limit field length sent to client to UINT_MAX32 as
it may exceeds 32 bit slot for LONG TEXT fields if
thd_charset->mbmaxlen > 1.
tests/mysql_client_test.c:
Fix for bug#19829:make test Failed in mysql_client_test
*with --with-charset=utf8*
- checking field members have in mind that field length
is limited to UINT_MAX32.
print compact view name if the view belongs to the current database
mysql-test/r/information_schema_db.result:
result fix
mysql-test/r/mysqldump.result:
result fix
mysql-test/r/view_grant.result:
result fix
sql/sql_show.cc:
print compact view name if the view belongs to the current database
Changed context of Create routine to Databases.
mysql-test/r/grant.result:
result fix
mysql-test/r/sp.result:
result fix
sql/sql_show.cc:
Changed context of Create routine to Databases.
for bug #15936.
On some platforms fenv.h may #undef the min/max macros
defined in my_global.h.
Fixed by moving the #include directive for fenv.h from
mysqld.cc to my_global.h before definitions for min/max.
include/my_global.h:
Moved #include <fenv.h> from mysqld.cc.
sql/mysqld.cc:
Moved #include <fenv.h> to my_global.h.
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.
Bug#41112: crash in mysql_ha_close_table/get_lock_data with alter table
The problem is that the server wasn't handling robustly failures
to re-open a table during a HANDLER .. READ statement. If the
table needed to be re-opened due to it's storage engine being
altered to one that doesn't support HANDLER, a reference (dangling
pointer) to a closed table could be left in place and accessed in
later attempts to fetch from the table using the handler. Also,
if the server failed to set a error message if the re-open
failed. These problems could lead to server crashes or hangs.
The solution is to remove any references to a closed table and
to set a error if reopening a table during a HANDLER .. READ
statement fails.
mysql-test/include/handler.inc:
Add test case for Bug#41110 and Bug#41112
mysql-test/r/handler_innodb.result:
Add test case result for Bug#41110 and Bug#41112
mysql-test/r/handler_myisam.result:
Add test case result for Bug#41110 and Bug#41112
sql/sql_handler.cc:
Remove redundant reopen check.
Set errors even if reopening table.
Reset TABLE_LIST::table reference when the table is closed.
Bug#41112: crash in mysql_ha_close_table/get_lock_data with alter table
The problem is that the server wasn't handling robustly failures
to re-open a table during a HANDLER .. READ statement. If the
table needed to be re-opened due to it's storage engine being
altered to one that doesn't support HANDLER, a reference (dangling
pointer) to a closed table could be left in place and accessed in
later attempts to fetch from the table using the handler. Also,
if the server failed to set a error message if the re-open
failed. These problems could lead to server crashes or hangs.
The solution is to remove any references to a closed table and
to set a error if reopening a table during a HANDLER .. READ
statement fails.
There is no test case in this change set as the test depends on
a testing feature only available on 5.1 and later.
sql/sql_handler.cc:
Remove redundant reopen check.
Set errors even if reopening table.
Reset TABLE_LIST::table reference when the table is closed.
- Add support for setting it as a server commandline argument
- Add support for those switches:
= no_index_merge
= no_index_merge_union
= no_index_merge_sort_union
= no_index_merge_intersection
mysql-test/r/index_merge_myisam.result:
Testcases for index_merge related @@optimizer_switch flags.
mysql-test/t/index_merge_myisam.test:
Testcases for index_merge related @@optimizer_switch flags.
sql/set_var.cc:
- Backport @@optimizer_switch support from 6.0
- Add support for setting it as a server commandline argument
sql/sql_class.h:
- Backport @@optimizer_switch support from 6.0
sql/sql_select.h:
- Backport @@optimizer_switch support from 6.0
Both of our own implementations of rint(3) were inconsistent with the
most common behavior of rint() on those platforms that have it: round
to nearest, break ties by rounding to nearest even.
Fixed by leaving just one implementation of rint() in our source tree,
and changing its behavior to match the most common native
implementations on other platforms.
configure.in:
Added checks for fenv.h and fesetround().
include/config-win.h:
Removed the incorrect implementation of rint() for Windows.
include/my_global.h:
Added an rint() implementation for platforms that do not have it.
mysql-test/r/func_math.result:
Added a test case for bug #15936.
mysql-test/t/func_math.test:
Added a test case for bug #15936.
sql/mysqld.cc:
Explicitly set the FPU rounding mode with fesetround().
slave.
In mixed mode, if we create a temporary table and do some update which switch to ROW format,
the format will keep in ROW format until the session ends or the table is dropped explicitly.
When the session ends, the temp table is dropped automaticly at cleanup time.
but it checks only current binlog format and so skip insertion of DROP TABLE instructions into binlog.
So the temp table can't be dropped correctly at slave.
Our solution is that when closing temp tables at cleanup time we check both binlog format and binlog mode,
and we could write DROP TABLE instructions into binlog if current binlog format is ROW but in MIX mode.
mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result:
Test result file.
mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test:
Test file.
sql/sql_base.cc:
Didn't do binloging when both current format and default format are ROW.
If secure-file-priv was set on slave, it became unable to execute
LOAD DATA INFILE statements sent from master using mixed or
statement-based replication.
This patch fixes the issue by ignoring this security restriction
and checking if the files are created and read by the slave in the
--slave-load-tmpdir while executing the SQL Thread.
Signed integer format specifier forced to print the binlog header with server_id
negative if the unsigned value sets the sign-bit ON.
Fixed with correcting the specifier to correspond to typeof(server_id) == ulong.
mysql-test/r/mysqlbinlog.result:
results changed.
mysql-test/t/mysqlbinlog.test:
displaying the expected unsignedly formatted server_id value, bug#37313.
sql/log_event.cc:
Format specifier is corrected to correspond to typeof(server_id).
The problem is that select queries executed concurrently with
a concurrent insert on a MyISAM table could be cached if the
select started after the query cache invalidation but before
the unlock of tables performed by the concurrent insert. This
race could happen because the concurrent insert was failing
to prevent cache of select queries happening at the same time.
The solution is to add a 'uncacheable' status flag to signal
that a concurrent insert is being performed on the table and
that queries executing at the same time shouldn't cache the
results.
mysql-test/r/query_cache_debug.result:
Add test case result for Bug#41098
mysql-test/t/disabled.def:
Re-enable test case.
mysql-test/t/query_cache_debug.test:
Add test case for Bug#41098
sql/sql_cache.cc:
Debug sync point for regression testing purposes.
sql/sql_insert.cc:
Remove meaningless query cache invalidate. There is already
a preceding invalidate for queries that started before the
concurrent insert.
storage/myisam/ha_myisam.cc:
Check for a active concurrent insert.
storage/myisam/mi_locking.c:
Signal the start of a concurrent insert. Flag is zeroed once
the state is updated back.
storage/myisam/myisamdef.h:
Add flag to signal a active concurrent insert.
connections
The problem is that tables can enter open table cache for a thread without
being properly cleaned up. This can happen if make_join_statistics() fails
to read a const table because of e.g. a deadlock. It does set a member of
TABLE structure to a value it allocates, but doesn't clean-up this setting
on error nor does it set the rest of the members in JOIN to allow for
automatic cleanup.
As a result when such an error occurs and the next statement depends re-uses
the table from the open tables cache it will get it with this
TABLE::reginfo.join_tab pointing to a memory area that's freed.
Fixed by making sure make_join_statistics() cleans up TABLE::reginfo.join_tab
on error.
mysql-test/r/innodb_mysql.result:
Bug #42419: test case
mysql-test/t/innodb_mysql-master.opt:
Bug #42419: increase the timeout so it covers te conservative
sleep 3 in the test
mysql-test/t/innodb_mysql.test:
Bug #42419: test case
sql/sql_select.cc:
Bug #42419: clean up the members of TABLE on failure in
make_join_statisitcs()
In case of ROW item each compared pair does not
check if argumet collations can be aggregated and
thus appropiriate item conversion does not happen.
The fix is to add the check and convertion for ROW
pairs.
mysql-test/r/row.result:
test result
mysql-test/t/row.test:
test case
sql/item.cc:
added agg_item_set_converter() function which was a part of
agg_item_charsets() func. The only difference is that
agg_item_set_converter() checks and converts items
using already known collation.
sql/item.h:
added agg_item_set_converter() function
sql/item_cmpfunc.cc:
In case of ROW item each compared pair does not
check if argumet collations can be aggregated and
thus appropiriate item conversion does not happen.
The fix is to add the check and convertion for ROW
pairs.
returns short string value.
Multibyte character sets were not taken into account when
calculating max_length in Item_param::convert_str_value(). As a
result, string parameters of a prepared statement could be
truncated later when calculating string length in characters by
dividing length in bytes by the charset's mbmaxlen value (e.g. in
Field_varstring::store()).
Fixed by taking charset's mbmaxlen into account when calculating
max_length in Item_param::convert_str_value().
sql/item.cc:
Multiply string's length in characters by charset's mbmaxlen when
calculating max_length.
tests/mysql_client_test.c:
Added a test case for bug #41078.
handler::get_dup_key used the called handler for the
info call, but used table->file handler for errkey.
Fixed by using table->file->info instead.
mysql-test/r/partition_error.result:
Bug#38719: Partitioning returns a different error code for
a duplicate key error
Added test for verification
mysql-test/t/partition_error.test:
Bug#38719: Partitioning returns a different error code for
a duplicate key error
Added test for verification
Backport from 6.0
Changed error message to show that it is partitioning
that does not support foreign keys yet.
Changed spelling from British english to American english.
mysql-test/r/partition.result:
Bug#36001: Partitions: spelling and using some error messages
Backport from 6.0
Changed spelling from British english to American english.
mysql-test/r/partition_mgm_err.result:
Bug#36001: Partitions: spelling and using some error messages
Backport from 6.0
Changed spelling from British english to American english.
mysql-test/t/partition.test:
Bug#36001: Partitions: spelling and using some error messages
Backport from 6.0
Added test for verifying error message
sql/share/errmsg.txt:
Bug#36001: Partitions: spelling and using some error messages
Backport from 6.0
Changed spelling from British english to American english.
sql/sql_table.cc:
Bug#36001: Partitions: spelling and using some error messages
Backport from 6.0
Using a better error message.
replace wild_case_compare with my_wildcmp which is multibyte safe function
mysql-test/r/lowercase_utf8.result:
test result
mysql-test/t/lowercase_utf8-master.opt:
test case
mysql-test/t/lowercase_utf8.test:
test case
sql/sql_show.cc:
replace wild_case_compare with my_wildcmp which is multibyte safe function
stack reservation too small
Problem: some tests fail on HP-UX due to insufficient stack reservation.
Fix: increase stack reservation.
sql/mysql_priv.h:
Fix for bug#21476: stack overflow crashes server; error-message
stack reservation too small
- raised STACK_MIN_SIZE to pass execution_constants.test on HP-UX.
Additional fix:
1. Revert the unification of DROP FUNCTION
and DROP PROCEDURE, because DROP FUNCTION can be used to
drop UDFs (that have a non-qualified name and don't require
database name to be present and valid).
2. Fixed the case sensitivity problem by adding a call to
check_db_name() (similar to the sp_name production).
MATCH() function accepts column list as an argument. It was possible to override
this requirement with aliased non-column select expression. Which results in
server crash.
With this fix aliased non-column select expressions are not accepted by MATCH()
function, returning an error.
mysql-test/r/fulltext.result:
A test case for BUG#36737.
mysql-test/t/fulltext.test:
A test case for BUG#36737.
sql/item_func.cc:
Only accept fields as arguments to MATCH().
The check for root-ness would signal an error. Errors would make the
server exit before usage (help) information was printed.
Now, test for whether we want help regardless of whether we're going
to exit with an error. If plugins are not initialized by the time we
print usage information, inform the user that some parameters are
missing.
date_format functions
String::realloc() did not check whether the existing string data fits in
the newly allocated buffer for cases when reallocating a String object
with external buffer (i.e.alloced == FALSE). This could lead to memory
overruns in some cases.
client/sql_string.cc:
Fixed String::realloc() to check whether the existing string data fits
in the newly allocated buffer for cases when reallocating a String
object with external buffer.
mysql-test/r/func_str.result:
Added a test case for bug #41868.
mysql-test/t/func_str.test:
Added a test case for bug #41868.
sql/sql_class.cc:
After each call to Item::send() in select_send::send_data() reset
buffer to its original state to reduce unnecessary malloc() calls. See
comments for bug #41868 for detailed analysis.
sql/sql_string.cc:
Fixed String::realloc() to check whether the existing string data fits
in the newly allocated buffer for cases when reallocating a String
object with external buffer.
There is an inconsistency with DROP DATABASE IF EXISTS, DROP
TABLE IF EXISTS and DROP VIEW IF EXISTS: those are binlogged even
if the DB or TABLE does not exist, whereas DROP PROCEDURE IF
EXISTS does not. It would be nice or at least consistent if DROP
PROCEDURE/STATEMENT worked the same too.
Fixed DROP PROCEDURE|FUNCTION IF EXISTS by adding a call to
write_bin_log in mysql_execute_command. Checked also if all
documented "DROP (...) IF EXISTS" get binlogged. Left out DROP
SERVER IF EXISTS because it seems that it only gets binlogged when
using row event (see BUG#25705).
The parser was not using the correct fully-qualified-name
production for DROP FUNCTION.
Fixed by copying the production from DROP PROCEDURE.
Tested in the windows specific suite to make sure it's
tested on a case-insensitive file system.
mysql-test/r/windows.result:
Bug #33813: test case
mysql-test/t/windows.test:
Bug #33813: test case
sql/sql_yacc.yy:
Bug #33813: use the correct production for the name in
DROP PROCEDURE
innodb_flush_method=wrong_value causes crash
Problem: after a failed plugin initialization, incompletely
initialized data remained in the plugin and handlerton data
structures. These were used later and caused the crash.
Fix: clean-up plugin related data if initialization failed.
Note: no test case added, hand tested.
sql/handler.cc:
Fix for bug #40757: Starting server on Windows with
innodb_flush_method=wrong_value causes crash
- free allocated hton and set plugin->data
(pointing to handlerton) to NULL if plugin->init() fails,
as we use it as a sign that ha_initialize_handlerton() is failed,
which is used in ha_finalize_handlerton().
- do the same if there's no free slot for a plugin in the
hton2plugin[] array or there are too many storage engines.
- call plugin->deinit() in such cases as we successfully
called plugin->init() before.
The problem is that a unfiltered user query was being passed as
the format string parameter of sql_print_warning which later
performs printf-like formatting, leading to crashes if the user
query contains formatting instructions (ie: %s). Also, it was
using THD::query as the source of the user query, but this
variable is not meaningful in some situations -- in a delayed
insert, it points to the table name.
The solution is to pass the user query as a parameter for the
format string and use the function parameter query_arg as the
source of the user query.
mysql-test/suite/binlog/r/binlog_unsafe.result:
Add test case result for Bug#42634
mysql-test/suite/binlog/t/binlog_unsafe.test:
Add test case for Bug#42634
sql/sql_class.cc:
Don't pass the user query as a format string.
added ignore-builtin-innodb option which disabled
initialization of builtin InnoDB plugin
mysql-test/r/innodb_ignore_builtin.result:
test case
mysql-test/t/innodb_ignore_builtin-master.opt:
test case
mysql-test/t/innodb_ignore_builtin.test:
test case
sql/mysql_priv.h:
added ignore-builtin-innodb option which disabled
initialization of builtin InnoDB plugin
sql/mysqld.cc:
added ignore-builtin-innodb option which disabled
initialization of builtin InnoDB plugin
sql/set_var.cc:
added ignore-builtin-innodb option which disabled
initialization of builtin InnoDB plugin
sql/sql_plugin.cc:
added ignore-builtin-innodb option which disabled
initialization of builtin InnoDB plugin