Skip to content
Permalink
Browse files
Merge 10.0 into 10.1
  • Loading branch information
dr-m committed May 19, 2017
2 parents d0eb4ee + 54bb04f commit 13a350a
Show file tree
Hide file tree
Showing 75 changed files with 830 additions and 790 deletions.
@@ -3962,6 +3962,7 @@ xtrabackup_backup_func(void)
mysql_data_home[0]=FN_CURLIB; // all paths are relative from here
mysql_data_home[1]=0;

srv_n_purge_threads = 1;
srv_read_only_mode = TRUE;

srv_backup_mode = TRUE;
@@ -4650,6 +4651,7 @@ xtrabackup_stats_func(int argc, char **argv)
mysql_data_home[0]=FN_CURLIB; // all paths are relative from here
mysql_data_home[1]=0;

srv_n_purge_threads = 1;
/* set read only */
srv_read_only_mode = TRUE;

@@ -6407,6 +6409,7 @@ xtrabackup_prepare_func(int argc, char ** argv)

/* Create logfiles for recovery from 'xtrabackup_logfile', before start InnoDB */
srv_max_n_threads = 1000;
srv_n_purge_threads = 1;
ut_mem_init();
/* temporally dummy value to avoid crash */
srv_page_size_shift = 14;
@@ -934,6 +934,12 @@ extern ulonglong my_getcputime(void);
#define hrtime_sec_part(X) ((ulong)((X).val % HRTIME_RESOLUTION))
#define my_time(X) hrtime_to_time(my_hrtime())

#if STACK_DIRECTION < 0
#define available_stack_size(CUR,END) (long) ((char*)(CUR) - (char*)(END))
#else
#define available_stack_size(CUR,END) (long) ((char*)(END) - (char*)(CUR))
#endif

#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>

@@ -1406,7 +1406,7 @@ void set_stmt_errmsg(MYSQL_STMT *stmt, NET *net)
DBUG_ASSERT(stmt != 0);

stmt->last_errno= net->last_errno;
if (net->last_error && net->last_error[0])
if (net->last_error[0])
strmov(stmt->last_error, net->last_error);
strmov(stmt->sqlstate, net->sqlstate);

@@ -4709,8 +4709,7 @@ my_bool STDCALL mysql_stmt_close(MYSQL_STMT *stmt)
{
uchar buff[MYSQL_STMT_HEADER]; /* 4 bytes - stmt id */

if ((rc= reset_stmt_handle(stmt, RESET_ALL_BUFFERS | RESET_CLEAR_ERROR)))
return rc;
reset_stmt_handle(stmt, RESET_ALL_BUFFERS | RESET_CLEAR_ERROR);

int4store(buff, stmt->stmt_id);
if ((rc= stmt_command(mysql, COM_STMT_CLOSE, buff, 4, stmt)))
@@ -878,3 +878,8 @@ SET @regCheck= '\\xE0\\x01';
SELECT CAST(0xE001 AS BINARY) REGEXP @regCheck;
CAST(0xE001 AS BINARY) REGEXP @regCheck
1
# MDEV-12420: Testing recursion overflow
SELECT 1 FROM dual WHERE ('Alpha,Bravo,Charlie,Delta,Echo,Foxtrot,StrataCentral,Golf,Hotel,India,Juliet,Kilo,Lima,Mike,StrataL3,November,Oscar,StrataL2,Sand,P3,P4SwitchTest,Arsys,Poppa,ExtensionMgr,Arp,Quebec,Romeo,StrataApiV2,PtReyes,Sierra,SandAcl,Arrow,Artools,BridgeTest,Tango,SandT,PAlaska,Namespace,Agent,Qos,PatchPanel,ProjectReport,Ark,Gimp,Agent,SliceAgent,Arnet,Bgp,Ale,Tommy,Central,AsicPktTestLib,Hsc,SandL3,Abuild,Pca9555,Standby,ControllerDut,CalSys,SandLib,Sb820,PointV2,BfnLib,Evpn,BfnSdk,Sflow,ManagementActive,AutoTest,GatedTest,Bgp,Sand,xinetd,BfnAgentLib,bf-utils,Hello,BfnState,Eos,Artest,Qos,Scd,ThermoMgr,Uniform,EosUtils,Eb,FanController,Central,BfnL3,BfnL2,tcp_wrappers,Victor,Environment,Route,Failover,Whiskey,Xray,Gimp,BfnFixed,Strata,SoCal,XApi,Msrp,XpProfile,tcpdump,PatchPanel,ArosTest,FhTest,Arbus,XpAcl,MacConc,XpApi,telnet,QosTest,Alpha2,BfnVlan,Stp,VxlanControllerTest,MplsAgent,Bravo2,Lanz,BfnMbb,Intf,XCtrl,Unicast,SandTunnel,L3Unicast,Ipsec,MplsTest,Rsvp,EthIntf,StageMgr,Sol,MplsUtils,Nat,Ira,P4NamespaceDut,Counters,Charlie2,Aqlc,Mlag,Power,OpenFlow,Lag,RestApi,BfdTest,strongs,Sfa,CEosUtils,Adt746,MaintenanceMode,MlagDut,EosImage,IpEth,MultiProtocol,Launcher,Max3179,Snmp,Acl,IpEthTest,PhyEee,bf-syslibs,tacc,XpL2,p4-ar-switch,p4-bf-switch,LdpTest,BfnPhy,Mirroring,Phy6,Ptp' REGEXP '^((?!\b(Strata|StrataApi|StrataApiV2)\b).)*$');
1
Warnings:
Warning 1139 Got error 'pcre_exec: recursion limit of NUM exceeded' from regexp
@@ -27,3 +27,15 @@ CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1,t2;
call mtr.add_suppression('Incorrect key file for table');
create table t1 (a int, index(a));
lock tables t1 write;
insert t1 values (1),(2),(1);
set @old_dbug=@@debug_dbug;
set debug_dbug='+d,mi_lock_database_failure';
unlock tables;
Warnings:
Error 126 Incorrect key file for table './test/t1.MYI'; try to repair it
Error 1030 Got error 22 "Invalid argument" from storage engine MyISAM
set debug_dbug=@old_dbug;
drop table t1;
@@ -0,0 +1,30 @@
create table t1 (a int not null) engine=csv;
insert t1 values (1),(2);
flush tables;
select * from information_schema.tables where table_schema='test';
TABLE_CATALOG def
TABLE_SCHEMA test
TABLE_NAME t1
TABLE_TYPE BASE TABLE
ENGINE NULL
VERSION NULL
ROW_FORMAT NULL
TABLE_ROWS NULL
AVG_ROW_LENGTH NULL
DATA_LENGTH NULL
MAX_DATA_LENGTH NULL
INDEX_LENGTH NULL
DATA_FREE NULL
AUTO_INCREMENT NULL
CREATE_TIME NULL
UPDATE_TIME NULL
CHECK_TIME NULL
TABLE_COLLATION NULL
CHECKSUM NULL
CREATE_OPTIONS NULL
TABLE_COMMENT File './test/t1.CSM' not found (Errcode: 13 "Permission denied")
Warnings:
Level Warning
Code 29
Message File './test/t1.CSM' not found (Errcode: 13 "Permission denied")
drop table t1;
@@ -0,0 +1,19 @@
#
# MDEV-11883 MariaDB crashes with out-of-memory when query information_schema
#
source include/have_csv.inc;

let datadir=`select @@datadir`;

create table t1 (a int not null) engine=csv;
insert t1 values (1),(2);
flush tables;

chmod 0400 $datadir/test/t1.CSM;
chmod 0400 $datadir/test/t1.CSV;

--replace_result $datadir ./
query_vertical select * from information_schema.tables where table_schema='test';

drop table t1;

@@ -426,3 +426,7 @@ SELECT 0xE001 REGEXP @regCheck;
SET NAMES latin1;
SET @regCheck= '\\xE0\\x01';
SELECT CAST(0xE001 AS BINARY) REGEXP @regCheck;

--echo # MDEV-12420: Testing recursion overflow
--replace_regex /[0-9]+ exceeded/NUM exceeded/
SELECT 1 FROM dual WHERE ('Alpha,Bravo,Charlie,Delta,Echo,Foxtrot,StrataCentral,Golf,Hotel,India,Juliet,Kilo,Lima,Mike,StrataL3,November,Oscar,StrataL2,Sand,P3,P4SwitchTest,Arsys,Poppa,ExtensionMgr,Arp,Quebec,Romeo,StrataApiV2,PtReyes,Sierra,SandAcl,Arrow,Artools,BridgeTest,Tango,SandT,PAlaska,Namespace,Agent,Qos,PatchPanel,ProjectReport,Ark,Gimp,Agent,SliceAgent,Arnet,Bgp,Ale,Tommy,Central,AsicPktTestLib,Hsc,SandL3,Abuild,Pca9555,Standby,ControllerDut,CalSys,SandLib,Sb820,PointV2,BfnLib,Evpn,BfnSdk,Sflow,ManagementActive,AutoTest,GatedTest,Bgp,Sand,xinetd,BfnAgentLib,bf-utils,Hello,BfnState,Eos,Artest,Qos,Scd,ThermoMgr,Uniform,EosUtils,Eb,FanController,Central,BfnL3,BfnL2,tcp_wrappers,Victor,Environment,Route,Failover,Whiskey,Xray,Gimp,BfnFixed,Strata,SoCal,XApi,Msrp,XpProfile,tcpdump,PatchPanel,ArosTest,FhTest,Arbus,XpAcl,MacConc,XpApi,telnet,QosTest,Alpha2,BfnVlan,Stp,VxlanControllerTest,MplsAgent,Bravo2,Lanz,BfnMbb,Intf,XCtrl,Unicast,SandTunnel,L3Unicast,Ipsec,MplsTest,Rsvp,EthIntf,StageMgr,Sol,MplsUtils,Nat,Ira,P4NamespaceDut,Counters,Charlie2,Aqlc,Mlag,Power,OpenFlow,Lag,RestApi,BfdTest,strongs,Sfa,CEosUtils,Adt746,MaintenanceMode,MlagDut,EosImage,IpEth,MultiProtocol,Launcher,Max3179,Snmp,Acl,IpEthTest,PhyEee,bf-syslibs,tacc,XpL2,p4-ar-switch,p4-bf-switch,LdpTest,BfnPhy,Mirroring,Phy6,Ptp' REGEXP '^((?!\b(Strata|StrataApi|StrataApiV2)\b).)*$');
@@ -59,3 +59,16 @@ KILL QUERY @thread_id;
CHECK TABLE t1;
DROP TABLE t1,t2;
DISCONNECT insertConn;

#
# MDEV-12761 Error return from external_lock make the server crash
#
call mtr.add_suppression('Incorrect key file for table');
create table t1 (a int, index(a));
lock tables t1 write;
insert t1 values (1),(2),(1);
set @old_dbug=@@debug_dbug;
set debug_dbug='+d,mi_lock_database_failure';
unlock tables;
set debug_dbug=@old_dbug;
drop table t1;
@@ -3,6 +3,7 @@
#
--source include/not_embedded.inc
--source include/have_perfschema.inc
--source include/have_profiling.inc
--source include/platform.inc

#
@@ -324,12 +324,6 @@ static int match_pins(LF_PINS *el, void *addr)
return 0;
}

#if STACK_DIRECTION < 0
#define available_stack_size(CUR,END) (long) ((char*)(CUR) - (char*)(END))
#else
#define available_stack_size(CUR,END) (long) ((char*)(END) - (char*)(CUR))
#endif

#define next_node(P, X) (*((uchar * volatile *)(((uchar *)(X)) + (P)->free_ptr_offset)))
#define anext_node(X) next_node(&allocator->pinbox, (X))

@@ -5830,7 +5830,7 @@ int handler::ha_external_lock(THD *thd, int lock_type)

DBUG_EXECUTE_IF("external_lock_failure", error= HA_ERR_GENERIC;);

if (error == 0)
if (error == 0 || lock_type == F_UNLCK)
{
m_lock_type= lock_type;
cached_table_flags= table_flags();
@@ -5311,6 +5311,15 @@ int Regexp_processor_pcre::default_regex_flags()
return default_regex_flags_pcre(current_thd);
}

void Regexp_processor_pcre::set_recursion_limit(THD *thd)
{
long stack_used;
DBUG_ASSERT(thd == current_thd);
stack_used= available_stack_size(thd->thread_stack, &stack_used);
m_pcre_extra.match_limit_recursion=
(my_thread_stack_size - stack_used)/my_pcre_frame_size;
}


/**
Convert string to lib_charset, if needed.
@@ -5402,15 +5411,77 @@ void Regexp_processor_pcre::pcre_exec_warn(int rc) const
*/
switch (rc)
{
case PCRE_ERROR_NULL:
errmsg= "pcre_exec: null arguement passed";
break;
case PCRE_ERROR_BADOPTION:
errmsg= "pcre_exec: bad option";
break;
case PCRE_ERROR_BADMAGIC:
errmsg= "pcre_exec: bad magic - not a compiled regex";
break;
case PCRE_ERROR_UNKNOWN_OPCODE:
errmsg= "pcre_exec: error in compiled regex";
break;
case PCRE_ERROR_NOMEMORY:
errmsg= "pcre_exec: Out of memory";
break;
case PCRE_ERROR_NOSUBSTRING:
errmsg= "pcre_exec: no substring";
break;
case PCRE_ERROR_MATCHLIMIT:
errmsg= "pcre_exec: match limit exceeded";
break;
case PCRE_ERROR_CALLOUT:
errmsg= "pcre_exec: callout error";
break;
case PCRE_ERROR_BADUTF8:
errmsg= "pcre_exec: Invalid utf8 byte sequence in the subject string";
break;
case PCRE_ERROR_BADUTF8_OFFSET:
errmsg= "pcre_exec: Started at invalid location within utf8 byte sequence";
break;
case PCRE_ERROR_PARTIAL:
errmsg= "pcre_exec: partial match";
break;
case PCRE_ERROR_INTERNAL:
errmsg= "pcre_exec: internal error";
break;
case PCRE_ERROR_BADCOUNT:
errmsg= "pcre_exec: ovesize is negative";
break;
case PCRE_ERROR_RECURSIONLIMIT:
my_snprintf(buf, sizeof(buf), "pcre_exec: recursion limit of %ld exceeded",
m_pcre_extra.match_limit_recursion);
errmsg= buf;
break;
case PCRE_ERROR_BADNEWLINE:
errmsg= "pcre_exec: bad newline options";
break;
case PCRE_ERROR_BADOFFSET:
errmsg= "pcre_exec: start offset negative or greater than string length";
break;
case PCRE_ERROR_SHORTUTF8:
errmsg= "pcre_exec: ended in middle of utf8 sequence";
break;
case PCRE_ERROR_JIT_STACKLIMIT:
errmsg= "pcre_exec: insufficient stack memory for JIT compile";
break;
case PCRE_ERROR_RECURSELOOP:
errmsg= "pcre_exec: Recursion loop detected";
break;
case PCRE_ERROR_BADMODE:
errmsg= "pcre_exec: compiled pattern passed to wrong bit library function";
break;
case PCRE_ERROR_BADENDIANNESS:
errmsg= "pcre_exec: compiled pattern passed to wrong endianness processor";
break;
case PCRE_ERROR_JIT_BADOPTION:
errmsg= "pcre_exec: bad jit option";
break;
case PCRE_ERROR_BADLENGTH:
errmsg= "pcre_exec: negative length";
break;
default:
/*
As other error codes should normally not happen,
@@ -5446,7 +5517,7 @@ int Regexp_processor_pcre::pcre_exec_with_warn(const pcre *code,

bool Regexp_processor_pcre::exec(const char *str, int length, int offset)
{
m_pcre_exec_rc= pcre_exec_with_warn(m_pcre, NULL, str, length, offset, 0,
m_pcre_exec_rc= pcre_exec_with_warn(m_pcre, &m_pcre_extra, str, length, offset, 0,
m_SubStrVec, m_subpatterns_needed * 3);
return false;
}
@@ -5457,7 +5528,7 @@ bool Regexp_processor_pcre::exec(String *str, int offset,
{
if (!(str= convert_if_needed(str, &subject_converter)))
return true;
m_pcre_exec_rc= pcre_exec_with_warn(m_pcre, NULL,
m_pcre_exec_rc= pcre_exec_with_warn(m_pcre, &m_pcre_extra,
str->c_ptr_safe(), str->length(),
offset, 0,
m_SubStrVec, m_subpatterns_needed * 3);
@@ -1892,6 +1892,7 @@ class Item_func_like :public Item_bool_func2
class Regexp_processor_pcre
{
pcre *m_pcre;
pcre_extra m_pcre_extra;
bool m_conversion_is_needed;
bool m_is_const;
int m_library_flags;
@@ -1916,8 +1917,12 @@ class Regexp_processor_pcre
m_data_charset(&my_charset_utf8_general_ci),
m_library_charset(&my_charset_utf8_general_ci),
m_subpatterns_needed(0)
{}
{
m_pcre_extra.flags= PCRE_EXTRA_MATCH_LIMIT_RECURSION;
m_pcre_extra.match_limit_recursion= 100L;
}
int default_regex_flags();
void set_recursion_limit(THD *);
void init(CHARSET_INFO *data_charset, int extra_flags, uint nsubpatterns_arg)
{
m_library_flags= default_regex_flags() | extra_flags |
@@ -392,6 +392,7 @@ void mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock)
void mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock, bool free_lock)
{
DBUG_ENTER("mysql_unlock_tables");
bool errors= thd->is_error();
THD_STAGE_INFO(thd, stage_unlocking_tables);

if (sql_lock->table_count)
@@ -400,6 +401,8 @@ void mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock, bool free_lock)
thr_multi_unlock(sql_lock->locks, sql_lock->lock_count, 0);
if (free_lock)
my_free(sql_lock);
if (!errors)
thd->clear_error();
DBUG_VOID_RETURN;
}

@@ -1304,7 +1304,7 @@ bool LOGGER::slow_log_print(THD *thd, const char *query, uint query_length,

/* fill in user_host value: the format is "%s[%s] @ %s [%s]" */
user_host_len= (strxnmov(user_host_buff, MAX_USER_HOST_SIZE,
sctx->priv_user ? sctx->priv_user : "", "[",
sctx->priv_user, "[",
sctx->user ? sctx->user : (thd->slave_thread ? "SQL_SLAVE" : ""), "] @ ",
sctx->host ? sctx->host : "", " [",
sctx->ip ? sctx->ip : "", "]", NullS) -
@@ -1584,8 +1584,7 @@ int Old_rows_log_event::do_apply_event(rpl_group_info *rgi)
default:
rli->report(ERROR_LEVEL, thd->net.last_errno, NULL,
"Error in %s event: row application failed. %s",
get_type_str(),
thd->net.last_error ? thd->net.last_error : "");
get_type_str(), thd->net.last_error);
thd->is_slave_error= 1;
break;
}
@@ -1624,8 +1623,7 @@ int Old_rows_log_event::do_apply_event(rpl_group_info *rgi)
"Error in %s event: error during transaction execution "
"on table %s.%s. %s",
get_type_str(), table->s->db.str,
table->s->table_name.str,
thd->net.last_error ? thd->net.last_error : "");
table->s->table_name.str, thd->net.last_error);

/*
If one day we honour --skip-slave-errors in row-based replication, and

0 comments on commit 13a350a

Please sign in to comment.