Both bugs are caused by the same problem: the function optimize_cond() should
update the value of *cond_equal rather than the value of join->cond_equal,
because it is called not only for the WHERE condition, but for the HAVING
condition as well.
Revert the old patch revid:monty@askmonty.org-20100325133339-7mkel6valai0b4lb
This patch caused the InnoDB part of the transaction to not be marked
read-write in some cases, which messes up XA commit (and likely other
stuff as well).
- With big_tables=ON, materialized table will use Aria (or MyISAM) SE, which
allows prefix key reads. However, the temp.table has rec_per_key=NULL which
causes the optimizer to crash when attempting to read index statistics for a
prefix index read.
- Fixed by providing a rec_per_key array with zeros (i.e. "no statistics data")
The calls of the function remove_eq_conds() may change the and/or structure
of the where conditions. So JOIN::equal_cond should be updated for non-recursive
calls of remove_eq_conds().
update_used_tables for the the where condition to update cached
indicators of constant subexpressions. It should be done before further
possible simplification of the where condition.
This change caused simplification of the executed where conditions
in many test cases.
MDEV-4556 Server crashes in SEL_ARG::rb_insert with index_merge+index_merge_sort_union, FORCE INDEX
- merge_same_index_scans() may put the same SEL_ARG tree in multiple result plans.
make it call incr_refs() on the SEL_ARG trees that it does key_or() on, because
key_or(sel_arg_tree_1, sel_arg_tree_2) call may invalidate SEL_ARG trees pointed
by sel_arg_tree_1 and sel_arg_tree_2.
In function ‘void* memset(void*, int, size_t)’,
inlined from ‘void Lifo_buffer::set_buffer_space(uchar*, uchar*)’ at sql_lifo_buffer.h:70:5,
inlined from ‘int DsMrr_impl::dsmrr_init(handler*, RANGE_SEQ_IF*, void*, uint, uint, HANDLER_BUFFER*)’ at multi_range_read.cc:895:62:
/usr/include/i386-linux-gnu/bits/string3.h:82:32: error: call to ‘__warn_memset_zero_len’ declared with attribute warning: memset used with constant zero length parameter; this could be due to transposed parameters [-Werror]
It was intentional that the buffer is set to zero length there.
- Item_direct_view_ref didn't clear its pointer to item_equal in ::cleanup.
- Some Item_direct_view_ref objects have statement lifetime (i.e. they
survive across multiple EXECUTE commands). Item_equal objects live only for
the duration of one EXECUTE. This caused Item_direct_view_ref to have a stale pointer,
which could cause all sorts of effects. (In this bug's testcase it was pointing to
the wrong Item_equal, causing wrong query result)
- Fixed by doing what Item_field::cleanup() does - don't keep item_equal pointer value.
- There is no testcase because the only testcase I've got is highly fragile (e.g. the
bug will not show up if @@datadir is of the wrong length).
The result is EMPTY for a buffer(line, -1), but we still
need one FALSE operation to be stored in the condition.
And we actually add it but forgot to alloc memory to store it.
- The problem was that JOIN::prepare() tried to set TABLE::maybe_null
for a table in join. Non-merged semi-join tables 1) are present as
join's base tables on second EXECUTE, but 2) do not yet have a TABLE
object.
Worked around the problem by putting mixed_implicit_grouping into JOIN
object, and then passing it to JTBM tables in setup_jtbm_semi_joins().
(mainly by backporting 5.5. changes)
mysql-test/suite/maria/t/distinct.test:
Remove the test that requires SSL. One test case for a bug is enough.
sql/scheduler.cc:
make it the same as in 5.5
storage/innodb_plugin/row/row0mysql.c:
make it the same as in 5.5
storage/innodb_plugin/row/row0sel.c:
make it the same as in 5.5
storage/xtradb/row/row0mysql.c:
make it the same as in 5.5
storage/xtradb/row/row0sel.c:
make it the same as in 5.5