Commit 28f81366 authored by Otto Kekäläinen's avatar Otto Kekäläinen
Browse files

Merge tag 'upstream/5.5.58' into ubuntu-14.04

Upstream version 5.5.58

# gpg: Signature made la 30. joulukuuta 2017 17.55.25 EET
# gpg:                using RSA key BED8449FCEE8DA88
# gpg: Good signature from "Otto Kekäläinen <otto@seravo.fi>" [full]
# gpg:                 aka "Otto Kekäläinen <otto@kekalainen.net>" [full]
# gpg:                 aka "Otto Kekäläinen <otto@fsfe.org>" [full]
# gpg:                 aka "Otto Kekäläinen <otto@linux.com>" [full]
# gpg:                 aka "Otto Kekäläinen <otto.kekalainen@seravo.fi>" [full]
# gpg:                 aka "Otto Kekäläinen <otto@mariadb.org>" [undefined]
# gpg:                 aka "Otto Kekäläinen <otto@debian.org>" [undefined]
# gpg:                 aka "Otto Kekäläinen <otto@sange.fi>" [full]
parents d84cded3 fa5f29ea
......@@ -159,7 +159,7 @@ parse_arguments()
# Try to find a specific file within --basedir which can either be a binary
# release or installed source directory and return the path.
find_in_basedir()
find_in_dirs()
{
case "$1" in
--dir)
......@@ -171,13 +171,13 @@ find_in_basedir()
for dir in "$@"
do
if test -f "$basedir/$dir/$file"
if test -f "$dir/$file"
then
if test -n "$return_dir"
then
echo "$basedir/$dir"
echo "$dir"
else
echo "$basedir/$dir/$file"
echo "$dir/$file"
fi
break
fi
......@@ -239,7 +239,7 @@ then
print_defaults="$builddir/extra/my_print_defaults"
elif test -n "$basedir"
then
print_defaults=`find_in_basedir my_print_defaults bin extra`
print_defaults=`find_in_dirs my_print_defaults $basedir/bin $basedir/extra`
if test -z "$print_defaults"
then
cannot_find_file my_print_defaults $basedir/bin $basedir/extra
......@@ -265,41 +265,43 @@ if test -n "$srcdir"
then
basedir="$builddir"
bindir="$basedir/client"
extra_bindir="$basedir/extra"
resolveip="$basedir/extra/resolveip"
mysqld="$basedir/sql/mysqld"
langdir="$basedir/sql/share/english"
pkgdatadir="$srcdir/scripts"
scriptdir="$srcdir/scripts"
elif test -n "$basedir"
then
bindir="$basedir/bin"
extra_bindir="$bindir"
mysqld=`find_in_basedir mysqld libexec sbin bin`
bindir="$basedir/bin" # only used in the help text
resolveip=`find_in_dirs resolveip @resolveip_locations@`
if test -z "$resolveip"
then
cannot_find_file resolveip @resolveip_locations@
exit 1
fi
mysqld=`find_in_dirs mysqld @mysqld_locations@`
if test -z "$mysqld"
then
cannot_find_file mysqld $basedir/libexec $basedir/sbin $basedir/bin
cannot_find_file mysqld @mysqld_locations@
exit 1
fi
langdir=`find_in_basedir --dir errmsg.sys share/english share/mysql/english`
langdir=`find_in_dirs --dir errmsg.sys @errmsg_locations@`
if test -z "$langdir"
then
cannot_find_file errmsg.sys $basedir/share/english $basedir/share/mysql/english
cannot_find_file errmsg.sys @errmsg_locations@
exit 1
fi
pkgdatadir=`find_in_basedir --dir fill_help_tables.sql share share/mysql`
pkgdatadir=`find_in_dirs --dir fill_help_tables.sql @pkgdata_locations@`
if test -z "$pkgdatadir"
then
cannot_find_file fill_help_tables.sql $basedir/share $basedir/share/mysql
cannot_find_file fill_help_tables.sql @pkgdata_locations@
exit 1
fi
scriptdir="$basedir/scripts"
else
basedir="@prefix@"
bindir="@bindir@"
extra_bindir="$bindir"
resolveip="$bindir/resolveip"
mysqld="@libexecdir@/mysqld"
pkgdatadir="@pkgdatadir@"
scriptdir="@scriptdir@"
fi
# Set up paths to SQL scripts required for bootstrap
......@@ -342,14 +344,14 @@ hostname=`@HOSTNAME@`
# Check if hostname is valid
if test "$cross_bootstrap" -eq 0 -a "$in_rpm" -eq 0 -a "$force" -eq 0
then
resolved=`"$extra_bindir/resolveip" $hostname 2>&1`
resolved=`"$resolveip" $hostname 2>&1`
if test $? -ne 0
then
resolved=`"$extra_bindir/resolveip" localhost 2>&1`
resolved=`"$resolveip" localhost 2>&1`
if test $? -ne 0
then
echo "Neither host '$hostname' nor 'localhost' could be looked up with"
echo "'$extra_bindir/resolveip'"
echo "'$resolveip'"
echo "Please configure the 'hostname' command to return a correct"
echo "hostname."
echo "If you want to solve this at a later stage, restart this script"
......@@ -357,7 +359,7 @@ then
link_to_help
exit 1
fi
echo "WARNING: The host '$hostname' could not be looked up with resolveip."
echo "WARNING: The host '$hostname' could not be looked up with $resolveip."
echo "This probably means that your libc libraries are not 100 % compatible"
echo "with this binary MariaDB version. The MariaDB daemon, mysqld, should work"
echo "normally with the exception that host name resolving will not work."
......@@ -436,7 +438,7 @@ else
echo "The problem could be conflicting information in an external"
echo "my.cnf files. You can ignore these by doing:"
echo
echo " shell> $scriptdir/scripts/mysql_install_db --defaults-file=~/.my.cnf"
echo " shell> $0 --defaults-file=~/.my.cnf"
echo
echo "You can also try to start the mysqld daemon with:"
echo
......
......@@ -1276,6 +1276,7 @@ void mysql_read_default_options(struct st_mysql_options *options,
break;
case OPT_pipe:
options->protocol = MYSQL_PROTOCOL_PIPE;
break;
case OPT_connect_timeout:
case OPT_timeout:
if (opt_arg)
......
......@@ -185,8 +185,8 @@ Events::reconstruct_interval_expression(String *buf, interval_type interval,
expr= tmp_expr - (tmp_expr/60)*60;
/* the code after the switch will finish */
}
break;
}
case INTERVAL_HOUR_SECOND:
{
ulonglong tmp_expr= expr;
......@@ -202,8 +202,8 @@ Events::reconstruct_interval_expression(String *buf, interval_type interval,
expr= tmp_expr - (tmp_expr/60)*60;
/* the code after the switch will finish */
}
break;
}
case INTERVAL_DAY_SECOND:
{
ulonglong tmp_expr= expr;
......@@ -225,8 +225,8 @@ Events::reconstruct_interval_expression(String *buf, interval_type interval,
expr= tmp_expr - (tmp_expr/60)*60;
/* the code after the switch will finish */
}
break;
}
case INTERVAL_DAY_MICROSECOND:
case INTERVAL_HOUR_MICROSECOND:
case INTERVAL_MINUTE_MICROSECOND:
......@@ -240,6 +240,8 @@ Events::reconstruct_interval_expression(String *buf, interval_type interval,
break;
case INTERVAL_WEEK:
expr/= 7;
close_quote= FALSE;
break;
default:
close_quote= FALSE;
break;
......
/*
Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2008, 2013, Monty Program Ab
Copyright (c) 2000, 2017, Oracle and/or its affiliates.
Copyright (c) 2008, 2017, MariaDB
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
......@@ -7947,13 +7947,13 @@ String *Field_set::val_str(String *val_buffer,
ulonglong tmp=(ulonglong) Field_enum::val_int();
uint bitnr=0;
/*
Some callers expect *val_buffer to contain the result,
so we assign to it, rather than doing 'return &empty_set_string.
*/
*val_buffer= empty_set_string;
if (tmp == 0)
{
/*
Some callers expect *val_buffer to contain the result,
so we assign to it, rather than doing 'return &empty_set_string.
*/
*val_buffer= empty_set_string;
return val_buffer;
}
......@@ -9218,7 +9218,7 @@ bool Create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
case MYSQL_TYPE_DATE:
/* We don't support creation of MYSQL_TYPE_DATE anymore */
sql_type= MYSQL_TYPE_NEWDATE;
/* fall trough */
/* fall through */
case MYSQL_TYPE_NEWDATE:
length= MAX_DATE_WIDTH;
break;
......
/*
Copyright (c) 2005, 2013, Oracle and/or its affiliates.
Copyright (c) 2005, 2017, Oracle and/or its affiliates.
Copyright (c) 2009, 2017, MariaDB
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
......@@ -1747,7 +1748,7 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
cleanup_new_partition(part_count);
DBUG_RETURN(error);
}
DBUG_PRINT("info", ("Add partition %s", part_name_buff));
if ((error= prepare_new_partition(table, create_info,
new_file_array[i],
......@@ -7331,6 +7332,7 @@ void ha_partition::print_error(int error, myf errflag)
m_err_rec= NULL;
DBUG_VOID_RETURN;
}
/* fall through */
default:
{
if (!(thd->lex->alter_info.flags & ALTER_TRUNCATE_PARTITION))
......
......@@ -6004,7 +6004,7 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table, bool fixed_length)
collation.collation);
break;
}
/* Fall through to make_string_field() */
/* fall through */
case MYSQL_TYPE_ENUM:
case MYSQL_TYPE_SET:
case MYSQL_TYPE_VAR_STRING:
......@@ -6726,6 +6726,7 @@ bool Item::cache_const_expr_analyzer(uchar **arg)
*/
if (const_item() &&
!(basic_const_item() || item->basic_const_item() ||
item->type() == Item::NULL_ITEM || /* Item_name_const hack */
item->type() == Item::FIELD_ITEM ||
item->type() == SUBSELECT_ITEM ||
/*
......@@ -6876,7 +6877,11 @@ class Dependency_marker: public Field_enumerator
// Find which select the field is in. This is achieved by walking up
// the select tree and looking for the table of interest.
st_select_lex *sel;
for (sel= current_select; sel; sel= sel->outer_select())
for (sel= current_select;
sel ;
sel= (sel->context.outer_context ?
sel->context.outer_context->select_lex:
NULL))
{
List_iterator<TABLE_LIST> li(sel->leaf_tables);
TABLE_LIST *tbl;
......@@ -8071,7 +8076,6 @@ bool Item_direct_view_ref::send(Protocol *protocol, String *buffer)
bool Item_direct_view_ref::fix_fields(THD *thd, Item **reference)
{
DBUG_ASSERT(1);
/* view fild reference must be defined */
DBUG_ASSERT(*ref);
/* (*ref)->check_cols() will be made in Item_direct_ref::fix_fields */
......@@ -9955,7 +9959,7 @@ void Item_direct_view_ref::update_used_tables()
table_map Item_direct_view_ref::used_tables() const
{
DBUG_ASSERT(null_ref_table);
DBUG_ASSERT(fixed);
if (get_depended_from())
return OUTER_REF_TABLE_BIT;
......
#ifndef SQL_ITEM_INCLUDED
#define SQL_ITEM_INCLUDED
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2009, 2016, MariaDB
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
Copyright (c) 2009, 2017, MariaDB
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
......
......@@ -863,6 +863,7 @@ void Item_func_num1::fix_length_and_dec()
break;
case TIME_RESULT:
cached_result_type= DECIMAL_RESULT;
/* fall through */
case DECIMAL_RESULT:
decimals= args[0]->decimal_scale(); // Do not preserve NOT_FIXED_DEC
max_length= args[0]->max_length;
......@@ -2038,6 +2039,7 @@ my_decimal *Item_func_mod::decimal_op(my_decimal *decimal_value)
return decimal_value;
case E_DEC_DIV_ZERO:
signal_divide_by_null();
/* fall through */
default:
null_value= 1;
return 0;
......
......@@ -44,7 +44,14 @@ Item_row::Item_row(List<Item> &arg):
//TODO: think placing 2-3 component items in item (as it done for function)
if ((arg_count= arg.elements))
{
items= (Item**) sql_alloc(sizeof(Item*)*arg_count);
if (!items)
{
arg_count= 0;
return;
}
}
else
items= 0;
List_iterator<Item> li(arg);
......@@ -53,7 +60,28 @@ Item_row::Item_row(List<Item> &arg):
while ((item= li++))
{
items[i]= item;
i++;
i++;
}
}
Item_row::Item_row(Item *item):
Item(),
used_tables_cache(0),
not_null_tables_cache(0),
arg_count(item->cols()),
const_item_cache(1),
with_null(0)
{
items= (Item**) sql_alloc(sizeof(Item*) * arg_count);
if (!items)
{
arg_count= 0;
return;
}
for (uint i= 0; i < arg_count; i++)
{
items[i]= item->element_index(i);
}
}
......
......@@ -35,6 +35,7 @@ class Item_row: public Item
const_item_cache(item->const_item_cache),
with_null(0)
{}
Item_row(Item *item);
enum Type type() const { return ROW_ITEM; };
void illegal_method_call(const char *);
......
......@@ -4430,7 +4430,7 @@ bool Item_dyncol_get::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
goto null;
case DYN_COL_INT:
signed_value= 1; // For error message
/* fall_trough */
/* fall through */
case DYN_COL_UINT:
if (signed_value || val.x.ulong_value <= LONGLONG_MAX)
{
......@@ -4443,7 +4443,7 @@ bool Item_dyncol_get::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
}
/* let double_to_datetime_with_warn() issue the warning message */
val.x.double_value= static_cast<double>(ULONGLONG_MAX);
/* fall_trough */
/* fall through */
case DYN_COL_DOUBLE:
if (double_to_datetime_with_warn(val.x.double_value, ltime, fuzzy_date,
0 /* TODO */))
......
......@@ -1374,6 +1374,9 @@ Item_in_subselect::Item_in_subselect(Item * left_exp,
{
DBUG_ENTER("Item_in_subselect::Item_in_subselect");
left_expr_orig= left_expr= left_exp;
/* prepare to possible disassembling the item in convert_subq_to_sj() */
if (left_exp->type() == Item::ROW_ITEM)
left_expr_orig= new Item_row(left_exp);
func= &eq_creator;
init(select_lex, new select_exists_subselect(this));
max_columns= UINT_MAX;
......@@ -1398,6 +1401,9 @@ Item_allany_subselect::Item_allany_subselect(Item * left_exp,
{
DBUG_ENTER("Item_allany_subselect::Item_allany_subselect");
left_expr_orig= left_expr= left_exp;
/* prepare to possible disassembling the item in convert_subq_to_sj() */
if (left_exp->type() == Item::ROW_ITEM)
left_expr_orig= new Item_row(left_exp);
func= func_creator(all_arg);
init(select_lex, new select_exists_subselect(this));
max_columns= 1;
......
......@@ -1733,9 +1733,18 @@ bool Item_func_sec_to_time::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
ltime->hour= TIME_MAX_HOUR+1;
check_time_range(ltime, decimals, &unused);
make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
err->ptr(), err->length(),
MYSQL_TIMESTAMP_TIME, NullS);
if (!err)
{
ErrConvInteger err2(sec, unsigned_flag);
make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
&err2, MYSQL_TIMESTAMP_TIME, NullS);
}
else
{
ErrConvString err2(err);
make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
&err2, MYSQL_TIMESTAMP_TIME, NullS);
}
return 0;
}
......
......@@ -500,8 +500,16 @@ class Item_temporal_func: public Item_func
{ return val_decimal_from_date(decimal_value); }
Field *tmp_table_field(TABLE *table)
{ return tmp_table_field_from_field_type(table, 0); }
#if MARIADB_VERSION_ID > 100300
#error This code should be removed in 10.3, to use the derived save_in_field()
#else
int save_in_field(Field *field, bool no_conversions)
{ return save_date_in_field(field); }
{
return field_type() == MYSQL_TYPE_TIME ?
save_time_in_field(field) :
save_date_in_field(field);
}
#endif
void fix_length_and_dec();
};
......
......@@ -7261,8 +7261,10 @@ void TC_LOG_MMAP::close()
mysql_cond_destroy(&COND_pool);
mysql_cond_destroy(&COND_active);
mysql_cond_destroy(&COND_queue_busy);
/* fall through */
case 5:
data[0]='A'; // garble the first (signature) byte, in case mysql_file_delete fails
/* fall through */
case 4:
for (i=0; i < npages; i++)
{
......@@ -7271,10 +7273,13 @@ void TC_LOG_MMAP::close()
mysql_mutex_destroy(&pages[i].lock);
mysql_cond_destroy(&pages[i].cond);
}
/* fall through */
case 3:
my_free(pages);
/* fall through */
case 2:
my_munmap((char*)data, (size_t)file_length);
/* fall through */
case 1:
mysql_file_close(fd, MYF(0));
}
......
......@@ -6437,21 +6437,6 @@ User_var_log_event(const char* buf, uint event_len,
we keep the flags set to UNDEF_F.
*/
uint bytes_read= ((val + val_len) - start);
#ifndef DBUG_OFF
bool old_pre_checksum_fd= description_event->is_version_before_checksum(
&description_event->server_version_split);
#endif
DBUG_ASSERT((bytes_read == data_written -
(old_pre_checksum_fd ||
(description_event->checksum_alg ==
BINLOG_CHECKSUM_ALG_OFF)) ?
0 : BINLOG_CHECKSUM_LEN)
||
(bytes_read == data_written -1 -
(old_pre_checksum_fd ||
(description_event->checksum_alg ==
BINLOG_CHECKSUM_ALG_OFF)) ?
0 : BINLOG_CHECKSUM_LEN));
if ((data_written - bytes_read) > 0)
{
flags= (uint) *(buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE +
......
......@@ -1609,6 +1609,7 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred)
sj-nest.
*/
st_select_lex *subq_lex= subq_pred->unit->first_select();
DBUG_ASSERT(subq_lex->next_select() == NULL);
nested_join->join_list.empty();
List_iterator_fast<TABLE_LIST> li(subq_lex->top_join_list);
TABLE_LIST *tl;
......@@ -1706,7 +1707,8 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred)
if (subq_pred->left_expr->cols() == 1)
{
nested_join->sj_outer_expr_list.push_back(subq_pred->left_expr);
/* add left = select_list_element */
nested_join->sj_outer_expr_list.push_back(&subq_pred->left_expr);
/*
Create Item_func_eq. Note that
1. this is done on the statement, not execution, arena
......@@ -1718,24 +1720,61 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred)
*/
Item_func_eq *item_eq=
new Item_func_eq(subq_pred->left_expr_orig, subq_lex->ref_pointer_array[0]);
if (!item_eq)
DBUG_RETURN(TRUE);
if (subq_pred->left_expr_orig != subq_pred->left_expr)
thd->change_item_tree(item_eq->arguments(), subq_pred->left_expr);
item_eq->in_equality_no= 0;
sj_nest->sj_on_expr= and_items(sj_nest->sj_on_expr, item_eq);
}
else
else if (subq_pred->left_expr->type() == Item::ROW_ITEM)
{
/*
disassemple left expression and add
left1 = select_list_element1 and left2 = select_list_element2 ...
*/
for (uint i= 0; i < subq_pred->left_expr->cols(); i++)
{
nested_join->sj_outer_expr_list.push_back(subq_pred->left_expr->
element_index(i));
Item_func_eq *item_eq=
new Item_func_eq(subq_pred->left_expr->element_index(i),
addr(i));
Item_func_eq *item_eq=
new Item_func_eq(subq_pred->left_expr_orig->element_index(i),
subq_lex->ref_pointer_array[i]);
if (!item_eq)
DBUG_RETURN(TRUE);
DBUG_ASSERT(subq_pred->left_expr->element_index(i)->fixed);
if (subq_pred->left_expr_orig->element_index(i) !=
subq_pred->left_expr->element_index(i))
thd->change_item_tree(item_eq->arguments(),
subq_pred->left_expr->element_index(i));
item_eq->in_equality_no= i;
sj_nest->sj_on_expr= and_items(sj_nest->sj_on_expr, item_eq);
}
}
else
{
/*
add row operation
left = (select_list_element1, select_list_element2, ...)
*/
Item_row *row= new Item_row(subq_lex->pre_fix);
/* fix fields on subquery was call so they should be the same */
DBUG_ASSERT(subq_pred->left_expr->cols() == row->cols());
if (!row)
DBUG_RETURN(TRUE);
nested_join->sj_outer_expr_list.push_back(&subq_pred->left_expr);
Item_func_eq *item_eq=
new Item_func_eq(subq_pred->left_expr_orig, row);
if (!item_eq)
DBUG_RETURN(TRUE);
for (uint i= 0; i < row->cols(); i++)
{
if (row->element_index(i) != subq_lex->ref_pointer_array[i])
thd->change_item_tree(row->addr(i), subq_lex->ref_pointer_array[i]);
}
item_eq->in_equality_no= 0;
sj_nest->sj_on_expr= and_items(sj_nest->sj_on_expr, item_eq);
}
/*
Fix the created equality and AND
......@@ -3285,8 +3324,8 @@ void restore_prev_sj_state(const table_map remaining_tables,
ulonglong get_bound_sj_equalities(TABLE_LIST *sj_nest,
table_map remaining_tables)
{
List_iterator<Item> li(sj_nest->nested_join->sj_outer_expr_list);
Item *item;
List_iterator<Item_ptr> li(sj_nest->nested_join->sj_outer_expr_list);
Item **item;
uint i= 0;
ulonglong res= 0;
while ((item= li++))
......@@ -3297,7 +3336,7 @@ ulonglong get_bound_sj_equalities(TABLE_LIST *sj_nest,
class and see if there is an element that is bound?
(this is an optional feature)
*/
if (!(item->used_tables() & remaining_tables))
if (!(item[0]->used_tables() & remaining_tables))
{
res |= 1ULL << i;
}
......
......@@ -1047,6 +1047,7 @@ static int maxmin_in_range(bool max_fl, Field* field, COND *cond)
case Item_func::LT_FUNC:
case Item_func::LE_FUNC:
less_fl= 1;
/* fall through */
case Item_func::GT_FUNC:
case Item_func::GE_FUNC:
{
......
......@@ -34,8 +34,6 @@
partition_info *partition_info::get_clone()
{
if (!this)
return 0;
List_iterator<partition_element> part_it(partitions);
partition_element *part;
partition_info *clone= new partition_info();
......
......@@ -2341,7 +2341,6 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
thd->enable_slow_log= opt_log_slow_slave_statements;
thd->variables.log_slow_filter= global_system_variables.log_slow_filter;
set_slave_thread_options(thd);
thd->client_capabilities = CLIENT_LOCAL_FILES;
mysql_mutex_lock(&LOCK_thread_count);
thd->thread_id= thd->variables.pseudo_thread_id= thread_id++;
mysql_mutex_unlock(&LOCK_thread_count);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment