Bug#31621: Windows server hanging during shutdown using named pipes
and idle connection
Problem: when idle pipe connection is forcefully closed with KILL
statement or when the server goes down, thread that is closing connection
would hang infinitely in CloseHandle(). The reason for the hang is that
named pipe operations are performed synchronously. In this mode all IOs
on pipe are serialized, that is CloseHandle() will not abort ReadFile()
in another thread, but wait for ReadFile() to complete.
The fix implements asynchrnous mode for named pipes, where operation of file
are not synchronized. Read/Write operation would fire an async IO and wait for
either IO completion or timeout.
Note, that with this patch timeouts are properly handled for named pipes.
Post-review: Win32 timeout code has been fixed for named pipes and shared
memory. We do not store pointer to NET in vio structure, only the read and
write timeouts.
include/violite.h:
Add pipe_overlapped to Vio structure for async IO for named pipes.
sql-common/client.c:
Use asynchronous pipe IO.
sql/mysqld.cc:
Use asynchronous pipe IO.
vio/vio.c:
-Refactor timeouts for win32 protocols: shared memory and named pipes.
Store read/write timeout in VIO structure, instead of storing pointer
to NET. New function vio_win32_timeout called indirectly via
vio_timeout changes these values.
vio/vio_priv.h:
Remove vio_ignore_timeout.
Add vio_win32_timeout to be used for named pipes and shared memory.
vio/viosocket.c:
Use async IO for named pipes.
After issuing IO, wait for either IO completion, pipe_close_event
or timeout.
Refactor timeouts for named pipe and shared memory.
Failing to connect would release parts of the MYSQL struct.
We would then proceed to try again to connect without re-
initializing the struct.
We prevent the unwanted freeing of data we'll still need now.
client/mysqladmin.cc:
Losing a connection (or not even getting on in the first place) should
not trash the MYSQL-struct.
Add a lot of comments.
Rewrite re-connection fu.
sql-common/client.c:
Assert against bad parameters usually caused by de-initing a
MYSQL-struct without re-initing it again before re-use.
with gcc 4.3.2
This patch fixes a number of GCC warnings about variables used
before initialized. A new macro UNINIT_VAR() is introduced for
use in the variable declaration, and LINT_INIT() usage will be
gradually deprecated. (A workaround is used for g++, pending a
patch for a g++ bug.)
GCC warnings for unused results (attribute warn_unused_result)
for a number of system calls (present at least in later
Ubuntus, where the usual void cast trick doesn't work) are
also fixed.
client/mysqlmanager-pwgen.c:
A fix for warn_unused_result, adding fallback to use of
srand()/rand() if /dev/random cannot be used. Also actually
adds calls to rand() in the second branch so that it actually
creates a random password.
sql/opt_range.cc:
Removed duplicate code (if statement must have been duplicated during earlier merge).
sql/sql_partition.cc:
After mergeing bug#46362 and bug#20577, the NULL partition was also searched
when col = const, fixed by checking if = or range.
There were a problem since pruning uses the field
for comparison (while evaluate_join_record uses longlong),
resulting in pruning failures when comparing DATE to DATETIME.
Fix was to always comparing DATE vs DATETIME as DATETIME,
by adding ' 00:00:00' to the DATE string.
And adding optimization for comparing with 23:59:59, so that
DATETIME_col > '2001-02-03 23:59:59' ->
TO_DAYS(DATETIME_col) > TO_DAYS('2001-02-03 23:59:59') instead
of '>='.
mysql-test/r/partition_pruning.result:
Bug#46362: Endpoint should be set to false for TO_DAYS(DATE)
Updated result-file
mysql-test/t/partition_pruning.test:
Bug#46362: Endpoint should be set to false for TO_DAYS(DATE)
Added testcases.
sql-common/my_time.c:
Bug#46362: Endpoint should be set to false for TO_DAYS(DATE)
removed duplicate assignment.
sql/item.cc:
Bug#46362: Endpoint should be set to false for TO_DAYS(DATE)
Changed field_is_equal_to_item into field_cmp_to_item, to
better handling DATE vs DATETIME comparision.
sql/item.h:
Bug#46362: Endpoint should be set to false for TO_DAYS(DATE)
Updated comment
sql/item_timefunc.cc:
Bug#46362: Endpoint should be set to false for TO_DAYS(DATE)
Added optimization (pruning) of DATETIME where time-part is
23:59:59
sql/opt_range.cc:
Bug#46362: Endpoint should be set to false for TO_DAYS(DATE)
Using the new stored_field_cmp_to_item for better pruning.
Bug#45243: crash on win in sql thread clear_tables_to_lock() -> free()
Bug#45242: crash on win in mysql_close() -> free()
Bug#45238: rpl_slave_skip, rpl_change_master failed (lost connection) for STOP SLAVE
Bug#46030: rpl_truncate_3innodb causes server crash on windows
Bug#46014: rpl_stm_reset_slave crashes the server sporadically in pb2
When killing a user session on the server, it's necessary to
interrupt (notify) the thread associated with the session that
the connection is being killed so that the thread is woken up
if waiting for I/O. On a few platforms (Mac, Windows and HP-UX)
where the SIGNAL_WITH_VIO_CLOSE flag is defined, this interruption
procedure is to asynchronously close the underlying socket of
the connection.
In order to enable this schema, each connection serving thread
registers its VIO (I/O interface) so that other threads can
access it and close the connection. But only the owner thread of
the VIO might delete it as to guarantee that other threads won't
see freed memory (the thread unregisters the VIO before deleting
it). A side note: closing the socket introduces a harmless race
that might cause a thread attempt to read from a closed socket,
but this is deemed acceptable.
The problem is that this infrastructure was meant to only be used
by server threads, but the slave I/O thread was registering the
VIO of a mysql handle (a client API structure that represents a
connection to another server instance) as a active connection of
the thread. But under some circumstances such as network failures,
the client API might destroy the VIO associated with a handle at
will, yet the VIO wouldn't be properly unregistered. This could
lead to accesses to freed data if a thread attempted to kill a
slave I/O thread whose connection was already broken.
There was a attempt to work around this by checking whether
the socket was being interrupted, but this hack didn't work as
intended due to the aforementioned race -- attempting to read
from the socket would yield a "bad file descriptor" error.
The solution is to add a hook to the client API that is called
from the client code before the VIO of a handle is deleted.
This hook allows the slave I/O thread to detach the active vio
so it does not point to freed memory.
server-tools/instance-manager/mysql_connection.cc:
Add stub method required for linking.
sql-common/client.c:
Invoke hook.
sql/client_settings.h:
Export hook.
sql/slave.cc:
Introduce hook that clears the active VIO before it is freed
by the client API.
The problem is that the C API function mysql_real_connect
only attempts to connect to the first IP address returned
for a hostname. This can be a problem if a hostname maps
to multiple IP address and the server is not bound to the
first one that is returned.
The solution is to augment mysql_real_connect so that it
attempts to connect to all IPv4 addresses that a domain
name maps to. The function goes over the list of address
until a successful connection is established.
No test case is provided as its not possible to test this
automatically with the current testing infrastructure.
sql-common/client.c:
The client will try to connect to each IPv4 address from
the list of addresses that hostname maps to until a successful
connection is established or there are no more address.
Backport to MySQL 5.0/1 fix by Vladislav Vaintroub:
In Vista and later and also in when using terminal services, when
server is started from command line, client cannot connect to it
via shared memory protocol.
This is a regression introduced when Bug#24731 was fixed. The
reason is that client is trying to attach to shared memory using
global kernel object namespace (all kernel objects are prefixed
with Global\). However, server started from the command line in
Vista and later will create shared memory and events using current
session namespace. Thus, client is unable to find the server and
connection fails.
The fix for the client is to first try to find server using "local"
names (omitting Global\ prefix) and only if server is not found,
trying global namespace.
in load_defaults()
load_defaults(), my_search_option_files() and
my_print_default_files() utilized a global variable
containing a pointer to thread local memory. This could lead
to race conditions when those functions were called with high
concurrency.
Fixed by changing the interface of the said functions to avoid
the necessity for using a global variable.
Since we cannot change load_defaults() prototype for API
compatibility reasons, it was renamed my_load_defaults().
Now load_defaults() is a thread-unsafe wrapper around
a thread-safe version, my_load_defaults().
mysys/default.c:
1. Added a thread-safe version of load_defaults(), changed
load_defaults() with the old interface to be a thread-unsafe
wrapper around the thread-safe version.
2. Always use a private MEM_ROOT in my_print_default_files,
don't use a global variable.
sql-common/client.c:
Use a thread-safe version of load_defaults().
Bug#38435 - LONG Microseconds cause MySQL to fail a CAST to DATETIME or DATE
Parsing of optional microsecond part in datetime did not
fail gracefully when field width was larger than the allowed
six places.
Now handles up to the correct six places, and disregards
any extra digits without messing up what we've already got.
mysql-test/r/type_datetime.result:
show graceful handling of overly long microsecond parts
(correct truncation).
mysql-test/t/type_datetime.test:
show graceful handling of overly long microsecond parts
(correct truncation).
sql-common/my_time.c:
Special case for time-parsing: for microsecond part,
leading zeroes are actually meaningful! Also, don't
break the entire date on more than the allowed six
digits in microsecond part, just truncate the extra
digits.
- Remove bothersome warning messages. This change focuses on the warnings
that are covered by the ignore file: support-files/compiler_warnings.supp.
- Strings are guaranteed to be max uint in length
- Remove bothersome warning messages. This change focuses on the warnings
that are covered by the ignore file: support-files/compiler_warnings.supp.
- Strings are guaranteed to be max uint in length
Passing dubious "year zero" in non-zero date (not "0000-00-00") could
lead to negative value for year internally, while variable was unsigned.
This led to Really Bad Things further down the line.
Now doing calculations with signed type for year internally.
mysql-test/r/date_formats.result:
show that very early dates no longer break DATE_FORMAT(..., '%W')
mysql-test/t/date_formats.test:
show that very early dates no longer break DATE_FORMAT(..., '%W')
sql-common/my_time.c:
Allow negative years numbers internally while keeping the interface.
otherwise if somebody passes year zero for whatever reason, we'll
get an integer wrap-around that can lead to Really Bad Things further
down the line. Note that amusingly, calcday_nr() already had signed
output and calc_weekday() already had signed input, anyway.
into zippy.cornsilk.net:/home/cmiller/work/mysql/bug26294/my51-bug26294
client/mysqlbinlog.cc:
Auto merged
include/my_time.h:
Auto merged
sql-common/my_time.c:
Auto merged
sql/init.cc:
Auto merged
sql/tztime.cc:
Auto merged
When linking with some external programs, "multiple definition
of `init_time'"
Rename init_time() to my_init_time() to avoid collision with other
libraries (particularly libmng).
client/mysqlbinlog.cc:
Rename init_time() to my_init_time().
include/my_time.h:
Rename init_time() to my_init_time().
sql-common/my_time.c:
Rename init_time() to my_init_time().
sql/init.cc:
Rename init_time() to my_init_time().
sql/tztime.cc:
Rename init_time() to my_init_time().
into quad.opbmk:/mnt/raid/alik/MySQL/devel/5.0-rt-merged
libmysql/libmysql.c:
Auto merged
sql-common/client.c:
Auto merged
tests/mysql_client_test.c:
Manually merged.
into quad.opbmk:/mnt/raid/alik/MySQL/devel/5.1-rt-merged
libmysql/libmysql.c:
Auto merged
sql-common/client.c:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/mysqld.cc:
Auto merged
tests/mysql_client_test.c:
Auto merged
The problem was that the COM_STMT_SEND_LONG_DATA was sending a response
packet if the prepared statement wasn't found in the server (due to
reconnection). The commands COM_STMT_SEND_LONG_DATA and COM_STMT_CLOSE
should not send any packets, even error packets should not be sent since
they are not expected by the client API.
The solution is to clear generated during the execution of the aforementioned
commands and to skip resend of prepared statement commands. Another fix is
that if the connection breaks during the send of prepared statement command,
the command is not sent again since the prepared statement is no longer in the
server.
libmysql/libmysql.c:
The mysql handle might be reset after a reconnection.
Pass the now used stmt argument to cli_advanced_command.
sql-common/client.c:
Don't resend command if the connection broke and it's a prepared
statement command. If the session is broken, prepared statements
on the server are gone, set the error accordanly.
sql/sql_prepare.cc:
Clear any error set during the execution of the request
command.
tests/mysql_client_test.c:
Fix memory leak by freeing result associated with statement.
Remove test case for Bug 29948 because it's not reliable in
5.0 (fixed in 5.1) due to KILL queries sending two packets for
a thread that kills itself.
in some case.
ER_CON_COUNT_ERROR is defined with SQL state 08004. However, this SQL state is not always
returned.
This error can be thrown in two cases:
1. when an ordinary user (a user w/o SUPER privilege) is connecting,
and the number of active user connections is equal or greater than
max_connections.
2. when a user is connecting and the number of active user connections is
already (max_connections + 1) -- that means that no more connections will
be accepted regardless of the user credentials.
In the 1-st case, SQL state is correct.
The bug happens in the 2-nd case -- on UNIX the client gets 00000 SQL state, which is
absolutely wrong (00000 means "not error SQL state); on Windows
the client accidentally gets HY000 (which means "unknown SQL state).
The cause of the problem is that the server rejects extra connection
prior to read a packet with client capabilities. Thus, the server
does not know if the client supports SQL states or not (if the client
supports 4.1 protocol or not). So, the server supposes the worst and
does not send SQL state at all.
The difference in behavior on UNIX and Windows occurs because on Windows
CLI_MYSQL_REAL_CONNECT() invokes create_shared_memory(), which returns
an error (in default configuration, where shared memory is not configured).
Then, the client does not reset this error, so when the connection is
rejected, SQL state is HY000 (from the error from create_shared_memory()).
The bug appeared after test case for Bug#33507 -- before that, this behavior
just had not been tested.
The fix is to 1) reset the error after create_shared_memory();
2) set SQL state to 'unknown error' if it was not received from
the server.
A separate test case is not required, since the behavior is already
tested in connect.test.
Note for doc-team: the manual should be updated to say that under
some circumstances, 'Too many connections' has HY000 SQL state.
mysql-test/r/connect.result:
Update result file.
sql-common/client.c:
1. Reset an error from create_shared_memory();
2. Set SQL state to 'unknown error' if it was not received from
the server.
into kaamos.(none):/data/src/opt/mysql-5.1-opt
client/mysql.cc:
Auto merged
client/mysqldump.c:
Auto merged
configure.in:
Auto merged
include/my_global.h:
Auto merged
libmysql/libmysql.c:
Auto merged
libmysqld/lib_sql.cc:
Auto merged
mysql-test/include/mix1.inc:
Auto merged
mysql-test/r/create.result:
Auto merged
mysql-test/r/func_str.result:
Auto merged
mysql-test/r/innodb.result:
Auto merged
mysql-test/r/innodb_mysql.result:
Auto merged
mysql-test/r/select.result:
Auto merged
mysql-test/r/subselect.result:
Auto merged
mysql-test/t/create.test:
Auto merged
mysql-test/t/disabled.def:
Auto merged
sql/filesort.cc:
Auto merged
sql/handler.cc:
Auto merged
sql/item.cc:
Auto merged
sql/item.h:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_func.h:
Auto merged
sql/item_sum.cc:
Auto merged
sql/log.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/set_var.cc:
Auto merged
sql/sp.cc:
Auto merged
sql/sql_acl.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_plugin.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
storage/ndb/src/kernel/blocks/backup/Backup.hpp:
Auto merged
tests/mysql_client_test.c:
Auto merged
mysql-test/r/func_time.result:
Manual merge.
mysql-test/r/view.result:
Manual merge.
mysql-test/t/view.test:
Manual merge.
scripts/mysql_config.sh:
Manual merge.
sql-common/client.c:
Manual merge.
sql/sql_parse.cc:
Manual merge.
Rename client_last_error to last_error and client_last_errno to last_errno
to not break connectors which use the internal net structure for error handling.
include/mysql_com.h:
Rename client_last_error to last_error, client_last_errno to last_errno.
include/mysql_h.ic:
Rename client_last_error to last_error, client_last_errno to last_errno.
libmysql/libmysql.c:
Rename client_last_error to last_error, client_last_errno to last_errno.
libmysql/manager.c:
Rename client_last_error to last_error, client_last_errno to last_errno.
libmysqld/lib_sql.cc:
Rename client_last_error to last_error, client_last_errno to last_errno.
libmysqld/libmysqld.c:
Rename client_last_error to last_error, client_last_errno to last_errno.
server-tools/instance-manager/mysql_connection.cc:
Rename client_last_error to last_error, client_last_errno to last_errno.
sql/log_event.cc:
Rename client_last_error to last_error, client_last_errno to last_errno.
sql-common/client.c:
Rename client_last_error to last_error, client_last_errno to last_errno.
sql/log_event_old.cc:
Rename client_last_error to last_error, client_last_errno to last_errno.
sql/net_serv.cc:
Rename client_last_error to last_error, client_last_errno to last_errno.
sql/repl_failsafe.cc:
Rename client_last_error to last_error, client_last_errno to last_errno.
into mysql.com:/home/hf/work/25097/my51-25097
libmysql/libmysql.c:
Auto merged
libmysqld/lib_sql.cc:
Auto merged
sql-common/client.c:
Auto merged
sql/log.cc:
Auto merged
into mysql.com:/home/hf/work/25097/my51-25097
client/mysql.cc:
Auto merged
include/sql_common.h:
Auto merged
libmysql/libmysql.c:
Auto merged
libmysqld/lib_sql.cc:
Auto merged
sql-common/client.c:
merging
sql/log.cc:
merging
There was no way to return an error from the client library
if no MYSQL connections was established.
So here i added variables to store that king of errors and
made functions like mysql_error(NULL) to return these.
client/mysql.cc:
Bug #25097 mysql_server_init fails silently if no errmsg.sys is present.
Show the error message on std_error
include/sql_common.h:
Bug #25097 mysql_server_init fails silently if no errmsg.sys is present.
cant_connect_sqlstate constant declared
libmysql/libmysql.c:
Bug #25097 mysql_server_init fails silently if no errmsg.sys is present.
mysql_sqlstate(NULL) returns 'unknown_sqlstate'
libmysqld/lib_sql.cc:
Bug #25097 mysql_server_init fails silently if no errmsg.sys is present.
EMBEDDED_SERVER version of the vprint_msg_to_log() implemented
sql-common/client.c:
Bug #25097 mysql_server_init fails silently if no errmsg.sys is present.
mysql_server_last_errno and mysql_server_last_error introduced
to store errors not related to particular connections.
mysql_error(NULL) and mysql_errno(NULL) now returns these
mysql_server_last_error and errno respectively
sql/log.cc:
Bug #25097 mysql_server_init fails silently if no errmsg.sys is present.
EMBEDDED_LIBRARY implementation of the vprint_msg_to_log() moved
to lib_sql.cc
--local-infile=0 checks can be bypassed by sending a FETCH LOCAL FILE response
Add a check for CLIENT_LOCAL_FILES before sending a local file.
Beware, that all binary distributions enable sending of local files and it's up
to the programs which use libmysql to disable it, if they don't use this functionality.
Otherwise they are not safe.
client/mysqltest.c:
Enable LOAD DATA LOCAL INFILE for the test suite, like some rpl and ndb test.
sql-common/client.c:
Check if the client has LOAD DATA LOCAL INFILE disabled and
don't serve such requests from the server. This is not 100% proof,
as if the client has this enabled, in all binary builds for BC,
the check won't work and the client can be tricked into sending a
local file.
tests/mysql_client_test.c:
Switch on LOCAL INFILE in client test. If one day there
is a test which uses it, then it will work out of the box.
into dipika.(none):/opt/local/work/mysql-5.1-runtime
include/my_sys.h:
Auto merged
mysql-test/mysql-test-run.pl:
Auto merged
mysql-test/suite/binlog/r/binlog_row_binlog.result:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/log.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/set_var.cc:
Auto merged
sql/set_var.h:
Auto merged
sql/sql_acl.cc:
Auto merged
sql-common/client.c:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_view.cc:
Auto merged
The problem is that one can not create a stored routine if sql_mode
contains NO_ENGINE_SUBSTITUTION or PAD_CHAR_TO_FULL_LENGTH. Also when
a event is created, the mode is silently lost if sql_mode contains one
of the aforementioned. This was happening because the table definitions
which stored sql_mode values weren't being updated to accept new values
of sql_mode.
The solution is to update, in a backwards compatible manner, the various
table definitions (columns) that store the sql_mode value to take into
account the new possible values. One incompatible change is that if a event
that is being created can't be stored to the mysql.event table, an error
will be raised.
The tests case also ensure that new SQL modes will be added to the mysql.proc
and mysql.event tables, otherwise the tests will fail.
mysql-test/r/events_bugs.result:
Add test case result for Bug#32633
mysql-test/r/information_schema.result:
Update the sql_mode column definition.
mysql-test/r/sp.result:
Add test case result for Bug#32633
mysql-test/r/system_mysql_db.result:
Update the sql_mode column definition.
mysql-test/t/events_bugs.test:
Add test case for Bug#32633
mysql-test/t/sp.test:
Add test case for Bug#32633
mysql-test/t/system_mysql_db_fix50117.test:
Update the sql_mode column definition.
scripts/mysql_system_tables.sql:
Update the sql_mode column definition.
scripts/mysql_system_tables_fix.sql:
Update the sql_mode column definition.
sql/event_db_repository.cc:
Reset and restore SQL modes when storing and loading a
event from the data dictionary. Also throw out a error
if a store fails.
sql/mysqld.cc:
Add warning to avoid this problem in the future.
sql-common/my_user.c:
Truncate length if user name or host name does not fit
in the buffer.
sql/sp.cc:
SQL mode of the thread must not effect data dictionary operations.
into dl145h.mysql.com:/data0/mkindahl/mysql-5.1-rpl-merge
BitKeeper/deleted/.del-show_binlog_events2.inc:
Auto merged
sql-common/client.c:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/log_event.cc:
Auto merged
sql/slave.cc:
Auto merged
BitKeeper/deleted/.del-show_binlog_events2.inc:
Delete: mysql-test/include/show_binlog_events2.inc
client/mysqlbinlog.cc:
char -> uchar for raw memory.
sql/item_cmpfunc.cc:
Adding cast to remove warning when converting negative integer
to unsigned type.
sql/log_event.cc:
char -> uchar for raw memory.
sql/log_event.h:
char -> uchar for raw memory.
sql/rpl_utility.cc:
Adding cast to remove warning when converting negative integer
to unsigned type.
sql/slave.cc:
char -> uchar for raw memory.
sql/sql_repl.cc:
char -> uchar for raw memory.
sql-common/client.c:
char -> uchar for raw memory.
into station.:/mnt/raid/alik/MySQL/devel/5.1-rt
client/mysqltest.c:
Auto merged
include/mysql_com.h:
Auto merged
libmysqld/emb_qcache.cc:
Auto merged
libmysqld/emb_qcache.h:
Auto merged
libmysqld/lib_sql.cc:
Auto merged
mysql-test/lib/mtr_report.pl:
Auto merged
sql/ha_partition.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/opt_range.cc:
Auto merged
sql/set_var.cc:
Auto merged
sql/set_var.h:
Auto merged
sql/slave.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_db.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_partition.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_table.cc:
Auto merged
sql/table.cc:
Auto merged
storage/myisam/ha_myisam.cc:
Auto merged
sql/protocol.cc:
SCCS merged
into mysql.com:/home/gluh/MySQL/Merge/5.1-opt
BitKeeper/etc/ignore:
auto-union
client/mysql.cc:
Auto merged
client/mysqltest.c:
Auto merged
include/mysql_com.h:
Auto merged
libmysql/CMakeLists.txt:
Auto merged
libmysqld/lib_sql.cc:
Auto merged
mysql-test/r/archive.result:
Auto merged
mysql-test/r/create.result:
Auto merged
mysql-test/r/delayed.result:
Auto merged
mysql-test/r/func_misc.result:
Auto merged
mysql-test/r/innodb.result:
Auto merged
mysql-test/r/innodb_mysql.result:
Auto merged
mysql-test/r/merge.result:
Auto merged
mysql-test/r/ps.result:
Auto merged
mysql-test/r/type_date.result:
Auto merged
mysql-test/suite/rpl/r/rpl_innodb_bug28430.result:
Auto merged
mysql-test/t/create.test:
Auto merged
mysql-test/t/func_misc.test:
Auto merged
mysql-test/t/information_schema.test:
Auto merged
mysql-test/t/merge.test:
Auto merged
mysql-test/t/subselect.test:
Auto merged
mysql-test/t/type_date.test:
Auto merged
mysql-test/t/type_datetime.test:
Auto merged
mysql-test/t/variables.test:
Auto merged
mysys/queues.c:
Auto merged
sql/events.cc:
Auto merged
sql/field.cc:
Auto merged
sql/field.h:
Auto merged
sql/ha_partition.cc:
Auto merged
sql/handler.cc:
Auto merged
sql/item.cc:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_func.h:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/opt_range.cc:
Auto merged
sql/protocol.cc:
Auto merged
sql/set_var.cc:
Auto merged
sql/set_var.h:
Auto merged
sql/slave.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_db.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_partition.cc:
Auto merged
sql/sql_plugin.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_string.cc:
Auto merged
sql/sql_table.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/table.cc:
Auto merged
sql/table.h:
Auto merged
storage/myisam/ha_myisam.cc:
Auto merged
storage/myisam/mi_check.c:
Auto merged
storage/myisam/mi_open.c:
Auto merged
tests/mysql_client_test.c:
Auto merged
mysql-test/lib/mtr_report.pl:
manual merge
mysql-test/r/myisam.result:
manual merge
mysql-test/r/partition.result:
manual merge
mysql-test/r/user_var.result:
manual merge
mysql-test/t/myisam.test:
manual merge
mysql-test/t/partition.test:
manual merge
mysql-test/t/user_var.test:
manual merge
sql/item.h:
manual merge
sql/item_func.cc:
manual merge
storage/myisammrg/ha_myisammrg.cc:
manual merge
into mysql.com:/home/gluh/MySQL/Merge/5.0-opt
client/mysql.cc:
Auto merged
client/mysqltest.c:
Auto merged
include/mysql_com.h:
Auto merged
libmysql/CMakeLists.txt:
Auto merged
myisam/mi_check.c:
Auto merged
mysql-test/r/delayed.result:
Auto merged
mysql-test/r/innodb.result:
Auto merged
mysql-test/r/myisam.result:
Auto merged
mysql-test/r/ps.result:
Auto merged
mysql-test/t/merge.test:
Auto merged
mysql-test/t/myisam.test:
Auto merged
mysql-test/t/subselect.test:
Auto merged
mysql-test/t/type_datetime.test:
Auto merged
mysql-test/t/variables.test:
Auto merged
sql/field.cc:
Auto merged
sql/ha_myisam.cc:
Auto merged
sql/item.cc:
Auto merged
sql/item.h:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_func.h:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/opt_range.cc:
Auto merged
sql/set_var.cc:
Auto merged
sql/set_var.h:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_table.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
mysql-test/r/func_misc.result:
manual merge
mysql-test/r/innodb_mysql.result:
manual merge
mysql-test/t/func_misc.test:
manual merge
mysql-test/t/innodb_mysql.test:
manual merge
sql/sql_insert.cc:
manual merge
cause ROLLBACK of statement", part 1. Review fixes.
Do not send OK/EOF packets to the client until we reached the end of
the current statement.
This is a consolidation, to keep the functionality that is shared by all
SQL statements in one place in the server.
Currently this functionality includes:
- close_thread_tables()
- log_slow_statement().
After this patch and the subsequent patch for Bug#12713, it shall also include:
- ha_autocommit_or_rollback()
- net_end_statement()
- query_cache_end_of_result().
In future it may also include:
- mysql_reset_thd_for_next_command().
include/mysql_com.h:
Rename now unused members of NET: no_send_ok, no_send_error, report_error.
These were server-specific variables related to the client/server
protocol. They have been made obsolete by this patch.
Previously the same members of NET were used to store the error message
both on the client and on the server.
The error message was stored in net.last_error (client: mysql->net.last_error,
server: thd->net.last_error).
The error code was stored in net.last_errno (client: mysql->net.last_errno,
server: thd->net.last_errno).
The server error code and message are now stored elsewhere
(in the Diagnostics_area), thus NET members are no longer used by the
server.
Rename last_error to client_last_error, last_errno to client_last_errno
to avoid potential bugs introduced by merges.
include/mysql_h.ic:
Update the ABI file to reflect a rename.
Renames do not break the binary compatibility.
libmysql/libmysql.c:
Rename last_error to client_last_error, last_errno to client_last_errno.
This is necessary to ensure no unnoticed bugs introduced by merged
changesets.
Remove net.report_error, net.no_send_ok, net.no_send_error.
libmysql/manager.c:
Rename net.last_errno to net.client_last_errno.
libmysqld/lib_sql.cc:
Rename net.last_errno to net.client_last_errno.
Update the embedded implementation of the client-server protocol to
reflect the refactoring of protocol.cc.
libmysqld/libmysqld.c:
Rename net.last_errno to net.client_last_errno.
mysql-test/r/events.result:
Update to reflect the change in mysql_rm_db(). Now we drop stored
routines and events for a given database name only if there
is a directory for this database name. ha_drop_database() and
query_cache_invalidate() are called likewise.
Previously we would attempt to drop routines/events even if database
directory was not found (it worked, since routines and events are stored
in tables). This fixes Bug 29958 "Weird message on DROP DATABASE if mysql.proc
does not exist".
The change was done because the previous code used to call send_ok()
twice, which led to an assertion failure when asserts against it were
added by this patch.
mysql-test/r/grant.result:
Fix the patch for Bug 16470, now FLUSH PRIVILEGES produces an error
if mysql.procs_priv is missing.
This fixes the assert that send_ok() must not called after send_error()
(the original patch for Bug 16470 was prone to this).
mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result:
Produce a more detailed error message.
mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result:
Produce a more detailed error message.
mysql-test/t/grant.test:
Update the test, now FLUSH PRIVILEGES returns an error if mysql.procs_priv
is missing.
server-tools/instance-manager/mysql_connection.cc:
Rename net.last_errno to net.client_last_errno.
sql/ha_ndbcluster_binlog.cc:
Add asserts.
Use getters to access statement status information.
Add a comment why run_query() is broken. Reset the diagnostics area
in the end of run_query() to fulfill the invariant that the diagnostics_area
is never assigned twice per statement (see the comment in the code
when this can happen). We still do not clear thd->is_fatal_error and
thd->is_slave_error, which may lead to bugs, I consider the whole affair
as something to be dealt with separately.
sql/ha_partition.cc:
fatal_error() doesn't set an error by itself. Perhaps we should
remove this method altogether and instead add a flag to my_error
to set thd->is_fatal_error property.
Meanwhile, this change is a part of inspection made to the entire source
code with the goal to ensure that fatal_error()
is always accompanied by my_error().
sql/item_func.cc:
There is no net.last_error anymore. Remove the obsolete assignment.
sql/log_event.cc:
Use getters to access statement error status information.
sql/log_event_old.cc:
Use getters to access statement error status information.
sql/mysqld.cc:
Previously, if a continue handler for an error was found, my_message_sql()
would not set an error in THD. Since the current statement
must be aborted in any case, find_handler() had a hack to assign
thd->net.report_error to 1.
Remove this hack. Set an error in my_message_sql() even if the continue
handler is found. The error will be cleared anyway when the handler
is executed. This is one action among many in this patch to ensure the
invariant that whenever thd->is_error() is TRUE, we have a message in
thd->main_da.message().
sql/net_serv.cc:
Use a full-blown my_error() in net_serv.cc to report an error,
instead of just setting net->last_errno. This ensures the invariant that
whenever thd->is_error() returns TRUE, we have a message in
thd->main_da.message().
Remove initialization of removed NET members.
sql/opt_range.cc:
Use my_error() instead of just raising thd->net.report_error.
This ensures the invariant that whenever thd->is_error() returns TRUE,
there is a message in thd->main_da.message().
sql/opt_sum.cc:
Move invocation of fatal_error() right next to the place where
we set the error message. That makes it easier to track that whenever
fatal_error() is called, there is a message in THD.
sql/protocol.cc:
Rename send_ok() and send_eof() to net_send_ok() and net_send_eof()
respectively. These functions write directly to the network and are not
for use anywhere outside the client/server protocol code.
Remove the code that was responsible for cases when either there is
no error code, or no error message, or both.
Instead the calling code ensures that they are always present. Asserts
are added to enforce the invariant.
Instead of a direct access to thd->server_status and thd->total_warn_count
use function parameters, since these from now on don't always come directly
from THD.
Introduce net_end_statement(), the single-entry-point replacement API for
send_ok(), send_eof() and net_send_error().
Implement Protocol::end_partial_result_set to use in select_send::abort()
when there is a continue handler.
sql/protocol.h:
Update declarations.
sql/repl_failsafe.cc:
Use getters to access statement status information in THD.
Rename net.last_error to net.client_last_error.
sql/rpl_record.cc:
Set an error message in prepare_record() if there is no default
value for the field -- later we do print this message to the client.
sql/rpl_rli.cc:
Use getters to access statement status information in THD.
sql/slave.cc:
In create_table_from_dump() (a common function that is used in
LOAD MASTER TABLE SQL statement and COM_LOAD_MASTER_DATA), instead of hacks
with no_send_ok, clear the diagnostics area when mysql_rm_table() succeeded.
Update has_temporary_error() to work correctly when no error is set.
This is the case when Incident_log_event is executed: it always returns
an error but does not set an error message.
Use getters to access error status information.
sql/sp_head.cc:
Instead of hacks with no_send_error, work through the diagnostics area
interface to suppress sending of OK/ERROR packets to the client.
Move query_cache_end_of_result before log_slow_statement(), similarly
to how it's done in dispatch_command().
sql/sp_rcontext.cc:
Remove hacks with assignment of thd->net.report_error, they are not
necessary any more (see the changes in mysqld.cc).
sql/sql_acl.cc:
Use getters to access error status information in THD.
sql/sql_base.cc:
Access thd->main_da.sql_errno() only if there is an error. This fixes
a bug when auto-discovery, that was effectively disabled under pre-locking.
sql/sql_binlog.cc:
Remove hacks with no_send_ok/no_send_error, they are not necessary
anymore: the caller is responsible for network communication.
sql/sql_cache.cc:
Disable sending of OK/ERROR/EOF packet in the end of dispatch_command
if the response has been served from the query cache. This raises the
question whether we should store EOF packet in the query cache at all,
or generate it anew for each statement (we should generate it anew), but
this is to be addressed separately.
sql/sql_class.cc:
Implement class Diagnostics_area. Please see comments in sql_class.h
for details.
Fix a subtle coding mistake in select_send::send_data: when on slave,
an error in Item::send() was ignored.
The problem became visible due to asserts that the diagnostics area is
never double assigned.
Remove initialization of removed NET members.
In select_send::abort() do not call select_send::send_eof(). This is
not inheritance-safe. Even if a stored procedure continue handler is
found, the current statement is aborted, not succeeded.
Instead introduce a Protocol API to send the required response,
Protocol::end_partial_result_set().
This simplifies implementation of select_send::send_eof(). No need
to add more asserts that there is no error, there is an assert inside
Diagnostics_area::set_ok_status() already.
Leave no trace of no_send_* in the code.
sql/sql_class.h:
Declare class Diagnostics_area.
Remove the hack with no_send_ok from
Substatement_state.
Provide inline implementations of send_ok/send_eof.
Add commetns.
sql/sql_connect.cc:
Remove hacks with no_send_error.
Since now an error in THD is always set if net->error, it's not necessary
to check both net->error and thd->is_error() in the do_command loop.
Use thd->main_da.message() instead of net->last_errno.
Remove the hack with is_slave_error in sys_init_connect. Since now we do not
reset the diagnostics area in net_send_error (it's reset at the beginning
of the next statement), we can access it safely even after
execute_init_command.
sql/sql_db.cc:
Update the code to satisfy the invariant that the diagnostics area is never
assigned twice.
Incidentally, this fixes Bug 29958 "Weird message on DROP DATABASE if
mysql.proc does not exist".
sql/sql_delete.cc:
Change multi-delete to abort in abort(), as per select_send protocol.
Fixes the merge error with the test for Bug 29136
sql/sql_derived.cc:
Use getters to access error information.
sql/sql_insert.cc:
Use getters to access error information.
sql-common/client.c:
Rename last_error to client_last_error, last_errno to client_last_errno.
sql/sql_parse.cc:
Remove hacks with no_send_error. Deploy net_end_statement().
The story of COM_SHUTDOWN is interesting. Long story short, the server
would become on its death's door, and only no_send_ok/no_send_error assigned
by send_ok()/net_send_error() would hide its babbling from the client.
First of all, COM_QUIT does not require a response. So, the comment saying
"Let's send a response to possible COM_QUIT" is not only groundless
(even mysqladmin shutdown/mysql_shutdown() doesn't send COM_QUIT after
COM_SHUTDOWN), it's plainly incorrect.
Secondly, besides this additional 'OK' packet to respond to a hypothetical
COM_QUIT, there was the following code in dispatch_command():
if (thd->killed)
thd->send_kill_message();
if (thd->is_error()
net_send_error(thd);
This worked out really funny for the thread through which COM_SHUTDOWN
was delivered: we would get COM_SHUTDOWN, say okay, say okay again,
kill everybody, get the kill signal ourselves, and then attempt to say
"Server shutdown in progress" to the client that is very likely long gone.
This all became visible when asserts were added that the Diagnostics_area
is not assigned twice.
Move query_cache_end_of_result() to the end of dispatch_command(), since
net_send_eof() has been moved there. This is safe, query_cache_end_of_result()
is a no-op if there is no started query in the cache.
Consistently use select_send interface to call abort() or send_eof()
depending on the operation result.
Remove thd->fatal_error() from reset_master(), it was a no-op.
in hacks with no_send_error woudl save us
from complete breakage of the client/server protocol.
Consistently use select_send::abort() whenever there is an error,
and select_send::send_eof() in case of success.
The issue became visible due to added asserts.
sql/sql_partition.cc:
Always set an error in THD whenever there is a call to fatal_error().
sql/sql_prepare.cc:
Deploy class Diagnostics_area.
Remove the unnecessary juggling with the protocol in
Select_fetch_protocol_binary::send_eof(). EOF packet format is
protocol-independent.
sql/sql_select.cc:
Call fatal_error() directly in opt_sum_query.
Call my_error() whenever we call thd->fatal_error().
sql/sql_servers.cc:
Use getters to access error information in THD.
sql/sql_show.cc:
Use getters to access error information in THD.
Add comments.
Call my_error() whenever we call fatal_error().
sql/sql_table.cc:
Replace hacks with no_send_ok with the interface of the diagnostics area.
Clear the error if ENOENT error in ha_delete_table().
sql/sql_update.cc:
Introduce multi_update::abort(), which is the proper way to abort a
multi-update. This fixes the merge conflict between this patch and
the patch for Bug 29136.
sql/table.cc:
Use a getter to access error information in THD.
sql/tztime.cc:
Use a getter to access error information in THD.