Commit aa3f7a10 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-12699 preparation: Write MLOG_INDEX_LOAD for FTS_ tables

The record MLOG_INDEX_LOAD is supposed to be written to indicate that
some page modifications bypassed redo logging, and that redo logging
is now re-enabled. It was not written for fulltext indexes during
ALTER TABLE.

row_merge_write_redo(): Declare globally. Assert that the index
is neither a spatial nor fulltext index.

recv_mlog_index_load(): Observe a MLOG_INDEX_LOAD operation.

recv_parse_log_recs(): Handle MLOG_INDEX_LOAD also in multi-record
mini-transactions. Because of this omission, we should keep writing
MLOG_INDEX_LOAD in single-record mini-transactions, because older
versions of Mariabackup would fail.

row_fts_merge_insert(): Write MLOG_INDEX_LOAD for the auxiliary
tables of fulltext indexes.
parent 45d338dc
/*****************************************************************************
Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2015, 2017, MariaDB Corporation.
Copyright (c) 2015, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
......@@ -294,6 +294,12 @@ row_merge_drop_table(
dict_table_t* table) /*!< in: table instance to drop */
MY_ATTRIBUTE((nonnull, warn_unused_result));
/** Write an MLOG_INDEX_LOAD record to indicate in the redo-log
that redo-logging of individual index pages was disabled, and
the flushing of such pages to the data files was completed.
@param[in] index an index tree on which redo logging was disabled */
void row_merge_write_redo(const dict_index_t* index);
/** Build indexes on a table by reading a clustered index, creating a temporary
file containing index entries, merge sorting these index entries and inserting
sorted index entries to indexes.
......
......@@ -2527,6 +2527,15 @@ recv_report_corrupt_log(
return(true);
}
/** Report a MLOG_INDEX_LOAD operation.
@param[in] space_id tablespace identifier */
ATTRIBUTE_COLD static void recv_mlog_index_load(ulint space_id)
{
if (log_optimized_ddl_op) {
log_optimized_ddl_op(space_id);
}
}
/** Parse log records from a buffer and optionally store them to a
hash table to wait merging to file pages.
@param[in] checkpoint_lsn the LSN of the latest checkpoint
......@@ -2684,9 +2693,7 @@ bool recv_parse_log_recs(lsn_t checkpoint_lsn, store_t store, bool apply)
/* fall through */
case MLOG_INDEX_LOAD:
if (type == MLOG_INDEX_LOAD) {
if (log_optimized_ddl_op) {
log_optimized_ddl_op(space);
}
recv_mlog_index_load(space);
}
/* fall through */
case MLOG_FILE_NAME:
......@@ -2840,10 +2847,7 @@ bool recv_parse_log_recs(lsn_t checkpoint_lsn, store_t store, bool apply)
break;
#endif /* UNIV_LOG_LSN_DEBUG */
case MLOG_INDEX_LOAD:
/* Mariabackup FIXME: Report an error
when encountering MLOG_INDEX_LOAD on
--prepare or already on --backup. */
ut_a(srv_operation == SRV_OPERATION_NORMAL);
recv_mlog_index_load(space);
break;
case MLOG_FILE_NAME:
case MLOG_FILE_DELETE:
......
......@@ -1807,5 +1807,9 @@ row_fts_merge_insert(
ib::info() << "InnoDB_FTS: inserted " << count << " records";
}
if (psort_info[0].psort_common->trx->get_flush_observer()) {
row_merge_write_redo(aux_index);
}
return(error);
}
......@@ -4481,17 +4481,14 @@ row_merge_drop_table(
that redo-logging of individual index pages was disabled, and
the flushing of such pages to the data files was completed.
@param[in] index an index tree on which redo logging was disabled */
static
void
row_merge_write_redo(
const dict_index_t* index)
void row_merge_write_redo(const dict_index_t* index)
{
mtr_t mtr;
byte* log_ptr;
ut_ad(!dict_table_is_temporary(index->table));
ut_ad(!(index->type & (DICT_SPATIAL | DICT_FTS)));
mtr_t mtr;
mtr.start();
log_ptr = mlog_open(&mtr, 11 + 8);
byte* log_ptr = mlog_open(&mtr, 11 + 8);
log_ptr = mlog_write_initial_log_record_low(
MLOG_INDEX_LOAD,
index->space, index->page, log_ptr, &mtr);
......@@ -5030,7 +5027,10 @@ row_merge_build_indexes(
= dict_table_get_first_index(new_table);
index != NULL;
index = dict_table_get_next_index(index)) {
row_merge_write_redo(index);
if (!(index->type
& (DICT_FTS | DICT_SPATIAL))) {
row_merge_write_redo(index);
}
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment