remove dead code

reduce the amount of engine-specific code in the server,
particularly as it does not serve any purpose now.

may be needed for VP engine,
to be reconsidered in MDEV-7795
This commit is contained in:
Sergei Golubchik 2020-06-07 20:39:31 +02:00
parent 76cb2f9dd6
commit 89a33303c4
11 changed files with 10 additions and 248 deletions

View file

@ -7241,8 +7241,6 @@ bool ha_partition::check_parallel_search()
if (order_field && order_field->table == table_list->table)
{
Field *part_field= m_part_info->full_part_field_array[0];
if (set_top_table_fields)
order_field= top_table_field[order_field->field_index];
DBUG_PRINT("info",("partition order_field: %p", order_field));
DBUG_PRINT("info",("partition part_field: %p", part_field));
if (part_field == order_field)
@ -7286,8 +7284,6 @@ bool ha_partition::check_parallel_search()
if (group_field && group_field->table == table_list->table)
{
Field *part_field= m_part_info->full_part_field_array[0];
if (set_top_table_fields)
group_field= top_table_field[group_field->field_index];
DBUG_PRINT("info",("partition group_field: %p", group_field));
DBUG_PRINT("info",("partition part_field: %p", part_field));
if (part_field == group_field)
@ -11223,22 +11219,6 @@ const COND *ha_partition::cond_push(const COND *cond)
COND *res_cond= NULL;
DBUG_ENTER("ha_partition::cond_push");
if (set_top_table_fields)
{
/*
We want to do this in a separate loop to not come into a situation
where we have only done cond_push() to some of the tables
*/
do
{
if (((*file)->set_top_table_and_fields(top_table,
top_table_field,
top_table_fields)))
DBUG_RETURN(cond); // Abort cond push, no error
} while (*(++file));
file= m_file;
}
do
{
if ((*file)->pushed_cond != cond)
@ -11870,23 +11850,6 @@ int ha_partition::info_push(uint info_type, void *info)
}
void ha_partition::clear_top_table_fields()
{
handler **file;
DBUG_ENTER("ha_partition::clear_top_table_fields");
if (set_top_table_fields)
{
set_top_table_fields= FALSE;
top_table= NULL;
top_table_field= NULL;
top_table_fields= 0;
for (file= m_file; *file; file++)
(*file)->clear_top_table_fields();
}
DBUG_VOID_RETURN;
}
bool
ha_partition::can_convert_string(const Field_string* field,
const Column_definition& new_type) const

View file

@ -1552,7 +1552,6 @@ public:
*/
const COND *cond_push(const COND *cond) override;
void cond_pop() override;
void clear_top_table_fields() override;
int info_push(uint info_type, void *info) override;
private:

View file

@ -6581,7 +6581,6 @@ int handler::ha_reset()
cancel_pushed_idx_cond();
/* Reset information about pushed index conditions */
cancel_pushed_rowid_filter();
clear_top_table_fields();
if (lookup_handler != this)
{
lookup_handler->ha_external_unlock(table->in_use);

View file

@ -3238,12 +3238,6 @@ public:
/** End a batch started with @c start_psi_batch_mode. */
void end_psi_batch_mode();
bool set_top_table_fields;
struct TABLE *top_table;
Field **top_table_field;
uint top_table_fields;
/* If we have row logging enabled for this table */
bool row_logging, row_logging_init;
/* If the row logging should be done in transaction cache */
@ -3292,8 +3286,6 @@ public:
m_psi_batch_mode(PSI_BATCH_MODE_NONE),
m_psi_numrows(0),
m_psi_locker(NULL),
set_top_table_fields(FALSE), top_table(0),
top_table_field(0), top_table_fields(0),
row_logging(0), row_logging_init(0),
m_lock_type(F_UNLCK), ha_share(NULL), m_prev_insert_id(0)
{
@ -4335,36 +4327,6 @@ public:
*/
virtual int info_push(uint info_type, void *info) { return 0; };
/**
This function is used to get correlating of a parent (table/column)
and children (table/column). When conditions are pushed down to child
table (like child of myisam_merge), child table needs to know about
which table/column is my parent for understanding conditions.
*/
virtual int set_top_table_and_fields(TABLE *top_table,
Field **top_table_field,
uint top_table_fields)
{
if (!set_top_table_fields)
{
set_top_table_fields= TRUE;
this->top_table= top_table;
this->top_table_field= top_table_field;
this->top_table_fields= top_table_fields;
}
return 0;
}
virtual void clear_top_table_fields()
{
if (set_top_table_fields)
{
set_top_table_fields= FALSE;
top_table= NULL;
top_table_field= NULL;
top_table_fields= 0;
}
}
/**
Push down an index condition to the handler.

View file

@ -1978,13 +1978,11 @@ retry_share:
MYF(MY_WME))))
goto err_lock;
table_list->intention_table= table;
error= open_table_from_share(thd, share, &table_list->alias,
HA_OPEN_KEYFILE | HA_TRY_READ_ONLY,
EXTRA_RECORD,
thd->open_options, table, FALSE,
IF_PARTITIONING(table_list->partition_names,0),
table_list);
IF_PARTITIONING(table_list->partition_names,0));
if (unlikely(error))
{

View file

@ -3868,8 +3868,7 @@ bool copy_keys_from_share(TABLE *outparam, MEM_ROOT *root)
enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share,
const LEX_CSTRING *alias, uint db_stat, uint prgflag,
uint ha_open_flags, TABLE *outparam,
bool is_create_table, List<String> *partitions_to_open,
TABLE_LIST *table_list)
bool is_create_table, List<String> *partitions_to_open)
{
enum open_frm_error error;
uint records, i, bitmap_size, bitmap_count;
@ -3891,7 +3890,6 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share,
outparam->s= share;
outparam->db_stat= db_stat;
outparam->write_row_record= NULL;
outparam->intention_pos_in_table_list= table_list;
if (share->incompatible_version &&
!(ha_open_flags & (HA_OPEN_FOR_ALTER | HA_OPEN_FOR_REPAIR)))

View file

@ -1289,9 +1289,6 @@ public:
/* Table's triggers, 0 if there are no of them */
Table_triggers_list *triggers;
TABLE_LIST *pos_in_table_list;/* Element referring to this table */
/* This is same as pos_in_table_list, but it is set as soon as possible when
TABLE is allocated */
TABLE_LIST *intention_pos_in_table_list;
/* Position in thd->locked_table_list under LOCK TABLES */
TABLE_LIST *pos_in_locked_tables;
/* Tables used in DEFAULT and CHECK CONSTRAINT (normally sequence tables) */
@ -2265,9 +2262,6 @@ struct TABLE_LIST
/* Index names in a "... JOIN ... USE/IGNORE INDEX ..." clause. */
List<Index_hint> *index_hints;
TABLE *table; /* opened table */
/* This is same as table, but it is set as soon as possible when
TABLE is allocated */
TABLE *intention_table;
ulonglong table_id; /* table id (from binlog) for opened table */
/*
select_result for derived table to pass it from table creation to table
@ -3113,8 +3107,7 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share,
const LEX_CSTRING *alias, uint db_stat, uint prgflag,
uint ha_open_flags, TABLE *outparam,
bool is_create_table,
List<String> *partitions_to_open= NULL,
TABLE_LIST *table_list= NULL);
List<String> *partitions_to_open= NULL);
bool copy_keys_from_share(TABLE *outparam, MEM_ROOT *root);
bool fix_session_vcol_expr(THD *thd, Virtual_column_info *vcol);
bool fix_session_vcol_expr_for_read(THD *thd, Field *field,

View file

@ -424,15 +424,7 @@ int ha_spider::open(
wide_handler->rnd_write_bitmap = rnd_write_bitmap;
wide_handler->owner = owner;
if (table_share->tmp_table == NO_TMP_TABLE)
{
TABLE_LIST *top = spider_get_parent_table_list(this);
if (top->intention_table)
{
wide_handler->top_share = top->intention_table->s;
} else {
wide_handler->top_share = top->table->s;
}
}
wide_handler->top_share = table->s;
owner->wide_handler_owner = TRUE;
memset(wide_handler->ft_discard_bitmap, 0xFF,
no_bytes_in_map(table->read_set));
@ -12059,80 +12051,6 @@ bool ha_spider::is_fatal_error(
DBUG_RETURN(TRUE);
}
int ha_spider::set_top_table_and_fields(
TABLE *top_table,
Field **top_table_field,
uint top_table_fields
) {
DBUG_ENTER("ha_spider::set_top_table_and_fields");
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (
wide_handler->stage == SPD_HND_STAGE_SET_TOP_TABLE_AND_FIELDS &&
wide_handler->stage_executor != this)
{
DBUG_RETURN(0);
}
wide_handler->stage = SPD_HND_STAGE_SET_TOP_TABLE_AND_FIELDS;
wide_handler->stage_executor = this;
#endif
if (!wide_handler->set_top_table_fields)
{
wide_handler->set_top_table_fields = TRUE;
wide_handler->top_table = top_table;
wide_handler->top_table_field = top_table_field;
wide_handler->top_table_fields = top_table_fields;
}
DBUG_RETURN(0);
}
void ha_spider::clear_top_table_fields()
{
DBUG_ENTER("ha_spider::clear_top_table_fields");
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (
wide_handler->stage == SPD_HND_STAGE_CLEAR_TOP_TABLE_FIELDS &&
wide_handler->stage_executor != this)
{
DBUG_VOID_RETURN;
}
wide_handler->stage = SPD_HND_STAGE_CLEAR_TOP_TABLE_FIELDS;
wide_handler->stage_executor = this;
#endif
if (wide_handler->set_top_table_fields)
{
wide_handler->set_top_table_fields = FALSE;
wide_handler->top_table = NULL;
wide_handler->top_table_field = NULL;
wide_handler->top_table_fields = 0;
}
DBUG_VOID_RETURN;
}
Field *ha_spider::get_top_table_field(
uint16 field_index
) {
Field *field;
DBUG_ENTER("ha_spider::get_top_table_field");
#ifdef HA_CAN_BULK_ACCESS
if (is_bulk_access_clone)
{
DBUG_RETURN(pt_clone_source_handler->get_top_table_field(field_index));
}
#endif
DBUG_PRINT("info",("spider field_index=%u", field_index));
#ifdef HANDLER_HAS_TOP_TABLE_FIELDS
if (wide_handler->set_top_table_fields)
{
field = wide_handler->top_table->field[field_index];
} else {
#endif
field = table->field[field_index];
#ifdef HANDLER_HAS_TOP_TABLE_FIELDS
}
#endif
DBUG_PRINT("info",("spider out field=%p", field));
DBUG_RETURN(field);
}
Field *ha_spider::field_exchange(
Field *field
) {
@ -12145,22 +12063,9 @@ Field *ha_spider::field_exchange(
#endif
DBUG_PRINT("info",("spider in field=%p", field));
DBUG_PRINT("info",("spider in field->table=%p", field->table));
#ifdef HANDLER_HAS_TOP_TABLE_FIELDS
if (wide_handler->set_top_table_fields)
{
DBUG_PRINT("info",("spider top_table=%p", wide_handler->top_table));
if (field->table != wide_handler->top_table)
DBUG_RETURN(NULL);
if (!(field = wide_handler->top_table_field[field->field_index]))
DBUG_RETURN(NULL);
} else {
#endif
DBUG_PRINT("info",("spider table=%p", table));
if (field->table != table)
DBUG_RETURN(NULL);
#ifdef HANDLER_HAS_TOP_TABLE_FIELDS
}
#endif
DBUG_PRINT("info",("spider table=%p", table));
if (field->table != table)
DBUG_RETURN(NULL);
DBUG_PRINT("info",("spider out field=%p", field));
DBUG_RETURN(field);
}
@ -12513,16 +12418,6 @@ TABLE *ha_spider::get_table()
DBUG_RETURN(table);
}
TABLE *ha_spider::get_top_table()
{
DBUG_ENTER("ha_spider::get_top_table");
#ifdef HANDLER_HAS_TOP_TABLE_FIELDS
if (set_top_table_fields)
DBUG_RETURN(top_table);
#endif
DBUG_RETURN(table);
}
void ha_spider::set_ft_discard_bitmap()
{
DBUG_ENTER("ha_spider::set_ft_discard_bitmap");

View file

@ -855,15 +855,6 @@ public:
int error_num,
uint flags
);
int set_top_table_and_fields(
TABLE *top_table,
Field **top_table_field,
uint top_table_fields
);
void clear_top_table_fields();
Field *get_top_table_field(
uint16 field_index
);
Field *field_exchange(
Field *field
);
@ -879,7 +870,6 @@ public:
void return_record_by_parent();
#endif
TABLE *get_table();
TABLE *get_top_table();
void set_ft_discard_bitmap();
void set_searched_bitmap();
void set_clone_searched_bitmap();

View file

@ -726,8 +726,6 @@ typedef struct st_spider_wide_handler
List<Item> *direct_update_fields;
List<Item> *direct_update_values;
#endif
TABLE *top_table;
Field **top_table_field;
TABLE_SHARE *top_share;
enum thr_lock_type lock_type;
uchar lock_table_type;
@ -773,7 +771,6 @@ typedef struct st_spider_wide_handler
bool write_can_replace;
bool insert_with_update;
bool cond_check;
bool set_top_table_fields;
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
bool hs_increment;

View file

@ -8743,28 +8743,9 @@ void spider_free_tmp_dbton_handler(
TABLE_LIST *spider_get_parent_table_list(
ha_spider *spider
) {
TABLE *table = spider->get_top_table();
TABLE_LIST *current, *parent;
TABLE *table = spider->get_table();
DBUG_ENTER("spider_get_parent_table_list");
DBUG_PRINT("info",("spider table=%p", table));
if (table->pos_in_table_list)
{
current = table->pos_in_table_list;
} else {
current = table->intention_pos_in_table_list;
}
#ifdef HANDLER_HAS_TOP_TABLE_FIELDS
if (!spider->set_top_table_fields)
{
#endif
while ((parent = current->parent_l))
{
current = parent;
}
#ifdef HANDLER_HAS_TOP_TABLE_FIELDS
}
#endif
DBUG_RETURN(current);
DBUG_RETURN(table->pos_in_table_list);
}
List<Index_hint> *spider_get_index_hints(
@ -9087,7 +9068,7 @@ bool spider_check_direct_order_limit(
longlong select_limit;
longlong offset_limit;
DBUG_ENTER("spider_check_direct_order_limit");
if (spider_check_index_merge(spider->get_top_table(),
if (spider_check_index_merge(spider->get_table(),
spider_get_select_lex(spider)))
{
DBUG_PRINT("info",("spider set use_index_merge"));
@ -9343,22 +9324,9 @@ Field *spider_field_exchange(
#endif
DBUG_PRINT("info",("spider in field=%p", field));
DBUG_PRINT("info",("spider in field->table=%p", field->table));
#ifdef HANDLER_HAS_TOP_TABLE_FIELDS
if (handler->set_top_table_fields)
{
DBUG_PRINT("info",("spider top_table=%p", handler->top_table));
if (field->table != handler->top_table)
DBUG_RETURN(NULL);
if (!(field = handler->top_table_field[field->field_index]))
DBUG_RETURN(NULL);
} else {
#endif
DBUG_PRINT("info",("spider table=%p", handler->get_table()));
if (field->table != handler->get_table())
DBUG_RETURN(NULL);
#ifdef HANDLER_HAS_TOP_TABLE_FIELDS
}
#endif
DBUG_PRINT("info",("spider out field=%p", field));
DBUG_RETURN(field);
}