rebase xtrabackup 2.3 on 5.6.24 #61

Merged
merged 214 commits into from May 23, 2015

Conversation

Projects
None yet
Contributor

gl-sergei commented May 21, 2015

No description provided.

balasubramanian.kandasamy@oracle.com and others added some commits Nov 3, 2014

Bug #18708334 REMOVE THE SPAM WARNINGS: CLIENT FAILED TO PROVIDE ITS …
…CHARACTER SET

Description:
When we try to connect mysql-5.6 server with mysql-4.0 client the error log gets filled with below warning message
"[Warning] Client failed to provide its character set. 'latin1' will be used as client character set"

Analysis: Since the the client protocol is older than 4.1 and the 4.0 client is not providing the character set while trying to connect to the server. so, the warning message is sent to error log file.

Fix: Since the warning message is not necessary, we are removing the warning message.
Bug #19815702 TIS620: CRASH WITH MULTI TABLE DELETE
Description:
  Using correct length when moving to next field in cmp_ref. The store
length already includes the length bytes of blobs, which is already considered
earlier for blob types.
	Approved by Mattias, Jimmy [rb-7088]
Bug#19855522 ASSERTION `N < M_SIZE' FAILED. | ABORT IN BOUNDS_CHECKED…
…_ARRAY

create_distinct_group() may need some extra space, so do a similar counting
in setup_ref_array() to have enough space in st_select_lex::ref_pointer_array

Also: shrinking an existing ref_pointer_array, as introduced by 
WL#5953 - Optimize away useless subquery clauses
has to be reversed. The '*' wildcards are fixed in the prepare phase,
but not in the execute phase.
Bug #18285007 COPY OF TABLES WITH INNODB FTS FROM
		WINDOWS TO LINUX CAUSES CRASH
	- Post fix failure in test script.
	Approved by Marko via IM
Bug #18957951 RPMBUILD DEPENDENCY SCANNER ADDS DEPENDENCY ON NON-EXIS…
…TING PERL "HOSTNAMES"

When building RPMs and using the "rpmbuild" automatic scanning for
Perl dependencies, it might interpret "use hostnames" in the
"mysql_config.pl" script usage comment as a Perl "use" statement.
And then makes the resulting RPMs depends on a non-existing module
Perl "hostnames". The comment was changed to prevent this.
Bug#19974500: SERVER 5.5 / DEBUG DOESN\'T COMPILE WITH GCC 4.9.1
Fix broken gcc 4.9.1 debug build by removing end of line noise.

In 5.6+ this issue was already fixed by:
------------------------------------------------------------
revno: 3091
committer: Davi Arnaut <davi.arnaut@oracle.com>
branch nick: mysql-trunk
timestamp: Mon 2011-05-16 11:30:54 -0300
message:
  Fix warnings emitted by Clang.
Bug#18036143 - CRASH (SEGFAULT) IN ST_JOIN_TABLE::GET_SJ_STRATEGY ON
                     UPDATE STATEMENT
      
Problem:
JOIN_TAB pointer is not checked before de-referencing it.
      
Analysis:
The fact that JOIN_TAB objects are not used for single-table
UPDATE and DELETE, is ignored when optimizer is trying to
generate simple equality condition from multiple
equalities in eliminate_item_equal().
As a result server fails accessing the uninitialized pointer.
Bug#17599258:- ERROR 1160 (08S01): GOT AN ERROR WRITING
               COMMUNICATION PACKETS; FEDERATED TABLE

Description:- Execution of FLUSH TABLES on a federated
table which has been idle for wait_timeout (on the remote
server) + tcp_keepalive_time, fails with an error,
"ERROR 1160 (08S01): Got an error writing communication
packets."

Analysis:- During FLUSH TABLE execution the federated
table is closed which will inturn close the federated
connection. While closing the connection, federated server
tries to communincate with the remote server. Since the
connection was idle for wait_timeout(on the remote server)+
tcp_keepalive_time, the socket gets closed. So this
communication fails because of broken pipe and the error is
thrown. But federated connections are expected to reconnect
silently. And also it cannot reconnect because the 
"auto_reconnect" variable is set to 0 in "mysql_close()".

Fix:- Before closing the federated connection, in
"ha_federated_close()", a check is added which will verify
wheather the connection is alive or not. If the connection
is not alive, then "mysql->net.error" is set to 2 which
will indicate that the connetion is broken. Also the
setting of "auto_reconnect" variable to 0 is delayed and is
done after "COM_QUIT" command.
      
NOTE:- For reproducing this issue, "tcp_keepalive_time" has
to be set to a smaller value. This value is set in the
"/proc/sys/net/ipv4/tcp_keepalive_time" file in Unix
systems. So we need root permission for changing it, which
can't be done through mtr test. So submitting the patch
without mtr test.
Bug#19890133 MAKE DIST USING BZR EXPORT EVEN FOR SOURCE DIR NOT A BZR…
… REPO

For 'make dist': only use 'bzr export' if bzr root == ${CMAKE_SOURCE_DIR}
Same thing for git.
Bug#19908468 PLACE CORRECT INFORMATION IN INFO_SRC AFTER TRANSITIONIN…
…G TO GIT

Use 'git log -1; git branch' rather than 'bzr version-info'
Merge branch 'mysql-5.5' into mysql-5.6
Conflicts:
	cmake/info_macros.cmake.in
Bug#20009543 SUPPORT-FILES/BUILD-TAGS TRANSITION TO GIT
Use 'git ls-files' to find source files for etags.
Merge branch 'mysql-5.5' into mysql-5.6
Conflicts:
	support-files/build-tags
Bug#18622657 SECONDS_BEHIND_MASTER DISTORTED BECAUSE OF
PREVIOUS_GTID EVENT

Problem: Previous gtid log event in relay log should not be contributed to
seconds behind master calculation.

Analysis: A log event contains a timestamp in it's header which represents
the time at which it got generated on Master. In relaylog, we have events which got
transferred from Master and also contains which were generated on Slave, which
we call it as " a relay log event" for eg: when relaylog is rotated,
Slave generates and writes Previous_gtid_log_event in to the relay log.
These events (which got generated on Slave) contains the
timestamp of thread's starting time. When we are calculating Second Behind
Master(SBM), the events which are generated on Slave should be ignored and should
not contribute to SBM calculation. We already have a logic in the server
if (!ev->is_relay_log_event())
{
  last_master_timestamp=
}

But the previous gtid log events generated on Slave are not marked as "relay log events"
hence last_master_timestamp is getting set with thread's start time and SBM
will have wrong value.

And also in some situations, we generate Rotate log events
on slave to maintain the SQL positions in sync with Master
these log events are generated with server_id 0.
These events also should not contribute to SBM calculation.

Fix: Mark previous_gtid_log_event as relay log event.
And don't set last_master_timestamp when server_id= 0.
Bug#19949915 IGNORABLE EVENTS DO NOT WORK AND ARE NOT TESTED
In 5.6, Ignorable log events were introduced. These events have
the flag LOG_EVENT_IGNORABLE_F flag (0x80) set in the flags field.
When the server (specifically, the replication receiver and applier
threads) sees an event with a type code it does not recognize, the
server is supposed to check if this flag is set. If the flag is not
set, the server generates an error and stops; if the flag is set,
the server ignores the event. The purpose is to allow future server
versions to introduce new event types that the slave can ignore
(such as informational event types). However, this does not work,
since the slave applyer thread explicitly checks if the type code
is in the range of known event types, and reports an error, before
it goes further and checks if the event is ignorable.

To fix the problem, the slave applyer thread does not check if this
is a known event type any more. And we also remove unnecessary check
for PREVIOUS_GTIDS_LOG_EVENT, then we can replicate from 5.7 with
WL#7592 and disabled gtid_mode to 5.6 with disabled gtid_mode without
introducing a new type code for PREVIOUS_GTIDS_LOG_EVENT in 5.7.
Bug#19803418 ASSERTION: TABLE->QUIESCE == QUIESCE_NONE
             IN ROW0QUIESCE.CC LINE 683

PROBLEM

When flushing the table,innodb tries to store all locks
on the table.If we have multiple read locks on the table
(which we can achieve using aliases),we try to set the
quiesec state of the table to QUIESCE_START multiple times
which causes the assert.

FIX

Relax the assert if table is already in QUIESCE_START
state.

[Approved by Jimmy rb#7167]
Bug #19528825 "UNABLE TO PURGE A RECORD" WITH IBUF AND VARCHAR FIELDS
CONTAINING SPACES

Problem:

This problem happens only if the change buffer is enabled.  It does not
happen if the change buffer is disabled.  Analysis showed that the cause
was the buffering of the following sequence of operations for a same
record - IBUF_OP_DELETE_MARK, IBUF_OP_INSERT, IBUF_OP_DELETE.  Because
of this sequence, while merging the change buffer entries into the page,
the delete operation (also called purge) found the "record to be purged"
without a delete mark.

Solution:

The above sequence of operations must not be bufferred.  This sequence is
avoided when change buffer is disabled, because of latching of secondary
index page.  So it must be avoided when change buffer is enabled by using
the "page watch" properly.

Once the purge thread has kept a watch for a page in the buffer pool,
a concurrent insert operation on the same page must take this into account,
and not buffer the operation.

rb#7293 approved by Marko.
Bug#18948649 : OUT OF FILE DESCRIPTORS - VARIOUS CRASHES WHEN
               TMP TABLES FAIL

Problem:
When too many temp tables are open, server fails instead of
giving an error.

Solution:
The return code from prepare_tmp_table is not checked in
QEP_tmp_table::put_record. Added a check for the same.
Bug#19843808: DEADLOCK ON FLUSH TABLES WITH READ LOCK + SHOW
SLAVE STATUS

Problem:

If a client thread on an slave does FLUSH TABLES WITH READ
LOCK; then master does some updates, SHOW SLAVE STATUS in
the same client will be blocked.

Analysis:

Execute FLUSH TABLES WITH READ LOCK on slave and at the same
time execute a DML on the master. Then the DML should be
made to stop at a state "Waiting for commit lock". This
state means that sql thread is holding rli->data_lock and
waiting for MDL_COMMIT lock. Now in the same client session
where FLUSH TABLES WITH READ LOCK was executed issue SHOW
SLAVE STATUS command. This command will be blocked waiting
for rli->data_lock causing a dead lock. Once this happens
it will not be possible to release the global read lock as
"UNLOCK TABLES" command has to be issued in the same client
where global read lock was acquired. This causes the dead
lock.

Fix:

Existing code holds the rli->data_lock for the whole
duration of commit operation. Instead of holding the lock
for entire commit duration the code has been restructured in
such a way that the lock is held only during the period when
rli object is being updated.
Bug#20043556 ALWAYS USE SAME FORMAT FOR INFO_SRC FILE
Change the format of 'git log' to produce INFO_SRC:

commit: <commit hash>
date: 2014-11-12 11:11:10 +0100
build-date: 2014-11-17 15:24:16 +0100
short: <abbreviated commit hash>
branch: mysql-5.5
Merge branch 'mysql-5.5' into mysql-5.6
Conflicts:
	cmake/info_macros.cmake.in
Bug #18789758 DATA INCONSISTENCIES WHEN MASTER HAS TRUNCATED
      BINARY LOG WITH GTID AFTER CRASH
      Problem:
       Master's dump thread is not detecting the case where Slave's
       gtid executed set is having more gtids than Master's gtid
       executed set with respective to Master's UUID.

      Analysis & Fix:
       In normal scenarios, it is not possible that Slave will
       contain more gtids than Master with respective to Master's UUID.
       But it could be possible case if Master's binary log is
       truncated(due to raid failure) or Master's binary log is
       deleted but GTID_PURGED was not set properly. That scenario
       needs to be validated, i.e., it should *always* be the case that
       Slave's gtid executed set (+retrieved set) is a subset of
       Master's gtid executed set with respective to Master's UUID.
       If it happens, Master's dump thread will be stopped and this
       situation will be informed to Slave during the handshake (thus.
       slave I/O thread also be stopped with an error
       (ER_MASTER_FATAL_ERROR_READING_BINLOG). Otherwise, it can lead
       to data inconsistency between Master and Slave.
Bug #18607971 : 5.5 TO 5.6 REGRESSION WITH A SUBQUERY IN THE FROM CLA…
…USE.

 ISSUE:
 ------ Materialization of derived
 tables has been delayed until it is actually required, because of this
 estimation of row count of derived tables can no longer be as exact as it
 used to be. In some cases where GROUP BY clause of Query is optimized away
 because all group expressions can be reduced to some constant, we can say
 query can produce at most one row. But we are not using this info to
 calculate estimated row count. This lead to inaccurate estimates and hence
 suboptimal plan.

Fix:
----
For cases where GROUP BY CLAUSE is optimized away
because all group expressions are constants set
estimated_rowcount of the query to 1.
Bug #20031243 CREATE TABLE FAILS TO CHECK IF FOREIGN KEY COLUMN NULL/NOT
NULL MISMATCH

Problem:

In an alter table command, when we modify the name of a column that is part of
a foreign key constraint, then reloading of the foreign key constraint failed.
This problem happened because the foreign object with old column names are
there in the dictionary cache.

Solution:

To avoid problem, when a column name is changed, then evict the corresponding
foreign key object from the dictionary cache.  It will be loaded subsequently
with foreign keys are loaded.

rb#7369 in review
Bug#19786861: HANDLE_FATAL_SIGNAL AT MARK_TRX_READ_WRITE IN HANDLER.CC
After a failed TRUNCATE of partition/partitioned table the internal
state of the partitions was not reset to normal, which caused
problems when using the table in following statements.

Fixed by resetting the partition state for all partitions
if truncate failed.

rb#7261
Bug#10063897 - COM_EXECUTE potential problem.
The patch ensures that final character set and the
placeholder character set are not NULL in the
function Item_param::convert_str_value.

Reviewed-By: Alexander Nozdrin, Dmitry Shulga.
Bug #19183565 CREATE DYNAMIC INNODB_TMPDIR VARIABLE TO CONTROL
		WHERE INNODB WRITES TEMP FILES

		- Reverting the patch.
BUG#11747548: DETECT ORPHAN TEMP-POOL FILES, AND HANDLE GRACEFULLY
Analysis:
--------
Certain queries using intrinsic temporary tables may fail due to
name clashes in the file name for the temporary table when the
'temp-pool' enabled.

'temp-pool' tries to reduce the number of different filenames used for
temp tables by allocating them from small pool in order to avoid
problems in the Linux kernel by using a three part filename:
<tmp_file_prefix>_<pid>_<temp_pool_slot_num>.
The bit corresponding to the temp_pool_slot_num is set in the bit
map maintained for the temp-pool when it used for the file name.
It is cleared after the temp table is deleted for re-use.

The 'create_tmp_table()' function call under error condition
tries to clear the same bit twice by calling 'free_tmp_table()'
and 'bitmap_lock_clear_bit()'. 'free_tmp_table()' does a delete
of the table/file and clears the bit by calling the same function
'bitmap_lock_clear_bit()'.

The issue reported can be triggered under the timing window mentioned
below for an error condition while creating the temp table:
a) THD1: Due to an error clears the temp pool slot number used by it
   by calling 'free_tmp_table'.
b) THD2: In the process of creating the temp table by using an unused
   slot number in the bit map.
c) THD1: Clears the slot number used THD2 by calling
  'bitmap_lock_clear_bit()' after completing the call 'free_tmp_table'.
d) THD3: Uses the slot number used the THD2 since it is freed by THD1.
   When it tries to create the temp file using that slot number,
   an error is reported since it is currently in use by THD2.
   [The error: Error 'Can't create/write to file
   '/tmp/#sql_277e_0.MYD' (Errcode: 17)']

Another issue which may occur in 5.6 and trunk is that:
When the open temporary table fails after its creation(due to ulimit
or OOM error), the file is not deleted. Thus further attempts to use
the same slot number in the 'temp-pool' results in failure.

Fix:
---
a) Under the error condition calling the 'bitmap_lock_clear_bit()'
   function to clear the bit is unnecessary since 'free_tmp_table()'
   deletes the table/file and clears the bit. Hence removed the
   redundant call 'bitmap_lock_clear_bit()' in 'create_tmp_table()'
   This prevents the timing window under which the issue reported
   can be seen.

b) If open of the temporary table fails, then the file is deleted
   thus allowing the temp-pool slot number to be utilized for the
   subsequent temporary table creation.

c) Also if the attempt to create temp table fails since it already
   exists, the temp-pool slot for it is marked as used, to avoid
   the problem from re-appearing.
BUG11747548: DETECT ORPHAN TEMP-POOL FILES, AND HANDLE GRACEFULLY
Follow up patch to fix the test case failure.
Bug #16869534 QUERYING SUBSET OF COLUMNS DOESN'T USE TABLE CACHE; OPE…
…NED_TABLES I

Description: When querying a subset of columns from the information_schema.TABLES

Analysis: When information about tables is collected for statements like
"SELECT ENGINE FROM I_S.TABLES" we do not perform full-blown table opens
in SE, instead we only use information from table shares from the Table
Definition Cache or .FRMs. Still in order to simplify I_S implementation
mock TABLE objects are created from TABLE_SHARE during this process.
This is done by calling open_table_from_share() function with special
arguments. Since this function always increments "Opened_tables" counter,
calls to it can be mistakingly interpreted as full-blown table opens in SE.

Note that claim that "'SELECT ENGINE FROM I_S.TABLES' statement doesn't
use Table Cache" is nevertheless factually correct. But it misses the
point, since such statements a) don't use full-blown TABLE objects and
therefore don't do table opens b) still use Table Definition Cache.

Fix: We are now incrementing the counter when db_stat(i.e open flags for ha_open(

we have considered an optimization which would use TABLE objects from
Table Cache when available instead of constructing mock TABLE objects,
but found it too intrusive for stable releases.
Merge branch 'mysql-5.5' into mysql-5.6
Conflicts:
	sql/table.cc
Bug#19649868: MYSQLBINLOG READ FROM REMOTE SERVER EXPOSED
BINARY LOG TO WORLD

Problem:

If binary logs are streamed from remote server with
mysqlbinlog by default they are written with more privileges
than their origin (660 vs 664). This allows world to read
the binary logs which is not possible on MySQL binary logs.

Analysis:

In MySQL server process's UMASK is set 0006 this causes the
server side binary logs to be created with file permission
660.

Sever side umask is calculated as shown below.
umask(((~my_umask) & 0666)).

my_umask=660 (110 110 000)
~my_umask= 001 001 111
066 in binary= 000 110 110
(~my_umask) & 0666=000 000 110 --> umask(006).

If user specified mode_t=660.
umask= 006.
Final file permissions are mode_t & (~umask).

mode_t in binary= 110 110 000
umask in binary= 000 000 110
~umask= 111 111 001
mode_t & (~umask)= 110 110 000 (660)

Where as for mysqlbinlog client tool it doesnot have any
umask set for itself. Hence it depends on the current system
terminal's umask.i.e if the umask is 002 files are getting
created with 664 permission.

Fix:

The client mysqlbinlog tool should be made independent of
system's terminal umask. Hence umask similar to server has
been added.
Bug #19861997 RENAME SIMPLIFIED_BINLOG_GTID_RECOVERY AND EXECUTED_GTI…
…DS_COMPRESSION_PERIOD

In 5.6.21, we introduced the global variable
'simplified_binlog_gtid_recovery', which breaks
the existing naming convention of binlog-related
variables, all starting with "binlog_".

To fix the problem, create a new alias
'binlog_gtid_simple_recovery', and produce a
deprecation warnings on setting and reading the
variable 'simplified_binlog_gtid_recovery'.
Bug #20023823 BACKPORT THE FIX FOR MYSQL_INSTALL_DB/MYSQL_UPGRADE ON …
…NON-EMPTY

PLUGIN COLUMN

Backported part of the WL#6982. The part responsible for:

4) mysql_upgrade must properly update the empty plugin values according to
   the length of exiting password
Bug #16862810 : ASSERT N_PAGES_PURGED == 0 || SRV_FAST_SHUTDOWN != 0,…
… SLOW SHUTDOWN AFTER CRASH

logs_empty_and_mark_files_at_shutdown() should wait for trx_rollback_or_clean_all_recovered() finished when srv_fast_shutdown == 0

Approved by Marko in rb#5104
Bug #19688008 CREATE_ASYMMETRIC_PUB_KEY: CRASHES IN OPENSSL
              CODE

Problem: UDF doesn't handle the arguments properly when they
         are of string type due to a misplaced break.
         The length of arguments is also not set properly
         when the argument is NULL.

Solution: Fixed the code by putting the break at right place
          and setting the argument length to zero when the
          argument is NULL.
Bug #20028323 INNODB FULLTEXT BOOLEAN SEARCH INCORRECTLY HANDLES PARE…
…NTHESES

Problem:

InnoDB fulltext boolean queries incorrectly handle plus combined with
parentheses. For example,

+word1 +(>word2 <word3)

The query is matching any rows containing "word1" and ignoring the values in
parentheses.

The documentation mentions about the following behaviour:

 '+apple +(>turnover <strudel)'

Find rows that contain the words “apple” and “turnover”, or “apple” and
“strudel” (in any order), but rank “apple turnover” higher than “apple
strudel”.

Solution:

Analysis showed that the result of the subexpression was being ignored if
it was empty.  This behaviour is incorrect.  Allow the subexpression to be
empty, which is necessary to handle the above case.

rb#7435 approved by Jimmy.
Bug#18366947 : VALID DATE RANGE OF DUMMY SSL CERTS IS WAY TOO SHORT
Generated new certificates with validity upto 2029.

Shaohua Wang and others added some commits Feb 6, 2015

BUG#19703520 - FATAL_SIGNAL IN I_S_FTS_CONFIG_FILL WITH I_S.INNODB_FT…
…_CONFIG TABLE

The root cause is that we access a null fts member in a dict table.
The fix is checking whether the table has fts index before that.

Reviewed-by: Jimmy Yang <jimmy.yang@oracle.com>
RB: 7919
Bug#20052694 - FAILED RESTARTS CONTAIN NO VERSION DETAILS.
In versions 5.5 and 5.6 the MySQL version is not logged until
server is started and ready to accept connections. Exiting
server before this point will not have server version information
in the log. But in 5.7 code, we log a server version information
just after we prepare server_version string and logging is initialized.

For 5.5 and 5.6 code also adding this code to print server version
information.

Test results:
================

5.5
-----
Server version will be logged as below on server startup:
141218  8:45:48 [Note] /home/praveen/WorkDir/mysql_local/bug20052694/mysql/sql/mysqld (mysqld 5.5.42-debug-log) starting as process 19697 ...

5.6
----
Server version will be logged as below on server startup:
2014-12-18 09:08:43 0 [Note] /home/praveen/WorkDir/mysql_local/bug20052694/mysql-5.6/sql/mysqld (mysqld 5.6.23-debug-log) starting as process 18474 ...
Bug#20052694 - FAILED RESTARTS CONTAIN NO VERSION DETAILS.
Merge branch 'mysql-5.5' into mysql-5.6
Followup: BUG#20465273 - INNODB FTS: WRONG RESULT WITH PHRASE SEARCH
BUG#19703520 - FATAL_SIGNAL IN I_S_FTS_CONFIG_FILL WITH I_S.INNODB_FT_CONFIG TABLE

Fix pb2 failures: innodb_fts.phrase, i_innodb.innodb_fts_i_s_config.
Bug #19226740 DOUBLE CLOSE() ON THE SAME FILE DESCRIPTOR INSIDE MYSQL…
…_REAL_CONNECT()

In mysql_real_connect() when vio_socket_connect() fails we already have socket handle stored in net->vio. That means we should not explicitly call closesocket() at the end of the address list loop.

If this is the last iteration of the loop then the code after the loop will pass control to the error label and end_server() call will close socket and free net->vio.

If there will be another iteration of the loop then vio_reset() will be called with the new socket handle. Note that at the moment of vio_reset() call net->vio still owns the socket handle created on the previous iteration. So vio_reset() should close socket stored in net->vio and store the new socket there.

Unfortunately vio_reset() did not close socket stored in Vio structure. This is why the patch makes following changes in vio_reset():
- If new socket handle passed to vio_reset() is not equal to the socket handle stored in Vio then socket handle will be closed before storing new value. If handles are equal then old socket is not closed. This is important for vio_reset() usage in ssl_do().
- If any error occurs then new vio_reset() implementation will not alter any Vio members thus preserving socket handle stored in Vio and not taking ownership over socket handle passed as parameter. With this behavior following code from mysql_real_connect() will be correct:

>  if (vio_reset(net->vio, VIO_TYPE_TCPIP, sock, NULL, flags))
>  {
>    set_mysql_error(mysql, CR_UNKNOWN_ERROR, unknown_sqlstate);
>    closesocket(sock);    <--- close new handle
>    freeaddrinfo(res_lst);
>    if (client_bind_ai_lst)
>      freeaddrinfo(client_bind_ai_lst);
>    goto error;           <--- close handle stored in net->vio
>  }

If no error occurs then vio_reset() closes handle stored in net->vio and then stores new handle there. Otherwise explicit closesocket() call closes new handle and then control is passed to error label where end_server() closes old handle stored in net->vio.

Reviewed-by: Rafal Somla <rafal.somla@oracle.com>
Reviewed-by: Georgi Kodinov <georgi.kodinov@oracle.com>
RB: 7973
Bug#20386835 MEMCACHE: PROCESS_ARITHMETIC_COMMAND ASSERTS
This bug is caused by we return a wrong error code when the key is not
exist in decr.

Reviewed-by: Jimmy Yang<jimmy.yang@oracle.com> on IM.
Bug#20049894: AUTOMATIC_SP_PRIVILEGES ARE NOT CORRECTLY
REPLICATED WHEN SETTING DEFINER

Problem:
========
Privileges created by automatic_sp_privileges are not
correctly replicated when the procedure is created by a
super user using DEFINER.

Analysis:
========
when automatic_sp_privileges variable is set, the server
automatically grants the EXECUTE and ALTER ROUTINE
privileges to the creator of a stored routine, if the user
cannot already execute and alter or drop the routine. In
existing code when a privileged user creates a procedure
with DEFINER as a non privileged user on master the current
user is considered as privileged user and mysql.procs_priv
table will not be updated. Where as when the same statement
is replicated to slave, on slave the non privileged DEFINER
is considered as current user and privileges are getting
allocated. Hence there is a difference with respect to the
privileges that are allocated on master and slave. On slave
the creator of the stored routine should be considered
first.

Fix:
===
Binlog the creator of the stored routine along with the
query. With this on the slave first check if the creator
user exists on slave or not if available grant privileges to
creator. For back ward compatibility we use definer when
invoker is not available. We allow anonymous users to be
replicated from master to slave. Existing code has a
restriction of user.length > 0 which is not true in the case
of anonymous users. That restriction is removed now.
Bug# 20400373 INNODB MEMCACHE CRASH WHEN RETRIEVING EXPIRED RECORD WI…
…TH @@ TABLE MAPPING

PROBLEM
-------

We were freeing the extra_col_value[] arrays without checking if they
have been allocated or not which was causing the crash.

FIX
---

First check the allocated flag and then free the item.

[#rb 7891 Aprooved by Jimmy]
Bug#19856162: HANDLE_FATAL_SIGNAL 11 IN
PARTITION_INFO::CHECK_PARTITION_INFO

Problem in prep_alter_part_table after error,
result in altered partition_info object was still used.

Solution was to only work on a clone and only use that
clone when needed and switch back to the original
partition_info object afterwards, so the altered object
would not be used in other cases (or be reused by
following statements under LOCK TABLES).
Bug#20030284 - HANDLE_FATAL_SIGNAL (SIG=11) IN NAME_HASH_SEARCH
Issue here is, "table_name" passed to function name_hash_search()
is "NULL". The "table_name"(NULL) is used as a source argument
in strcpy operation. This is resulting in the issue reported in
the bug report.

While processing derived table needed for the query execution,
the name of the table (i.e. TABLE_LIST::table_name) is made to
point to the temporary table name held in "TABLE_SHARE::
table_name.str". Member "TABLE_LIST::table_name" with temporary
table name is used through out the execution of the query. While
closing "THD::derived_tables", the instances of TABLE and TABLE_SHARE
allocated are deleted. Because of this "TABLE_LIST::table_name"
becomes stale pointer. While initializing prepared statement for the
next execution, "TABLE_LIST::table_name" and "TABLE_LIST::db" is reset
to NULL for the derived tables. And while opening the tables of prepared
statement, "TABLE_LIST::table_name" and "TABLE_LIST::db" of derived
table created for view is restored from the "TABLE_LIST::view_name"
and "TABLE_LIST::view_db".

But for the prepared statement, create_view_precheck() is called
before restoring the "table_name" and "db" of derived table
created for the view. Because of this NULL value is passed to the
"name_hash_search" function.

Fix:
---------------
To fix this issue, added a code to restore table name and database
name of the derived tables created for view during the initialization
of prepared statement.
Logic to restore the table name and database name in open table logic
is required for the stored routines. So added a check in open
tables logic to not restore table name and database name again if
it is already restored.
Bug #18523599 ALTER .. RENAME : FAILING ASSERTION: TRX_STATE_EQ(TRX,
TRX_STATE_NOT_STARTED)

The assert is using the wrong transaction object.  Fixed it by using
the correct transaction object.

approved by Marko over IM.
Bug#20436436 NEW->OLD ASSERT FAILURE `GTID_MODE > 0' IN 5.6.24 AT LOG…
…_EVENT.CC:13555

The problem is caused when slave sql thread is applying an
anonymous_gtid log events on mysql 5.6, since the
anonymous_gtid log event can be generated on mysql 5.7 after
wl#7592 when gtid_mode is OFF or OFF_PERMISSVE. So the
NEW->OLD replication is broken.

On mysql 5.6, the slave sql thread should manage to apply the
anonymous_gtid log event successfully if gtid_mode is OFF;
the slave sql thread should report an error and abort when
applying the anonymous_gtid log event if gtid_mode is ON;
the slave sql thread should report an error and abort when
applying a gtid log event if gtid_mode is OFF.
Fix for:
Bug #19509398    ACCOUNT FILTERING ISN'T APPLIED FOR CONNECTION EVENTS
Bug #19509373    NON-ERROR COM_QUIT EVENTS RECORDED INCORRECTLY
Bug #19509263    AUDIT_LOG_EVENTS_FILTERED DOESN'T INCLUDE EVENTS FILTERED BASED ON ACCOUNTS
Bug #19509336    AUDIT LOG STATISTICS DON'T ADD UP
Bug #19502900    VERSION AUDIT PLUGIN APPROPRIATELY
Bug #14584292    AUDIT_LOG PLUGIN INITIALISATION FAILED ONCE SERVER CRASHED AND RESTARTED

Audit_log code cleanups.
Bug#20390277 MEMCACHE: FLUSH_ALL: TABLE->MEMCACHED_SYNC_COUNT >= 0
We need to block all dmls from both SQL layer and memcached when
flush_all is running.

Reviewed-by: Jimmy Yang<jimmy.yang@oracle.com>
RB: 7804
BUG#19910140: HANDLE_FATAL_SIGNAL (SIG=11) IN
              REPLACE_USER_TABLE | SQL/SQL_ACL.CC:3125

Description:- Creating a user after altering the user table
definition results in a server crash.

Analysis:- Altering mysql user table definition by dropping
some columns and trying to create a user will result in a
server crash. This is due to the invalid memory access for
the dropped columns of the user table while accesing the
user table.

Fix:- In "replace_user_table()", a condition is added which
will check whether the total number of fields is greater
than or equal to MYSQL_USER_FIELD_AUTHENTICATION_STRING
before storing plugin and authentiacation string values. If
total number of fields is less than 42, an error is thrown,
"ERROR 1054 (42S22): Unknown column 'plugin' in 'mysql.user'".
Similar check is added in "update_user_table()" also.

NOTE:- This patch is only for mysql-5.6. In mysql-5.7 and
mysql-trunk, the bug does not exist anymore.
Bug#19975697 5.6: SLAVE IO_THREAD MAY GET STUCK WHEN USING
GTID AND LOW SLAVE_NET_TIMEOUTS

Problem: When GTID is enabled, dump thread is not checking
the necessity of heartbeat event while it is scanning
through the binary log files and skipping some GTID groups
which were already present at Slave.

Analysis: Dump thread sends a heartbeat event to Slave if
there are no events to send for "heartbeat_period" seconds
to make the connection between Master and Slave active.
But when dump thread is scanning a binary log file and
if it finds many GTID groups(/events) that needs to be skipped,
it is not looking for this time period and not
looking to send heartbeat event to Slave.

There are two problems with the existing code in this
scenario:

Problem 1: If dump thread is spending more time in skipping the groups
(many groups that needs to be skipped) and is not sending any
heartbeat event, Slave thinks that Master is dead and it will
try to reestablish the connection.
Problem 2): Dump thread has two while loops to process the events at Master
side, a ) outer loop: to process all binary log files one by one
      b ) inner loop: to process all the events one by one in a file

Outer loop is having a flag 'thd->killed' to check if dump thread is killed
in between processing the different files, if so, it exists the while loop.

But Inner loop is not having any checks like this which end up in processing
the full binary file( if it is huge, taking more time) which is unnecessary
if this dump thread is killed due to some reason (One reason could be that
this dump thread could have been detected as Zombie thread by another new
dump request from Slave).

Fix:
1) Dump thread will now check whether it is time to send an heartbeat event
before skipping an event. If so, it will send one heartbeat event to Slave.
2) Inner loop also checks for thd->killed flag to avoid unnecessary work.
BUG#19897405: CRASH WHILE ACCESSING VIEWS IN STORED ROUTINE
              AND TABLES ARE FLUSHED

Analysis:
---------
The server crashes while accessing view columns in the
stored procedure after DDL/FLUSH TABLE operation
is performed on the tables used by the SQL statements
in the stored procedure.

The DDL/FLUSH TABLE operation on the tables used by the
SQL statement of the stored procedure triggers a
re-parse of the query. The state of the statement arena
was set to 'STMT_EXECUTED' and was not reset to
'STMT_INITIALIZED_FOR_SP' during the re-parse. This state
of the query arena caused the runtime arena to be used
for the allocation of item representing the view column
instead of persistent arena. The runtime arena and the
mem_root associated with it is not persistent and is
deallocated at the end of the query execution. Hence
the subsequent execution of the stored procedure,
accesses invalid(freed) memory causing the server to crash.

Fix:
---
The state of the statement arena for the query re-parsed
is set to STMT_INITIALIZED_FOR_SP. Thus, when the item
representing the view column is created, it will
be allocated on the persistent memroot which
will be accessible for the subsequent calls to
the stored procedure
Bug#20458574 FIX ALL THE ARRAY BOUNDS WARNINGS
Remove compiler warnings when building in optimized mode:

In strings/decimal.c fix numerous warnings of the type:
array subscript is below array bounds [-Werror=array-bounds]
This part of the patch is based on a patch
from https://github.com/webscalesql/webscalesql-5.6
That patch added some bounds-checks for loops, and worked for
gcc4.8.3 but not for gcc 4.9.1 so it was re-written to unroll the loops instead.

In other source files, fix numerous warnings of the type:
variable XX set but not used [-Werror=unused-but-set-variable]
variable XX may be used uninitialized in this function [-Werror=maybe-uninitialized]
These were variables used only for debugging purposes,
or variables not proven to be set by all execution paths.

Compiled with gcc 4.7.2 4.8.3 4.9.1 in optimized mode, with -Wall -Werror
Bug#20458574 FIX ALL THE ARRAY BOUNDS WARNINGS
Post-push fix: revert changes to embedded code in sql_load.cc
Bug #19612819 : FILESORT: ASSERTION FAILED: POS->FIELD != 0 || POS->I…
…TEM != 0

Problem:
While getting the temp table field for a REF_ITEM
make_sortorder is using the real_item. As a result
server fails later with an assert.

Solution:
Do not use real_item to get the temp table field.
Instead use the REF_ITEM itself as temp table fields
are created for REF_ITEM not the real_item.
Bug #19670915 GROUP_CONCAT_MAX_LEN=18446744073709547520 NOT ACCEPTED …
…IN MY.CNF

Reverting the testcase because of having different size values in different platforms and architectures.
BUG#18751585: GTID_SET::GET_STRING_LENGTH GIVES WRONG RESULT AFTER GT…
…ID_SET::CLEAR

Background:
GTID sets are stored internally using class Gtid_set, where
intervals of Gtids are stored using linked lists.
The member function Gtid_set::to_string returns a string representation
of the set. The member function Gtid_set::get_string_length returns the
length of the string, without actually computing the string (this is useful
so that a caller can allocate a buffer before computing the actual string).
Gtid_set::get_string_length caches the string length, so that if
get_string_length is called twice, the length does not need to be recomputed.
The cached string length is forgotten when the set is modified.

Problem:
There was one case where we had forgotten to forget the cached string length:
Gtid_set::clear(). This could cause get_string_length() to return a too big
number after calling Gtid_set::clear(). This in turn would mean that
Gtid_set::to_string would allocate more than one byte, set the first byte
to '\0', leave the rest uninitialized, and return a string length that is
longer than 0.

Since the generated string is NULL-terminated this did not cause much trouble,
except in one place: in 5.7,
performance_schema.replicate_connection_status/RECEIVED_GTID_SET stores a
Gtid_set in a BLOB column. Since it is a BLOB, it does not count '\0' as
end-of-string. So it would print all the allocated characters, including
uninitialized bytes.

Fix:
Clear Gtid_set::cached_string_length in Gtid_set::clear.
Bug#19880368 : GROUP_CONCAT CRASHES AFTER DUMP_LEAF_KEY
Problem:
find_order_by_list does not update the address of order_item
correctly after resolving.

Solution:
Change the ref_by address for a order_by field if its
SUM_FUNC_ITEM to the address of the field present in
all_fields.
Bug #20527363 TRUNCATE TEMPORARY TABLE CRASH:
		!DICT_TF2_FLAG_IS_SET(TABLE, DICT_TF2_TEMPORARY)

Problem:

   Server asserts while truncating the temporary tables.

Reason:

If temporary table object is evicted from data dictionary cache during its
lifetime on reload from SYS_TABLES object is not full constructed as it was
when it was created. This is because not all fields of temporary tables are
persisted to SYS_TABLES and dir_path_to_temp_table is one such field which
on reload is set to NULL. Making any decision based on such fields can result
in inconsistent output. Truncate code was trying to do the same.

Reviewed-by: Krunal Bauskar <krunal.bauskar@oracle.com>
Reviewed-by: Sunny Bains <sunny.bains@oracle.com>
RB: 8081
WL#7725 FIREWALL
An audit plugin which use the P_S digset to record SQL statements
and firewall against SQL injections.

Bug#20567900 PREPARED STATEMENTS WON'T ALLOW FOR AUDIT PLUGINS TO RETURN AN ERROR

During the prepare phase of a prepared statement any audit plugin might
raise an error. This error was ignored by the Prepare_statement::prepare
function.

The fix is to check the state of the DA and set the error state
accordingly.
Bug#20576506 FIREWALL PLUGIN CRASH ON SECOND AUDIT EVENT ON SOLARIS 1…
…0 X86 32-BIT

A crash in Solaris 10 32bit x86 was caused by a misalignment of
memory when arguments are passed with implicit type conversion
using va_args.
Bug#20414606 USE SINGLE QUOTES FOR PERL PATHS, IN CASE OF SPECIAL SYM…
…BOLS

Bug#20414565 DISABLE LARGE_TESTS.ALTER_TABLE IN DEBUG MODE
Bug#20414569 STABILIZE TESTS THAT USE SHOW PROCESSLIST

In a few cases some minor beautification or
adjustment to current handling of storage engines in tests.
Add support for SLES12
Signed-off-by: Terje Røsten <terje.rosten@oracle.com>
BUG#20477758 CONFLICTS WHILE INSTALLING COMMUNITY PACKAGES WHEN MARIA…
…DB, LIB FILES INSTALLED

Due to large version numbers used libmysqlclient-devel packages was
not considered for install. Fixed by removing version check.

Signed-off-by: Terje Røsten <terje.rosten@oracle.com>
Bug #20536590: BACKPORT BUG #12368204 AND BUG #16953758 TO MYSQL-5.6
Backported the fixes.
Partially backported the fix for bug #19463877 too :
the part about different audit events count for the different
protocols.
Changed the strategy of the original fix to account for the lack
of the changes done in WL#6613 as follows:
Instead of mixing the calls to the audit log API by calling them
both outside of the general log hooks and inside some
moved all audit log API calls inside the general log hooks but
before any checks to the general log options. Made sure that the
general log hooks are called regardless of the value of the
general log option and moved all checking of it inside the
hooks.
Changed the binary log calles used by the prepared statement
code to use the convenience hooks instead of directly calling the
LOGGER functions. Ensured that prepared statements pass down the
query text.
Getting it from the THD is not correct for prepared statements.
** Added an extra test file that tests firewall with general log off.
Patch for Bug#17162055: SSL.CMAKE SILENTLY CHOOSES BUNDLED YASSL INST…
…EAD OF

ERRORING FOR OLD OPENSSL VER

The problem was that if the user specified incorrect path to SSL installation,
or if the user specified unsupported (too old) SSL installation using WITH_SSL,
it's implicitly changed to the 'bundled' value, meaning bundled YaSSL will be
used instead of user-specified SSL.

The fix is to do not change WITH_SSL to the 'bundled' value, but rather
exit with an error message and let the user to correct the WITH_SSL value.

(cherry picked from commit c4fcbf13b6cd3f075490dc80bfd7546c5504c74f)

Conflicts:
	cmake/ssl.cmake

(cherry picked from commit e858eb9b5722520f3aaa445e284bba7b5882a249)
Bug#20756770 MYSQL SERVER DOESN'T COMPILE AGAINST OPENSSL 1.0.1M
The #define in openssl/opensslv.h contains an extra space in 1.0.1M
Fix the regexp that is used for parsing the version number.

(cherry picked from commit e5f6940dfc10580117249fefaee511e44df55326)
Merge remote-tracking branch 'mysql-server/mysql-5.6.24' into 2.2-xb-…
…rebase-5.6.24

* mysql-server/mysql-5.6.24: (167 commits)
  Bumped rpm version for oel due to respin
  Bug#20756770 MYSQL SERVER DOESN'T COMPILE AGAINST OPENSSL 1.0.1M
  Patch for Bug#17162055: SSL.CMAKE SILENTLY CHOOSES BUNDLED YASSL INSTEAD OF ERRORING FOR OLD OPENSSL VER
  ca4a636
  a543b76
  Bug #20536590: BACKPORT BUG #12368204 AND BUG #16953758 TO MYSQL-5.6
  BUG#20477758 CONFLICTS WHILE INSTALLING COMMUNITY PACKAGES WHEN MARIADB, LIB FILES INSTALLED
  Add support for SLES12
  Raise version number after cloning 5.5.43
  Bug#20414606 USE SINGLE QUOTES FOR PERL PATHS, IN CASE OF SPECIAL SYMBOLS Bug#20414565 DISABLE LARGE_TESTS.ALTER_TABLE IN DEBUG MODE Bug#20414569 STABILIZE TESTS THAT USE SHOW PROCESSLIST
  fa433ca
  439e607
  Bug#20576506 FIREWALL PLUGIN CRASH ON SECOND AUDIT EVENT ON SOLARIS 10 X86 32-BIT
  WL#7725 FIREWALL
  Bug #20527363	TRUNCATE TEMPORARY TABLE CRASH: 		!DICT_TF2_FLAG_IS_SET(TABLE, DICT_TF2_TEMPORARY)
  Bug#19880368 : GROUP_CONCAT CRASHES AFTER DUMP_LEAF_KEY
  BUG#18751585: GTID_SET::GET_STRING_LENGTH GIVES WRONG RESULT AFTER GTID_SET::CLEAR
  Bug #19670915 GROUP_CONCAT_MAX_LEN=18446744073709547520 NOT ACCEPTED IN MY.CNF
  Bug #19612819 :  FILESORT: ASSERTION FAILED: POS->FIELD != 0 || POS->ITEM != 0
  Bug#20458574 FIX ALL THE ARRAY BOUNDS WARNINGS
  ...
Merge branch '2.2-xb-rebase-5.6.24' into 2.3-xb-rebase-5.6.24
* elder/2.2-xb-rebase-5.6.24: (167 commits)
  Bumped rpm version for oel due to respin
  Bug#20756770 MYSQL SERVER DOESN'T COMPILE AGAINST OPENSSL 1.0.1M
  Patch for Bug#17162055: SSL.CMAKE SILENTLY CHOOSES BUNDLED YASSL INSTEAD OF ERRORING FOR OLD OPENSSL VER
  ca4a636
  a543b76
  Bug #20536590: BACKPORT BUG #12368204 AND BUG #16953758 TO MYSQL-5.6
  BUG#20477758 CONFLICTS WHILE INSTALLING COMMUNITY PACKAGES WHEN MARIADB, LIB FILES INSTALLED
  Add support for SLES12
  Raise version number after cloning 5.5.43
  Bug#20414606 USE SINGLE QUOTES FOR PERL PATHS, IN CASE OF SPECIAL SYMBOLS Bug#20414565 DISABLE LARGE_TESTS.ALTER_TABLE IN DEBUG MODE Bug#20414569 STABILIZE TESTS THAT USE SHOW PROCESSLIST
  fa433ca
  439e607
  Bug#20576506 FIREWALL PLUGIN CRASH ON SECOND AUDIT EVENT ON SOLARIS 10 X86 32-BIT
  WL#7725 FIREWALL
  Bug #20527363	TRUNCATE TEMPORARY TABLE CRASH: 		!DICT_TF2_FLAG_IS_SET(TABLE, DICT_TF2_TEMPORARY)
  Bug#19880368 : GROUP_CONCAT CRASHES AFTER DUMP_LEAF_KEY
  BUG#18751585: GTID_SET::GET_STRING_LENGTH GIVES WRONG RESULT AFTER GTID_SET::CLEAR
  Bug #19670915 GROUP_CONCAT_MAX_LEN=18446744073709547520 NOT ACCEPTED IN MY.CNF
  Bug #19612819 :  FILESORT: ASSERTION FAILED: POS->FIELD != 0 || POS->ITEM != 0
  Bug#20458574 FIX ALL THE ARRAY BOUNDS WARNINGS
  ...
Contributor

georgelorchpercona commented May 22, 2015

Same as 2.2: This looks like a good merge to me, history seems maintained, no odd extra or missing commits, jenkins looks as expected.

gl-sergei added a commit that referenced this pull request May 23, 2015

@gl-sergei gl-sergei merged commit ebd9947 into percona:2.3 May 23, 2015

@gl-sergei gl-sergei deleted the gl-sergei:2.3-xb-rebase-5.6.24 branch Nov 24, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment