Skip to content

Commit 89a3330

Browse files
committed
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
1 parent 76cb2f9 commit 89a3330

File tree

11 files changed

+10
-248
lines changed

11 files changed

+10
-248
lines changed

sql/ha_partition.cc

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -7241,8 +7241,6 @@ bool ha_partition::check_parallel_search()
72417241
if (order_field && order_field->table == table_list->table)
72427242
{
72437243
Field *part_field= m_part_info->full_part_field_array[0];
7244-
if (set_top_table_fields)
7245-
order_field= top_table_field[order_field->field_index];
72467244
DBUG_PRINT("info",("partition order_field: %p", order_field));
72477245
DBUG_PRINT("info",("partition part_field: %p", part_field));
72487246
if (part_field == order_field)
@@ -7286,8 +7284,6 @@ bool ha_partition::check_parallel_search()
72867284
if (group_field && group_field->table == table_list->table)
72877285
{
72887286
Field *part_field= m_part_info->full_part_field_array[0];
7289-
if (set_top_table_fields)
7290-
group_field= top_table_field[group_field->field_index];
72917287
DBUG_PRINT("info",("partition group_field: %p", group_field));
72927288
DBUG_PRINT("info",("partition part_field: %p", part_field));
72937289
if (part_field == group_field)
@@ -11223,22 +11219,6 @@ const COND *ha_partition::cond_push(const COND *cond)
1122311219
COND *res_cond= NULL;
1122411220
DBUG_ENTER("ha_partition::cond_push");
1122511221

11226-
if (set_top_table_fields)
11227-
{
11228-
/*
11229-
We want to do this in a separate loop to not come into a situation
11230-
where we have only done cond_push() to some of the tables
11231-
*/
11232-
do
11233-
{
11234-
if (((*file)->set_top_table_and_fields(top_table,
11235-
top_table_field,
11236-
top_table_fields)))
11237-
DBUG_RETURN(cond); // Abort cond push, no error
11238-
} while (*(++file));
11239-
file= m_file;
11240-
}
11241-
1124211222
do
1124311223
{
1124411224
if ((*file)->pushed_cond != cond)
@@ -11870,23 +11850,6 @@ int ha_partition::info_push(uint info_type, void *info)
1187011850
}
1187111851

1187211852

11873-
void ha_partition::clear_top_table_fields()
11874-
{
11875-
handler **file;
11876-
DBUG_ENTER("ha_partition::clear_top_table_fields");
11877-
11878-
if (set_top_table_fields)
11879-
{
11880-
set_top_table_fields= FALSE;
11881-
top_table= NULL;
11882-
top_table_field= NULL;
11883-
top_table_fields= 0;
11884-
for (file= m_file; *file; file++)
11885-
(*file)->clear_top_table_fields();
11886-
}
11887-
DBUG_VOID_RETURN;
11888-
}
11889-
1189011853
bool
1189111854
ha_partition::can_convert_string(const Field_string* field,
1189211855
const Column_definition& new_type) const

sql/ha_partition.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1552,7 +1552,6 @@ class ha_partition :public handler
15521552
*/
15531553
const COND *cond_push(const COND *cond) override;
15541554
void cond_pop() override;
1555-
void clear_top_table_fields() override;
15561555
int info_push(uint info_type, void *info) override;
15571556

15581557
private:

sql/handler.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6581,7 +6581,6 @@ int handler::ha_reset()
65816581
cancel_pushed_idx_cond();
65826582
/* Reset information about pushed index conditions */
65836583
cancel_pushed_rowid_filter();
6584-
clear_top_table_fields();
65856584
if (lookup_handler != this)
65866585
{
65876586
lookup_handler->ha_external_unlock(table->in_use);

sql/handler.h

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3238,12 +3238,6 @@ class handler :public Sql_alloc
32383238
/** End a batch started with @c start_psi_batch_mode. */
32393239
void end_psi_batch_mode();
32403240

3241-
bool set_top_table_fields;
3242-
3243-
struct TABLE *top_table;
3244-
Field **top_table_field;
3245-
uint top_table_fields;
3246-
32473241
/* If we have row logging enabled for this table */
32483242
bool row_logging, row_logging_init;
32493243
/* If the row logging should be done in transaction cache */
@@ -3292,8 +3286,6 @@ class handler :public Sql_alloc
32923286
m_psi_batch_mode(PSI_BATCH_MODE_NONE),
32933287
m_psi_numrows(0),
32943288
m_psi_locker(NULL),
3295-
set_top_table_fields(FALSE), top_table(0),
3296-
top_table_field(0), top_table_fields(0),
32973289
row_logging(0), row_logging_init(0),
32983290
m_lock_type(F_UNLCK), ha_share(NULL), m_prev_insert_id(0)
32993291
{
@@ -4335,36 +4327,6 @@ class handler :public Sql_alloc
43354327
*/
43364328
virtual int info_push(uint info_type, void *info) { return 0; };
43374329

4338-
/**
4339-
This function is used to get correlating of a parent (table/column)
4340-
and children (table/column). When conditions are pushed down to child
4341-
table (like child of myisam_merge), child table needs to know about
4342-
which table/column is my parent for understanding conditions.
4343-
*/
4344-
virtual int set_top_table_and_fields(TABLE *top_table,
4345-
Field **top_table_field,
4346-
uint top_table_fields)
4347-
{
4348-
if (!set_top_table_fields)
4349-
{
4350-
set_top_table_fields= TRUE;
4351-
this->top_table= top_table;
4352-
this->top_table_field= top_table_field;
4353-
this->top_table_fields= top_table_fields;
4354-
}
4355-
return 0;
4356-
}
4357-
virtual void clear_top_table_fields()
4358-
{
4359-
if (set_top_table_fields)
4360-
{
4361-
set_top_table_fields= FALSE;
4362-
top_table= NULL;
4363-
top_table_field= NULL;
4364-
top_table_fields= 0;
4365-
}
4366-
}
4367-
43684330
/**
43694331
Push down an index condition to the handler.
43704332

sql/sql_base.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1978,13 +1978,11 @@ bool open_table(THD *thd, TABLE_LIST *table_list, Open_table_context *ot_ctx)
19781978
MYF(MY_WME))))
19791979
goto err_lock;
19801980

1981-
table_list->intention_table= table;
19821981
error= open_table_from_share(thd, share, &table_list->alias,
19831982
HA_OPEN_KEYFILE | HA_TRY_READ_ONLY,
19841983
EXTRA_RECORD,
19851984
thd->open_options, table, FALSE,
1986-
IF_PARTITIONING(table_list->partition_names,0),
1987-
table_list);
1985+
IF_PARTITIONING(table_list->partition_names,0));
19881986

19891987
if (unlikely(error))
19901988
{

sql/table.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3868,8 +3868,7 @@ bool copy_keys_from_share(TABLE *outparam, MEM_ROOT *root)
38683868
enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share,
38693869
const LEX_CSTRING *alias, uint db_stat, uint prgflag,
38703870
uint ha_open_flags, TABLE *outparam,
3871-
bool is_create_table, List<String> *partitions_to_open,
3872-
TABLE_LIST *table_list)
3871+
bool is_create_table, List<String> *partitions_to_open)
38733872
{
38743873
enum open_frm_error error;
38753874
uint records, i, bitmap_size, bitmap_count;
@@ -3891,7 +3890,6 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share,
38913890
outparam->s= share;
38923891
outparam->db_stat= db_stat;
38933892
outparam->write_row_record= NULL;
3894-
outparam->intention_pos_in_table_list= table_list;
38953893

38963894
if (share->incompatible_version &&
38973895
!(ha_open_flags & (HA_OPEN_FOR_ALTER | HA_OPEN_FOR_REPAIR)))

sql/table.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,9 +1289,6 @@ struct TABLE
12891289
/* Table's triggers, 0 if there are no of them */
12901290
Table_triggers_list *triggers;
12911291
TABLE_LIST *pos_in_table_list;/* Element referring to this table */
1292-
/* This is same as pos_in_table_list, but it is set as soon as possible when
1293-
TABLE is allocated */
1294-
TABLE_LIST *intention_pos_in_table_list;
12951292
/* Position in thd->locked_table_list under LOCK TABLES */
12961293
TABLE_LIST *pos_in_locked_tables;
12971294
/* Tables used in DEFAULT and CHECK CONSTRAINT (normally sequence tables) */
@@ -2265,9 +2262,6 @@ struct TABLE_LIST
22652262
/* Index names in a "... JOIN ... USE/IGNORE INDEX ..." clause. */
22662263
List<Index_hint> *index_hints;
22672264
TABLE *table; /* opened table */
2268-
/* This is same as table, but it is set as soon as possible when
2269-
TABLE is allocated */
2270-
TABLE *intention_table;
22712265
ulonglong table_id; /* table id (from binlog) for opened table */
22722266
/*
22732267
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,
31133107
const LEX_CSTRING *alias, uint db_stat, uint prgflag,
31143108
uint ha_open_flags, TABLE *outparam,
31153109
bool is_create_table,
3116-
List<String> *partitions_to_open= NULL,
3117-
TABLE_LIST *table_list= NULL);
3110+
List<String> *partitions_to_open= NULL);
31183111
bool copy_keys_from_share(TABLE *outparam, MEM_ROOT *root);
31193112
bool fix_session_vcol_expr(THD *thd, Virtual_column_info *vcol);
31203113
bool fix_session_vcol_expr_for_read(THD *thd, Field *field,

storage/spider/ha_spider.cc

Lines changed: 4 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -424,15 +424,7 @@ int ha_spider::open(
424424
wide_handler->rnd_write_bitmap = rnd_write_bitmap;
425425
wide_handler->owner = owner;
426426
if (table_share->tmp_table == NO_TMP_TABLE)
427-
{
428-
TABLE_LIST *top = spider_get_parent_table_list(this);
429-
if (top->intention_table)
430-
{
431-
wide_handler->top_share = top->intention_table->s;
432-
} else {
433-
wide_handler->top_share = top->table->s;
434-
}
435-
}
427+
wide_handler->top_share = table->s;
436428
owner->wide_handler_owner = TRUE;
437429
memset(wide_handler->ft_discard_bitmap, 0xFF,
438430
no_bytes_in_map(table->read_set));
@@ -12059,80 +12051,6 @@ bool ha_spider::is_fatal_error(
1205912051
DBUG_RETURN(TRUE);
1206012052
}
1206112053

12062-
int ha_spider::set_top_table_and_fields(
12063-
TABLE *top_table,
12064-
Field **top_table_field,
12065-
uint top_table_fields
12066-
) {
12067-
DBUG_ENTER("ha_spider::set_top_table_and_fields");
12068-
#ifdef WITH_PARTITION_STORAGE_ENGINE
12069-
if (
12070-
wide_handler->stage == SPD_HND_STAGE_SET_TOP_TABLE_AND_FIELDS &&
12071-
wide_handler->stage_executor != this)
12072-
{
12073-
DBUG_RETURN(0);
12074-
}
12075-
wide_handler->stage = SPD_HND_STAGE_SET_TOP_TABLE_AND_FIELDS;
12076-
wide_handler->stage_executor = this;
12077-
#endif
12078-
if (!wide_handler->set_top_table_fields)
12079-
{
12080-
wide_handler->set_top_table_fields = TRUE;
12081-
wide_handler->top_table = top_table;
12082-
wide_handler->top_table_field = top_table_field;
12083-
wide_handler->top_table_fields = top_table_fields;
12084-
}
12085-
DBUG_RETURN(0);
12086-
}
12087-
void ha_spider::clear_top_table_fields()
12088-
{
12089-
DBUG_ENTER("ha_spider::clear_top_table_fields");
12090-
#ifdef WITH_PARTITION_STORAGE_ENGINE
12091-
if (
12092-
wide_handler->stage == SPD_HND_STAGE_CLEAR_TOP_TABLE_FIELDS &&
12093-
wide_handler->stage_executor != this)
12094-
{
12095-
DBUG_VOID_RETURN;
12096-
}
12097-
wide_handler->stage = SPD_HND_STAGE_CLEAR_TOP_TABLE_FIELDS;
12098-
wide_handler->stage_executor = this;
12099-
#endif
12100-
if (wide_handler->set_top_table_fields)
12101-
{
12102-
wide_handler->set_top_table_fields = FALSE;
12103-
wide_handler->top_table = NULL;
12104-
wide_handler->top_table_field = NULL;
12105-
wide_handler->top_table_fields = 0;
12106-
}
12107-
DBUG_VOID_RETURN;
12108-
}
12109-
12110-
Field *ha_spider::get_top_table_field(
12111-
uint16 field_index
12112-
) {
12113-
Field *field;
12114-
DBUG_ENTER("ha_spider::get_top_table_field");
12115-
#ifdef HA_CAN_BULK_ACCESS
12116-
if (is_bulk_access_clone)
12117-
{
12118-
DBUG_RETURN(pt_clone_source_handler->get_top_table_field(field_index));
12119-
}
12120-
#endif
12121-
DBUG_PRINT("info",("spider field_index=%u", field_index));
12122-
#ifdef HANDLER_HAS_TOP_TABLE_FIELDS
12123-
if (wide_handler->set_top_table_fields)
12124-
{
12125-
field = wide_handler->top_table->field[field_index];
12126-
} else {
12127-
#endif
12128-
field = table->field[field_index];
12129-
#ifdef HANDLER_HAS_TOP_TABLE_FIELDS
12130-
}
12131-
#endif
12132-
DBUG_PRINT("info",("spider out field=%p", field));
12133-
DBUG_RETURN(field);
12134-
}
12135-
1213612054
Field *ha_spider::field_exchange(
1213712055
Field *field
1213812056
) {
@@ -12145,22 +12063,9 @@ Field *ha_spider::field_exchange(
1214512063
#endif
1214612064
DBUG_PRINT("info",("spider in field=%p", field));
1214712065
DBUG_PRINT("info",("spider in field->table=%p", field->table));
12148-
#ifdef HANDLER_HAS_TOP_TABLE_FIELDS
12149-
if (wide_handler->set_top_table_fields)
12150-
{
12151-
DBUG_PRINT("info",("spider top_table=%p", wide_handler->top_table));
12152-
if (field->table != wide_handler->top_table)
12153-
DBUG_RETURN(NULL);
12154-
if (!(field = wide_handler->top_table_field[field->field_index]))
12155-
DBUG_RETURN(NULL);
12156-
} else {
12157-
#endif
12158-
DBUG_PRINT("info",("spider table=%p", table));
12159-
if (field->table != table)
12160-
DBUG_RETURN(NULL);
12161-
#ifdef HANDLER_HAS_TOP_TABLE_FIELDS
12162-
}
12163-
#endif
12066+
DBUG_PRINT("info",("spider table=%p", table));
12067+
if (field->table != table)
12068+
DBUG_RETURN(NULL);
1216412069
DBUG_PRINT("info",("spider out field=%p", field));
1216512070
DBUG_RETURN(field);
1216612071
}
@@ -12513,16 +12418,6 @@ TABLE *ha_spider::get_table()
1251312418
DBUG_RETURN(table);
1251412419
}
1251512420

12516-
TABLE *ha_spider::get_top_table()
12517-
{
12518-
DBUG_ENTER("ha_spider::get_top_table");
12519-
#ifdef HANDLER_HAS_TOP_TABLE_FIELDS
12520-
if (set_top_table_fields)
12521-
DBUG_RETURN(top_table);
12522-
#endif
12523-
DBUG_RETURN(table);
12524-
}
12525-
1252612421
void ha_spider::set_ft_discard_bitmap()
1252712422
{
1252812423
DBUG_ENTER("ha_spider::set_ft_discard_bitmap");

storage/spider/ha_spider.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -855,15 +855,6 @@ class ha_spider: public handler
855855
int error_num,
856856
uint flags
857857
);
858-
int set_top_table_and_fields(
859-
TABLE *top_table,
860-
Field **top_table_field,
861-
uint top_table_fields
862-
);
863-
void clear_top_table_fields();
864-
Field *get_top_table_field(
865-
uint16 field_index
866-
);
867858
Field *field_exchange(
868859
Field *field
869860
);
@@ -879,7 +870,6 @@ class ha_spider: public handler
879870
void return_record_by_parent();
880871
#endif
881872
TABLE *get_table();
882-
TABLE *get_top_table();
883873
void set_ft_discard_bitmap();
884874
void set_searched_bitmap();
885875
void set_clone_searched_bitmap();

storage/spider/spd_include.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -726,8 +726,6 @@ typedef struct st_spider_wide_handler
726726
List<Item> *direct_update_fields;
727727
List<Item> *direct_update_values;
728728
#endif
729-
TABLE *top_table;
730-
Field **top_table_field;
731729
TABLE_SHARE *top_share;
732730
enum thr_lock_type lock_type;
733731
uchar lock_table_type;
@@ -773,7 +771,6 @@ typedef struct st_spider_wide_handler
773771
bool write_can_replace;
774772
bool insert_with_update;
775773
bool cond_check;
776-
bool set_top_table_fields;
777774
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
778775
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
779776
bool hs_increment;

0 commit comments

Comments
 (0)