MDEV-24719 backport MDEV-24705 from 10.5 to 10.2, 10.3, 10.4
Do not mark page as modified if log mode is MTR_LOG_ALL. Set log mode to
MTR_LOG_NO_REDO instead of MTR_LOG_ALL for the cases when pages must be
marked as modified but no log records are written for them.
MDEV-24940: dict_hdr_get_new_id() changes table id in dictionary header, but does not write log record for it
Take a look dict_hdr_get_new_id(). If a table is temporary, log mode is
set to MTR_LOG_NO_REDO. But then table id is increased and written back
to space 0. But it's not logged due to log mode.
The proper fix is:
MDEV-17794 Do not assign persistent ID for temporary tables
But we don't want to backport a half of 10.[345] commits in order to fix
all bugs properly for this certain custom build. So this commit is just a
simple workaround for the bug fix.
MDEV-24719 backport MDEV-24705 from 10.5 to 10.2, 10.3, 10.4
Backported. The general issue was in updating FIL_PAGE_LSN with the LSN
of the last applied record instead of MTR commit LSN during page recovery.
Fixed in this commit.
See recv_t::end_lsn, recv_add_to_hash_table() call from
recv_parse_log_recs() for details.
This is backport from 10.5. Strictly speaking this is not a backport because
in 10.5 all the code which writes to mtr was moved to mtr_t class,
and the corresponding mtr_t functions have block_t parameter,
and that is why it's quite easy to mark the block as modified for mtr
in 10.5, it's enough just to call the correcponding function from the
corredponding mtr_t functions, which modify the block.
In 10.2 the code which writes in mtr_t is spread among the code base,
and that is why we can't backport MDEV-22110 as is. The common idea is
to find all mlog_write_initial_log_record_fast() and
mlog_write_initial_log_record_low() calls, and mark blocks as modified
there. We can't do this inside of mlog_write_initial_log_record_fast()
or mlog_write_initial_log_record_low() because when log mode is
MTR_LOG_NONE or MTR_LOG_NO_REDO, the functions are not invoked(see also
mlog_open() and it's invocation).
The downside of such approach is performace impact due to frequent
mtr_t::memo_modify_page() calls from mlog_write_*() and mlog_log_string()
functions.
MDEV-24873 : galera.galera_as_slave_ctas MTR failed: Assertion `(&(&LOCK_thd_data)->m_mutex)->count > 0 && pthread_equal(pthread_self(), (&(&LOCK_thd_data)->m_mutex)->thread)' failed in sql_class.cc on THD::awake(killed_state)
Problem was that thd::awake assumes now that you hold THD::LOCK_thd_data
so we need to keep it when we call wsrep_thd_awake from
wsrep_abort_transaction.
Let us avoid the excessive allocation of explicit record locks
(a work-around of MDEV-24813) so that the test will execute
much faster under AddressSanitizer, MemorySanitizer, Valgrind.
MDEV-23291: SUM column from a derived table returns invalid values
The issue here was the read_set bitmap was not set for a field which
was used as a reference in an inner select.
We need to make sure that if we are in an inner select and we have
references from outer select then we update the table bitmaps for
such references.
Introduced a function in the class Item_subselect that would
update bitmaps of table for the references within a
subquery that are defined in outer selects.
MDEV-24779: main.subselect fails in buildbot with --ps-protocol
Follow-up fix to commit 26f5033(MDEV-23449)
The GROUP BY clause inside IN/ALL/ANY subquery is removed
when there is no aggregate function or HAVING clause in the subquery.
When the GROUP BY clause is removed, a subquery can also be removed
if it part of the GROUP BY clause. This is done inside the function
remove_redundant_subquery_clauses. Here we walk over the GROUP BY list
and remove a subselect from its unit via the callback function
eliminate_subselect_processor.
The issue here was that when the query was being re-executed it was trying
to reinitialize the select that was removed as stated above.
This is not required, so the fix would be to remove select_lex
both from tree lex structure and the global list of nodes so that
we don't do the reinitialization again.