Commit 95c6357a authored by Otto Kekäläinen's avatar Otto Kekäläinen
Browse files

Imported Upstream version 5.5.50

parent d97fe3f6
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
Copyright (c) 2011, 2016, MariaDB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
......
...@@ -169,7 +169,9 @@ static int do_test() ...@@ -169,7 +169,9 @@ static int do_test()
for (j=0 ; j < 1000 ; j++) for (j=0 ; j < 1000 ; j++)
if (key1[j] > 1) if (key1[j] > 1)
break; break;
if (key1[j] > 1) // j will be 1000 only if we have no keys in the hash. This only happens
// when the parameter recant is set to 0 via command line argument.
if (j < 1000 && key1[j] > 1)
{ {
HASH_SEARCH_STATE state; HASH_SEARCH_STATE state;
printf("- Testing identical read\n"); printf("- Testing identical read\n");
......
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
Copyright (c) 2010, 2016, MariaDB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
......
...@@ -163,6 +163,10 @@ char *argv[]; ...@@ -163,6 +163,10 @@ char *argv[];
} }
else if (argc > 3) else if (argc > 3)
for (n = atoi(argv[3]); n > 0; n--) { for (n = atoi(argv[3]); n > 0; n--) {
if(sizeof(buf)-1 < strlen(argv[1]))
{
exit(EXIT_FAILURE);
}
(void) strcpy(buf, argv[1]); (void) strcpy(buf, argv[1]);
(void) split(buf, fields, MNF, argv[2]); (void) split(buf, fields, MNF, argv[2]);
} }
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
# MA 02110-1301, USA # MA 02110-1301, USA
# Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public # modify it under the terms of the GNU Library General Public
...@@ -621,7 +621,11 @@ sub my_which ...@@ -621,7 +621,11 @@ sub my_which
my ($command) = @_; my ($command) = @_;
my (@paths, $path); my (@paths, $path);
return $command if (-f $command && -x $command); # If the argument is not 'my_print_defaults' then it would be of the format
# <absolute_path>/<program>
return $command if ($command ne 'my_print_defaults' && -f $command &&
-x $command);
@paths = split(':', $ENV{'PATH'}); @paths = split(':', $ENV{'PATH'});
foreach $path (@paths) foreach $path (@paths)
{ {
......
...@@ -1197,6 +1197,20 @@ static int add_init_command(struct st_mysql_options *options, const char *cmd) ...@@ -1197,6 +1197,20 @@ static int add_init_command(struct st_mysql_options *options, const char *cmd)
my_free((OPTS)->extension->X); \ my_free((OPTS)->extension->X); \
EXTENSION_SET(OPTS, X, my_strdup((STR), MYF(MY_WME))); EXTENSION_SET(OPTS, X, my_strdup((STR), MYF(MY_WME)));
#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
static char *set_ssl_option_unpack_path(const char *arg)
{
char *opt_var= NULL;
if (arg)
{
char buff[FN_REFLEN + 1];
unpack_filename(buff, (char *)arg);
opt_var= my_strdup(buff, MYF(MY_WME));
}
return opt_var;
}
#endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY */
void mysql_read_default_options(struct st_mysql_options *options, void mysql_read_default_options(struct st_mysql_options *options,
const char *filename,const char *group) const char *filename,const char *group)
{ {
...@@ -1796,10 +1810,10 @@ mysql_ssl_set(MYSQL *mysql __attribute__((unused)) , ...@@ -1796,10 +1810,10 @@ mysql_ssl_set(MYSQL *mysql __attribute__((unused)) ,
my_free(mysql->options.ssl_ca); my_free(mysql->options.ssl_ca);
my_free(mysql->options.ssl_capath); my_free(mysql->options.ssl_capath);
my_free(mysql->options.ssl_cipher); my_free(mysql->options.ssl_cipher);
mysql->options.ssl_key= strdup_if_not_null(key); mysql->options.ssl_key= set_ssl_option_unpack_path(key);
mysql->options.ssl_cert= strdup_if_not_null(cert); mysql->options.ssl_cert= set_ssl_option_unpack_path(cert);
mysql->options.ssl_ca= strdup_if_not_null(ca); mysql->options.ssl_ca= set_ssl_option_unpack_path(ca);
mysql->options.ssl_capath= strdup_if_not_null(capath); mysql->options.ssl_capath= set_ssl_option_unpack_path(capath);
mysql->options.ssl_cipher= strdup_if_not_null(cipher); mysql->options.ssl_cipher= strdup_if_not_null(cipher);
mysql->options.use_ssl= TRUE; mysql->options.use_ssl= TRUE;
#endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY */ #endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY */
......
...@@ -1701,6 +1701,7 @@ Field_str::Field_str(uchar *ptr_arg,uint32 len_arg, uchar *null_ptr_arg, ...@@ -1701,6 +1701,7 @@ Field_str::Field_str(uchar *ptr_arg,uint32 len_arg, uchar *null_ptr_arg,
if (charset_arg->state & MY_CS_BINSORT) if (charset_arg->state & MY_CS_BINSORT)
flags|=BINARY_FLAG; flags|=BINARY_FLAG;
field_derivation= DERIVATION_IMPLICIT; field_derivation= DERIVATION_IMPLICIT;
field_repertoire= my_charset_repertoire(charset_arg);
} }
......
...@@ -580,11 +580,12 @@ class Field ...@@ -580,11 +580,12 @@ class Field
{ return binary() ? &my_charset_bin : charset(); } { return binary() ? &my_charset_bin : charset(); }
virtual CHARSET_INFO *sort_charset(void) const { return charset(); } virtual CHARSET_INFO *sort_charset(void) const { return charset(); }
virtual bool has_charset(void) const { return FALSE; } virtual bool has_charset(void) const { return FALSE; }
virtual void set_charset(CHARSET_INFO *charset_arg) { }
virtual enum Derivation derivation(void) const virtual enum Derivation derivation(void) const
{ return DERIVATION_IMPLICIT; } { return DERIVATION_IMPLICIT; }
virtual uint repertoire(void) const { return MY_REPERTOIRE_UNICODE30; } virtual uint repertoire(void) const { return MY_REPERTOIRE_UNICODE30; }
virtual void set_derivation(enum Derivation derivation_arg) { } virtual void set_derivation(enum Derivation derivation_arg,
uint repertoire_arg)
{ }
virtual int set_time() { return 1; } virtual int set_time() { return 1; }
void set_warning(MYSQL_ERROR::enum_warning_level, unsigned int code, void set_warning(MYSQL_ERROR::enum_warning_level, unsigned int code,
int cuted_increment); int cuted_increment);
...@@ -775,8 +776,10 @@ class Field_num :public Field { ...@@ -775,8 +776,10 @@ class Field_num :public Field {
class Field_str :public Field { class Field_str :public Field {
protected: protected:
// TODO-10.2: Reuse DTCollation instead of these three members
CHARSET_INFO *field_charset; CHARSET_INFO *field_charset;
enum Derivation field_derivation; enum Derivation field_derivation;
uint field_repertoire;
public: public:
Field_str(uchar *ptr_arg,uint32 len_arg, uchar *null_ptr_arg, Field_str(uchar *ptr_arg,uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg, utype unireg_check_arg, uchar null_bit_arg, utype unireg_check_arg,
...@@ -799,15 +802,15 @@ class Field_str :public Field { ...@@ -799,15 +802,15 @@ class Field_str :public Field {
int store_decimal(const my_decimal *); int store_decimal(const my_decimal *);
int store(const char *to,uint length,CHARSET_INFO *cs)=0; int store(const char *to,uint length,CHARSET_INFO *cs)=0;
uint size_of() const { return sizeof(*this); } uint size_of() const { return sizeof(*this); }
uint repertoire(void) const uint repertoire(void) const { return field_repertoire; }
{
return my_charset_repertoire(field_charset);
}
CHARSET_INFO *charset(void) const { return field_charset; } CHARSET_INFO *charset(void) const { return field_charset; }
void set_charset(CHARSET_INFO *charset_arg) { field_charset= charset_arg; }
enum Derivation derivation(void) const { return field_derivation; } enum Derivation derivation(void) const { return field_derivation; }
virtual void set_derivation(enum Derivation derivation_arg) void set_derivation(enum Derivation derivation_arg,
{ field_derivation= derivation_arg; } uint repertoire_arg)
{
field_derivation= derivation_arg;
field_repertoire= repertoire_arg;
}
bool binary() const { return field_charset == &my_charset_bin; } bool binary() const { return field_charset == &my_charset_bin; }
uint32 max_display_length() { return field_length; } uint32 max_display_length() { return field_length; }
friend class Create_field; friend class Create_field;
...@@ -1851,10 +1854,9 @@ class Field_blob :public Field_longstr { ...@@ -1851,10 +1854,9 @@ class Field_blob :public Field_longstr {
packlength= 4; packlength= 4;
if (set_packlength) if (set_packlength)
{ {
uint32 l_char_length= len_arg/cs->mbmaxlen; packlength= len_arg <= 255 ? 1 :
packlength= l_char_length <= 255 ? 1 : len_arg <= 65535 ? 2 :
l_char_length <= 65535 ? 2 : len_arg <= 16777215 ? 3 : 4;
l_char_length <= 16777215 ? 3 : 4;
} }
} }
Field_blob(uint32 packlength_arg) Field_blob(uint32 packlength_arg)
......
...@@ -310,6 +310,7 @@ void print_find_structs() ...@@ -310,6 +310,7 @@ void print_find_structs()
add_structs_to_map(root_by_len,max_len); add_structs_to_map(root_by_len,max_len);
set_links(root_by_len,max_len); set_links(root_by_len,max_len);
print_hash_map("sql_functions_map"); print_hash_map("sql_functions_map");
free(hash_map);
hash_map= 0; hash_map= 0;
size_hash_map= 0; size_hash_map= 0;
...@@ -319,6 +320,7 @@ void print_find_structs() ...@@ -319,6 +320,7 @@ void print_find_structs()
add_structs_to_map(root_by_len2,max_len2); add_structs_to_map(root_by_len2,max_len2);
set_links(root_by_len2,max_len2); set_links(root_by_len2,max_len2);
print_hash_map("symbols_map"); print_hash_map("symbols_map");
free(hash_map);
} }
......
...@@ -244,9 +244,6 @@ bool Item::val_bool() ...@@ -244,9 +244,6 @@ bool Item::val_bool()
*/ */
String *Item::val_str_ascii(String *str) String *Item::val_str_ascii(String *str)
{ {
if (!(collation.collation->state & MY_CS_NONASCII))
return val_str(str);
DBUG_ASSERT(str != &str_value); DBUG_ASSERT(str != &str_value);
uint errors; uint errors;
...@@ -254,11 +251,15 @@ String *Item::val_str_ascii(String *str) ...@@ -254,11 +251,15 @@ String *Item::val_str_ascii(String *str)
if (!res) if (!res)
return 0; return 0;
if ((null_value= str->copy(res->ptr(), res->length(), if (!(res->charset()->state & MY_CS_NONASCII))
collation.collation, &my_charset_latin1, str= res;
&errors))) else
return 0; {
if ((null_value= str->copy(res->ptr(), res->length(), collation.collation,
&my_charset_latin1, &errors)))
return 0;
}
return str; return str;
} }
......
...@@ -160,10 +160,11 @@ static int cmp_row_type(Item* item1, Item* item2) ...@@ -160,10 +160,11 @@ static int cmp_row_type(Item* item1, Item* item2)
static int agg_cmp_type(Item_result *type, Item **items, uint nitems) static int agg_cmp_type(Item_result *type, Item **items, uint nitems)
{ {
uint i; uint unsigned_count= items[0]->unsigned_flag;
type[0]= items[0]->cmp_type(); type[0]= items[0]->cmp_type();
for (i= 1 ; i < nitems ; i++) for (uint i= 1 ; i < nitems ; i++)
{ {
unsigned_count+= items[i]->unsigned_flag;
type[0]= item_cmp_type(type[0], items[i]->cmp_type()); type[0]= item_cmp_type(type[0], items[i]->cmp_type());
/* /*
When aggregating types of two row expressions we have to check When aggregating types of two row expressions we have to check
...@@ -175,6 +176,12 @@ static int agg_cmp_type(Item_result *type, Item **items, uint nitems) ...@@ -175,6 +176,12 @@ static int agg_cmp_type(Item_result *type, Item **items, uint nitems)
if (type[0] == ROW_RESULT && cmp_row_type(items[0], items[i])) if (type[0] == ROW_RESULT && cmp_row_type(items[0], items[i]))
return 1; // error found: invalid usage of rows return 1; // error found: invalid usage of rows
} }
/**
If all arguments are of INT type but have different unsigned_flag values,
switch to DECIMAL_RESULT.
*/
if (type[0] == INT_RESULT && unsigned_count != nitems && unsigned_count != 0)
type[0]= DECIMAL_RESULT;
return 0; return 0;
} }
......
...@@ -2939,12 +2939,13 @@ bool Item_func_min_max::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date) ...@@ -2939,12 +2939,13 @@ bool Item_func_min_max::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
} }
unpack_time(min_max, ltime); unpack_time(min_max, ltime);
if (compare_as_dates->field_type() == MYSQL_TYPE_DATE) enum_field_types ftype= compare_as_dates->field_type();
if (ftype == MYSQL_TYPE_DATE || ftype == MYSQL_TYPE_NEWDATE)
{ {
ltime->time_type= MYSQL_TIMESTAMP_DATE; ltime->time_type= MYSQL_TIMESTAMP_DATE;
ltime->hour= ltime->minute= ltime->second= ltime->second_part= 0; ltime->hour= ltime->minute= ltime->second= ltime->second_part= 0;
} }
else if (compare_as_dates->field_type() == MYSQL_TYPE_TIME) else if (ftype == MYSQL_TYPE_TIME)
{ {
ltime->time_type= MYSQL_TIMESTAMP_TIME; ltime->time_type= MYSQL_TIMESTAMP_TIME;
ltime->hour+= (ltime->month * 32 + ltime->day) * 24; ltime->hour+= (ltime->month * 32 + ltime->day) * 24;
...@@ -6366,6 +6367,8 @@ bool Item_func_match::fix_index() ...@@ -6366,6 +6367,8 @@ bool Item_func_match::fix_index()
for (i=1; i < arg_count; i++) for (i=1; i < arg_count; i++)
{ {
if (args[i]->type() != FIELD_ITEM)
goto err;
item=(Item_field*)args[i]; item=(Item_field*)args[i];
for (keynr=0 ; keynr < fts ; keynr++) for (keynr=0 ; keynr < fts ; keynr++)
{ {
......
/* /* Copyright (c) 2003, 2016, Oracle and/or its affiliates.
Copyright (c) 2003-2007 MySQL AB, 2009, 2010 Sun Microsystems, Inc. Copyright (c) 2011, 2016, MariaDB
Use is subject to license terms.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
......
...@@ -935,9 +935,8 @@ void Item_func_monthname::fix_length_and_dec() ...@@ -935,9 +935,8 @@ void Item_func_monthname::fix_length_and_dec()
{ {
THD* thd= current_thd; THD* thd= current_thd;
CHARSET_INFO *cs= thd->variables.collation_connection; CHARSET_INFO *cs= thd->variables.collation_connection;
uint32 repertoire= my_charset_repertoire(cs);
locale= thd->variables.lc_time_names; locale= thd->variables.lc_time_names;
collation.set(cs, DERIVATION_COERCIBLE, repertoire); collation.set(cs, DERIVATION_COERCIBLE, locale->repertoire());
decimals=0; decimals=0;
max_length= locale->max_month_name_length * collation.collation->mbmaxlen; max_length= locale->max_month_name_length * collation.collation->mbmaxlen;
maybe_null=1; maybe_null=1;
...@@ -1082,9 +1081,8 @@ void Item_func_dayname::fix_length_and_dec() ...@@ -1082,9 +1081,8 @@ void Item_func_dayname::fix_length_and_dec()
{ {
THD* thd= current_thd; THD* thd= current_thd;
CHARSET_INFO *cs= thd->variables.collation_connection; CHARSET_INFO *cs= thd->variables.collation_connection;
uint32 repertoire= my_charset_repertoire(cs);
locale= thd->variables.lc_time_names; locale= thd->variables.lc_time_names;
collation.set(cs, DERIVATION_COERCIBLE, repertoire); collation.set(cs, DERIVATION_COERCIBLE, locale->repertoire());
decimals=0; decimals=0;
max_length= locale->max_day_name_length * collation.collation->mbmaxlen; max_length= locale->max_day_name_length * collation.collation->mbmaxlen;
maybe_null=1; maybe_null=1;
......
...@@ -46,12 +46,9 @@ SYM_GROUP sym_group_rtree= {"RTree keys", "HAVE_RTREE_KEYS"}; ...@@ -46,12 +46,9 @@ SYM_GROUP sym_group_rtree= {"RTree keys", "HAVE_RTREE_KEYS"};
static SYMBOL symbols[] = { static SYMBOL symbols[] = {
{ "&&", SYM(AND_AND_SYM)}, { "&&", SYM(AND_AND_SYM)},
{ "<", SYM(LT)},
{ "<=", SYM(LE)}, { "<=", SYM(LE)},
{ "<>", SYM(NE)}, { "<>", SYM(NE)},
{ "!=", SYM(NE)}, { "!=", SYM(NE)},
{ "=", SYM(EQ)},
{ ">", SYM(GT_SYM)},
{ ">=", SYM(GE)}, { ">=", SYM(GE)},
{ "<<", SYM(SHIFT_LEFT)}, { "<<", SYM(SHIFT_LEFT)},
{ ">>", SYM(SHIFT_RIGHT)}, { ">>", SYM(SHIFT_RIGHT)},
......
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. /* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
Copyright (c) 2009, 2016, MariaDB Copyright (c) 2009, 2016, MariaDB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
......
/* Copyright (c) 2005, 2012, Oracle and/or its affiliates. /* Copyright (c) 2005, 2016, Oracle and/or its affiliates.
Copyright (c) 2009, 2012, Monty Program Ab Copyright (c) 2009, 2016, Monty Program Ab
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
......
/* /*
Copyright (c) 2000, 2015, Oracle and/or its affiliates. Copyright (c) 2000, 2016, Oracle and/or its affiliates.
Copyright (c) 2009, 2016, MariaDB Copyright (c) 2009, 2016, MariaDB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
...@@ -8424,9 +8424,6 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli) ...@@ -8424,9 +8424,6 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli)
/* /*
When the open and locking succeeded, we check all tables to When the open and locking succeeded, we check all tables to
ensure that they still have the correct type. ensure that they still have the correct type.
We can use a down cast here since we know that every table added
to the tables_to_lock is a RPL_TABLE_LIST.
*/ */
{ {
...@@ -8445,10 +8442,37 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli) ...@@ -8445,10 +8442,37 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli)
NOTE: The base tables are added here are removed when NOTE: The base tables are added here are removed when
close_thread_tables is called. close_thread_tables is called.
*/ */
RPL_TABLE_LIST *ptr= rli->tables_to_lock; TABLE_LIST *table_list_ptr= rli->tables_to_lock;
for (uint i= 0 ; ptr && (i < rli->tables_to_lock_count); for (uint i=0 ; table_list_ptr && (i < rli->tables_to_lock_count);
ptr= static_cast<RPL_TABLE_LIST*>(ptr->next_global), i++) table_list_ptr= table_list_ptr->next_global, i++)
{ {
/*
Below if condition takes care of skipping base tables that
make up the MERGE table (which are added by open_tables()
call). They are added next to the merge table in the list.
For eg: If RPL_TABLE_LIST is t3->t1->t2 (where t1 and t2
are base tables for merge table 't3'), open_tables will modify
the list by adding t1 and t2 again immediately after t3 in the
list (*not at the end of the list*). New table_to_lock list will
look like t3->t1'->t2'->t1->t2 (where t1' and t2' are TABLE_LIST
objects added by open_tables() call). There is no flag(or logic) in
open_tables() that can skip adding these base tables to the list.
So the logic here should take care of skipping them.
tables_to_lock_count logic will take care of skipping base tables
that are added at the end of the list.
For eg: If RPL_TABLE_LIST is t1->t2->t3, open_tables will modify
the list into t1->t2->t3->t1'->t2'. t1' and t2' will be skipped
because tables_to_lock_count logic in this for loop.
*/
if (table_list_ptr->parent_l)
continue;
/*
We can use a down cast here since we know that every table added
to the tables_to_lock is a RPL_TABLE_LIST (or child table which is
skipped above).
*/
RPL_TABLE_LIST *ptr= static_cast<RPL_TABLE_LIST*>(table_list_ptr);
DBUG_ASSERT(ptr->m_tabledef_valid); DBUG_ASSERT(ptr->m_tabledef_valid);
TABLE *conv_table; TABLE *conv_table;
if (!ptr->m_tabledef.compatible_with(thd, const_cast<Relay_log_info*>(rli), if (!ptr->m_tabledef.compatible_with(thd, const_cast<Relay_log_info*>(rli),
...@@ -8489,7 +8513,15 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli) ...@@ -8489,7 +8513,15 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli)
*/ */
TABLE_LIST *ptr= rli->tables_to_lock; TABLE_LIST *ptr= rli->tables_to_lock;
for (uint i=0 ; ptr && (i < rli->tables_to_lock_count); ptr= ptr->next_global, i++) for (uint i=0 ; ptr && (i < rli->tables_to_lock_count); ptr= ptr->next_global, i++)
{
/*
Please see comment in above 'for' loop to know the reason
for this if condition
*/
if (ptr->parent_l)
continue;
const_cast<Relay_log_info*>(rli)->m_table_map.set_table(ptr->table_id, ptr->table); const_cast<Relay_log_info*>(rli)->m_table_map.set_table(ptr->table_id, ptr->table);
}
#ifdef HAVE_QUERY_CACHE #ifdef HAVE_QUERY_CACHE
query_cache.invalidate_locked_for_write(thd, rli->tables_to_lock); query_cache.invalidate_locked_for_write(thd, rli->tables_to_lock);
......
/* Copyright (c) 2007, 2013, Oracle and/or its affiliates. /* Copyright (c) 2007, 2016, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -119,16 +119,25 @@ Old_rows_log_event::do_apply_event(Old_rows_log_event *ev, const Relay_log_info ...@@ -119,16 +119,25 @@ Old_rows_log_event::do_apply_event(Old_rows_log_event *ev, const Relay_log_info
/* /*
When the open and locking succeeded, we check all tables to When the open and locking succeeded, we check all tables to
ensure that they still have the correct type. ensure that they still have the correct type.
We can use a down cast here since we know that every table added
to the tables_to_lock is a RPL_TABLE_LIST.
*/ */
{ {
RPL_TABLE_LIST *ptr= rli->tables_to_lock; TABLE_LIST *table_list_ptr= rli->tables_to_lock;
for (uint i= 0 ; ptr&& (i< rli->tables_to_lock_count); for (uint i=0 ; table_list_ptr&& (i< rli->tables_to_lock_count);
ptr= static_cast<RPL_TABLE_LIST*>(ptr->next_global), i++) table_list_ptr= table_list_ptr->next_global, i++)
{ {
/*
Please see comment in log_event.cc-Rows_log_event::do_apply_event()
function for the explanation of the below if condition
*/
if (table_list_ptr->parent_l)
continue;
/*
We can use a down cast here since we know that every table added
to the tables_to_lock is a RPL_TABLE_LIST(or child table which is
skipped above).
*/
RPL_TABLE_LIST *ptr=static_cast<RPL_TABLE_LIST*>(table_list_ptr);
DBUG_ASSERT(ptr->m_tabledef_valid); DBUG_ASSERT(ptr->m_tabledef_valid);
TABLE *conv_table; TABLE *conv_table;
if (!ptr->m_tabledef.compatible_with(thd, const_cast<Relay_log_info*>(rli), if (!ptr->m_tabledef.compatible_with(thd, const_cast<Relay_log_info*>(rli),
...@@ -162,7 +171,15 @@ Old_rows_log_event::do_apply_event(Old_rows_log_event *ev, const Relay_log_info ...@@ -162,7 +171,15 @@ Old_rows_log_event::do_apply_event(Old_rows_log_event *ev, const Relay_log_info
*/ */
TABLE_LIST *ptr= rli->tables_to_lock; TABLE_LIST *ptr= rli->tables_to_lock;
for (uint i=0; ptr && (i < rli->tables_to_lock_count); ptr= ptr->next_global, i++) for (uint i=0; ptr && (i < rli->tables_to_lock_count); ptr= ptr->next_global, i++)
{
/*
Please see comment in log_event.cc-Rows_log_event::do_apply_event()
function for the explanation of the below if condition
*/
if (ptr->parent_l)
continue;
const_cast<Relay_log_info*>(rli)->m_table_map.set_table(ptr->table_id, ptr->table); const_cast<Relay_log_info*>(rli)->m_table_map.set_table(ptr->table_id, ptr->table);
}
#ifdef HAVE_QUERY_CACHE #ifdef HAVE_QUERY_CACHE
query_cache.invalidate_locked_for_write(thd, rli->tables_to_lock); query_cache.invalidate_locked_for_write(thd, rli->tables_to_lock);
#endif #endif
...@@ -1545,16 +1562,25 @@ int Old_rows_log_event::do_apply_event(Relay_log_info const *rli) ...@@ -1545,16 +1562,25 @@ int Old_rows_log_event::do_apply_event(Relay_log_info const *rli)
/* /*
When the open and locking succeeded, we check all tables to When the open and locking succeeded, we check all tables to
ensure that they still have the correct type. ensure that they still have the correct type.
We can use a down cast here since we know that every table added
to the tables_to_lock is a RPL_TABLE_LIST.
*/ */
{ {
RPL_TABLE_LIST *ptr= rli->tables_to_lock; TABLE_LIST *table_list_ptr= rli->tables_to_lock;
for (uint i= 0 ; ptr&& (i< rli->tables_to_lock_count); for (uint i=0; table_list_ptr&& (i< rli->tables_to_lock_count);
ptr= static_cast<RPL_TABLE_LIST*>(ptr->next_global), i++) table_list_ptr= static_cast<RPL_TABLE_LIST*>(table_list_ptr->next_global), i++)
{ {
/*
Please see comment in log_event.cc-Rows_log_event::do_apply_event()
function for the explanation of the below if condition
*/
if (table_list_ptr->parent_l)
continue;
/*
We can use a down cast here since we know that every table added
to the tables_to_lock is a RPL_TABLE_LIST (or child table which is
skipped above).
*/
RPL_TABLE_LIST *ptr=static_cast<RPL_TABLE_LIST*>(table_list_ptr);
TABLE *conv_table; TABLE *conv_table;
if (ptr->m_tabledef.compatible_with(thd, const_cast<Relay_log_info*>(rli), if (ptr->m_tabledef.compatible_with(thd, const_cast<Relay_log_info*>(rli),
ptr->table, &conv_table)) ptr->table, &conv_table))
......
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. /* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
Copyright (c) 2008, 2015, SkySQL Ab. Copyright (c) 2009, 2016, MariaDB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
......
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