Skip to content

Commit 0c7b018

Browse files
montywivuvova
authored andcommitted
Remove not used IPC_COND_USED_INDEX
1 parent acf282c commit 0c7b018

File tree

1 file changed

+4
-21
lines changed

1 file changed

+4
-21
lines changed

sql/opt_index_cond_pushdown.cc

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ bool uses_index_fields_only(Item *item, TABLE *tbl, uint keyno,
152152
}
153153
}
154154

155-
#define ICP_COND_USES_INDEX_ONLY 10
156155

157156
/*
158157
Get a part of the condition that can be checked using only index fields
@@ -161,8 +160,8 @@ bool uses_index_fields_only(Item *item, TABLE *tbl, uint keyno,
161160
make_cond_for_index()
162161
cond The source condition
163162
table The table that is partially available
164-
keyno The index in the above table. Only fields covered by the index
165-
are available
163+
keyno The index in the above table. Only fields covered by the
164+
index are available
166165
other_tbls_ok TRUE <=> Fields of other non-const tables are allowed
167166
168167
DESCRIPTION
@@ -173,8 +172,8 @@ bool uses_index_fields_only(Item *item, TABLE *tbl, uint keyno,
173172
174173
Example:
175174
make_cond_for_index(
176-
"cond(t1.field) AND cond(t2.key1) AND cond(t2.non_key) AND cond(t2.key2)",
177-
t2, keyno(t2.key1))
175+
"cond(t1.field) AND cond(t2.key1) AND cond(t2.non_key) AND cond(t2.key2)",
176+
t2, keyno(t2.key1))
178177
will return
179178
"cond(t1.field) AND cond(t2.key2)"
180179
@@ -189,7 +188,6 @@ static Item *make_cond_for_index(THD *thd, Item *cond, TABLE *table, uint keyno,
189188
return cond;
190189
if (cond->type() == Item::COND_ITEM)
191190
{
192-
uint n_marked= 0;
193191
if (((Item_cond*) cond)->functype() == Item_func::COND_AND_FUNC)
194192
{
195193
table_map used_tables= 0;
@@ -206,14 +204,7 @@ static Item *make_cond_for_index(THD *thd, Item *cond, TABLE *table, uint keyno,
206204
new_cond->argument_list()->push_back(fix, thd->mem_root);
207205
used_tables|= fix->used_tables();
208206
}
209-
if (item->marker == ICP_COND_USES_INDEX_ONLY)
210-
{
211-
n_marked++;
212-
item->marker= 0;
213-
}
214207
}
215-
if (n_marked ==((Item_cond*)cond)->argument_list()->elements)
216-
cond->marker= ICP_COND_USES_INDEX_ONLY;
217208
switch (new_cond->argument_list()->elements) {
218209
case 0:
219210
return (COND*) 0;
@@ -239,14 +230,7 @@ static Item *make_cond_for_index(THD *thd, Item *cond, TABLE *table, uint keyno,
239230
if (!fix)
240231
return (COND*) 0;
241232
new_cond->argument_list()->push_back(fix, thd->mem_root);
242-
if (item->marker == ICP_COND_USES_INDEX_ONLY)
243-
{
244-
n_marked++;
245-
item->marker= 0;
246-
}
247233
}
248-
if (n_marked ==((Item_cond*)cond)->argument_list()->elements)
249-
cond->marker= ICP_COND_USES_INDEX_ONLY;
250234
new_cond->quick_fix_field();
251235
new_cond->used_tables_cache= ((Item_cond_or*) cond)->used_tables_cache;
252236
new_cond->top_level_item();
@@ -256,7 +240,6 @@ static Item *make_cond_for_index(THD *thd, Item *cond, TABLE *table, uint keyno,
256240

257241
if (!uses_index_fields_only(cond, table, keyno, other_tbls_ok))
258242
return (COND*) 0;
259-
cond->marker= ICP_COND_USES_INDEX_ONLY;
260243
return cond;
261244
}
262245

0 commit comments

Comments
 (0)