1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge 10.4 into 10.5

This commit is contained in:
Marko Mäkelä
2020-08-14 11:33:35 +03:00
39 changed files with 251 additions and 157 deletions

View File

@@ -1781,7 +1781,7 @@ apply_log_finish()
bool
copy_back()
{
bool ret;
bool ret = false;
datadir_iter_t *it = NULL;
datadir_node_t node;
char *dst_dir;

View File

@@ -19,6 +19,8 @@
#ifndef ILIST_H
#define ILIST_H
#include "my_dbug.h"
#include <cstddef>
#include <iterator>
@@ -73,11 +75,13 @@ public:
typedef T *pointer;
typedef T &reference;
Iterator(ListNode *node) noexcept : node_(node) {}
Iterator(ListNode *node) noexcept : node_(node)
{ DBUG_ASSERT(node_ != nullptr); }
Iterator &operator++() noexcept
{
node_= node_->next;
DBUG_ASSERT(node_ != nullptr);
return *this;
}
Iterator operator++(int) noexcept
@@ -90,6 +94,7 @@ public:
Iterator &operator--() noexcept
{
node_= node_->prev;
DBUG_ASSERT(node_ != nullptr);
return *this;
}
Iterator operator--(int) noexcept
@@ -184,8 +189,8 @@ public:
#ifndef DBUG_OFF
ListNode *curr= pos.node_;
curr->prev= NULL;
curr->next= NULL;
curr->prev= nullptr;
curr->next= nullptr;
#endif
return next;

View File

@@ -57,6 +57,7 @@ select * from t1;
t
0000-00-00 00:00:00
drop table t1;
SET TIMESTAMP=UNIX_TIMESTAMP('2020-08-11 00:00:01');
CREATE TABLE t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, b date, c time, d datetime);
insert into t1 (b,c,d) values(now(),curtime(),now());
Warnings:
@@ -65,6 +66,7 @@ select date_format(a,"%Y-%m-%d")=b,right(a+0,6)=c+0,a=d+0 from t1;
date_format(a,"%Y-%m-%d")=b right(a+0,6)=c+0 a=d+0
1 1 1
drop table t1;
SET TIMESTAMP=DEFAULT;
CREATE TABLE t1 (a datetime not null);
insert into t1 values (0);
select * from t1 where a is null;
@@ -298,8 +300,10 @@ f2 f3
select f2 from t1 where DATE(f2) between "2001-4-15" AND "01-4-15";
f2
2001-04-15 00:00:00
SET timestamp=UNIX_TIMESTAMP('2001-01-01 00:00:01');
SELECT 1 from dual where NOW() BETWEEN CURRENT_DATE() - INTERVAL 1 DAY AND CURRENT_DATE();
1
SET timestamp=DEFAULT;
drop table t1;
create table t1 (f1 date);
insert into t1 values('01-01-01'),('01-01-02'),('01-01-03');

View File

@@ -32,10 +32,12 @@ drop table t1;
# Test insert of now() and curtime()
#
SET TIMESTAMP=UNIX_TIMESTAMP('2020-08-11 00:00:01');
CREATE TABLE t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, b date, c time, d datetime);
insert into t1 (b,c,d) values(now(),curtime(),now());
select date_format(a,"%Y-%m-%d")=b,right(a+0,6)=c+0,a=d+0 from t1;
drop table t1;
SET TIMESTAMP=DEFAULT;
#
# Test of datetime and not null
@@ -201,6 +203,7 @@ drop table t1;
#
# Bug#16377: Wrong DATE/DATETIME comparison in BETWEEN function.
#
create table t1 (f1 date, f2 datetime, f3 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
insert into t1 values('2001-01-01','2001-01-01 01:01:01','2001-01-01 01:01:01');
insert into t1 values('2001-02-05','2001-02-05 00:00:00','2001-02-05 01:01:01');
@@ -214,7 +217,9 @@ select f1, f2, f3 from t1 where cast(f1 as datetime) between f2 and
select f2 from t1 where '2001-04-10 12:34:56' between f2 and '01-05-01';
select f2, f3 from t1 where '01-03-10' between f2 and f3;
select f2 from t1 where DATE(f2) between "2001-4-15" AND "01-4-15";
SET timestamp=UNIX_TIMESTAMP('2001-01-01 00:00:01');
SELECT 1 from dual where NOW() BETWEEN CURRENT_DATE() - INTERVAL 1 DAY AND CURRENT_DATE();
SET timestamp=DEFAULT;
drop table t1;
#

View File

@@ -1,6 +1,12 @@
connection node_2;
connection node_1;
connection node_2;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1';
connection node_1;
connection node_2;
SET SESSION wsrep_on = OFF;
SET SESSION wsrep_on = ON;
connection node_1;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (2);
@@ -12,8 +18,13 @@ INSERT INTO t1 VALUES (7);
INSERT INTO t1 VALUES (8);
INSERT INTO t1 VALUES (9);
INSERT INTO t1 VALUES (10);
connection node_2;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 0';
include/assert_grep.inc [Receiving IST: 11 writesets, seqnos]
include/assert_grep.inc [Receiving IST\.\.\. 0\.0% \( 0/11 events\) complete]
include/assert_grep.inc [Receiving IST\.\.\.100\.0% \(11/11 events\) complete]
connection node_1;
connection node_2;
connection node_1;
include/assert_grep.inc [Receiving IST: 13 writesets, seqnos 3-15]
include/assert_grep.inc [Receiving IST\.\.\. 0\.0% \( 0/13 events\) complete]
include/assert_grep.inc [Receiving IST\.\.\.100\.0% \(13/13 events\) complete]
connection node_1;
DROP TABLE t1;

View File

@@ -5,6 +5,7 @@
--source include/galera_cluster.inc
# This could cause out of storage if run /dev/shm
--source include/big_test.inc
--source include/force_restart.inc
# Isolate node #2
--connection node_2
@@ -58,16 +59,16 @@ SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 0';
--let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.2.err
--let $assert_only_after = Need state transfer
--let $assert_text = Receiving IST: 1[13] writesets
--let $assert_select = Receiving IST: 1[13] writesets
--let $assert_text = Receiving IST: 13 writesets, seqnos 3-15
--let $assert_select = Receiving IST: 13 writesets, seqnos 3-15
--source include/assert_grep.inc
--let $assert_text = Receiving IST\.\.\. 0\.0% \( 0/11 events\) complete
--let $assert_select = Receiving IST\.\.\. 0\.0% \( 0/11 events\) complete
--let $assert_text = Receiving IST\.\.\. 0\.0% \( 0/13 events\) complete
--let $assert_select = Receiving IST\.\.\. 0\.0% \( 0/13 events\) complete
--source include/assert_grep.inc
--let $assert_text = Receiving IST\.\.\.100\.0% \(11/11 events\) complete
--let $assert_select = Receiving IST\.\.\.100\.0% \(11/11 events\) complete
--let $assert_text = Receiving IST\.\.\.100\.0% \(13/13 events\) complete
--let $assert_select = Receiving IST\.\.\.100\.0% \(13/13 events\) complete
--source include/assert_grep.inc
# Cleanup

View File

@@ -263,3 +263,10 @@ create table t1(o1 int, o2 int, o3 int, primary key(o1,o2,o3)) engine = innodb;
insert into t1 values(1,1,2),(2,2,1);
alter table t1 drop primary key, add primary key(o1), lock=none;
drop table t1;
# pk(o1,o2) to pk(o1,o2,autoinc) must not sort
create table t1(o1 int, o2 int, primary key(o1,o2)) engine = innodb;
insert into t1 values(1,1),(2,1);
alter table t1 drop primary key, add column a int unique auto_increment,
add primary key(o1,o2,a), algorithm=inplace;
drop table t1;

View File

@@ -53,6 +53,13 @@ ALTER TABLE t1 DROP a;
ERROR HY000: Cannot drop index 'a': needed in a foreign key constraint
ALTER TABLE t1 ADD c INT;
DROP TABLE t1, tx;
#
# MDEV-14119 Assertion cmp_rec_rec() on ALTER TABLE
#
CREATE TABLE t1(a INT NOT NULL UNIQUE) ENGINE=InnoDB;
INSERT INTO t1 SELECT * FROM seq_1_to_128;
ALTER TABLE t1 ADD b TINYINT AUTO_INCREMENT PRIMARY KEY, DROP KEY a;
DROP TABLE t1;
create table t1 (a int) transactional=1 engine=aria;
create table t2 (a int) transactional=1 engine=innodb;
show create table t1;

View File

@@ -1081,3 +1081,10 @@ update t2 set col145=@b;
COMMIT;
drop table t2;
DROP TABLE t1;
#
# MDEV-19526 heap number overflow
#
CREATE TABLE t1(a SMALLINT NOT NULL UNIQUE AUTO_INCREMENT, KEY(a))
ENGINE=InnoDB;
INSERT INTO t1 (a) SELECT seq FROM seq_1_to_8191;
DROP TABLE t1;

View File

@@ -323,4 +323,9 @@ create table t1(o1 int, o2 int, o3 int, primary key(o1,o2,o3)) engine = innodb;
insert into t1 values(1,1,2),(2,2,1);
alter table t1 drop primary key, add primary key(o1), lock=none;
drop table t1;
create table t1(o1 int, o2 int, primary key(o1,o2)) engine = innodb;
insert into t1 values(1,1),(2,1);
alter table t1 drop primary key, add column a int unique auto_increment,
add primary key(o1,o2,a), algorithm=inplace;
drop table t1;
SET DEBUG_DBUG = @saved_debug_dbug;

View File

@@ -1907,6 +1907,11 @@ create table t1(o1 int, o2 int, o3 int, primary key(o1,o2,o3)) engine = innodb;
insert into t1 values(1,1,2),(2,2,1);
alter table t1 drop primary key, add primary key(o1), lock=none;
drop table t1;
create table t1(o1 int, o2 int, primary key(o1,o2)) engine = innodb;
insert into t1 values(1,1),(2,1);
alter table t1 drop primary key, add column a int unique auto_increment,
add primary key(o1,o2,a), algorithm=inplace;
drop table t1;
#
# MDEV-15325 Incomplete validation of missing tablespace during recovery
#

View File

@@ -1,4 +1,5 @@
--source include/have_innodb.inc
--source include/have_sequence.inc
#
# MDEV-11995 ALTER TABLE proceeds despite reporting ER_TOO_LONG_KEY error
#
@@ -60,6 +61,14 @@ ALTER TABLE t1 DROP a;
ALTER TABLE t1 ADD c INT;
DROP TABLE t1, tx;
--echo #
--echo # MDEV-14119 Assertion cmp_rec_rec() on ALTER TABLE
--echo #
CREATE TABLE t1(a INT NOT NULL UNIQUE) ENGINE=InnoDB;
INSERT INTO t1 SELECT * FROM seq_1_to_128;
ALTER TABLE t1 ADD b TINYINT AUTO_INCREMENT PRIMARY KEY, DROP KEY a;
DROP TABLE t1;
#
# Check that innodb supports transactional=1
#

View File

@@ -2,6 +2,7 @@
# Tests for setting innodb-page-size=64k;
--source include/have_innodb.inc
--source include/have_innodb_64k.inc
--source include/have_sequence.inc
call mtr.add_suppression('InnoDB: Cannot add field.*because after adding it, the row size is');
@@ -638,3 +639,11 @@ COMMIT;
drop table t2;
DROP TABLE t1;
--echo #
--echo # MDEV-19526 heap number overflow
--echo #
CREATE TABLE t1(a SMALLINT NOT NULL UNIQUE AUTO_INCREMENT, KEY(a))
ENGINE=InnoDB;
INSERT INTO t1 (a) SELECT seq FROM seq_1_to_8191;
DROP TABLE t1;

View File

@@ -398,7 +398,7 @@ SESSION_VALUE NULL
DEFAULT_VALUE zlib
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE ENUM
VARIABLE_COMMENT Compression algorithm used on page compression. One of: none, zlib, lz4, lzo, lzma, or bzip2
VARIABLE_COMMENT Compression algorithm used on page compression. One of: none, zlib, lz4, lzo, lzma, bzip2, or snappy
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL

View File

@@ -1,7 +1,8 @@
IF(WIN32)
IF(WIN32 OR WITHOUT_SERVER)
# Handlersocket does not compile on Windows, compiles but does
# not start on FreeBSD.
# It is a server plugin and disable it explicitly here.
RETURN()
ENDIF()

View File

@@ -1431,7 +1431,6 @@ static size_t escape_string_hide_passwords(const char *str, unsigned int len,
const char *res_start= result;
const char *res_end= result + result_len - 2;
size_t d_len;
char b_char;
while (len)
{
@@ -1469,27 +1468,28 @@ static size_t escape_string_hide_passwords(const char *str, unsigned int len,
if (*next_s)
{
memmove(result + d_len, "*****", 5);
const char b_char= *next_s++;
memset(result + d_len, '*', 5);
result+= d_len + 5;
b_char= *(next_s++);
while (*next_s)
{
if (*next_s == b_char)
{
++next_s;
break;
}
if (*next_s == '\\')
{
if (next_s[1])
next_s++;
}
next_s++;
}
}
else
result+= d_len;
while (*next_s)
{
if (*next_s == b_char)
{
++next_s;
break;
}
if (*next_s == '\\')
{
if (next_s[1])
next_s++;
}
next_s++;
}
len-= (uint)(next_s - str);
str= next_s;
continue;
@@ -1497,19 +1497,23 @@ static size_t escape_string_hide_passwords(const char *str, unsigned int len,
no_password:
if (result >= res_end)
break;
if ((b_char= escaped_char(*str)))
{
if (result+1 >= res_end)
break;
*(result++)= '\\';
*(result++)= b_char;
}
else if (is_space(*str))
*(result++)= ' ';
else
*(result++)= *str;
str++;
len--;
{
const char b_char= escaped_char(*str);
if (b_char)
{
if (result+1 >= res_end)
break;
*(result++)= '\\';
*(result++)= b_char;
}
else if (is_space(*str))
*(result++)= ' ';
else
*(result++)= *str;
str++;
len--;
}
}
*result= 0;
return result - res_start;

View File

@@ -308,9 +308,7 @@ sub report_mysqlds
sub start_mysqlds()
{
my (@groups, $com, $tmp, $i, @options, $j, $mysqld_found, $suffix_found, $info_sent);
$suffix_found= 0;
my (@groups, $com, $tmp, $i, @options, $j, $mysqld_found, $info_sent);
if (!$opt_no_log)
{
@@ -349,10 +347,6 @@ sub start_mysqlds()
$options[$j]= quote_shell_word($options[$j]);
$tmp.= " $options[$j]";
}
elsif ("--defaults-group-suffix=" eq substr($options[$j], 0, 24))
{
$suffix_found= 1;
}
else
{
$options[$j]= quote_shell_word($options[$j]);
@@ -369,12 +363,6 @@ sub start_mysqlds()
$info_sent= 1;
}
if (!$suffix_found)
{
$com.= " --defaults-group-suffix=";
$com.= substr($groups[$i],6);
}
$com.= $tmp;
if ($opt_wsrep_new_cluster) {

View File

@@ -712,7 +712,8 @@ INNODB_DATA_HOME_DIR=${INNODB_DATA_HOME_DIR:-""}
if [ ! -z "$INNODB_DATA_HOME_DIR_ARG" ]; then
INNODB_DATA_HOME_DIR=$INNODB_DATA_HOME_DIR_ARG
fi
# if INNODB_DATA_HOME_DIR env. variable is not set, try to get it from my.cnf
# if no command line arg and INNODB_DATA_HOME_DIR environment variable
# is not set, try to get it from my.cnf:
if [ -z "$INNODB_DATA_HOME_DIR" ]; then
INNODB_DATA_HOME_DIR=$(parse_cnf mysqld$WSREP_SST_OPT_SUFFIX_VALUE innodb-data-home-dir '')
fi
@@ -951,17 +952,25 @@ then
ib_home_dir=$INNODB_DATA_HOME_DIR
# Try to set ib_log_dir from the command line:
ib_log_dir=$INNODB_LOG_GROUP_HOME_ARG
if [ -z "$ib_log_dir" ]; then
ib_log_dir=$(parse_cnf mysqld$WSREP_SST_OPT_SUFFIX_VALUE innodb-log-group-home-dir "")
WSREP_LOG_DIR=${WSREP_LOG_DIR:-""}
# Try to set WSREP_LOG_DIR from the command line:
if [ ! -z "$INNODB_LOG_GROUP_HOME_ARG" ]; then
WSREP_LOG_DIR=$INNODB_LOG_GROUP_HOME_ARG
fi
if [ -z "$ib_log_dir" ]; then
ib_log_dir=$(parse_cnf --mysqld innodb-log-group-home-dir "")
# if no command line arg and WSREP_LOG_DIR is not set,
# try to get it from my.cnf:
if [ -z "$WSREP_LOG_DIR" ]; then
WSREP_LOG_DIR=$(parse_cnf mysqld$WSREP_SST_OPT_SUFFIX_VALUE innodb-log-group-home-dir '')
fi
if [ -z "$WSREP_LOG_DIR" ]; then
WSREP_LOG_DIR=$(parse_cnf --mysqld innodb-log-group-home-dir '')
fi
ib_log_dir=$WSREP_LOG_DIR
# Try to set ib_undo_dir from the command line:
ib_undo_dir=$INNODB_UNDO_DIR_ARG
ib_undo_dir=${INNODB_UNDO_DIR_ARG:-""}
# if no command line arg then try to get it from my.cnf:
if [ -z "$ib_undo_dir" ]; then
ib_undo_dir=$(parse_cnf mysqld$WSREP_SST_OPT_SUFFIX_VALUE innodb-undo-directory "")
fi

View File

@@ -152,10 +152,11 @@ fi
WSREP_LOG_DIR=${WSREP_LOG_DIR:-""}
# Try to set WSREP_LOG_DIR from the command line:
if [ -z "$WSREP_LOG_DIR" ]; then
if [ ! -z "$INNODB_LOG_GROUP_HOME_ARG" ]; then
WSREP_LOG_DIR=$INNODB_LOG_GROUP_HOME_ARG
fi
# if WSREP_LOG_DIR env. variable is not set, try to get it from my.cnf
# if no command line arg and WSREP_LOG_DIR is not set,
# try to get it from my.cnf:
if [ -z "$WSREP_LOG_DIR" ]; then
WSREP_LOG_DIR=$(parse_cnf mysqld$WSREP_SST_OPT_SUFFIX_VALUE innodb-log-group-home-dir '')
fi
@@ -176,7 +177,8 @@ INNODB_DATA_HOME_DIR=${INNODB_DATA_HOME_DIR:-""}
if [ ! -z "$INNODB_DATA_HOME_DIR_ARG" ]; then
INNODB_DATA_HOME_DIR=$INNODB_DATA_HOME_DIR_ARG
fi
# if INNODB_DATA_HOME_DIR env. variable is not set, try to get it from my.cnf
# if no command line arg and INNODB_DATA_HOME_DIR environment variable
# is not set, try to get it from my.cnf:
if [ -z "$INNODB_DATA_HOME_DIR" ]; then
INNODB_DATA_HOME_DIR=$(parse_cnf mysqld$WSREP_SST_OPT_SUFFIX_VALUE innodb-data-home-dir '')
fi

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2018, MariaDB Corporation
/* Copyright (c) 2018, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
@@ -96,7 +96,7 @@ bool run_backup_stage(THD *thd, backup_stages stage)
do
{
bool res;
bool res= false;
backup_stages previous_stage= thd->current_backup_stage;
thd->current_backup_stage= next_stage;
switch (next_stage) {
@@ -120,7 +120,6 @@ bool run_backup_stage(THD *thd, backup_stages stage)
break;
case BACKUP_FINISHED:
DBUG_ASSERT(0);
res= 0;
}
if (res)
{

View File

@@ -9683,7 +9683,6 @@ double ha_partition::read_time(uint index, uint ranges, ha_rows rows)
ha_rows ha_partition::records()
{
int error;
ha_rows tot_rows= 0;
uint i;
DBUG_ENTER("ha_partition::records");
@@ -9692,9 +9691,10 @@ ha_rows ha_partition::records()
i < m_tot_parts;
i= bitmap_get_next_set(&m_part_info->read_partitions, i))
{
ha_rows rows;
if (unlikely((error= m_file[i]->pre_records()) ||
(rows= m_file[i]->records()) == HA_POS_ERROR))
if (unlikely(m_file[i]->pre_records()))
DBUG_RETURN(HA_POS_ERROR);
const ha_rows rows= m_file[i]->records();
if (unlikely(rows == HA_POS_ERROR))
DBUG_RETURN(HA_POS_ERROR);
tot_rows+= rows;
}

View File

@@ -7537,7 +7537,6 @@ Item *find_producing_item(Item *item, st_select_lex *sel)
DBUG_ASSERT(item->type() == Item::FIELD_ITEM ||
(item->type() == Item::REF_ITEM &&
((Item_ref *) item)->ref_type() == Item_ref::VIEW_REF));
Item *producing_item;
Item_field *field_item= NULL;
Item_equal *item_equal= item->get_item_equal();
table_map tab_map= sel->master_unit()->derived->table->map;
@@ -7559,6 +7558,7 @@ Item *find_producing_item(Item *item, st_select_lex *sel)
List_iterator_fast<Item> li(sel->item_list);
if (field_item)
{
Item *producing_item= NULL;
uint field_no= field_item->field->field_index;
for (uint i= 0; i <= field_no; i++)
producing_item= li++;

View File

@@ -2372,12 +2372,15 @@ double Item_func_distance::val_real()
MBR mbr1, mbr2;
const char *c_end;
if ((null_value= (args[0]->null_value || args[1]->null_value ||
!(g1= Geometry::construct(&buffer1, res1->ptr(), res1->length())) ||
!(g2= Geometry::construct(&buffer2, res2->ptr(), res2->length())) ||
g1->get_mbr(&mbr1, &c_end) ||
g2->get_mbr(&mbr2, &c_end))))
if (args[0]->null_value || args[1]->null_value)
goto mem_error;
g1= Geometry::construct(&buffer1, res1->ptr(), res1->length());
if (!g1)
goto mem_error;
g2= Geometry::construct(&buffer2, res2->ptr(), res2->length());
if (!g2)
goto mem_error;
if (g1->get_mbr(&mbr1, &c_end) || g2->get_mbr(&mbr2, &c_end))
goto mem_error;
mbr1.add_mbr(&mbr2);
@@ -2526,7 +2529,7 @@ String *Item_func_pointonsurface::val_str(String *str)
Geometry *g;
MBR mbr;
const char *c_end;
double UNINIT_VAR(px), UNINIT_VAR(py), x0, y0;
double UNINIT_VAR(px), UNINIT_VAR(py), x0, UNINIT_VAR(y0);
String *result= 0;
const Gcalc_scan_iterator::point *pprev= NULL;
uint32 srid;

View File

@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2017, Oracle and/or its affiliates.
Copyright (c) 2009, 2020, MariaDB Corporation
Copyright (c) 2009, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -641,7 +641,7 @@ String *Item_func_concat_operator_oracle::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
THD *thd= current_thd;
String *res;
String *res= NULL;
uint i;
null_value=0;
@@ -651,7 +651,7 @@ String *Item_func_concat_operator_oracle::val_str(String *str)
if ((res= args[i]->val_str(str)))
break;
}
if (i == arg_count)
if (!res)
goto null;
if (res != str)

View File

@@ -374,11 +374,15 @@ static int send_file(THD *thd)
We need net_flush here because the client will not know it needs to send
us the file name until it has processed the load event entry
*/
if (unlikely(net_flush(net) || (packet_len = my_net_read(net)) == packet_error))
if (unlikely(net_flush(net)))
{
read_error:
errmsg = "while reading file name";
goto err;
}
packet_len= my_net_read(net);
if (unlikely(packet_len == packet_error))
goto read_error;
// terminate with \0 for fn_format
*((char*)net->read_pos + packet_len) = 0;

View File

@@ -3877,9 +3877,11 @@ sp_fetch_list:
LEX *lex= Lex;
sp_head *sp= lex->sphead;
sp_pcontext *spc= lex->spcont;
sp_variable *spv;
sp_variable *spv= likely(spc != NULL)
? spc->find_variable(&$1, false)
: NULL;
if (unlikely(!spc || !(spv = spc->find_variable(&$1, false))))
if (unlikely(!spv))
my_yyabort_error((ER_SP_UNDECLARED_VAR, MYF(0), $1.str));
/* An SP local variable */
@@ -3891,9 +3893,11 @@ sp_fetch_list:
LEX *lex= Lex;
sp_head *sp= lex->sphead;
sp_pcontext *spc= lex->spcont;
sp_variable *spv;
sp_variable *spv= likely(spc != NULL)
? spc->find_variable(&$3, false)
: NULL;
if (unlikely(!spc || !(spv = spc->find_variable(&$3, false))))
if (unlikely(!spv))
my_yyabort_error((ER_SP_UNDECLARED_VAR, MYF(0), $3.str));
/* An SP local variable */

View File

@@ -1017,7 +1017,10 @@ void thread_group_destroy(thread_group_t *thread_group)
#endif
if (!--shutdown_group_count)
{
my_free(all_groups);
all_groups= 0;
}
}
/**
@@ -1628,6 +1631,14 @@ TP_pool_generic::~TP_pool_generic()
{
thread_group_close(&all_groups[i]);
}
/*
Wait until memory occupied by all_groups is freed.
*/
int timeout_ms=5000;
while(all_groups && timeout_ms--)
my_sleep(1000);
threadpool_started= false;
DBUG_VOID_RETURN;
}

View File

@@ -3455,17 +3455,23 @@ fail_err:
}
ulint max_size = page_get_max_insert_size_after_reorganize(page, 1);
if (max_size < rec_size) {
goto fail;
}
const ulint n_recs = page_get_n_recs(page);
if (UNIV_UNLIKELY(n_recs >= 8189)) {
ut_ad(srv_page_size == 65536);
goto fail;
}
if (page_has_garbage(page)) {
if ((max_size < rec_size
|| max_size < BTR_CUR_PAGE_REORGANIZE_LIMIT)
&& page_get_n_recs(page) > 1
if (max_size < BTR_CUR_PAGE_REORGANIZE_LIMIT
&& n_recs > 1
&& page_get_max_insert_size(page, 1) < rec_size) {
goto fail;
}
} else if (max_size < rec_size) {
goto fail;
}
/* If there have been many consecutive inserts to the

View File

@@ -1462,28 +1462,31 @@ inline fil_space_t *fil_system_t::keyrotate_next(fil_space_t *space,
ut_ad(mutex_own(&mutex));
sized_ilist<fil_space_t, rotation_list_tag_t>::iterator it=
space ? space : rotation_list.begin();
space && space->is_in_rotation_list ? space : rotation_list.begin();
const sized_ilist<fil_space_t, rotation_list_tag_t>::iterator end=
rotation_list.end();
if (space)
{
while (++it != end && (!UT_LIST_GET_LEN(it->chain) || it->is_stopping()));
const bool released= !space->release();
/* If one of the encryption threads already started the encryption
of the table then don't remove the unencrypted spaces from rotation list
If there is a change in innodb_encrypt_tables variables value then
don't remove the last processed tablespace from the rotation list. */
space->release();
if (!space->referenced() &&
(!recheck || space->crypt_data) && !encrypt == !srv_encrypt_tables &&
space->is_in_rotation_list)
if (space->is_in_rotation_list)
{
ut_a(!rotation_list.empty());
rotation_list.remove(*space);
space->is_in_rotation_list= false;
while (++it != end &&
(!UT_LIST_GET_LEN(it->chain) || it->is_stopping()));
/* If one of the encryption threads already started the encryption
of the table then don't remove the unencrypted spaces from rotation list
If there is a change in innodb_encrypt_tables variables value then
don't remove the last processed tablespace from the rotation list. */
if (released && (!recheck || space->crypt_data) &&
!encrypt == !srv_encrypt_tables)
{
ut_a(!rotation_list.empty());
rotation_list.remove(*space);
space->is_in_rotation_list= false;
}
}
}

View File

@@ -253,15 +253,6 @@ fail:
memset(out_buf + tmp, 0, write_size - tmp);
}
#ifdef UNIV_DEBUG
/* Verify that page can be decompressed */
{
page_t tmp_buf[UNIV_PAGE_SIZE_MAX];
page_t page[UNIV_PAGE_SIZE_MAX];
memcpy(page, out_buf, write_size);
ut_ad(fil_page_decompress(tmp_buf, page, flags));
}
#endif
srv_stats.page_compression_saved.add(srv_page_size - write_size);
srv_stats.pages_page_compressed.inc();
@@ -332,23 +323,13 @@ static ulint fil_page_compress_for_non_full_crc32(
mach_write_to_2(out_buf + FIL_PAGE_DATA + FIL_PAGE_COMP_SIZE,
write_size);
#ifdef UNIV_DEBUG
/* Verify */
switch (fil_page_get_type(out_buf)) {
case FIL_PAGE_PAGE_COMPRESSED:
case FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED:
break;
default:
ut_ad("wrong page type" == 0);
break;
}
ut_ad(mach_read_from_4(out_buf + FIL_PAGE_SPACE_OR_CHKSUM)
== BUF_NO_CHECKSUM_MAGIC);
ut_ad(mach_read_from_2(out_buf + FIL_PAGE_DATA + FIL_PAGE_COMP_SIZE)
== write_size);
#ifdef UNIV_DEBUG
bool is_compressed = (mach_read_from_8(out_buf + FIL_PAGE_COMP_ALGO)
== (ulint) comp_algo);
@@ -356,19 +337,10 @@ static ulint fil_page_compress_for_non_full_crc32(
(mach_read_from_2(out_buf + FIL_PAGE_DATA
+ FIL_PAGE_ENCRYPT_COMP_ALGO)
== (ulint) comp_algo);
#endif /* UNIV_DEBUG */
ut_ad(is_compressed || is_encrypted_compressed);
/* Verify that page can be decompressed */
{
page_t tmp_buf[UNIV_PAGE_SIZE_MAX];
page_t page[UNIV_PAGE_SIZE_MAX];
memcpy(page, out_buf, srv_page_size);
ut_ad(fil_page_decompress(tmp_buf, page, flags));
ut_ad(!buf_page_is_corrupted(false, page, flags));
}
#endif /* UNIV_DEBUG */
write_size+=header_len;
if (block_size <= 0) {

View File

@@ -2743,7 +2743,7 @@ fts_query_phrase_search(
/* Ignore empty strings. */
if (num_token > 0) {
fts_string_t* token;
fts_string_t* token = NULL;
fts_fetch_t fetch;
trx_t* trx = query->trx;
fts_ast_oper_t oper = query->oper;

View File

@@ -19930,7 +19930,7 @@ static TYPELIB page_compression_algorithms_typelib=
};
static MYSQL_SYSVAR_ENUM(compression_algorithm, innodb_compression_algorithm,
PLUGIN_VAR_OPCMDARG,
"Compression algorithm used on page compression. One of: none, zlib, lz4, lzo, lzma, or bzip2",
"Compression algorithm used on page compression. One of: none, zlib, lz4, lzo, lzma, bzip2, or snappy",
innodb_compression_algorithm_validate, NULL,
/* We use here the largest number of supported compression method to
enable all those methods that are available. Availability of compression

View File

@@ -4693,7 +4693,11 @@ innobase_pk_order_preserved(
if (old_pk_column) {
new_field_order = lint(old_field);
} else if (innobase_pk_col_is_existing(new_col_no, col_map,
old_n_cols)) {
old_n_cols)
|| new_clust_index->table->persistent_autoinc
== new_field + 1) {
/* Adding an existing column or an AUTO_INCREMENT
column may change the existing ordering. */
new_field_order = lint(old_n_uniq
+ existing_field_count++);
} else {
@@ -6828,12 +6832,6 @@ error_handling_drop_uncached_1:
user_table);
dict_index_t* new_clust_index = dict_table_get_first_index(
ctx->new_table);
ctx->skip_pk_sort = innobase_pk_order_preserved(
ctx->col_map, clust_index, new_clust_index);
DBUG_EXECUTE_IF("innodb_alter_table_pk_assert_no_sort",
DBUG_ASSERT(ctx->skip_pk_sort););
ut_ad(!new_clust_index->is_instant());
/* row_merge_build_index() depends on the correct value */
ut_ad(new_clust_index->n_core_null_bytes
@@ -6857,6 +6855,12 @@ error_handling_drop_uncached_1:
}
}
ctx->skip_pk_sort = innobase_pk_order_preserved(
ctx->col_map, clust_index, new_clust_index);
DBUG_EXECUTE_IF("innodb_alter_table_pk_assert_no_sort",
DBUG_ASSERT(ctx->skip_pk_sort););
if (ctx->online) {
/* Allocate a log for online table rebuild. */
rw_lock_x_lock(&clust_index->lock);

View File

@@ -504,8 +504,9 @@ struct fil_space_t
/** Acquire a tablespace reference. */
void acquire() { n_pending_ops++; }
/** Release a tablespace reference. */
void release() { ut_ad(referenced()); n_pending_ops--; }
/** Release a tablespace reference.
@return whether this was the last reference */
bool release() { auto n= n_pending_ops--; ut_ad(n); return n == 1; }
/** @return whether references are being held */
bool referenced() const { return n_pending_ops; }

View File

@@ -1053,6 +1053,15 @@ static byte* page_mem_alloc_heap(buf_block_t *block, ulint need,
byte *n_heap= my_assume_aligned<2>(PAGE_N_HEAP + PAGE_HEADER + block->frame);
const uint16_t h= mach_read_from_2(n_heap);
if (UNIV_UNLIKELY((h + 1) & 0x6000))
{
/* At the minimum record size of 5+2 bytes, we can only reach this
condition when using innodb_page_size=64k. */
ut_ad((h & 0x7fff) == 8191);
ut_ad(srv_page_size == 65536);
return NULL;
}
*heap_no= h & 0x7fff;
ut_ad(*heap_no < srv_page_size / REC_N_NEW_EXTRA_BYTES);
compile_time_assert(UNIV_PAGE_SIZE_MAX / REC_N_NEW_EXTRA_BYTES < 0x3fff);

View File

@@ -897,7 +897,6 @@ int maria_create(const char *name, enum data_file_type datafile_type,
fn_format(kfilename, name, "", MARIA_NAME_IEXT,
MY_UNPACK_FILENAME | MY_RETURN_REAL_PATH |
(have_iext ? MY_REPLACE_EXT : MY_APPEND_EXT));
klinkname_ptr= NullS;
/*
Replace the current file.
Don't sync dir now if the data file has the same path.

View File

@@ -3618,7 +3618,8 @@ my_bool translog_init_with_table(const char *directory,
int old_log_was_recovered= 0, logs_found= 0;
uint old_flags= flags;
uint32 start_file_num= 1;
TRANSLOG_ADDRESS sure_page, last_page, last_valid_page, checkpoint_lsn;
TRANSLOG_ADDRESS UNINIT_VAR(sure_page), last_page, last_valid_page,
checkpoint_lsn;
my_bool version_changed= 0;
DBUG_ENTER("translog_init_with_table");

View File

@@ -623,7 +623,6 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
fn_format(kfilename, name, "", MI_NAME_IEXT,
MY_UNPACK_FILENAME | MY_RETURN_REAL_PATH |
(have_iext ? MY_REPLACE_EXT : MY_APPEND_EXT));
klinkname_ptr= 0;
/* Replace the current file */
create_flag=(flags & HA_CREATE_KEEP_FILES) ? 0 : MY_DELETE_OLD;
}

View File

@@ -828,7 +828,7 @@ my_strtoll10_mb2(CHARSET_INFO *cs __attribute__((unused)),
const char *nptr, char **endptr, int *error)
{
const uchar *s, *end, *start, *n_end, *true_end;
uchar c;
uchar UNINIT_VAR(c);
unsigned long i, j, k;
ulonglong li;
int negative;