Merge branch 'mysql/5.5' into 5.5

This commit is contained in:
Sergei Golubchik 2018-04-19 22:27:02 +02:00
commit 1a019d0801
21 changed files with 190 additions and 34 deletions

View file

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. /* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
Copyright (c) 2010, 2013, Monty Program Ab Copyright (c) 2010, 2018, 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

View file

@ -1,7 +1,7 @@
#ifndef SQL_COMMON_INCLUDED #ifndef SQL_COMMON_INCLUDED
#define SQL_COMMON_INCLUDED #define SQL_COMMON_INCLUDED
/* Copyright (c) 2003, 2012, Oracle and/or its affiliates. /* Copyright (c) 2003, 2012, Oracle and/or its affiliates.
Copyright (c) 2010, 2012, Monty Program Ab Copyright (c) 2010, 2018, 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

View file

@ -2,7 +2,7 @@
# -*- cperl -*- # -*- cperl -*-
# Copyright (c) 2004, 2014, Oracle and/or its affiliates. # Copyright (c) 2004, 2014, Oracle and/or its affiliates.
# Copyright (c) 2009, 2017, MariaDB Corporation # Copyright (c) 2009, 2018, MariaDB Corporation
# #
# 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

View file

@ -1,5 +1,5 @@
/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. /* Copyright (c) 2006, 2018, Oracle and/or its affiliates.
Copyright (c) 2009, 2016, MariaDB Copyright (c) 2009, 2018, 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
@ -86,7 +86,8 @@ retry:
do { /* PTR() isn't necessary below, head is a dummy node */ do { /* PTR() isn't necessary below, head is a dummy node */
cursor->curr= (LF_SLIST *)(*cursor->prev); cursor->curr= (LF_SLIST *)(*cursor->prev);
_lf_pin(pins, 1, cursor->curr); _lf_pin(pins, 1, cursor->curr);
} while (*cursor->prev != (intptr)cursor->curr && LF_BACKOFF); } while (my_atomic_loadptr((void**)cursor->prev) != cursor->curr &&
LF_BACKOFF);
for (;;) for (;;)
{ {
if (unlikely(!cursor->curr)) if (unlikely(!cursor->curr))
@ -100,7 +101,7 @@ retry:
cur_hashnr= cursor->curr->hashnr; cur_hashnr= cursor->curr->hashnr;
cur_key= cursor->curr->key; cur_key= cursor->curr->key;
cur_keylen= cursor->curr->keylen; cur_keylen= cursor->curr->keylen;
if (*cursor->prev != (intptr)cursor->curr) if (my_atomic_loadptr((void**)cursor->prev) != cursor->curr)
{ {
(void)LF_BACKOFF; (void)LF_BACKOFF;
goto retry; goto retry;

View file

@ -1,5 +1,6 @@
/* /*
Copyright (c) 2006, 2011, Oracle and/or its affiliates. Copyright (c) 2006, 2017, Oracle and/or its affiliates.
Copyright (c) 2009, 2018, 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
@ -176,6 +177,8 @@ protected:
error_log_print(ERROR_LEVEL, fmt, args); error_log_print(ERROR_LEVEL, fmt, args);
va_end(args); va_end(args);
} }
public:
Event_db_intact() { has_keys= TRUE; }
}; };
/** In case of an error, a message is printed to the error log. */ /** In case of an error, a message is printed to the error log. */

View file

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2000, 2016, Oracle and/or its affiliates. Copyright (c) 2000, 2018, Oracle and/or its affiliates.
Copyright (c) 2009, 2016, MariaDB Copyright (c) 2009, 2018, 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
@ -3333,6 +3333,25 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
db= (char *)start; db= (char *)start;
query= (char *)(start + db_len + 1); query= (char *)(start + db_len + 1);
q_len= data_len - db_len -1; q_len= data_len - db_len -1;
if (data_len && (data_len < db_len ||
data_len < q_len ||
data_len != (db_len + q_len + 1)))
{
q_len= 0;
query= NULL;
DBUG_VOID_RETURN;
}
unsigned int max_length;
max_length= (event_len - ((const char*)(end + db_len + 1) -
(buf - common_header_len)));
if (q_len != max_length)
{
q_len= 0;
query= NULL;
DBUG_VOID_RETURN;
}
/** /**
Append the db length at the end of the buffer. This will be used by Append the db length at the end of the buffer. This will be used by
Query_cache::send_result_to_client() in case the query cache is On. Query_cache::send_result_to_client() in case the query cache is On.
@ -3613,6 +3632,20 @@ int Query_log_event::do_apply_event(Relay_log_info const *rli,
you. you.
*/ */
thd->catalog= catalog_len ? (char *) catalog : (char *)""; thd->catalog= catalog_len ? (char *) catalog : (char *)"";
int len_error;
size_t valid_len= system_charset_info->cset->well_formed_len(system_charset_info,
db, db + db_len, db_len, &len_error);
if (valid_len != db_len)
{
rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
ER_THD(thd, ER_SLAVE_FATAL_ERROR),
"Invalid database name in Query event.");
thd->is_slave_error= true;
goto end;
}
new_db.length= db_len; new_db.length= db_len;
new_db.str= (char *) rpl_filter->get_rewrite_db(db, &new_db.length); new_db.str= (char *) rpl_filter->get_rewrite_db(db, &new_db.length);
thd->set_db(new_db.str, new_db.length); /* allocates a copy of 'db' */ thd->set_db(new_db.str, new_db.length); /* allocates a copy of 'db' */
@ -3790,6 +3823,22 @@ int Query_log_event::do_apply_event(Relay_log_info const *rli,
else else
thd->variables.collation_database= thd->db_charset; thd->variables.collation_database= thd->db_charset;
{
const CHARSET_INFO *cs= thd->charset();
/*
We cannot ask for parsing a statement using a character set
without state_maps (parser internal data).
*/
if (!cs->state_map)
{
rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
ER_THD(thd, ER_SLAVE_FATAL_ERROR),
"character_set cannot be parsed");
thd->is_slave_error= true;
goto end;
}
}
thd->table_map_for_update= (table_map)table_map_for_update; thd->table_map_for_update= (table_map)table_map_for_update;
thd->set_invoker(&user, &host); thd->set_invoker(&user, &host);
/* /*
@ -4256,7 +4305,13 @@ int Start_log_event_v3::do_apply_event(Relay_log_info const *rli)
*/ */
break; break;
default: default:
/* this case is impossible */ /*
This case is not expected. It can be either an event corruption or an
unsupported binary log version.
*/
rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
ER_THD(thd, ER_SLAVE_FATAL_ERROR),
"Binlog version not supported");
DBUG_RETURN(1); DBUG_RETURN(1);
} }
DBUG_RETURN(error); DBUG_RETURN(error);
@ -5182,6 +5237,9 @@ int Load_log_event::copy_log_event(const char *buf, ulong event_len,
fields = (char*)field_lens + num_fields; fields = (char*)field_lens + num_fields;
table_name = fields + field_block_len; table_name = fields + field_block_len;
if (strlen(table_name) > NAME_LEN)
goto err;
db = table_name + table_name_len + 1; db = table_name + table_name_len + 1;
DBUG_EXECUTE_IF ("simulate_invalid_address", DBUG_EXECUTE_IF ("simulate_invalid_address",
db_len = data_len;); db_len = data_len;);
@ -6378,6 +6436,13 @@ User_var_log_event(const char* buf, uint event_len,
buf+= description_event->common_header_len + buf+= description_event->common_header_len +
description_event->post_header_len[USER_VAR_EVENT-1]; description_event->post_header_len[USER_VAR_EVENT-1];
name_len= uint4korr(buf); name_len= uint4korr(buf);
/* Avoid reading out of buffer */
if ((buf - buf_start) + UV_NAME_LEN_SIZE + name_len > event_len)
{
error= true;
goto err;
}
name= (char *) buf + UV_NAME_LEN_SIZE; name= (char *) buf + UV_NAME_LEN_SIZE;
/* /*
@ -6437,6 +6502,11 @@ User_var_log_event(const char* buf, uint event_len,
we keep the flags set to UNDEF_F. we keep the flags set to UNDEF_F.
*/ */
uint bytes_read= ((val + val_len) - start); uint bytes_read= ((val + val_len) - start);
if (bytes_read > event_len)
{
error= true;
goto err;
}
if ((data_written - bytes_read) > 0) if ((data_written - bytes_read) > 0)
{ {
flags= (uint) *(buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE + flags= (uint) *(buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE +
@ -6651,7 +6721,12 @@ int User_var_log_event::do_apply_event(Relay_log_info const *rli)
} }
if (!(charset= get_charset(charset_number, MYF(MY_WME)))) if (!(charset= get_charset(charset_number, MYF(MY_WME))))
{
rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
ER_THD(thd, ER_SLAVE_FATAL_ERROR),
"Invalid character set for User var event");
DBUG_RETURN(1); DBUG_RETURN(1);
}
LEX_STRING user_var_name; LEX_STRING user_var_name;
user_var_name.str= name; user_var_name.str= name;
user_var_name.length= name_len; user_var_name.length= name_len;
@ -6672,12 +6747,26 @@ int User_var_log_event::do_apply_event(Relay_log_info const *rli)
{ {
switch (type) { switch (type) {
case REAL_RESULT: case REAL_RESULT:
if (val_len != 8)
{
rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
ER_THD(thd, ER_SLAVE_FATAL_ERROR),
"Invalid variable length at User var event");
return 1;
}
float8get(real_val, val); float8get(real_val, val);
it= new Item_float(real_val, 0); it= new Item_float(real_val, 0);
val= (char*) &real_val; // Pointer to value in native format val= (char*) &real_val; // Pointer to value in native format
val_len= 8; val_len= 8;
break; break;
case INT_RESULT: case INT_RESULT:
if (val_len != 8)
{
rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
ER_THD(thd, ER_SLAVE_FATAL_ERROR),
"Invalid variable length at User var event");
return 1;
}
int_val= (longlong) uint8korr(val); int_val= (longlong) uint8korr(val);
it= new Item_int(int_val); it= new Item_int(int_val);
val= (char*) &int_val; // Pointer to value in native format val= (char*) &int_val; // Pointer to value in native format
@ -6685,6 +6774,13 @@ int User_var_log_event::do_apply_event(Relay_log_info const *rli)
break; break;
case DECIMAL_RESULT: case DECIMAL_RESULT:
{ {
if (val_len < 3)
{
rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
ER_THD(thd, ER_SLAVE_FATAL_ERROR),
"Invalid variable length at User var event");
return 1;
}
Item_decimal *dec= new Item_decimal((uchar*) val+2, val[0], val[1]); Item_decimal *dec= new Item_decimal((uchar*) val+2, val[0], val[1]);
it= dec; it= dec;
val= (char *)dec->val_decimal(NULL); val= (char *)dec->val_decimal(NULL);
@ -8124,6 +8220,15 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len,
DBUG_PRINT("debug", ("Reading from %p", ptr_after_width)); DBUG_PRINT("debug", ("Reading from %p", ptr_after_width));
m_width = net_field_length(&ptr_after_width); m_width = net_field_length(&ptr_after_width);
DBUG_PRINT("debug", ("m_width=%lu", m_width)); DBUG_PRINT("debug", ("m_width=%lu", m_width));
/* Avoid reading out of buffer */
if (static_cast<unsigned int>((ptr_after_width +
(m_width + 7) / 8) -
(uchar*)buf) > event_len)
{
m_cols.bitmap= NULL;
DBUG_VOID_RETURN;
}
/* if bitmap_init fails, catched in is_valid() */ /* if bitmap_init fails, catched in is_valid() */
if (likely(!bitmap_init(&m_cols, if (likely(!bitmap_init(&m_cols,
m_width <= sizeof(m_bitbuf)*8 ? m_bitbuf : NULL, m_width <= sizeof(m_bitbuf)*8 ? m_bitbuf : NULL,
@ -8172,7 +8277,12 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len,
const uchar* const ptr_rows_data= (const uchar*) ptr_after_width; const uchar* const ptr_rows_data= (const uchar*) ptr_after_width;
size_t const data_size= event_len - (ptr_rows_data - (const uchar *) buf); size_t const read_size= ptr_rows_data - (const unsigned char *) buf;
if (read_size > event_len)
{
DBUG_VOID_RETURN;
}
size_t const data_size= event_len - read_size;
DBUG_PRINT("info",("m_table_id: %lu m_flags: %d m_width: %lu data_size: %lu", DBUG_PRINT("info",("m_table_id: %lu m_flags: %d m_width: %lu data_size: %lu",
m_table_id, m_flags, m_width, (ulong) data_size)); m_table_id, m_flags, m_width, (ulong) data_size));

View file

@ -1,4 +1,5 @@
/* Copyright (c) 2007, 2016, Oracle and/or its affiliates. /* Copyright (c) 2007, 2018, Oracle and/or its affiliates.
Copyright (c) 2009, 2018, 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
@ -1357,6 +1358,15 @@ Old_rows_log_event::Old_rows_log_event(const char *buf, uint event_len,
DBUG_PRINT("debug", ("Reading from %p", ptr_after_width)); DBUG_PRINT("debug", ("Reading from %p", ptr_after_width));
m_width = net_field_length(&ptr_after_width); m_width = net_field_length(&ptr_after_width);
DBUG_PRINT("debug", ("m_width=%lu", m_width)); DBUG_PRINT("debug", ("m_width=%lu", m_width));
/* Avoid reading out of buffer */
if (static_cast<unsigned int>(m_width +
(ptr_after_width -
(const uchar *)buf)) > event_len)
{
m_cols.bitmap= NULL;
DBUG_VOID_RETURN;
}
/* if bitmap_init fails, catched in is_valid() */ /* if bitmap_init fails, catched in is_valid() */
if (likely(!bitmap_init(&m_cols, if (likely(!bitmap_init(&m_cols,
m_width <= sizeof(m_bitbuf)*8 ? m_bitbuf : NULL, m_width <= sizeof(m_bitbuf)*8 ? m_bitbuf : NULL,

View file

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. /* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2008, 2015, SkySQL Ab. Copyright (c) 2008, 2018, 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

View file

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2002, 2016, Oracle and/or its affiliates. Copyright (c) 2002, 2018, Oracle and/or its affiliates.
Copyright (c) 2009, 2017, MariaDB Copyright (c) 2009, 2018, 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
@ -354,7 +354,7 @@ private:
bool m_print_once; bool m_print_once;
public: public:
Proc_table_intact() : m_print_once(TRUE) {} Proc_table_intact() : m_print_once(TRUE) { has_keys= TRUE; }
protected: protected:
void report_error(uint code, const char *fmt, ...); void report_error(uint code, const char *fmt, ...);

View file

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. /* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
Copyright (c) 2009, 2016, MariaDB Copyright (c) 2009, 2018, 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

View file

@ -1,5 +1,5 @@
/* Copyright (c) 2010, 2015, Oracle and/or its affiliates. /* Copyright (c) 2010, 2015, Oracle and/or its affiliates.
Copyright (c) 2011, 2016, MariaDB Copyright (c) 2011, 2018, 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

View file

@ -1,4 +1,6 @@
/* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2011, 2018, 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

View file

@ -1,5 +1,5 @@
/* Copyright (c) 2005, 2017, Oracle and/or its affiliates. /* Copyright (c) 2005, 2017, Oracle and/or its affiliates.
Copyright (c) 2009, 2017, SkySQL Ab. Copyright (c) 2009, 2018, 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

View file

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2005, 2013, Oracle and/or its affiliates. Copyright (c) 2005, 2018, Oracle and/or its affiliates.
Copyright (c) 2010, 2014, SkySQL Ab. Copyright (c) 2010, 2018, 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
@ -2243,6 +2243,16 @@ bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name,
if (! (table= open_ltable(thd, &tables, TL_WRITE, MYSQL_LOCK_IGNORE_TIMEOUT))) if (! (table= open_ltable(thd, &tables, TL_WRITE, MYSQL_LOCK_IGNORE_TIMEOUT)))
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
if (!table->key_info)
{
my_printf_error(ER_UNKNOWN_ERROR,
"The table %s.%s has no primary key. "
"Please check the table definition and "
"create the primary key accordingly.", MYF(0),
table->s->db.str, table->s->table_name.str);
DBUG_RETURN(TRUE);
}
/* /*
Pre-acquire audit plugins for events that may potentially occur Pre-acquire audit plugins for events that may potentially occur
during [UN]INSTALL PLUGIN. during [UN]INSTALL PLUGIN.

View file

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. /* Copyright (c) 2000, 2018, Oracle and/or its affiliates.
Copyright (c) 2010, 2014, Monty Program Ab. Copyright (c) 2010, 2018, 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
@ -193,6 +193,11 @@ template <class T> T available_buffer(const char* buf_start,
const char* buf_current, const char* buf_current,
T buf_len) T buf_len)
{ {
/* Sanity check */
if (buf_current < buf_start ||
buf_len < static_cast<T>(buf_current - buf_start))
return static_cast<T>(0);
return buf_len - (buf_current - buf_start); return buf_len - (buf_current - buf_start);
} }

View file

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2000, 2016, Oracle and/or its affiliates. Copyright (c) 2000, 2016, Oracle and/or its affiliates.
Copyright (c) 2010, 2016, MariaDB Copyright (c) 2010, 2018, 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

View file

@ -1,5 +1,6 @@
/* /*
Copyright (c) 2004, 2012, Oracle and/or its affiliates. Copyright (c) 2004, 2012, Oracle and/or its affiliates.
Copyright (c) 2010, 2018, 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

View file

@ -1,4 +1,5 @@
/* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2010, 2015, Oracle and/or its affiliates.
Copyright (c) 2012, 2018, 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

View file

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. /* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
Copyright (c) 2008, 2015, MariaDB Copyright (c) 2008, 2018, 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
@ -3630,7 +3630,7 @@ Table_check_intact::check(TABLE *table, const TABLE_FIELD_DEF *table_def)
/* Whether the table definition has already been validated. */ /* Whether the table definition has already been validated. */
if (table->s->table_field_def_cache == table_def) if (table->s->table_field_def_cache == table_def)
DBUG_RETURN(FALSE); goto end;
if (table->s->fields != table_def->count) if (table->s->fields != table_def->count)
{ {
@ -3753,6 +3753,16 @@ Table_check_intact::check(TABLE *table, const TABLE_FIELD_DEF *table_def)
if (! error) if (! error)
table->s->table_field_def_cache= table_def; table->s->table_field_def_cache= table_def;
end:
if (has_keys && !error && !table->key_info)
{
report_error(0, "Incorrect definition of table %s.%s: "
"indexes are missing",
table->s->db.str, table->alias.c_ptr());
error= TRUE;
}
DBUG_RETURN(error); DBUG_RETURN(error);
} }

View file

@ -1,7 +1,7 @@
#ifndef TABLE_INCLUDED #ifndef TABLE_INCLUDED
#define TABLE_INCLUDED #define TABLE_INCLUDED
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. /* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
Copyright (c) 2009, 2014, SkySQL Ab. Copyright (c) 2009, 2018, 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
@ -496,10 +496,11 @@ typedef struct st_ha_data_partition
class Table_check_intact class Table_check_intact
{ {
protected: protected:
bool has_keys;
virtual void report_error(uint code, const char *fmt, ...)= 0; virtual void report_error(uint code, const char *fmt, ...)= 0;
public: public:
Table_check_intact() {} Table_check_intact() : has_keys(FALSE) {}
virtual ~Table_check_intact() {} virtual ~Table_check_intact() {}
/** Checks whether a table is intact. */ /** Checks whether a table is intact. */

View file

@ -1,6 +1,6 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2000, 2018, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc. Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc. Copyright (c) 2009, Percona Inc.
@ -9434,8 +9434,10 @@ ha_innobase::start_stmt(
case SQLCOM_INSERT: case SQLCOM_INSERT:
case SQLCOM_UPDATE: case SQLCOM_UPDATE:
case SQLCOM_DELETE: case SQLCOM_DELETE:
case SQLCOM_REPLACE:
init_table_handle_for_HANDLER(); init_table_handle_for_HANDLER();
prebuilt->select_lock_type = LOCK_X; prebuilt->select_lock_type = LOCK_X;
prebuilt->stored_select_lock_type = LOCK_X;
error = row_lock_table_for_mysql(prebuilt, NULL, 1); error = row_lock_table_for_mysql(prebuilt, NULL, 1);
if (error != DB_SUCCESS) { if (error != DB_SUCCESS) {