Merge branch '10.6' into 10.11

This commit is contained in:
Yuchen Pei 2024-09-11 16:10:53 +10:00
commit b168859d1e
No known key found for this signature in database
GPG key ID: 3DD1B35105743563
34 changed files with 124 additions and 549 deletions

View file

@ -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")
show warnings;
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")
Warning 1022 Can't write; duplicate key in table 't2'
drop table t1;

View file

@ -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
remove_immutable_flag_processor processor.
*/
int new_flag= MARKER_IMMUTABLE;
int16 new_flag= MARKER_IMMUTABLE;
this->walk(&Item::set_extraction_flag_processor, false,
(void*)&new_flag);
}

View file

@ -198,15 +198,13 @@ static bool btr_root_fseg_validate(ulint offset,
return false;
}
/** Report a decryption failure. */
ATTRIBUTE_COLD void btr_decryption_failed(const dict_index_t &index)
/** Report a read failure if it is a decryption failure.
@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,
"Table %s is encrypted but encryption service or"
" used key_id is not available. "
" Can't continue reading table.",
index.table->name.m_name);
index.table->file_unreadable= true;
if (err == DB_DECRYPTION_FAILED)
innodb_decryption_failed(nullptr, index.table);
}
/** 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)
*first= true;
}
else if (*err == DB_DECRYPTION_FAILED)
btr_decryption_failed(index);
else
btr_read_failed(*err, index);
return block;
}
@ -309,8 +307,8 @@ btr_root_block_get(
else
buf_page_make_young_if_needed(&block->page);
}
else if (*err == DB_DECRYPTION_FAILED)
btr_decryption_failed(*index);
else
btr_read_failed(*err, *index);
return block;
}

View file

@ -1240,20 +1240,17 @@ dberr_t btr_cur_t::search_leaf(const dtuple_t *tuple, page_cur_mode_t mode,
&err, height == 0 && !index()->is_clust());
if (!block)
{
switch (err) {
case DB_DECRYPTION_FAILED:
btr_decryption_failed(*index());
/* fall through */
default:
if (err != DB_SUCCESS)
{
btr_read_failed(err, *index());
goto func_exit;
case DB_SUCCESS:
/* This must be a search to perform an insert, delete mark, or delete;
try using the change buffer */
ut_ad(height == 0);
ut_ad(thr);
break;
}
/* This must be a search to perform an insert, delete mark, or delete;
try using the change buffer */
ut_ad(height == 0);
ut_ad(thr);
switch (btr_op) {
default:
MY_ASSERT_UNREACHABLE();
@ -1791,8 +1788,7 @@ dberr_t btr_cur_t::pessimistic_search_leaf(const dtuple_t *tuple,
if (!block)
{
if (err == DB_DECRYPTION_FAILED)
btr_decryption_failed(*index());
btr_read_failed(err, *index());
goto func_exit;
}
@ -1888,8 +1884,7 @@ search_loop:
else if (!(block= buf_page_get_gen(page_id, zip_size, rw_latch,
block, BUF_GET, mtr, &err)))
{
if (err == DB_DECRYPTION_FAILED)
btr_decryption_failed(*index);
btr_read_failed(err, *index);
goto func_exit;
}
else

View file

@ -1597,104 +1597,6 @@ dict_create_add_foreign_field_to_dictionary(
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.
@return error code or DB_SUCCESS */
@ -1736,29 +1638,8 @@ dict_create_add_foreign_to_dictionary(
, name, foreign->id, trx);
if (error != DB_SUCCESS) {
if (error == DB_DUPLICATE_KEY) {
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);
}
err_exit:
innodb_fk_error(trx, error, name, *foreign);
DBUG_RETURN(error);
}
@ -1767,27 +1648,7 @@ dict_create_add_foreign_to_dictionary(
i, name, foreign, trx);
if (error != DB_SUCCESS) {
char buf[MAX_TABLE_NAME_LEN + 1] = "";
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);
goto err_exit;
}
}

View file

@ -195,21 +195,6 @@ dict_tables_have_same_db(
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 */
void dict_table_close(dict_table_t *table)
{
@ -3879,15 +3864,10 @@ dict_index_calc_min_rec_len(
return(sum);
}
/**********************************************************************//**
Outputs info on a foreign key of a table in a format suitable for
CREATE TABLE. */
std::string
dict_print_info_on_foreign_key_in_create_format(
/*============================================*/
trx_t* trx, /*!< in: transaction */
dict_foreign_t* foreign, /*!< in: foreign key constraint */
ibool add_newline) /*!< in: whether to add a newline */
dict_print_info_on_foreign_key_in_create_format(const trx_t *trx,
const dict_foreign_t *foreign,
bool add_newline)
{
const char* stripped_id;
ulint i;

View file

@ -671,8 +671,7 @@ dberr_t rtr_search_to_nth_level(ulint level, const dtuple_t *tuple,
if (err)
{
err_exit:
if (err == DB_DECRYPTION_FAILED)
btr_decryption_failed(*index);
btr_read_failed(err, *index);
mtr->rollback_to_savepoint(savepoint);
}
func_exit:

View file

@ -3368,7 +3368,7 @@ innobase_invalidate_query_cache(
void
innobase_quote_identifier(
FILE* file,
trx_t* trx,
const trx_t* trx,
const char* id)
{
const int q = trx != NULL && trx->mysql_thd != NULL
@ -3398,7 +3398,7 @@ innobase_quote_identifier(
std::string
innobase_quote_identifier(
/*======================*/
trx_t* trx,
const trx_t* trx,
const char* id)
{
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;
}
static const size_t MAX_BUF_SIZE = 4 * 1024;
/********************************************************************//**
Helper function to push warnings from InnoDB internals to SQL-layer. */
void
ib_push_warning(
trx_t* trx, /*!< in: trx */
dberr_t error, /*!< in: error code to push as warning */
const char *format,/*!< in: warning message */
...)
/** Report that a table cannot be decrypted.
@param thd connection context
@param table table that cannot be decrypted
@retval DB_DECRYPTION_FAILED (always) */
ATTRIBUTE_COLD
dberr_t innodb_decryption_failed(THD *thd, dict_table_t *table)
{
if (trx && trx->mysql_thd) {
THD *thd = (THD *)trx->mysql_thd;
va_list args;
char *buf;
va_start(args, format);
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);
}
table->file_unreadable= true;
if (!thd)
thd= current_thd;
const int dblen= int(table->name.dblen());
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
HA_ERR_DECRYPTION_FAILED,
"Table %`.*s.%`s in tablespace " UINT32PF
" (file %s) cannot be decrypted.",
dblen, table->name.m_name,
table->name.m_name + dblen + 1,
uint32_t(table->space_id),
UT_LIST_GET_FIRST(table->space->chain)->name);
return DB_DECRYPTION_FAILED;
}
/********************************************************************//**
Helper function to push warnings from InnoDB internals to SQL-layer. */
void
ib_push_warning(
void* ithd, /*!< in: thd */
dberr_t error, /*!< in: error code to push as warning */
const char *format,/*!< in: warning message */
...)
/** Report a foreign key error.
@param error error to report
@param name table name
@param foreign constraint */
ATTRIBUTE_COLD
void innodb_fk_error(const trx_t *trx, dberr_t err, const char *name,
const dict_foreign_t& foreign)
{
va_list args;
THD *thd = (THD *)ithd;
char *buf;
if (ithd == NULL) {
thd = current_thd;
}
if (thd) {
va_start(args, format);
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);
}
const int dblen= int(table_name_t(const_cast<char*>(name)).dblen());
std::string fk= dict_print_info_on_foreign_key_in_create_format
(trx, &foreign, false);
push_warning_printf(trx->mysql_thd, Sql_condition::WARN_LEVEL_WARN,
convert_error_code_to_mysql(err, 0, nullptr),
"CREATE or ALTER TABLE %`.*s.%`s failed%s%.*s",
dblen, name, name + dblen + 1,
err == DB_DUPLICATE_KEY
? ": duplicate name" : "",
int(fk.length()), fk.data());
}
/** Helper function to push warnings from InnoDB internals to SQL-layer.

View file

@ -79,8 +79,10 @@ btr_root_adjust_on_import(
const dict_index_t* index) /*!< in: index tree */
MY_ATTRIBUTE((warn_unused_result));
/** Report a decryption failure. */
ATTRIBUTE_COLD void btr_decryption_failed(const dict_index_t &index);
/** Report a read failure if it is a decryption failure.
@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.
@param[in] index index tree

View file

@ -102,15 +102,9 @@ dict_table_is_partition(const dict_table_t* table)
return (strstr(table->name.m_name, "#p#")
|| strstr(table->name.m_name, "#P#"));
}
/********************************************************************//**
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 */
MY_ATTRIBUTE((nonnull, warn_unused_result));
#define dict_remove_db_name(name) \
(table_name_t{const_cast<char*>(name)}.dbend() + 1)
/** Operation to perform when opening a table */
enum dict_table_op_t {
@ -566,15 +560,15 @@ dict_print_info_on_foreign_keys(
trx_t* trx, /*!< in: transaction */
dict_table_t* table); /*!< in: table */
/**********************************************************************//**
Outputs info on a foreign key of a table in a format suitable for
CREATE TABLE. */
/** Output info on a foreign key of a table in a format suitable for
CREATE TABLE.
@param trx transaction
@param foreign constraint
@param add_newline whether to add a newline */
std::string
dict_print_info_on_foreign_key_in_create_format(
/*============================================*/
trx_t* trx, /*!< in: transaction */
dict_foreign_t* foreign, /*!< in: foreign key constraint */
ibool add_newline); /*!< in: whether to add a newline */
dict_print_info_on_foreign_key_in_create_format(const trx_t *trx,
const dict_foreign_t *foreign,
bool add_newline);
/*********************************************************************//**
Tries to find an index whose first fields are the columns in the array,

View file

@ -37,6 +37,9 @@ simple headers.
/* Forward declarations */
class THD;
class Field;
struct dict_table_t;
struct dict_foreign_t;
struct table_name_t;
// JAN: TODO missing features:
#undef MYSQL_FT_INIT_EXT
@ -83,7 +86,7 @@ innobase_invalidate_query_cache(
void
innobase_quote_identifier(
FILE* file,
trx_t* trx,
const trx_t* trx,
const char* id);
/** 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. */
std::string
innobase_quote_identifier(
trx_t* trx,
const trx_t* trx,
const char* id);
/*****************************************************************//**
@ -406,23 +409,20 @@ innobase_convert_to_filename_charset(
const char* from, /* in: identifier to convert */
ulint len); /* in: length of 'to', in bytes */
/********************************************************************//**
Helper function to push warnings from InnoDB internals to SQL-layer. */
void
ib_push_warning(
trx_t* trx, /*!< in: trx */
dberr_t error, /*!< in: error code to push as warning */
const char *format,/*!< in: warning message */
...);
/** Report that a table cannot be decrypted.
@param thd connection context
@param table table that cannot be decrypted
@retval DB_DECRYPTION_FAILED (always) */
ATTRIBUTE_COLD
dberr_t innodb_decryption_failed(THD *thd, dict_table_t *table);
/********************************************************************//**
Helper function to push warnings from InnoDB internals to SQL-layer. */
void
ib_push_warning(
void* ithd, /*!< in: thd */
dberr_t error, /*!< in: error code to push as warning */
const char *format,/*!< in: warning message */
...);
/** Report a foreign key error.
@param error error to report
@param name table name
@param foreign constraint */
ATTRIBUTE_COLD
void innodb_fk_error(const trx_t *trx, dberr_t err, const char *name,
const dict_foreign_t& foreign);
/********************************************************************//**
Helper function to push warnings from InnoDB internals to SQL-layer. */

View file

@ -3061,7 +3061,8 @@ row_ins_sec_index_entry_low(
if (err != DB_SUCCESS) {
if (err == DB_DECRYPTION_FAILED) {
btr_decryption_failed(*index);
innodb_decryption_failed(thr_get_trx(thr)->mysql_thd,
index->table);
}
goto func_exit;
}

View file

@ -4730,13 +4730,9 @@ row_merge_build_indexes(
/* Do not continue if we can't encrypt table pages */
if (!old_table->is_readable() ||
!new_table->is_readable()) {
error = DB_DECRYPTION_FAILED;
ib_push_warning(trx->mysql_thd, DB_DECRYPTION_FAILED,
"Table %s is encrypted but encryption service or"
" 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);
error = innodb_decryption_failed(trx->mysql_thd,
!old_table->is_readable()
? old_table : new_table);
goto func_exit;
}

View file

@ -1186,51 +1186,26 @@ row_lock_table(row_prebuilt_t* prebuilt)
return(err);
}
/** Determine is tablespace encrypted but decryption failed, is table corrupted
or is tablespace .ibd file missing.
@param[in] table Table
@param[in] trx Transaction
@param[in] push_warning true if we should push warning to user
/** Report an error for a failure to access a table.
@param table unreadable table
@param trx transaction
@retval DB_DECRYPTION_FAILED table is encrypted but decryption failed
@retval DB_CORRUPTION table is corrupted
@retval DB_TABLESPACE_NOT_FOUND tablespace .ibd file not found */
static
dberr_t
row_mysql_get_table_status(
const dict_table_t* table,
trx_t* trx,
bool push_warning = true)
ATTRIBUTE_COLD
static dberr_t row_mysql_get_table_error(trx_t *trx, dict_table_t *table)
{
dberr_t err;
if (const fil_space_t* space = table->space) {
if (space->crypt_data && space->crypt_data->is_encrypted()) {
// maybe we cannot access the table due to failing
// to decrypt
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);
}
if (const fil_space_t *space= table->space)
{
if (space->crypt_data && space->crypt_data->is_encrypted())
return innodb_decryption_failed(trx->mysql_thd, table);
return DB_CORRUPTION;
}
err = DB_DECRYPTION_FAILED;
} else {
if (push_warning) {
ib_push_warning(trx, DB_CORRUPTION,
"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);
const int dblen= int(table->name.dblen());
sql_print_error("InnoDB .ibd file is missing for table %`.*s.%`s",
dblen, table->name.m_name, table->name.m_name + dblen + 1);
return DB_TABLESPACE_NOT_FOUND;
}
/** Does an insert for MySQL.
@ -1266,7 +1241,7 @@ row_insert_for_mysql(
return(DB_TABLESPACE_DELETED);
} 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) {
return(DB_READ_ONLY);
} else if (UNIV_UNLIKELY(table->corrupted)
@ -1623,7 +1598,7 @@ row_update_for_mysql(row_prebuilt_t* prebuilt)
ut_ad(table->stat_initialized);
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) {

View file

@ -4842,7 +4842,8 @@ page_corrupted:
if (err != DB_SUCCESS) {
if (err == DB_DECRYPTION_FAILED) {
btr_decryption_failed(*index);
innodb_decryption_failed(trx->mysql_thd,
index->table);
}
rec = NULL;
goto page_read_error;

View file

@ -21,7 +21,6 @@
#define MYSQL_SERVER 1
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
#include "sql_priv.h"
#include "probes_mysql.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)))
DBUG_RETURN(error_num);
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:
#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"));
if (table_share->primary_key != MAX_KEY)
{
@ -1217,7 +1210,6 @@ int ha_spider::extra(
}
}
break;
#endif
default:
break;
}
@ -6464,9 +6456,7 @@ int ha_spider::info(
DBUG_ENTER("ha_spider::info");
DBUG_PRINT("info",("spider this=%p", this));
DBUG_PRINT("info",("spider flag=%x", flag));
#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT
auto_inc_temporary = FALSE;
#endif
wide_handler->sql_command = thd_sql_command(thd);
/*
if (
@ -6482,9 +6472,7 @@ int ha_spider::info(
share->lgtm_tblhnd_share->auto_increment_value;
else {
stats.auto_increment_value = 1;
#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT
auto_inc_temporary = TRUE;
#endif
}
}
if (
@ -6743,9 +6731,7 @@ int ha_spider::info(
}
if (flag & HA_STATUS_AUTO)
{
#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT
auto_inc_temporary = FALSE;
#endif
if (share->wide_share && table->next_number_field)
{
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()
{
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
));
}
#endif
int ha_spider::update_auto_increment()
{
@ -7918,19 +7902,11 @@ int ha_spider::end_bulk_update(
DBUG_RETURN(0);
}
#ifdef SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA
int ha_spider::bulk_update_row(
const uchar *old_data,
const uchar *new_data,
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_PRINT("info",("spider this=%p", this));
@ -7938,17 +7914,10 @@ int ha_spider::bulk_update_row(
DBUG_RETURN(update_row(old_data, new_data));
}
#ifdef SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA
int ha_spider::update_row(
const uchar *old_data,
const uchar *new_data
)
#else
int ha_spider::update_row(
const uchar *old_data,
uchar *new_data
)
#endif
{
int error_num;
THD *thd = ha_thd();

View file

@ -123,9 +123,7 @@ public:
bool pre_bitmap_checked;
bool bulk_insert;
bool info_auto_called;
#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT
bool auto_inc_temporary;
#endif
int bulk_size= 0;
int direct_dup_insert;
int store_error_num;
@ -354,9 +352,7 @@ public:
uint max_supported_key_part_length() const override;
uint8 table_cache_type() 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;
#endif
int update_auto_increment();
void get_auto_increment(
ulonglong offset,
@ -377,7 +373,6 @@ public:
bool start_bulk_update() override;
int exec_bulk_update(ha_rows *dup_key_found) override;
int end_bulk_update() override;
#ifdef SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA
int bulk_update_row(
const uchar *old_data,
const uchar *new_data,
@ -387,17 +382,6 @@ public:
const uchar *old_data,
const uchar *new_data
) 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(
st_select_lex *select_lex,
longlong select_limit,

View file

@ -17,7 +17,6 @@
#define MYSQL_SERVER 1
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"
@ -3024,32 +3023,6 @@ void *spider_bg_sts_action(
trx, &spider, FALSE, FALSE, SPIDER_CONN_KIND_MYSQL,
&error_num);
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;
}
if (spider.search_link_idx != -1 && conns[spider.search_link_idx])
@ -3060,31 +3033,6 @@ void *spider_bg_sts_action(
share->bg_sts_sync,
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;
}
}
@ -3327,12 +3275,6 @@ void *spider_bg_crd_action(
if (spider.search_link_idx < 0)
{
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,
share->link_statuses, share->access_balances, spider.conn_link_idx,
share->link_count, SPIDER_LINK_STATUS_OK);
@ -3349,32 +3291,6 @@ void *spider_bg_crd_action(
trx, &spider, FALSE, FALSE, SPIDER_CONN_KIND_MYSQL,
&error_num);
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;
}
if (spider.search_link_idx != -1 && conns[spider.search_link_idx])
@ -3385,31 +3301,6 @@ void *spider_bg_crd_action(
share->bg_crd_sync,
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;
}
}
@ -3714,17 +3605,11 @@ void *spider_bg_mon_action(
share->monitoring_bg_interval[link_idx] * 1000);
pthread_cond_timedwait(&share->bg_mon_sleep_conds[link_idx],
&share->bg_mon_mutexes[link_idx], &abstime);
/*
my_sleep((ulong) share->monitoring_bg_interval[link_idx]);
*/
}
DBUG_PRINT("info",("spider bg mon roop start"));
if (share->bg_mon_kill)
{
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_mutex_unlock(&share->bg_mon_mutexes[link_idx]);
spider_free_trx(trx, TRUE);

View file

@ -17,7 +17,6 @@
#define MYSQL_SERVER 1
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"

View file

@ -17,7 +17,6 @@
#define MYSQL_SERVER 1
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"

View file

@ -17,7 +17,6 @@
#define MYSQL_SERVER 1
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"

View file

@ -17,7 +17,6 @@
#define MYSQL_SERVER 1
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"
@ -2005,9 +2004,7 @@ int spider_db_mbase::connect(
connect_retry_count--;
my_sleep((ulong) connect_retry_interval);
} else {
#ifdef SPIDER_NET_HAS_THD
db_conn->net.thd = NULL;
#endif
if (connect_mutex)
pthread_mutex_unlock(&spider_open_conn_mutex);
break;

View file

@ -17,7 +17,6 @@
#define MYSQL_SERVER 1
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"

View file

@ -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 */

View file

@ -17,7 +17,6 @@
#define MYSQL_SERVER 1
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"

View file

@ -17,7 +17,6 @@
#define MYSQL_SERVER 1
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"

View file

@ -88,8 +88,6 @@
#define SPIDER_FIELD_FIELDPTR_REQUIRES_THDPTR
#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_WITHOUT_HA_STATISTIC_INCREMENT

View file

@ -17,7 +17,6 @@
#define MYSQL_SERVER 1
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"

View file

@ -37,7 +37,6 @@
#define MYSQL_SERVER 1
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"

View file

@ -17,7 +17,6 @@
#define MYSQL_SERVER 1
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"

View file

@ -16,7 +16,6 @@
#define MYSQL_SERVER 1
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"

View file

@ -17,7 +17,6 @@
#define MYSQL_SERVER 1
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
#include "sql_priv.h"
#include "probes_mysql.h"
#include "my_getopt.h"

View file

@ -17,7 +17,6 @@
#define MYSQL_SERVER 1
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"

View file

@ -15,7 +15,6 @@
#define MYSQL_SERVER 1
#include <my_global.h>
#include "spd_environ.h"
#include "mysql.h"
#include "spd_udf.h"