mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
Merge branch '10.6' into 10.11
This commit is contained in:
@@ -16,7 +16,7 @@ CONSTRAINT test FOREIGN KEY (b) REFERENCES t2 (id)
|
|||||||
ERROR HY000: Can't create table `test`.`t2` (errno: 121 "Duplicate key on write or update")
|
ERROR HY000: Can't create table `test`.`t2` (errno: 121 "Duplicate key on write or update")
|
||||||
show warnings;
|
show warnings;
|
||||||
Level Code Message
|
Level Code Message
|
||||||
Warning 121 Create or Alter table `test`.`t2` with foreign key constraint failed. Foreign key constraint `test`.`test` already exists on data dictionary. Foreign key constraint names need to be unique in database. Error in foreign key definition: CONSTRAINT `test` FOREIGN KEY (`b`) REFERENCES `test`.`t2` (`id`).
|
Warning 121 CREATE or ALTER TABLE `test`.`t2` failed: duplicate name, CONSTRAINT `test` FOREIGN KEY (`b`) REFERENCES `t2` (`id`)
|
||||||
Error 1005 Can't create table `test`.`t2` (errno: 121 "Duplicate key on write or update")
|
Error 1005 Can't create table `test`.`t2` (errno: 121 "Duplicate key on write or update")
|
||||||
Warning 1022 Can't write; duplicate key in table 't2'
|
Warning 1022 Can't write; duplicate key in table 't2'
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
@@ -1295,7 +1295,7 @@ Item *Item::multiple_equality_transformer(THD *thd, uchar *arg)
|
|||||||
This flag will be removed at the end of the pushdown optimization by
|
This flag will be removed at the end of the pushdown optimization by
|
||||||
remove_immutable_flag_processor processor.
|
remove_immutable_flag_processor processor.
|
||||||
*/
|
*/
|
||||||
int new_flag= MARKER_IMMUTABLE;
|
int16 new_flag= MARKER_IMMUTABLE;
|
||||||
this->walk(&Item::set_extraction_flag_processor, false,
|
this->walk(&Item::set_extraction_flag_processor, false,
|
||||||
(void*)&new_flag);
|
(void*)&new_flag);
|
||||||
}
|
}
|
||||||
|
@@ -198,15 +198,13 @@ static bool btr_root_fseg_validate(ulint offset,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Report a decryption failure. */
|
/** Report a read failure if it is a decryption failure.
|
||||||
ATTRIBUTE_COLD void btr_decryption_failed(const dict_index_t &index)
|
@param err error code
|
||||||
|
@param index the index that is being accessed */
|
||||||
|
ATTRIBUTE_COLD void btr_read_failed(dberr_t err, const dict_index_t &index)
|
||||||
{
|
{
|
||||||
ib_push_warning(static_cast<void*>(nullptr), DB_DECRYPTION_FAILED,
|
if (err == DB_DECRYPTION_FAILED)
|
||||||
"Table %s is encrypted but encryption service or"
|
innodb_decryption_failed(nullptr, index.table);
|
||||||
" used key_id is not available. "
|
|
||||||
" Can't continue reading table.",
|
|
||||||
index.table->name.m_name);
|
|
||||||
index.table->file_unreadable= true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get an index page and declare its latching order level.
|
/** Get an index page and declare its latching order level.
|
||||||
@@ -246,8 +244,8 @@ buf_block_t *btr_block_get(const dict_index_t &index,
|
|||||||
else if (!buf_page_make_young_if_needed(&block->page) && first)
|
else if (!buf_page_make_young_if_needed(&block->page) && first)
|
||||||
*first= true;
|
*first= true;
|
||||||
}
|
}
|
||||||
else if (*err == DB_DECRYPTION_FAILED)
|
else
|
||||||
btr_decryption_failed(index);
|
btr_read_failed(*err, index);
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
@@ -309,8 +307,8 @@ btr_root_block_get(
|
|||||||
else
|
else
|
||||||
buf_page_make_young_if_needed(&block->page);
|
buf_page_make_young_if_needed(&block->page);
|
||||||
}
|
}
|
||||||
else if (*err == DB_DECRYPTION_FAILED)
|
else
|
||||||
btr_decryption_failed(*index);
|
btr_read_failed(*err, *index);
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
@@ -1240,19 +1240,16 @@ dberr_t btr_cur_t::search_leaf(const dtuple_t *tuple, page_cur_mode_t mode,
|
|||||||
&err, height == 0 && !index()->is_clust());
|
&err, height == 0 && !index()->is_clust());
|
||||||
if (!block)
|
if (!block)
|
||||||
{
|
{
|
||||||
switch (err) {
|
if (err != DB_SUCCESS)
|
||||||
case DB_DECRYPTION_FAILED:
|
{
|
||||||
btr_decryption_failed(*index());
|
btr_read_failed(err, *index());
|
||||||
/* fall through */
|
|
||||||
default:
|
|
||||||
goto func_exit;
|
goto func_exit;
|
||||||
case DB_SUCCESS:
|
}
|
||||||
|
|
||||||
/* This must be a search to perform an insert, delete mark, or delete;
|
/* This must be a search to perform an insert, delete mark, or delete;
|
||||||
try using the change buffer */
|
try using the change buffer */
|
||||||
ut_ad(height == 0);
|
ut_ad(height == 0);
|
||||||
ut_ad(thr);
|
ut_ad(thr);
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (btr_op) {
|
switch (btr_op) {
|
||||||
default:
|
default:
|
||||||
@@ -1791,8 +1788,7 @@ dberr_t btr_cur_t::pessimistic_search_leaf(const dtuple_t *tuple,
|
|||||||
|
|
||||||
if (!block)
|
if (!block)
|
||||||
{
|
{
|
||||||
if (err == DB_DECRYPTION_FAILED)
|
btr_read_failed(err, *index());
|
||||||
btr_decryption_failed(*index());
|
|
||||||
goto func_exit;
|
goto func_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1888,8 +1884,7 @@ search_loop:
|
|||||||
else if (!(block= buf_page_get_gen(page_id, zip_size, rw_latch,
|
else if (!(block= buf_page_get_gen(page_id, zip_size, rw_latch,
|
||||||
block, BUF_GET, mtr, &err)))
|
block, BUF_GET, mtr, &err)))
|
||||||
{
|
{
|
||||||
if (err == DB_DECRYPTION_FAILED)
|
btr_read_failed(err, *index);
|
||||||
btr_decryption_failed(*index);
|
|
||||||
goto func_exit;
|
goto func_exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -1597,104 +1597,6 @@ dict_create_add_foreign_field_to_dictionary(
|
|||||||
table_name, foreign->id, trx));
|
table_name, foreign->id, trx));
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************//**
|
|
||||||
Construct foreign key constraint defintion from data dictionary information.
|
|
||||||
*/
|
|
||||||
static
|
|
||||||
char*
|
|
||||||
dict_foreign_def_get(
|
|
||||||
/*=================*/
|
|
||||||
dict_foreign_t* foreign,/*!< in: foreign */
|
|
||||||
trx_t* trx) /*!< in: trx */
|
|
||||||
{
|
|
||||||
char* fk_def = (char *)mem_heap_alloc(foreign->heap, 4*1024);
|
|
||||||
const char* tbname;
|
|
||||||
char tablebuf[MAX_TABLE_NAME_LEN + 1] = "";
|
|
||||||
unsigned i;
|
|
||||||
char* bufend;
|
|
||||||
|
|
||||||
tbname = dict_remove_db_name(foreign->id);
|
|
||||||
bufend = innobase_convert_name(tablebuf, MAX_TABLE_NAME_LEN,
|
|
||||||
tbname, strlen(tbname), trx->mysql_thd);
|
|
||||||
tablebuf[bufend - tablebuf] = '\0';
|
|
||||||
|
|
||||||
sprintf(fk_def,
|
|
||||||
(char *)"CONSTRAINT %s FOREIGN KEY (", (char *)tablebuf);
|
|
||||||
|
|
||||||
for(i = 0; i < foreign->n_fields; i++) {
|
|
||||||
char buf[MAX_TABLE_NAME_LEN + 1] = "";
|
|
||||||
innobase_convert_name(buf, MAX_TABLE_NAME_LEN,
|
|
||||||
foreign->foreign_col_names[i],
|
|
||||||
strlen(foreign->foreign_col_names[i]),
|
|
||||||
trx->mysql_thd);
|
|
||||||
strcat(fk_def, buf);
|
|
||||||
if (i < static_cast<unsigned>(foreign->n_fields-1)) {
|
|
||||||
strcat(fk_def, (char *)",");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
strcat(fk_def,(char *)") REFERENCES ");
|
|
||||||
|
|
||||||
bufend = innobase_convert_name(tablebuf, MAX_TABLE_NAME_LEN,
|
|
||||||
foreign->referenced_table_name,
|
|
||||||
strlen(foreign->referenced_table_name),
|
|
||||||
trx->mysql_thd);
|
|
||||||
tablebuf[bufend - tablebuf] = '\0';
|
|
||||||
|
|
||||||
strcat(fk_def, tablebuf);
|
|
||||||
strcat(fk_def, " (");
|
|
||||||
|
|
||||||
for(i = 0; i < foreign->n_fields; i++) {
|
|
||||||
char buf[MAX_TABLE_NAME_LEN + 1] = "";
|
|
||||||
bufend = innobase_convert_name(buf, MAX_TABLE_NAME_LEN,
|
|
||||||
foreign->referenced_col_names[i],
|
|
||||||
strlen(foreign->referenced_col_names[i]),
|
|
||||||
trx->mysql_thd);
|
|
||||||
buf[bufend - buf] = '\0';
|
|
||||||
strcat(fk_def, buf);
|
|
||||||
if (i < (uint)foreign->n_fields-1) {
|
|
||||||
strcat(fk_def, (char *)",");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
strcat(fk_def, (char *)")");
|
|
||||||
|
|
||||||
return fk_def;
|
|
||||||
}
|
|
||||||
|
|
||||||
/********************************************************************//**
|
|
||||||
Convert foreign key column names from data dictionary to SQL-layer.
|
|
||||||
*/
|
|
||||||
static
|
|
||||||
void
|
|
||||||
dict_foreign_def_get_fields(
|
|
||||||
/*========================*/
|
|
||||||
dict_foreign_t* foreign,/*!< in: foreign */
|
|
||||||
trx_t* trx, /*!< in: trx */
|
|
||||||
char** field, /*!< out: foreign column */
|
|
||||||
char** field2, /*!< out: referenced column */
|
|
||||||
ulint col_no) /*!< in: column number */
|
|
||||||
{
|
|
||||||
char* bufend;
|
|
||||||
char* fieldbuf = (char *)mem_heap_alloc(foreign->heap, MAX_TABLE_NAME_LEN+1);
|
|
||||||
char* fieldbuf2 = (char *)mem_heap_alloc(foreign->heap, MAX_TABLE_NAME_LEN+1);
|
|
||||||
|
|
||||||
bufend = innobase_convert_name(fieldbuf, MAX_TABLE_NAME_LEN,
|
|
||||||
foreign->foreign_col_names[col_no],
|
|
||||||
strlen(foreign->foreign_col_names[col_no]),
|
|
||||||
trx->mysql_thd);
|
|
||||||
|
|
||||||
fieldbuf[bufend - fieldbuf] = '\0';
|
|
||||||
|
|
||||||
bufend = innobase_convert_name(fieldbuf2, MAX_TABLE_NAME_LEN,
|
|
||||||
foreign->referenced_col_names[col_no],
|
|
||||||
strlen(foreign->referenced_col_names[col_no]),
|
|
||||||
trx->mysql_thd);
|
|
||||||
|
|
||||||
fieldbuf2[bufend - fieldbuf2] = '\0';
|
|
||||||
*field = fieldbuf;
|
|
||||||
*field2 = fieldbuf2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/********************************************************************//**
|
/********************************************************************//**
|
||||||
Add a foreign key definition to the data dictionary tables.
|
Add a foreign key definition to the data dictionary tables.
|
||||||
@return error code or DB_SUCCESS */
|
@return error code or DB_SUCCESS */
|
||||||
@@ -1736,29 +1638,8 @@ dict_create_add_foreign_to_dictionary(
|
|||||||
, name, foreign->id, trx);
|
, name, foreign->id, trx);
|
||||||
|
|
||||||
if (error != DB_SUCCESS) {
|
if (error != DB_SUCCESS) {
|
||||||
|
err_exit:
|
||||||
if (error == DB_DUPLICATE_KEY) {
|
innodb_fk_error(trx, error, name, *foreign);
|
||||||
char buf[MAX_TABLE_NAME_LEN + 1] = "";
|
|
||||||
char tablename[MAX_TABLE_NAME_LEN + 1] = "";
|
|
||||||
char* fk_def;
|
|
||||||
|
|
||||||
innobase_convert_name(tablename, MAX_TABLE_NAME_LEN,
|
|
||||||
name, strlen(name), trx->mysql_thd);
|
|
||||||
|
|
||||||
innobase_convert_name(buf, MAX_TABLE_NAME_LEN,
|
|
||||||
foreign->id, strlen(foreign->id), trx->mysql_thd);
|
|
||||||
|
|
||||||
fk_def = dict_foreign_def_get((dict_foreign_t*)foreign, trx);
|
|
||||||
|
|
||||||
ib_push_warning(trx, error,
|
|
||||||
"Create or Alter table %s with foreign key constraint"
|
|
||||||
" failed. Foreign key constraint %s"
|
|
||||||
" already exists on data dictionary."
|
|
||||||
" Foreign key constraint names need to be unique in database."
|
|
||||||
" Error in foreign key definition: %s.",
|
|
||||||
tablename, buf, fk_def);
|
|
||||||
}
|
|
||||||
|
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1767,27 +1648,7 @@ dict_create_add_foreign_to_dictionary(
|
|||||||
i, name, foreign, trx);
|
i, name, foreign, trx);
|
||||||
|
|
||||||
if (error != DB_SUCCESS) {
|
if (error != DB_SUCCESS) {
|
||||||
char buf[MAX_TABLE_NAME_LEN + 1] = "";
|
goto err_exit;
|
||||||
char tablename[MAX_TABLE_NAME_LEN + 1] = "";
|
|
||||||
char* field=NULL;
|
|
||||||
char* field2=NULL;
|
|
||||||
char* fk_def;
|
|
||||||
|
|
||||||
innobase_convert_name(tablename, MAX_TABLE_NAME_LEN,
|
|
||||||
name, strlen(name), trx->mysql_thd);
|
|
||||||
innobase_convert_name(buf, MAX_TABLE_NAME_LEN,
|
|
||||||
foreign->id, strlen(foreign->id), trx->mysql_thd);
|
|
||||||
fk_def = dict_foreign_def_get((dict_foreign_t*)foreign, trx);
|
|
||||||
dict_foreign_def_get_fields((dict_foreign_t*)foreign, trx, &field, &field2, i);
|
|
||||||
|
|
||||||
ib_push_warning(trx, error,
|
|
||||||
"Create or Alter table %s with foreign key constraint"
|
|
||||||
" failed. Error adding foreign key constraint name %s"
|
|
||||||
" fields %s or %s to the dictionary."
|
|
||||||
" Error in foreign key definition: %s.",
|
|
||||||
tablename, buf, i+1, fk_def);
|
|
||||||
|
|
||||||
DBUG_RETURN(error);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -195,21 +195,6 @@ dict_tables_have_same_db(
|
|||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************//**
|
|
||||||
Return the end of table name where we have removed dbname and '/'.
|
|
||||||
@return table name */
|
|
||||||
const char*
|
|
||||||
dict_remove_db_name(
|
|
||||||
/*================*/
|
|
||||||
const char* name) /*!< in: table name in the form
|
|
||||||
dbname '/' tablename */
|
|
||||||
{
|
|
||||||
const char* s = strchr(name, '/');
|
|
||||||
ut_a(s);
|
|
||||||
|
|
||||||
return(s + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Decrement the count of open handles */
|
/** Decrement the count of open handles */
|
||||||
void dict_table_close(dict_table_t *table)
|
void dict_table_close(dict_table_t *table)
|
||||||
{
|
{
|
||||||
@@ -3879,15 +3864,10 @@ dict_index_calc_min_rec_len(
|
|||||||
return(sum);
|
return(sum);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************//**
|
|
||||||
Outputs info on a foreign key of a table in a format suitable for
|
|
||||||
CREATE TABLE. */
|
|
||||||
std::string
|
std::string
|
||||||
dict_print_info_on_foreign_key_in_create_format(
|
dict_print_info_on_foreign_key_in_create_format(const trx_t *trx,
|
||||||
/*============================================*/
|
const dict_foreign_t *foreign,
|
||||||
trx_t* trx, /*!< in: transaction */
|
bool add_newline)
|
||||||
dict_foreign_t* foreign, /*!< in: foreign key constraint */
|
|
||||||
ibool add_newline) /*!< in: whether to add a newline */
|
|
||||||
{
|
{
|
||||||
const char* stripped_id;
|
const char* stripped_id;
|
||||||
ulint i;
|
ulint i;
|
||||||
|
@@ -671,8 +671,7 @@ dberr_t rtr_search_to_nth_level(ulint level, const dtuple_t *tuple,
|
|||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
err_exit:
|
err_exit:
|
||||||
if (err == DB_DECRYPTION_FAILED)
|
btr_read_failed(err, *index);
|
||||||
btr_decryption_failed(*index);
|
|
||||||
mtr->rollback_to_savepoint(savepoint);
|
mtr->rollback_to_savepoint(savepoint);
|
||||||
}
|
}
|
||||||
func_exit:
|
func_exit:
|
||||||
|
@@ -3368,7 +3368,7 @@ innobase_invalidate_query_cache(
|
|||||||
void
|
void
|
||||||
innobase_quote_identifier(
|
innobase_quote_identifier(
|
||||||
FILE* file,
|
FILE* file,
|
||||||
trx_t* trx,
|
const trx_t* trx,
|
||||||
const char* id)
|
const char* id)
|
||||||
{
|
{
|
||||||
const int q = trx != NULL && trx->mysql_thd != NULL
|
const int q = trx != NULL && trx->mysql_thd != NULL
|
||||||
@@ -3398,7 +3398,7 @@ innobase_quote_identifier(
|
|||||||
std::string
|
std::string
|
||||||
innobase_quote_identifier(
|
innobase_quote_identifier(
|
||||||
/*======================*/
|
/*======================*/
|
||||||
trx_t* trx,
|
const trx_t* trx,
|
||||||
const char* id)
|
const char* id)
|
||||||
{
|
{
|
||||||
std::string quoted_identifier;
|
std::string quoted_identifier;
|
||||||
@@ -21134,64 +21134,46 @@ static void innodb_remember_check_sysvar_funcs()
|
|||||||
check_sysvar_int = MYSQL_SYSVAR_NAME(flush_log_at_timeout).check;
|
check_sysvar_int = MYSQL_SYSVAR_NAME(flush_log_at_timeout).check;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const size_t MAX_BUF_SIZE = 4 * 1024;
|
/** Report that a table cannot be decrypted.
|
||||||
|
@param thd connection context
|
||||||
/********************************************************************//**
|
@param table table that cannot be decrypted
|
||||||
Helper function to push warnings from InnoDB internals to SQL-layer. */
|
@retval DB_DECRYPTION_FAILED (always) */
|
||||||
void
|
ATTRIBUTE_COLD
|
||||||
ib_push_warning(
|
dberr_t innodb_decryption_failed(THD *thd, dict_table_t *table)
|
||||||
trx_t* trx, /*!< in: trx */
|
|
||||||
dberr_t error, /*!< in: error code to push as warning */
|
|
||||||
const char *format,/*!< in: warning message */
|
|
||||||
...)
|
|
||||||
{
|
{
|
||||||
if (trx && trx->mysql_thd) {
|
table->file_unreadable= true;
|
||||||
THD *thd = (THD *)trx->mysql_thd;
|
if (!thd)
|
||||||
va_list args;
|
thd= current_thd;
|
||||||
char *buf;
|
const int dblen= int(table->name.dblen());
|
||||||
|
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
|
||||||
va_start(args, format);
|
HA_ERR_DECRYPTION_FAILED,
|
||||||
buf = (char *)my_malloc(PSI_INSTRUMENT_ME, MAX_BUF_SIZE, MYF(MY_WME));
|
"Table %`.*s.%`s in tablespace " UINT32PF
|
||||||
buf[MAX_BUF_SIZE - 1] = 0;
|
" (file %s) cannot be decrypted.",
|
||||||
vsnprintf(buf, MAX_BUF_SIZE - 1, format, args);
|
dblen, table->name.m_name,
|
||||||
|
table->name.m_name + dblen + 1,
|
||||||
push_warning_printf(
|
uint32_t(table->space_id),
|
||||||
thd, Sql_condition::WARN_LEVEL_WARN,
|
UT_LIST_GET_FIRST(table->space->chain)->name);
|
||||||
uint(convert_error_code_to_mysql(error, 0, thd)), buf);
|
return DB_DECRYPTION_FAILED;
|
||||||
my_free(buf);
|
|
||||||
va_end(args);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************//**
|
/** Report a foreign key error.
|
||||||
Helper function to push warnings from InnoDB internals to SQL-layer. */
|
@param error error to report
|
||||||
void
|
@param name table name
|
||||||
ib_push_warning(
|
@param foreign constraint */
|
||||||
void* ithd, /*!< in: thd */
|
ATTRIBUTE_COLD
|
||||||
dberr_t error, /*!< in: error code to push as warning */
|
void innodb_fk_error(const trx_t *trx, dberr_t err, const char *name,
|
||||||
const char *format,/*!< in: warning message */
|
const dict_foreign_t& foreign)
|
||||||
...)
|
|
||||||
{
|
{
|
||||||
va_list args;
|
const int dblen= int(table_name_t(const_cast<char*>(name)).dblen());
|
||||||
THD *thd = (THD *)ithd;
|
std::string fk= dict_print_info_on_foreign_key_in_create_format
|
||||||
char *buf;
|
(trx, &foreign, false);
|
||||||
|
push_warning_printf(trx->mysql_thd, Sql_condition::WARN_LEVEL_WARN,
|
||||||
if (ithd == NULL) {
|
convert_error_code_to_mysql(err, 0, nullptr),
|
||||||
thd = current_thd;
|
"CREATE or ALTER TABLE %`.*s.%`s failed%s%.*s",
|
||||||
}
|
dblen, name, name + dblen + 1,
|
||||||
|
err == DB_DUPLICATE_KEY
|
||||||
if (thd) {
|
? ": duplicate name" : "",
|
||||||
va_start(args, format);
|
int(fk.length()), fk.data());
|
||||||
buf = (char *)my_malloc(PSI_INSTRUMENT_ME, MAX_BUF_SIZE, MYF(MY_WME));
|
|
||||||
buf[MAX_BUF_SIZE - 1] = 0;
|
|
||||||
vsnprintf(buf, MAX_BUF_SIZE - 1, format, args);
|
|
||||||
|
|
||||||
push_warning_printf(
|
|
||||||
thd, Sql_condition::WARN_LEVEL_WARN,
|
|
||||||
uint(convert_error_code_to_mysql(error, 0, thd)), buf);
|
|
||||||
my_free(buf);
|
|
||||||
va_end(args);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Helper function to push warnings from InnoDB internals to SQL-layer.
|
/** Helper function to push warnings from InnoDB internals to SQL-layer.
|
||||||
|
@@ -79,8 +79,10 @@ btr_root_adjust_on_import(
|
|||||||
const dict_index_t* index) /*!< in: index tree */
|
const dict_index_t* index) /*!< in: index tree */
|
||||||
MY_ATTRIBUTE((warn_unused_result));
|
MY_ATTRIBUTE((warn_unused_result));
|
||||||
|
|
||||||
/** Report a decryption failure. */
|
/** Report a read failure if it is a decryption failure.
|
||||||
ATTRIBUTE_COLD void btr_decryption_failed(const dict_index_t &index);
|
@param err error code
|
||||||
|
@param index the index that is being accessed */
|
||||||
|
ATTRIBUTE_COLD void btr_read_failed(dberr_t err, const dict_index_t &index);
|
||||||
|
|
||||||
/** Get an index page and declare its latching order level.
|
/** Get an index page and declare its latching order level.
|
||||||
@param[in] index index tree
|
@param[in] index index tree
|
||||||
|
@@ -102,15 +102,9 @@ dict_table_is_partition(const dict_table_t* table)
|
|||||||
return (strstr(table->name.m_name, "#p#")
|
return (strstr(table->name.m_name, "#p#")
|
||||||
|| strstr(table->name.m_name, "#P#"));
|
|| strstr(table->name.m_name, "#P#"));
|
||||||
}
|
}
|
||||||
/********************************************************************//**
|
|
||||||
Return the end of table name where we have removed dbname and '/'.
|
#define dict_remove_db_name(name) \
|
||||||
@return table name */
|
(table_name_t{const_cast<char*>(name)}.dbend() + 1)
|
||||||
const char*
|
|
||||||
dict_remove_db_name(
|
|
||||||
/*================*/
|
|
||||||
const char* name) /*!< in: table name in the form
|
|
||||||
dbname '/' tablename */
|
|
||||||
MY_ATTRIBUTE((nonnull, warn_unused_result));
|
|
||||||
|
|
||||||
/** Operation to perform when opening a table */
|
/** Operation to perform when opening a table */
|
||||||
enum dict_table_op_t {
|
enum dict_table_op_t {
|
||||||
@@ -566,15 +560,15 @@ dict_print_info_on_foreign_keys(
|
|||||||
trx_t* trx, /*!< in: transaction */
|
trx_t* trx, /*!< in: transaction */
|
||||||
dict_table_t* table); /*!< in: table */
|
dict_table_t* table); /*!< in: table */
|
||||||
|
|
||||||
/**********************************************************************//**
|
/** Output info on a foreign key of a table in a format suitable for
|
||||||
Outputs info on a foreign key of a table in a format suitable for
|
CREATE TABLE.
|
||||||
CREATE TABLE. */
|
@param trx transaction
|
||||||
|
@param foreign constraint
|
||||||
|
@param add_newline whether to add a newline */
|
||||||
std::string
|
std::string
|
||||||
dict_print_info_on_foreign_key_in_create_format(
|
dict_print_info_on_foreign_key_in_create_format(const trx_t *trx,
|
||||||
/*============================================*/
|
const dict_foreign_t *foreign,
|
||||||
trx_t* trx, /*!< in: transaction */
|
bool add_newline);
|
||||||
dict_foreign_t* foreign, /*!< in: foreign key constraint */
|
|
||||||
ibool add_newline); /*!< in: whether to add a newline */
|
|
||||||
|
|
||||||
/*********************************************************************//**
|
/*********************************************************************//**
|
||||||
Tries to find an index whose first fields are the columns in the array,
|
Tries to find an index whose first fields are the columns in the array,
|
||||||
|
@@ -37,6 +37,9 @@ simple headers.
|
|||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
class THD;
|
class THD;
|
||||||
class Field;
|
class Field;
|
||||||
|
struct dict_table_t;
|
||||||
|
struct dict_foreign_t;
|
||||||
|
struct table_name_t;
|
||||||
|
|
||||||
// JAN: TODO missing features:
|
// JAN: TODO missing features:
|
||||||
#undef MYSQL_FT_INIT_EXT
|
#undef MYSQL_FT_INIT_EXT
|
||||||
@@ -83,7 +86,7 @@ innobase_invalidate_query_cache(
|
|||||||
void
|
void
|
||||||
innobase_quote_identifier(
|
innobase_quote_identifier(
|
||||||
FILE* file,
|
FILE* file,
|
||||||
trx_t* trx,
|
const trx_t* trx,
|
||||||
const char* id);
|
const char* id);
|
||||||
|
|
||||||
/** Quote an standard SQL identifier like tablespace, index or column name.
|
/** Quote an standard SQL identifier like tablespace, index or column name.
|
||||||
@@ -93,7 +96,7 @@ Return the string as an std:string object.
|
|||||||
@return a std::string with id properly quoted. */
|
@return a std::string with id properly quoted. */
|
||||||
std::string
|
std::string
|
||||||
innobase_quote_identifier(
|
innobase_quote_identifier(
|
||||||
trx_t* trx,
|
const trx_t* trx,
|
||||||
const char* id);
|
const char* id);
|
||||||
|
|
||||||
/*****************************************************************//**
|
/*****************************************************************//**
|
||||||
@@ -406,23 +409,20 @@ innobase_convert_to_filename_charset(
|
|||||||
const char* from, /* in: identifier to convert */
|
const char* from, /* in: identifier to convert */
|
||||||
ulint len); /* in: length of 'to', in bytes */
|
ulint len); /* in: length of 'to', in bytes */
|
||||||
|
|
||||||
/********************************************************************//**
|
/** Report that a table cannot be decrypted.
|
||||||
Helper function to push warnings from InnoDB internals to SQL-layer. */
|
@param thd connection context
|
||||||
void
|
@param table table that cannot be decrypted
|
||||||
ib_push_warning(
|
@retval DB_DECRYPTION_FAILED (always) */
|
||||||
trx_t* trx, /*!< in: trx */
|
ATTRIBUTE_COLD
|
||||||
dberr_t error, /*!< in: error code to push as warning */
|
dberr_t innodb_decryption_failed(THD *thd, dict_table_t *table);
|
||||||
const char *format,/*!< in: warning message */
|
|
||||||
...);
|
|
||||||
|
|
||||||
/********************************************************************//**
|
/** Report a foreign key error.
|
||||||
Helper function to push warnings from InnoDB internals to SQL-layer. */
|
@param error error to report
|
||||||
void
|
@param name table name
|
||||||
ib_push_warning(
|
@param foreign constraint */
|
||||||
void* ithd, /*!< in: thd */
|
ATTRIBUTE_COLD
|
||||||
dberr_t error, /*!< in: error code to push as warning */
|
void innodb_fk_error(const trx_t *trx, dberr_t err, const char *name,
|
||||||
const char *format,/*!< in: warning message */
|
const dict_foreign_t& foreign);
|
||||||
...);
|
|
||||||
|
|
||||||
/********************************************************************//**
|
/********************************************************************//**
|
||||||
Helper function to push warnings from InnoDB internals to SQL-layer. */
|
Helper function to push warnings from InnoDB internals to SQL-layer. */
|
||||||
|
@@ -3061,7 +3061,8 @@ row_ins_sec_index_entry_low(
|
|||||||
|
|
||||||
if (err != DB_SUCCESS) {
|
if (err != DB_SUCCESS) {
|
||||||
if (err == DB_DECRYPTION_FAILED) {
|
if (err == DB_DECRYPTION_FAILED) {
|
||||||
btr_decryption_failed(*index);
|
innodb_decryption_failed(thr_get_trx(thr)->mysql_thd,
|
||||||
|
index->table);
|
||||||
}
|
}
|
||||||
goto func_exit;
|
goto func_exit;
|
||||||
}
|
}
|
||||||
|
@@ -4730,13 +4730,9 @@ row_merge_build_indexes(
|
|||||||
/* Do not continue if we can't encrypt table pages */
|
/* Do not continue if we can't encrypt table pages */
|
||||||
if (!old_table->is_readable() ||
|
if (!old_table->is_readable() ||
|
||||||
!new_table->is_readable()) {
|
!new_table->is_readable()) {
|
||||||
error = DB_DECRYPTION_FAILED;
|
error = innodb_decryption_failed(trx->mysql_thd,
|
||||||
ib_push_warning(trx->mysql_thd, DB_DECRYPTION_FAILED,
|
!old_table->is_readable()
|
||||||
"Table %s is encrypted but encryption service or"
|
? old_table : new_table);
|
||||||
" used key_id is not available. "
|
|
||||||
" Can't continue reading table.",
|
|
||||||
!old_table->is_readable() ? old_table->name.m_name :
|
|
||||||
new_table->name.m_name);
|
|
||||||
goto func_exit;
|
goto func_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1186,51 +1186,26 @@ row_lock_table(row_prebuilt_t* prebuilt)
|
|||||||
return(err);
|
return(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Determine is tablespace encrypted but decryption failed, is table corrupted
|
/** Report an error for a failure to access a table.
|
||||||
or is tablespace .ibd file missing.
|
@param table unreadable table
|
||||||
@param[in] table Table
|
@param trx transaction
|
||||||
@param[in] trx Transaction
|
|
||||||
@param[in] push_warning true if we should push warning to user
|
|
||||||
@retval DB_DECRYPTION_FAILED table is encrypted but decryption failed
|
@retval DB_DECRYPTION_FAILED table is encrypted but decryption failed
|
||||||
@retval DB_CORRUPTION table is corrupted
|
@retval DB_CORRUPTION table is corrupted
|
||||||
@retval DB_TABLESPACE_NOT_FOUND tablespace .ibd file not found */
|
@retval DB_TABLESPACE_NOT_FOUND tablespace .ibd file not found */
|
||||||
static
|
ATTRIBUTE_COLD
|
||||||
dberr_t
|
static dberr_t row_mysql_get_table_error(trx_t *trx, dict_table_t *table)
|
||||||
row_mysql_get_table_status(
|
|
||||||
const dict_table_t* table,
|
|
||||||
trx_t* trx,
|
|
||||||
bool push_warning = true)
|
|
||||||
{
|
{
|
||||||
dberr_t err;
|
if (const fil_space_t *space= table->space)
|
||||||
if (const fil_space_t* space = table->space) {
|
{
|
||||||
if (space->crypt_data && space->crypt_data->is_encrypted()) {
|
if (space->crypt_data && space->crypt_data->is_encrypted())
|
||||||
// maybe we cannot access the table due to failing
|
return innodb_decryption_failed(trx->mysql_thd, table);
|
||||||
// to decrypt
|
return DB_CORRUPTION;
|
||||||
if (push_warning) {
|
|
||||||
ib_push_warning(trx, DB_DECRYPTION_FAILED,
|
|
||||||
"Table %s is encrypted."
|
|
||||||
"However key management plugin or used key_id is not found or"
|
|
||||||
" used encryption algorithm or method does not match.",
|
|
||||||
table->name.m_name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err = DB_DECRYPTION_FAILED;
|
const int dblen= int(table->name.dblen());
|
||||||
} else {
|
sql_print_error("InnoDB .ibd file is missing for table %`.*s.%`s",
|
||||||
if (push_warning) {
|
dblen, table->name.m_name, table->name.m_name + dblen + 1);
|
||||||
ib_push_warning(trx, DB_CORRUPTION,
|
return DB_TABLESPACE_NOT_FOUND;
|
||||||
"Table %s in tablespace %lu corrupted.",
|
|
||||||
table->name.m_name, table->space);
|
|
||||||
}
|
|
||||||
|
|
||||||
err = DB_CORRUPTION;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ib::error() << ".ibd file is missing for table "
|
|
||||||
<< table->name;
|
|
||||||
err = DB_TABLESPACE_NOT_FOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
return(err);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Does an insert for MySQL.
|
/** Does an insert for MySQL.
|
||||||
@@ -1266,7 +1241,7 @@ row_insert_for_mysql(
|
|||||||
|
|
||||||
return(DB_TABLESPACE_DELETED);
|
return(DB_TABLESPACE_DELETED);
|
||||||
} else if (!table->is_readable()) {
|
} else if (!table->is_readable()) {
|
||||||
return row_mysql_get_table_status(table, trx, true);
|
return row_mysql_get_table_error(trx, table);
|
||||||
} else if (high_level_read_only) {
|
} else if (high_level_read_only) {
|
||||||
return(DB_READ_ONLY);
|
return(DB_READ_ONLY);
|
||||||
} else if (UNIV_UNLIKELY(table->corrupted)
|
} else if (UNIV_UNLIKELY(table->corrupted)
|
||||||
@@ -1623,7 +1598,7 @@ row_update_for_mysql(row_prebuilt_t* prebuilt)
|
|||||||
ut_ad(table->stat_initialized);
|
ut_ad(table->stat_initialized);
|
||||||
|
|
||||||
if (!table->is_readable()) {
|
if (!table->is_readable()) {
|
||||||
return(row_mysql_get_table_status(table, trx, true));
|
return row_mysql_get_table_error(trx, table);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (high_level_read_only) {
|
if (high_level_read_only) {
|
||||||
|
@@ -4842,7 +4842,8 @@ page_corrupted:
|
|||||||
|
|
||||||
if (err != DB_SUCCESS) {
|
if (err != DB_SUCCESS) {
|
||||||
if (err == DB_DECRYPTION_FAILED) {
|
if (err == DB_DECRYPTION_FAILED) {
|
||||||
btr_decryption_failed(*index);
|
innodb_decryption_failed(trx->mysql_thd,
|
||||||
|
index->table);
|
||||||
}
|
}
|
||||||
rec = NULL;
|
rec = NULL;
|
||||||
goto page_read_error;
|
goto page_read_error;
|
||||||
|
@@ -21,7 +21,6 @@
|
|||||||
#define MYSQL_SERVER 1
|
#define MYSQL_SERVER 1
|
||||||
#include <my_global.h>
|
#include <my_global.h>
|
||||||
#include "mysql_version.h"
|
#include "mysql_version.h"
|
||||||
#include "spd_environ.h"
|
|
||||||
#include "sql_priv.h"
|
#include "sql_priv.h"
|
||||||
#include "probes_mysql.h"
|
#include "probes_mysql.h"
|
||||||
#include "sql_class.h"
|
#include "sql_class.h"
|
||||||
@@ -1183,13 +1182,7 @@ int ha_spider::extra(
|
|||||||
if (!(wide_handler->trx = spider_get_trx(ha_thd(), TRUE, &error_num)))
|
if (!(wide_handler->trx = spider_get_trx(ha_thd(), TRUE, &error_num)))
|
||||||
DBUG_RETURN(error_num);
|
DBUG_RETURN(error_num);
|
||||||
break;
|
break;
|
||||||
#if defined(HA_EXTRA_HAS_STARTING_ORDERED_INDEX_SCAN) || defined(HA_EXTRA_HAS_HA_EXTRA_USE_CMP_REF)
|
|
||||||
#ifdef HA_EXTRA_HAS_STARTING_ORDERED_INDEX_SCAN
|
|
||||||
case HA_EXTRA_STARTING_ORDERED_INDEX_SCAN:
|
case HA_EXTRA_STARTING_ORDERED_INDEX_SCAN:
|
||||||
#endif
|
|
||||||
#ifdef HA_EXTRA_HAS_HA_EXTRA_USE_CMP_REF
|
|
||||||
case HA_EXTRA_USE_CMP_REF:
|
|
||||||
#endif
|
|
||||||
DBUG_PRINT("info",("spider HA_EXTRA_STARTING_ORDERED_INDEX_SCAN"));
|
DBUG_PRINT("info",("spider HA_EXTRA_STARTING_ORDERED_INDEX_SCAN"));
|
||||||
if (table_share->primary_key != MAX_KEY)
|
if (table_share->primary_key != MAX_KEY)
|
||||||
{
|
{
|
||||||
@@ -1217,7 +1210,6 @@ int ha_spider::extra(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -6464,9 +6456,7 @@ int ha_spider::info(
|
|||||||
DBUG_ENTER("ha_spider::info");
|
DBUG_ENTER("ha_spider::info");
|
||||||
DBUG_PRINT("info",("spider this=%p", this));
|
DBUG_PRINT("info",("spider this=%p", this));
|
||||||
DBUG_PRINT("info",("spider flag=%x", flag));
|
DBUG_PRINT("info",("spider flag=%x", flag));
|
||||||
#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT
|
|
||||||
auto_inc_temporary = FALSE;
|
auto_inc_temporary = FALSE;
|
||||||
#endif
|
|
||||||
wide_handler->sql_command = thd_sql_command(thd);
|
wide_handler->sql_command = thd_sql_command(thd);
|
||||||
/*
|
/*
|
||||||
if (
|
if (
|
||||||
@@ -6482,9 +6472,7 @@ int ha_spider::info(
|
|||||||
share->lgtm_tblhnd_share->auto_increment_value;
|
share->lgtm_tblhnd_share->auto_increment_value;
|
||||||
else {
|
else {
|
||||||
stats.auto_increment_value = 1;
|
stats.auto_increment_value = 1;
|
||||||
#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT
|
|
||||||
auto_inc_temporary = TRUE;
|
auto_inc_temporary = TRUE;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
@@ -6743,9 +6731,7 @@ int ha_spider::info(
|
|||||||
}
|
}
|
||||||
if (flag & HA_STATUS_AUTO)
|
if (flag & HA_STATUS_AUTO)
|
||||||
{
|
{
|
||||||
#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT
|
|
||||||
auto_inc_temporary = FALSE;
|
auto_inc_temporary = FALSE;
|
||||||
#endif
|
|
||||||
if (share->wide_share && table->next_number_field)
|
if (share->wide_share && table->next_number_field)
|
||||||
{
|
{
|
||||||
ulonglong first_value, nb_reserved_values;
|
ulonglong first_value, nb_reserved_values;
|
||||||
@@ -7578,7 +7564,6 @@ bool ha_spider::need_info_for_auto_inc()
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT
|
|
||||||
bool ha_spider::can_use_for_auto_inc_init()
|
bool ha_spider::can_use_for_auto_inc_init()
|
||||||
{
|
{
|
||||||
DBUG_ENTER("ha_spider::can_use_for_auto_inc_init");
|
DBUG_ENTER("ha_spider::can_use_for_auto_inc_init");
|
||||||
@@ -7590,7 +7575,6 @@ bool ha_spider::can_use_for_auto_inc_init()
|
|||||||
!auto_inc_temporary
|
!auto_inc_temporary
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
int ha_spider::update_auto_increment()
|
int ha_spider::update_auto_increment()
|
||||||
{
|
{
|
||||||
@@ -7918,19 +7902,11 @@ int ha_spider::end_bulk_update(
|
|||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA
|
|
||||||
int ha_spider::bulk_update_row(
|
int ha_spider::bulk_update_row(
|
||||||
const uchar *old_data,
|
const uchar *old_data,
|
||||||
const uchar *new_data,
|
const uchar *new_data,
|
||||||
ha_rows *dup_key_found
|
ha_rows *dup_key_found
|
||||||
)
|
)
|
||||||
#else
|
|
||||||
int ha_spider::bulk_update_row(
|
|
||||||
const uchar *old_data,
|
|
||||||
uchar *new_data,
|
|
||||||
ha_rows *dup_key_found
|
|
||||||
)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
DBUG_ENTER("ha_spider::bulk_update_row");
|
DBUG_ENTER("ha_spider::bulk_update_row");
|
||||||
DBUG_PRINT("info",("spider this=%p", this));
|
DBUG_PRINT("info",("spider this=%p", this));
|
||||||
@@ -7938,17 +7914,10 @@ int ha_spider::bulk_update_row(
|
|||||||
DBUG_RETURN(update_row(old_data, new_data));
|
DBUG_RETURN(update_row(old_data, new_data));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA
|
|
||||||
int ha_spider::update_row(
|
int ha_spider::update_row(
|
||||||
const uchar *old_data,
|
const uchar *old_data,
|
||||||
const uchar *new_data
|
const uchar *new_data
|
||||||
)
|
)
|
||||||
#else
|
|
||||||
int ha_spider::update_row(
|
|
||||||
const uchar *old_data,
|
|
||||||
uchar *new_data
|
|
||||||
)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int error_num;
|
int error_num;
|
||||||
THD *thd = ha_thd();
|
THD *thd = ha_thd();
|
||||||
|
@@ -123,9 +123,7 @@ public:
|
|||||||
bool pre_bitmap_checked;
|
bool pre_bitmap_checked;
|
||||||
bool bulk_insert;
|
bool bulk_insert;
|
||||||
bool info_auto_called;
|
bool info_auto_called;
|
||||||
#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT
|
|
||||||
bool auto_inc_temporary;
|
bool auto_inc_temporary;
|
||||||
#endif
|
|
||||||
int bulk_size= 0;
|
int bulk_size= 0;
|
||||||
int direct_dup_insert;
|
int direct_dup_insert;
|
||||||
int store_error_num;
|
int store_error_num;
|
||||||
@@ -354,9 +352,7 @@ public:
|
|||||||
uint max_supported_key_part_length() const override;
|
uint max_supported_key_part_length() const override;
|
||||||
uint8 table_cache_type() override;
|
uint8 table_cache_type() override;
|
||||||
bool need_info_for_auto_inc() override;
|
bool need_info_for_auto_inc() override;
|
||||||
#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT
|
|
||||||
bool can_use_for_auto_inc_init() override;
|
bool can_use_for_auto_inc_init() override;
|
||||||
#endif
|
|
||||||
int update_auto_increment();
|
int update_auto_increment();
|
||||||
void get_auto_increment(
|
void get_auto_increment(
|
||||||
ulonglong offset,
|
ulonglong offset,
|
||||||
@@ -377,7 +373,6 @@ public:
|
|||||||
bool start_bulk_update() override;
|
bool start_bulk_update() override;
|
||||||
int exec_bulk_update(ha_rows *dup_key_found) override;
|
int exec_bulk_update(ha_rows *dup_key_found) override;
|
||||||
int end_bulk_update() override;
|
int end_bulk_update() override;
|
||||||
#ifdef SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA
|
|
||||||
int bulk_update_row(
|
int bulk_update_row(
|
||||||
const uchar *old_data,
|
const uchar *old_data,
|
||||||
const uchar *new_data,
|
const uchar *new_data,
|
||||||
@@ -387,17 +382,6 @@ public:
|
|||||||
const uchar *old_data,
|
const uchar *old_data,
|
||||||
const uchar *new_data
|
const uchar *new_data
|
||||||
) override;
|
) override;
|
||||||
#else
|
|
||||||
int bulk_update_row(
|
|
||||||
const uchar *old_data,
|
|
||||||
uchar *new_data,
|
|
||||||
ha_rows *dup_key_found
|
|
||||||
);
|
|
||||||
int update_row(
|
|
||||||
const uchar *old_data,
|
|
||||||
uchar *new_data
|
|
||||||
);
|
|
||||||
#endif
|
|
||||||
bool check_direct_update_sql_part(
|
bool check_direct_update_sql_part(
|
||||||
st_select_lex *select_lex,
|
st_select_lex *select_lex,
|
||||||
longlong select_limit,
|
longlong select_limit,
|
||||||
|
@@ -17,7 +17,6 @@
|
|||||||
#define MYSQL_SERVER 1
|
#define MYSQL_SERVER 1
|
||||||
#include <my_global.h>
|
#include <my_global.h>
|
||||||
#include "mysql_version.h"
|
#include "mysql_version.h"
|
||||||
#include "spd_environ.h"
|
|
||||||
#include "sql_priv.h"
|
#include "sql_priv.h"
|
||||||
#include "probes_mysql.h"
|
#include "probes_mysql.h"
|
||||||
#include "sql_class.h"
|
#include "sql_class.h"
|
||||||
@@ -3024,32 +3023,6 @@ void *spider_bg_sts_action(
|
|||||||
trx, &spider, FALSE, FALSE, SPIDER_CONN_KIND_MYSQL,
|
trx, &spider, FALSE, FALSE, SPIDER_CONN_KIND_MYSQL,
|
||||||
&error_num);
|
&error_num);
|
||||||
conns[spider.search_link_idx]->error_mode = 0;
|
conns[spider.search_link_idx]->error_mode = 0;
|
||||||
/*
|
|
||||||
if (
|
|
||||||
error_num &&
|
|
||||||
share->monitoring_kind[spider.search_link_idx] &&
|
|
||||||
need_mons[spider.search_link_idx]
|
|
||||||
) {
|
|
||||||
lex_start(thd);
|
|
||||||
error_num = spider_ping_table_mon_from_table(
|
|
||||||
trx,
|
|
||||||
thd,
|
|
||||||
share,
|
|
||||||
spider.search_link_idx,
|
|
||||||
(uint32) share->monitoring_sid[spider.search_link_idx],
|
|
||||||
share->table_name,
|
|
||||||
share->table_name_length,
|
|
||||||
spider.conn_link_idx[spider.search_link_idx],
|
|
||||||
NULL,
|
|
||||||
0,
|
|
||||||
share->monitoring_kind[spider.search_link_idx],
|
|
||||||
share->monitoring_limit[spider.search_link_idx],
|
|
||||||
share->monitoring_flag[spider.search_link_idx],
|
|
||||||
TRUE
|
|
||||||
);
|
|
||||||
lex_end(thd->lex);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
spider.search_link_idx = -1;
|
spider.search_link_idx = -1;
|
||||||
}
|
}
|
||||||
if (spider.search_link_idx != -1 && conns[spider.search_link_idx])
|
if (spider.search_link_idx != -1 && conns[spider.search_link_idx])
|
||||||
@@ -3060,31 +3033,6 @@ void *spider_bg_sts_action(
|
|||||||
share->bg_sts_sync,
|
share->bg_sts_sync,
|
||||||
2, HA_STATUS_CONST | HA_STATUS_VARIABLE))
|
2, HA_STATUS_CONST | HA_STATUS_VARIABLE))
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
if (
|
|
||||||
share->monitoring_kind[spider.search_link_idx] &&
|
|
||||||
need_mons[spider.search_link_idx]
|
|
||||||
) {
|
|
||||||
lex_start(thd);
|
|
||||||
error_num = spider_ping_table_mon_from_table(
|
|
||||||
trx,
|
|
||||||
thd,
|
|
||||||
share,
|
|
||||||
spider.search_link_idx,
|
|
||||||
(uint32) share->monitoring_sid[spider.search_link_idx],
|
|
||||||
share->table_name,
|
|
||||||
share->table_name_length,
|
|
||||||
spider.conn_link_idx[spider.search_link_idx],
|
|
||||||
NULL,
|
|
||||||
0,
|
|
||||||
share->monitoring_kind[spider.search_link_idx],
|
|
||||||
share->monitoring_limit[spider.search_link_idx],
|
|
||||||
share->monitoring_flag[spider.search_link_idx],
|
|
||||||
TRUE
|
|
||||||
);
|
|
||||||
lex_end(thd->lex);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
spider.search_link_idx = -1;
|
spider.search_link_idx = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3327,12 +3275,6 @@ void *spider_bg_crd_action(
|
|||||||
if (spider.search_link_idx < 0)
|
if (spider.search_link_idx < 0)
|
||||||
{
|
{
|
||||||
spider_trx_set_link_idx_for_all(&spider);
|
spider_trx_set_link_idx_for_all(&spider);
|
||||||
/*
|
|
||||||
spider.search_link_idx = spider_conn_next_link_idx(
|
|
||||||
thd, share->link_statuses, share->access_balances,
|
|
||||||
spider.conn_link_idx, spider.search_link_idx, share->link_count,
|
|
||||||
SPIDER_LINK_STATUS_OK);
|
|
||||||
*/
|
|
||||||
spider.search_link_idx = spider_conn_first_link_idx(thd,
|
spider.search_link_idx = spider_conn_first_link_idx(thd,
|
||||||
share->link_statuses, share->access_balances, spider.conn_link_idx,
|
share->link_statuses, share->access_balances, spider.conn_link_idx,
|
||||||
share->link_count, SPIDER_LINK_STATUS_OK);
|
share->link_count, SPIDER_LINK_STATUS_OK);
|
||||||
@@ -3349,32 +3291,6 @@ void *spider_bg_crd_action(
|
|||||||
trx, &spider, FALSE, FALSE, SPIDER_CONN_KIND_MYSQL,
|
trx, &spider, FALSE, FALSE, SPIDER_CONN_KIND_MYSQL,
|
||||||
&error_num);
|
&error_num);
|
||||||
conns[spider.search_link_idx]->error_mode = 0;
|
conns[spider.search_link_idx]->error_mode = 0;
|
||||||
/*
|
|
||||||
if (
|
|
||||||
error_num &&
|
|
||||||
share->monitoring_kind[spider.search_link_idx] &&
|
|
||||||
need_mons[spider.search_link_idx]
|
|
||||||
) {
|
|
||||||
lex_start(thd);
|
|
||||||
error_num = spider_ping_table_mon_from_table(
|
|
||||||
trx,
|
|
||||||
thd,
|
|
||||||
share,
|
|
||||||
spider.search_link_idx,
|
|
||||||
(uint32) share->monitoring_sid[spider.search_link_idx],
|
|
||||||
share->table_name,
|
|
||||||
share->table_name_length,
|
|
||||||
spider.conn_link_idx[spider.search_link_idx],
|
|
||||||
NULL,
|
|
||||||
0,
|
|
||||||
share->monitoring_kind[spider.search_link_idx],
|
|
||||||
share->monitoring_limit[spider.search_link_idx],
|
|
||||||
share->monitoring_flag[spider.search_link_idx],
|
|
||||||
TRUE
|
|
||||||
);
|
|
||||||
lex_end(thd->lex);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
spider.search_link_idx = -1;
|
spider.search_link_idx = -1;
|
||||||
}
|
}
|
||||||
if (spider.search_link_idx != -1 && conns[spider.search_link_idx])
|
if (spider.search_link_idx != -1 && conns[spider.search_link_idx])
|
||||||
@@ -3385,31 +3301,6 @@ void *spider_bg_crd_action(
|
|||||||
share->bg_crd_sync,
|
share->bg_crd_sync,
|
||||||
2))
|
2))
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
if (
|
|
||||||
share->monitoring_kind[spider.search_link_idx] &&
|
|
||||||
need_mons[spider.search_link_idx]
|
|
||||||
) {
|
|
||||||
lex_start(thd);
|
|
||||||
error_num = spider_ping_table_mon_from_table(
|
|
||||||
trx,
|
|
||||||
thd,
|
|
||||||
share,
|
|
||||||
spider.search_link_idx,
|
|
||||||
(uint32) share->monitoring_sid[spider.search_link_idx],
|
|
||||||
share->table_name,
|
|
||||||
share->table_name_length,
|
|
||||||
spider.conn_link_idx[spider.search_link_idx],
|
|
||||||
NULL,
|
|
||||||
0,
|
|
||||||
share->monitoring_kind[spider.search_link_idx],
|
|
||||||
share->monitoring_limit[spider.search_link_idx],
|
|
||||||
share->monitoring_flag[spider.search_link_idx],
|
|
||||||
TRUE
|
|
||||||
);
|
|
||||||
lex_end(thd->lex);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
spider.search_link_idx = -1;
|
spider.search_link_idx = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3714,17 +3605,11 @@ void *spider_bg_mon_action(
|
|||||||
share->monitoring_bg_interval[link_idx] * 1000);
|
share->monitoring_bg_interval[link_idx] * 1000);
|
||||||
pthread_cond_timedwait(&share->bg_mon_sleep_conds[link_idx],
|
pthread_cond_timedwait(&share->bg_mon_sleep_conds[link_idx],
|
||||||
&share->bg_mon_mutexes[link_idx], &abstime);
|
&share->bg_mon_mutexes[link_idx], &abstime);
|
||||||
/*
|
|
||||||
my_sleep((ulong) share->monitoring_bg_interval[link_idx]);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
DBUG_PRINT("info",("spider bg mon roop start"));
|
DBUG_PRINT("info",("spider bg mon roop start"));
|
||||||
if (share->bg_mon_kill)
|
if (share->bg_mon_kill)
|
||||||
{
|
{
|
||||||
DBUG_PRINT("info",("spider bg mon kill start"));
|
DBUG_PRINT("info",("spider bg mon kill start"));
|
||||||
/*
|
|
||||||
pthread_mutex_lock(&share->bg_mon_mutexes[link_idx]);
|
|
||||||
*/
|
|
||||||
pthread_cond_signal(&share->bg_mon_conds[link_idx]);
|
pthread_cond_signal(&share->bg_mon_conds[link_idx]);
|
||||||
pthread_mutex_unlock(&share->bg_mon_mutexes[link_idx]);
|
pthread_mutex_unlock(&share->bg_mon_mutexes[link_idx]);
|
||||||
spider_free_trx(trx, TRUE);
|
spider_free_trx(trx, TRUE);
|
||||||
|
@@ -17,7 +17,6 @@
|
|||||||
#define MYSQL_SERVER 1
|
#define MYSQL_SERVER 1
|
||||||
#include <my_global.h>
|
#include <my_global.h>
|
||||||
#include "mysql_version.h"
|
#include "mysql_version.h"
|
||||||
#include "spd_environ.h"
|
|
||||||
#include "sql_priv.h"
|
#include "sql_priv.h"
|
||||||
#include "probes_mysql.h"
|
#include "probes_mysql.h"
|
||||||
#include "sql_class.h"
|
#include "sql_class.h"
|
||||||
|
@@ -17,7 +17,6 @@
|
|||||||
#define MYSQL_SERVER 1
|
#define MYSQL_SERVER 1
|
||||||
#include <my_global.h>
|
#include <my_global.h>
|
||||||
#include "mysql_version.h"
|
#include "mysql_version.h"
|
||||||
#include "spd_environ.h"
|
|
||||||
#include "sql_priv.h"
|
#include "sql_priv.h"
|
||||||
#include "probes_mysql.h"
|
#include "probes_mysql.h"
|
||||||
#include "sql_class.h"
|
#include "sql_class.h"
|
||||||
|
@@ -17,7 +17,6 @@
|
|||||||
#define MYSQL_SERVER 1
|
#define MYSQL_SERVER 1
|
||||||
#include <my_global.h>
|
#include <my_global.h>
|
||||||
#include "mysql_version.h"
|
#include "mysql_version.h"
|
||||||
#include "spd_environ.h"
|
|
||||||
#include "sql_priv.h"
|
#include "sql_priv.h"
|
||||||
#include "probes_mysql.h"
|
#include "probes_mysql.h"
|
||||||
#include "sql_class.h"
|
#include "sql_class.h"
|
||||||
|
@@ -17,7 +17,6 @@
|
|||||||
#define MYSQL_SERVER 1
|
#define MYSQL_SERVER 1
|
||||||
#include <my_global.h>
|
#include <my_global.h>
|
||||||
#include "mysql_version.h"
|
#include "mysql_version.h"
|
||||||
#include "spd_environ.h"
|
|
||||||
#include "sql_priv.h"
|
#include "sql_priv.h"
|
||||||
#include "probes_mysql.h"
|
#include "probes_mysql.h"
|
||||||
#include "sql_class.h"
|
#include "sql_class.h"
|
||||||
@@ -2005,9 +2004,7 @@ int spider_db_mbase::connect(
|
|||||||
connect_retry_count--;
|
connect_retry_count--;
|
||||||
my_sleep((ulong) connect_retry_interval);
|
my_sleep((ulong) connect_retry_interval);
|
||||||
} else {
|
} else {
|
||||||
#ifdef SPIDER_NET_HAS_THD
|
|
||||||
db_conn->net.thd = NULL;
|
db_conn->net.thd = NULL;
|
||||||
#endif
|
|
||||||
if (connect_mutex)
|
if (connect_mutex)
|
||||||
pthread_mutex_unlock(&spider_open_conn_mutex);
|
pthread_mutex_unlock(&spider_open_conn_mutex);
|
||||||
break;
|
break;
|
||||||
|
@@ -17,7 +17,6 @@
|
|||||||
#define MYSQL_SERVER 1
|
#define MYSQL_SERVER 1
|
||||||
#include <my_global.h>
|
#include <my_global.h>
|
||||||
#include "mysql_version.h"
|
#include "mysql_version.h"
|
||||||
#include "spd_environ.h"
|
|
||||||
#include "sql_priv.h"
|
#include "sql_priv.h"
|
||||||
#include "probes_mysql.h"
|
#include "probes_mysql.h"
|
||||||
#include "sql_class.h"
|
#include "sql_class.h"
|
||||||
|
@@ -1,29 +0,0 @@
|
|||||||
/* Copyright (C) 2008-2020 Kentoku Shiba
|
|
||||||
Copyright (C) 2017-2020 MariaDB corp
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
|
|
||||||
|
|
||||||
/*
|
|
||||||
Define functionality offered by MySQL or MariaDB
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SPD_ENVIRON_INCLUDED
|
|
||||||
|
|
||||||
#define SPIDER_NET_HAS_THD
|
|
||||||
#define HANDLER_HAS_TOP_TABLE_FIELDS
|
|
||||||
#define PARTITION_HAS_GET_PART_SPEC
|
|
||||||
#define HA_EXTRA_HAS_STARTING_ORDERED_INDEX_SCAN
|
|
||||||
#define HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT
|
|
||||||
#define SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA
|
|
||||||
#endif /* SPD_ENVIRON_INCLUDED */
|
|
@@ -17,7 +17,6 @@
|
|||||||
#define MYSQL_SERVER 1
|
#define MYSQL_SERVER 1
|
||||||
#include <my_global.h>
|
#include <my_global.h>
|
||||||
#include "mysql_version.h"
|
#include "mysql_version.h"
|
||||||
#include "spd_environ.h"
|
|
||||||
#include "sql_priv.h"
|
#include "sql_priv.h"
|
||||||
#include "probes_mysql.h"
|
#include "probes_mysql.h"
|
||||||
#include "sql_class.h"
|
#include "sql_class.h"
|
||||||
|
@@ -17,7 +17,6 @@
|
|||||||
#define MYSQL_SERVER 1
|
#define MYSQL_SERVER 1
|
||||||
#include <my_global.h>
|
#include <my_global.h>
|
||||||
#include "mysql_version.h"
|
#include "mysql_version.h"
|
||||||
#include "spd_environ.h"
|
|
||||||
#include "sql_priv.h"
|
#include "sql_priv.h"
|
||||||
#include "probes_mysql.h"
|
#include "probes_mysql.h"
|
||||||
#include "sql_class.h"
|
#include "sql_class.h"
|
||||||
|
@@ -88,8 +88,6 @@
|
|||||||
#define SPIDER_FIELD_FIELDPTR_REQUIRES_THDPTR
|
#define SPIDER_FIELD_FIELDPTR_REQUIRES_THDPTR
|
||||||
#define SPIDER_ENGINE_CONDITION_PUSHDOWN_IS_ALWAYS_ON
|
#define SPIDER_ENGINE_CONDITION_PUSHDOWN_IS_ALWAYS_ON
|
||||||
|
|
||||||
#define SPIDER_Item_args_arg_count_IS_PROTECTED
|
|
||||||
|
|
||||||
#define SPIDER_Item_func_conv_charset_conv_charset collation.collation
|
#define SPIDER_Item_func_conv_charset_conv_charset collation.collation
|
||||||
|
|
||||||
#define SPIDER_WITHOUT_HA_STATISTIC_INCREMENT
|
#define SPIDER_WITHOUT_HA_STATISTIC_INCREMENT
|
||||||
|
@@ -17,7 +17,6 @@
|
|||||||
#define MYSQL_SERVER 1
|
#define MYSQL_SERVER 1
|
||||||
#include <my_global.h>
|
#include <my_global.h>
|
||||||
#include "mysql_version.h"
|
#include "mysql_version.h"
|
||||||
#include "spd_environ.h"
|
|
||||||
#include "sql_priv.h"
|
#include "sql_priv.h"
|
||||||
#include "probes_mysql.h"
|
#include "probes_mysql.h"
|
||||||
#include "sql_class.h"
|
#include "sql_class.h"
|
||||||
|
@@ -37,7 +37,6 @@
|
|||||||
#define MYSQL_SERVER 1
|
#define MYSQL_SERVER 1
|
||||||
#include <my_global.h>
|
#include <my_global.h>
|
||||||
#include "mysql_version.h"
|
#include "mysql_version.h"
|
||||||
#include "spd_environ.h"
|
|
||||||
#include "sql_priv.h"
|
#include "sql_priv.h"
|
||||||
#include "probes_mysql.h"
|
#include "probes_mysql.h"
|
||||||
#include "sql_class.h"
|
#include "sql_class.h"
|
||||||
|
@@ -17,7 +17,6 @@
|
|||||||
#define MYSQL_SERVER 1
|
#define MYSQL_SERVER 1
|
||||||
#include <my_global.h>
|
#include <my_global.h>
|
||||||
#include "mysql_version.h"
|
#include "mysql_version.h"
|
||||||
#include "spd_environ.h"
|
|
||||||
#include "sql_priv.h"
|
#include "sql_priv.h"
|
||||||
#include "probes_mysql.h"
|
#include "probes_mysql.h"
|
||||||
#include "sql_class.h"
|
#include "sql_class.h"
|
||||||
|
@@ -16,7 +16,6 @@
|
|||||||
#define MYSQL_SERVER 1
|
#define MYSQL_SERVER 1
|
||||||
#include <my_global.h>
|
#include <my_global.h>
|
||||||
#include "mysql_version.h"
|
#include "mysql_version.h"
|
||||||
#include "spd_environ.h"
|
|
||||||
#include "sql_priv.h"
|
#include "sql_priv.h"
|
||||||
#include "probes_mysql.h"
|
#include "probes_mysql.h"
|
||||||
#include "sql_class.h"
|
#include "sql_class.h"
|
||||||
|
@@ -17,7 +17,6 @@
|
|||||||
#define MYSQL_SERVER 1
|
#define MYSQL_SERVER 1
|
||||||
#include <my_global.h>
|
#include <my_global.h>
|
||||||
#include "mysql_version.h"
|
#include "mysql_version.h"
|
||||||
#include "spd_environ.h"
|
|
||||||
#include "sql_priv.h"
|
#include "sql_priv.h"
|
||||||
#include "probes_mysql.h"
|
#include "probes_mysql.h"
|
||||||
#include "my_getopt.h"
|
#include "my_getopt.h"
|
||||||
|
@@ -17,7 +17,6 @@
|
|||||||
#define MYSQL_SERVER 1
|
#define MYSQL_SERVER 1
|
||||||
#include <my_global.h>
|
#include <my_global.h>
|
||||||
#include "mysql_version.h"
|
#include "mysql_version.h"
|
||||||
#include "spd_environ.h"
|
|
||||||
#include "sql_priv.h"
|
#include "sql_priv.h"
|
||||||
#include "probes_mysql.h"
|
#include "probes_mysql.h"
|
||||||
#include "sql_class.h"
|
#include "sql_class.h"
|
||||||
|
@@ -15,7 +15,6 @@
|
|||||||
|
|
||||||
#define MYSQL_SERVER 1
|
#define MYSQL_SERVER 1
|
||||||
#include <my_global.h>
|
#include <my_global.h>
|
||||||
#include "spd_environ.h"
|
|
||||||
#include "mysql.h"
|
#include "mysql.h"
|
||||||
#include "spd_udf.h"
|
#include "spd_udf.h"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user