MDEV-19747: Deprecate and ignore innodb_log_optimize_ddl

During native table rebuild or index creation, InnoDB used to skip
redo logging and write MLOG_INDEX_LOAD records to inform crash recovery
and Mariabackup of the gaps in redo log. This is fragile and prohibits
some optimizations, such as skipping the doublewrite buffer for
newly (re)initialized pages (MDEV-19738).

row_merge_write_redo(): Remove. We do not write MLOG_INDEX_LOAD
records any more. Instead, we write full redo log.

FlushObserver: Remove.

fseg_free_page_func(): Remove the parameter log. Redo logging
cannot be disabled.

fil_space_t::redo_skipped_count: Remove.

We cannot remove buf_block_t::skip_flush_check, because PageBulk
will temporarily generate invalid B-tree pages in the buffer pool.
This commit is contained in:
Marko Mäkelä 2020-02-11 18:44:26 +02:00
parent 8ccb3caafb
commit fc2f2fa853
46 changed files with 127 additions and 964 deletions

View File

@ -1,54 +0,0 @@
CREATE PROCEDURE populate_t1()
BEGIN
DECLARE i int DEFAULT 1;
START TRANSACTION;
WHILE (i <= 10000) DO
INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
SET i = i + 1;
END WHILE;
COMMIT;
END|
CREATE TABLE t1(
class INT,
id INT,
title VARCHAR(100)
) ENGINE=InnoDB;
SELECT COUNT(*) FROM t1;
COUNT(*)
10000
SET @saved_dbug= @@SESSION.debug_dbug;
SET debug_dbug='+d,ib_index_build_fail_before_flush';
CREATE INDEX idx_id ON t1(id);
ERROR 70100: Query execution was interrupted
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
CREATE INDEX idx_title ON t1(title);
ERROR 70100: Query execution was interrupted
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
CREATE FULLTEXT INDEX fidx_title ON t1(title);
ERROR 70100: Query execution was interrupted
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
ALTER TABLE t1 ADD COLUMN content TEXT, FORCE;
ERROR 70100: Query execution was interrupted
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
SET debug_dbug= @saved_dbug;
INSERT INTO t1 VALUES(10001, 10001, 'a10000');
ALTER TABLE t1 ADD UNIQUE INDEX idx_title(title);
ERROR 23000: Duplicate entry 'a10000' for key 'idx_title'
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
ALTER TABLE t1 ADD UNIQUE INDEX idx_id(id), ADD UNIQUE INDEX idx_title(title);
ERROR 23000: Duplicate entry 'a10000' for key 'idx_title'
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
DROP PROCEDURE populate_t1;

View File

@ -13,7 +13,7 @@ ALTER TABLE t1 DROP INDEX b, ADD INDEX (b), LOCK=SHARED;
# Kill the server # Kill the server
# restart: --debug=d,ib_log # restart: --debug=d,ib_log
FOUND 2 /scan \d+: multi-log rec MLOG_FILE_CREATE2 len \d+ page \d+:0/ in mysqld.1.err FOUND 2 /scan \d+: multi-log rec MLOG_FILE_CREATE2 len \d+ page \d+:0/ in mysqld.1.err
FOUND 3 /scan \d+: log rec MLOG_INDEX_LOAD/ in mysqld.1.err NOT FOUND /scan \d+: log rec MLOG_INDEX_LOAD/ in mysqld.1.err
CHECK TABLE t1; CHECK TABLE t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK

View File

@ -1,75 +0,0 @@
#
# Test flush on error in bulk load to make sure we do a proper cleanup.
# Note: We flush all dirty pages before applying any online log in bulk load.
#
-- source include/have_innodb.inc
-- source include/have_debug.inc
# Create Insert Procedure
DELIMITER |;
CREATE PROCEDURE populate_t1()
BEGIN
DECLARE i int DEFAULT 1;
START TRANSACTION;
WHILE (i <= 10000) DO
INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
SET i = i + 1;
END WHILE;
COMMIT;
END|
DELIMITER ;|
CREATE TABLE t1(
class INT,
id INT,
title VARCHAR(100)
) ENGINE=InnoDB;
-- disable_query_log
CALL populate_t1();
-- enable_query_log
SELECT COUNT(*) FROM t1;
SET @saved_dbug= @@SESSION.debug_dbug;
SET debug_dbug='+d,ib_index_build_fail_before_flush';
-- error ER_QUERY_INTERRUPTED
CREATE INDEX idx_id ON t1(id);
CHECK TABLE t1;
-- error ER_QUERY_INTERRUPTED
CREATE INDEX idx_title ON t1(title);
CHECK TABLE t1;
-- error ER_QUERY_INTERRUPTED
CREATE FULLTEXT INDEX fidx_title ON t1(title);
CHECK TABLE t1;
-- error ER_QUERY_INTERRUPTED
ALTER TABLE t1 ADD COLUMN content TEXT, FORCE;
CHECK TABLE t1;
SET debug_dbug= @saved_dbug;
INSERT INTO t1 VALUES(10001, 10001, 'a10000');
-- error ER_DUP_ENTRY
ALTER TABLE t1 ADD UNIQUE INDEX idx_title(title);
CHECK TABLE t1;
-- error ER_DUP_ENTRY
ALTER TABLE t1 ADD UNIQUE INDEX idx_id(id), ADD UNIQUE INDEX idx_title(title);
CHECK TABLE t1;
DROP TABLE t1;
DROP PROCEDURE populate_t1;

View File

@ -30,11 +30,10 @@ ALTER TABLE t1 DROP INDEX b, ADD INDEX (b), LOCK=SHARED;
--source include/start_mysqld.inc --source include/start_mysqld.inc
let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err; let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err;
let SEARCH_ABORT=NOT FOUND;
# ensure that we have exactly 2 records there. # ensure that we have exactly 2 records there.
let SEARCH_PATTERN=scan \d+: multi-log rec MLOG_FILE_CREATE2 len \d+ page \d+:0; let SEARCH_PATTERN=scan \d+: multi-log rec MLOG_FILE_CREATE2 len \d+ page \d+:0;
--source include/search_pattern_in_file.inc --source include/search_pattern_in_file.inc
# ensure that we have exactly 3 records there. # ensure that we have 0 records there.
let SEARCH_PATTERN=scan \d+: log rec MLOG_INDEX_LOAD; let SEARCH_PATTERN=scan \d+: log rec MLOG_INDEX_LOAD;
--source include/search_pattern_in_file.inc --source include/search_pattern_in_file.inc

View File

@ -1,37 +0,0 @@
SET GLOBAL innodb_log_optimize_ddl=OFF;
CREATE TABLE tz(id BIGINT PRIMARY KEY, i INT)
ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
INSERT INTO tz(id) select * from seq_1_to_10000;
CREATE TABLE tr(id BIGINT PRIMARY KEY, i INT)
ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
INSERT INTO tr(id) select * from seq_1_to_10000;
CREATE TABLE td(id BIGINT PRIMARY KEY, i INT)
ENGINE=InnoDB;
INSERT INTO td(id) select * from seq_1_to_10000;
CREATE PROCEDURE a()
BEGIN
ALTER TABLE tz ADD INDEX(i);
ALTER TABLE tr ADD INDEX(i);
ALTER TABLE td ADD INDEX(i);
END //
call a();
# shutdown server
# remove datadir
# xtrabackup move back
# restart
DROP PROCEDURE a;
CHECK TABLE tz,tr,td;
Table Op Msg_type Msg_text
test.tz check status OK
test.tr check status OK
test.td check status OK
SELECT COUNT(*) FROM tz;
COUNT(*)
10000
SELECT COUNT(*) FROM tr;
COUNT(*)
10000
SELECT COUNT(*) FROM td;
COUNT(*)
10000
DROP TABLE tz,tr,td;

View File

@ -1,47 +0,0 @@
# see unsupported_redo.test for the opposite (default) case
--source include/have_innodb.inc
--source include/have_sequence.inc
SET GLOBAL innodb_log_optimize_ddl=OFF;
CREATE TABLE tz(id BIGINT PRIMARY KEY, i INT)
ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
INSERT INTO tz(id) select * from seq_1_to_10000;
CREATE TABLE tr(id BIGINT PRIMARY KEY, i INT)
ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
INSERT INTO tr(id) select * from seq_1_to_10000;
CREATE TABLE td(id BIGINT PRIMARY KEY, i INT)
ENGINE=InnoDB;
INSERT INTO td(id) select * from seq_1_to_10000;
DELIMITER //;
CREATE PROCEDURE a()
BEGIN
ALTER TABLE tz ADD INDEX(i);
ALTER TABLE tr ADD INDEX(i);
ALTER TABLE td ADD INDEX(i);
END //
DELIMITER ;//
let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
send call a();
--disable_result_log
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir;
--enable_result_log
exec $XTRABACKUP --prepare --target-dir=$targetdir;
reap;
-- source include/restart_and_restore.inc
--rmdir $targetdir
DROP PROCEDURE a;
CHECK TABLE tz,tr,td;
SELECT COUNT(*) FROM tz;
SELECT COUNT(*) FROM tr;
SELECT COUNT(*) FROM td;
DROP TABLE tz,tr,td;

View File

@ -1,15 +0,0 @@
CREATE TABLE t1(i INT PRIMARY KEY auto_increment, a int) ENGINE INNODB;
INSERT INTO t1(a) SELECT * from seq_1_to_10000;
# xtrabackup backup
t1.frm
t1.ibd
t1.new
# xtrabackup prepare
# shutdown server
# remove datadir
# xtrabackup move back
# restart
SELECT COUNT(*) from t1;
COUNT(*)
10000
DROP TABLE t1;

View File

@ -1,27 +0,0 @@
--source include/have_debug.inc
CREATE TABLE t1(i INT PRIMARY KEY auto_increment, a int) ENGINE INNODB;
INSERT INTO t1(a) SELECT * from seq_1_to_10000;
let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
let after_copy_test_t1=CREATE INDEX a_ind ON test.t1(a) ALGORITHM=INPLACE;
echo # xtrabackup backup;
--disable_result_log
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --dbug=+d,mariabackup_events;
--enable_result_log
--list_files $targetdir/test t1*
--let before_copy_test_t1=
echo # xtrabackup prepare;
--disable_result_log
exec $XTRABACKUP --prepare --target-dir=$targetdir;
-- source include/restart_and_restore.inc
--enable_result_log
# Check that new table is there after restore.
SELECT COUNT(*) from t1;
DROP TABLE t1;
rmdir $targetdir;

View File

@ -7,7 +7,11 @@ ERROR HY000: Variable 'innodb_log_optimize_ddl' is a GLOBAL variable
Expected error 'Variable is a GLOBAL variable' Expected error 'Variable is a GLOBAL variable'
SELECT @@GLOBAL.innodb_log_optimize_ddl INTO @innodb_log_optimize_ddl_save; SELECT @@GLOBAL.innodb_log_optimize_ddl INTO @innodb_log_optimize_ddl_save;
SET @@GLOBAL.innodb_log_optimize_ddl = ON; SET @@GLOBAL.innodb_log_optimize_ddl = ON;
Warnings:
Warning 138 The parameter innodb_log_optimize_ddl is deprecated and has no effect.
SET @@GLOBAL.innodb_log_optimize_ddl = OFF; SET @@GLOBAL.innodb_log_optimize_ddl = OFF;
Warnings:
Warning 138 The parameter innodb_log_optimize_ddl is deprecated and has no effect.
SET @@GLOBAL.innodb_log_optimize_ddl = 13; SET @@GLOBAL.innodb_log_optimize_ddl = 13;
ERROR 42000: Variable 'innodb_log_optimize_ddl' can't be set to the value of '13' ERROR 42000: Variable 'innodb_log_optimize_ddl' can't be set to the value of '13'
SET @@GLOBAL.innodb_log_optimize_ddl = 'ABC'; SET @@GLOBAL.innodb_log_optimize_ddl = 'ABC';
@ -34,3 +38,5 @@ Expected error 'Variable is a GLOBAL variable'
SELECT innodb_log_optimize_ddl; SELECT innodb_log_optimize_ddl;
ERROR 42S22: Unknown column 'innodb_log_optimize_ddl' in 'field list' ERROR 42S22: Unknown column 'innodb_log_optimize_ddl' in 'field list'
SET GLOBAL innodb_log_optimize_ddl = @innodb_log_optimize_ddl_save; SET GLOBAL innodb_log_optimize_ddl = @innodb_log_optimize_ddl_save;
Warnings:
Warning 138 The parameter innodb_log_optimize_ddl is deprecated and has no effect.

View File

@ -1259,10 +1259,10 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME INNODB_LOG_OPTIMIZE_DDL VARIABLE_NAME INNODB_LOG_OPTIMIZE_DDL
SESSION_VALUE NULL SESSION_VALUE NULL
DEFAULT_VALUE ON DEFAULT_VALUE OFF
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN VARIABLE_TYPE BOOLEAN
VARIABLE_COMMENT Reduce redo logging when natively creating indexes or rebuilding tables. Setting this OFF avoids delay due to page flushing and allows concurrent backup. VARIABLE_COMMENT Deprecated parameter with no effect.
NUMERIC_MIN_VALUE NULL NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL NUMERIC_BLOCK_SIZE NULL

View File

@ -2,7 +2,7 @@
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc. Copyright (c) 2012, Facebook Inc.
Copyright (c) 2014, 2019, MariaDB Corporation. Copyright (c) 2014, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
@ -747,7 +747,7 @@ void btr_page_free(dict_index_t* index, buf_block_t* block, mtr_t* mtr,
: PAGE_HEADER + PAGE_BTR_SEG_TOP]; : PAGE_HEADER + PAGE_BTR_SEG_TOP];
fseg_free_page(seg_header, fseg_free_page(seg_header,
index->table->space, block->page.id.page_no(), index->table->space, block->page.id.page_no(),
block->index != NULL, !block->page.flush_observer, mtr); block->index != NULL, mtr);
/* The page was marked free in the allocation bitmap, but it /* The page was marked free in the allocation bitmap, but it
should remain exclusively latched until mtr_t::commit() or until it should remain exclusively latched until mtr_t::commit() or until it

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 2014, 2019, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2014, 2019, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2019, MariaDB Corporation. Copyright (c) 2017, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
@ -33,8 +33,6 @@ Created 03/11/2014 Shaohua Wang
/** Innodb B-tree index fill factor for bulk load. */ /** Innodb B-tree index fill factor for bulk load. */
uint innobase_fill_factor; uint innobase_fill_factor;
/** whether to reduce redo logging during ALTER TABLE */
my_bool innodb_log_optimize_ddl;
/** Initialize members, allocate page if needed and start mtr. /** Initialize members, allocate page if needed and start mtr.
Note: we commit all mtrs on failure. Note: we commit all mtrs on failure.
@ -51,13 +49,7 @@ PageBulk::init()
m_heap = mem_heap_create(1000); m_heap = mem_heap_create(1000);
m_mtr.start(); m_mtr.start();
if (m_flush_observer) {
m_mtr.set_log_mode(MTR_LOG_NO_REDO);
m_mtr.set_flush_observer(m_flush_observer);
} else {
m_index->set_modified(m_mtr); m_index->set_modified(m_mtr);
}
if (m_page_no == FIL_NULL) { if (m_page_no == FIL_NULL) {
mtr_t alloc_mtr; mtr_t alloc_mtr;
@ -233,7 +225,7 @@ inline void PageBulk::insertPage(const rec_t *rec, offset_t *offsets)
m_heap_top += rec_size; m_heap_top += rec_size;
m_rec_no += 1; m_rec_no += 1;
if (!m_flush_observer && !m_page_zip) { if (!m_page_zip) {
/* For ROW_FORMAT=COMPRESSED, redo log may be written /* For ROW_FORMAT=COMPRESSED, redo log may be written
in PageBulk::compress(). */ in PageBulk::compress(). */
page_cur_insert_rec_write_log(insert_rec, rec_size, page_cur_insert_rec_write_log(insert_rec, rec_size,
@ -322,7 +314,7 @@ inline void PageBulk::finishPage()
ut_ad(!page_get_instant(m_page)); ut_ad(!page_get_instant(m_page));
ut_ad(!mach_read_from_2(PAGE_HEADER + PAGE_N_DIRECTION + m_page)); ut_ad(!mach_read_from_2(PAGE_HEADER + PAGE_N_DIRECTION + m_page));
if (fmt != COMPRESSED && !m_flush_observer) { if (fmt != COMPRESSED) {
m_mtr.write<2,mtr_t::OPT>(*m_block, m_mtr.write<2,mtr_t::OPT>(*m_block,
PAGE_HEADER + PAGE_N_DIR_SLOTS PAGE_HEADER + PAGE_N_DIR_SLOTS
+ m_page, 2 + slot_index); + m_page, 2 + slot_index);
@ -671,13 +663,7 @@ dberr_t
PageBulk::latch() PageBulk::latch()
{ {
m_mtr.start(); m_mtr.start();
if (m_flush_observer) {
m_mtr.set_log_mode(MTR_LOG_NO_REDO);
m_mtr.set_flush_observer(m_flush_observer);
} else {
m_index->set_modified(m_mtr); m_index->set_modified(m_mtr);
}
/* In case the block is S-latched by page_cleaner. */ /* In case the block is S-latched by page_cleaner. */
if (!buf_page_optimistic_get(RW_X_LATCH, m_block, m_modify_clock, if (!buf_page_optimistic_get(RW_X_LATCH, m_block, m_modify_clock,
@ -720,7 +706,7 @@ BtrBulk::pageSplit(
/* 2. create a new page. */ /* 2. create a new page. */
PageBulk new_page_bulk(m_index, m_trx->id, FIL_NULL, PageBulk new_page_bulk(m_index, m_trx->id, FIL_NULL,
page_bulk->getLevel(), m_flush_observer); page_bulk->getLevel());
dberr_t err = new_page_bulk.init(); dberr_t err = new_page_bulk.init();
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
return(err); return(err);
@ -855,7 +841,7 @@ BtrBulk::insert(
if (level + 1 > m_page_bulks.size()) { if (level + 1 > m_page_bulks.size()) {
PageBulk* new_page_bulk PageBulk* new_page_bulk
= UT_NEW_NOKEY(PageBulk(m_index, m_trx->id, FIL_NULL, = UT_NEW_NOKEY(PageBulk(m_index, m_trx->id, FIL_NULL,
level, m_flush_observer)); level));
err = new_page_bulk->init(); err = new_page_bulk->init();
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
UT_DELETE(new_page_bulk); UT_DELETE(new_page_bulk);
@ -909,8 +895,7 @@ BtrBulk::insert(
/* Create a sibling page_bulk. */ /* Create a sibling page_bulk. */
PageBulk* sibling_page_bulk; PageBulk* sibling_page_bulk;
sibling_page_bulk = UT_NEW_NOKEY(PageBulk(m_index, m_trx->id, sibling_page_bulk = UT_NEW_NOKEY(PageBulk(m_index, m_trx->id,
FIL_NULL, level, FIL_NULL, level));
m_flush_observer));
err = sibling_page_bulk->init(); err = sibling_page_bulk->init();
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
UT_DELETE(sibling_page_bulk); UT_DELETE(sibling_page_bulk);
@ -935,10 +920,6 @@ BtrBulk::insert(
/* Important: log_free_check whether we need a checkpoint. */ /* Important: log_free_check whether we need a checkpoint. */
if (page_is_leaf(sibling_page_bulk->getPage())) { if (page_is_leaf(sibling_page_bulk->getPage())) {
if (trx_is_interrupted(m_trx)) { if (trx_is_interrupted(m_trx)) {
if (m_flush_observer) {
m_flush_observer->interrupted();
}
err = DB_INTERRUPTED; err = DB_INTERRUPTED;
goto func_exit; goto func_exit;
} }
@ -1032,8 +1013,7 @@ BtrBulk::finish(dberr_t err)
mtr_t mtr; mtr_t mtr;
buf_block_t* last_block; buf_block_t* last_block;
PageBulk root_page_bulk(m_index, m_trx->id, PageBulk root_page_bulk(m_index, m_trx->id,
m_index->page, m_root_level, m_index->page, m_root_level);
m_flush_observer);
mtr.start(); mtr.start();
m_index->set_modified(mtr); m_index->set_modified(mtr);
@ -1057,9 +1037,6 @@ BtrBulk::finish(dberr_t err)
/* Remove last page. */ /* Remove last page. */
btr_page_free(m_index, last_block, &mtr); btr_page_free(m_index, last_block, &mtr);
/* Do not flush the last page. */
last_block->page.flush_observer = NULL;
mtr.commit(); mtr.commit();
err = pageCommit(&root_page_bulk, NULL, false); err = pageCommit(&root_page_bulk, NULL, false);

View File

@ -7347,7 +7347,6 @@ struct btr_blob_log_check_t {
dict_index_t* index = m_pcur->index(); dict_index_t* index = m_pcur->index();
ulint offs = 0; ulint offs = 0;
ulint page_no = ULINT_UNDEFINED; ulint page_no = ULINT_UNDEFINED;
FlushObserver* observer = m_mtr->get_flush_observer();
if (UNIV_UNLIKELY(m_op == BTR_STORE_INSERT_BULK)) { if (UNIV_UNLIKELY(m_op == BTR_STORE_INSERT_BULK)) {
offs = page_offset(*m_rec); offs = page_offset(*m_rec);
@ -7368,7 +7367,6 @@ struct btr_blob_log_check_t {
m_mtr->start(); m_mtr->start();
m_mtr->set_log_mode(log_mode); m_mtr->set_log_mode(log_mode);
index->set_modified(*m_mtr); index->set_modified(*m_mtr);
m_mtr->set_flush_observer(observer);
if (UNIV_UNLIKELY(m_op == BTR_STORE_INSERT_BULK)) { if (UNIV_UNLIKELY(m_op == BTR_STORE_INSERT_BULK)) {
m_pcur->btr_cur.page_cur.block = btr_block_get( m_pcur->btr_cur.page_cur.block = btr_block_get(
@ -7563,7 +7561,6 @@ btr_store_big_rec_extern_fields(
mtr.start(); mtr.start();
index->set_modified(mtr); index->set_modified(mtr);
mtr.set_log_mode(btr_mtr->get_log_mode()); mtr.set_log_mode(btr_mtr->get_log_mode());
mtr.set_flush_observer(btr_mtr->get_flush_observer());
buf_page_get(rec_block->page.id, buf_page_get(rec_block->page.id,
rec_block->zip_size(), RW_X_LATCH, &mtr); rec_block->zip_size(), RW_X_LATCH, &mtr);

View File

@ -1496,7 +1496,6 @@ buf_block_init(
block->page.state = BUF_BLOCK_NOT_USED; block->page.state = BUF_BLOCK_NOT_USED;
block->page.buf_fix_count = 0; block->page.buf_fix_count = 0;
block->page.io_fix = BUF_IO_NONE; block->page.io_fix = BUF_IO_NONE;
block->page.flush_observer = NULL;
block->page.init_on_flush = false; block->page.init_on_flush = false;
block->page.real_size = 0; block->page.real_size = 0;
block->page.write_size = 0; block->page.write_size = 0;
@ -5336,7 +5335,6 @@ buf_page_init_for_read(
bpage->state = BUF_BLOCK_ZIP_PAGE; bpage->state = BUF_BLOCK_ZIP_PAGE;
bpage->id = page_id; bpage->id = page_id;
bpage->flush_observer = NULL;
bpage->init_on_flush = false; bpage->init_on_flush = false;
ut_d(bpage->in_page_hash = FALSE); ut_d(bpage->in_page_hash = FALSE);

View File

@ -623,14 +623,6 @@ buf_flush_remove(
ut_a(buf_flush_validate_skip(buf_pool)); ut_a(buf_flush_validate_skip(buf_pool));
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ #endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
/* If there is an observer that want to know if the asynchronous
flushing was done then notify it. */
if (bpage->flush_observer != NULL) {
bpage->flush_observer->notify_remove(buf_pool, bpage);
bpage->flush_observer = NULL;
}
buf_flush_list_mutex_exit(buf_pool); buf_flush_list_mutex_exit(buf_pool);
} }
@ -1362,19 +1354,6 @@ buf_flush_page(
rw_lock_sx_lock_gen(rw_lock, BUF_IO_WRITE); rw_lock_sx_lock_gen(rw_lock, BUF_IO_WRITE);
} }
/* If there is an observer that want to know if the asynchronous
flushing was sent then notify it.
Note: we set flush observer to a page with x-latch, so we can
guarantee that notify_flush and notify_remove are called in pair
with s-latch on a uncompressed page. */
if (bpage->flush_observer != NULL) {
buf_pool_mutex_enter(buf_pool);
bpage->flush_observer->notify_flush(buf_pool, bpage);
buf_pool_mutex_exit(buf_pool);
}
/* Even though bpage is not protected by any mutex at this /* Even though bpage is not protected by any mutex at this
point, it is safe to access bpage, because it is io_fixed and point, it is safe to access bpage, because it is io_fixed and
oldest_modification != 0. Thus, it cannot be relocated in the oldest_modification != 0. Thus, it cannot be relocated in the
@ -3674,9 +3653,7 @@ ulint
buf_pool_get_dirty_pages_count( buf_pool_get_dirty_pages_count(
/*===========================*/ /*===========================*/
buf_pool_t* buf_pool, /*!< in: buffer pool */ buf_pool_t* buf_pool, /*!< in: buffer pool */
ulint id, /*!< in: space id to check */ ulint id) /*!< in: space id to check */
FlushObserver* observer) /*!< in: flush observer to check */
{ {
ulint count = 0; ulint count = 0;
@ -3693,10 +3670,7 @@ buf_pool_get_dirty_pages_count(
ut_ad(bpage->in_flush_list); ut_ad(bpage->in_flush_list);
ut_ad(bpage->oldest_modification > 0); ut_ad(bpage->oldest_modification > 0);
if ((observer != NULL if (id == bpage->id.space()) {
&& observer == bpage->flush_observer)
|| (observer == NULL
&& id == bpage->id.space())) {
++count; ++count;
} }
} }
@ -3706,128 +3680,3 @@ buf_pool_get_dirty_pages_count(
return(count); return(count);
} }
/******************************************************************//**
Check if there are any dirty pages that belong to a space id in the flush list.
@return number of dirty pages present in all the buffer pools */
static
ulint
buf_flush_get_dirty_pages_count(
/*============================*/
ulint id, /*!< in: space id to check */
FlushObserver* observer) /*!< in: flush observer to check */
{
ulint count = 0;
for (ulint i = 0; i < srv_buf_pool_instances; ++i) {
buf_pool_t* buf_pool;
buf_pool = buf_pool_from_array(i);
count += buf_pool_get_dirty_pages_count(buf_pool, id, observer);
}
return(count);
}
/** FlushObserver constructor
@param[in] space tablespace
@param[in] trx trx instance
@param[in] stage performance schema accounting object,
used by ALTER TABLE. It is passed to log_preflush_pool_modified_pages()
for accounting. */
FlushObserver::FlushObserver(
fil_space_t* space,
trx_t* trx,
ut_stage_alter_t* stage)
:
m_space(space),
m_trx(trx),
m_stage(stage),
m_interrupted(false)
{
m_flushed = UT_NEW_NOKEY(std::vector<ulint>(srv_buf_pool_instances));
m_removed = UT_NEW_NOKEY(std::vector<ulint>(srv_buf_pool_instances));
for (ulint i = 0; i < srv_buf_pool_instances; i++) {
m_flushed->at(i) = 0;
m_removed->at(i) = 0;
}
DBUG_LOG("flush", "FlushObserver(): trx->id=" << m_trx->id);
}
/** FlushObserver deconstructor */
FlushObserver::~FlushObserver()
{
ut_ad(buf_flush_get_dirty_pages_count(m_space->id, this) == 0);
UT_DELETE(m_flushed);
UT_DELETE(m_removed);
DBUG_LOG("flush", "~FlushObserver(): trx->id=" << m_trx->id);
}
/** Check whether the operation has been interrupted */
void FlushObserver::check_interrupted()
{
if (trx_is_interrupted(m_trx)) {
interrupted();
}
}
/** Notify observer of a flush
@param[in] buf_pool buffer pool instance
@param[in] bpage buffer page to flush */
void
FlushObserver::notify_flush(
buf_pool_t* buf_pool,
buf_page_t* bpage)
{
ut_ad(buf_pool_mutex_own(buf_pool));
m_flushed->at(buf_pool->instance_no)++;
if (m_stage != NULL) {
m_stage->inc();
}
DBUG_LOG("flush", "Flush " << bpage->id);
}
/** Notify observer of a remove
@param[in] buf_pool buffer pool instance
@param[in] bpage buffer page flushed */
void
FlushObserver::notify_remove(
buf_pool_t* buf_pool,
buf_page_t* bpage)
{
ut_ad(buf_pool_mutex_own(buf_pool));
m_removed->at(buf_pool->instance_no)++;
DBUG_LOG("flush", "Remove " << bpage->id);
}
/** Flush dirty pages and wait. */
void
FlushObserver::flush()
{
ut_ad(m_trx);
if (!m_interrupted && m_stage) {
m_stage->begin_phase_flush(buf_flush_get_dirty_pages_count(
m_space->id, this));
}
buf_LRU_flush_or_remove_pages(m_space->id, this);
/* Wait for all dirty pages were flushed. */
for (ulint i = 0; i < srv_buf_pool_instances; i++) {
while (!is_complete(i)) {
os_thread_sleep(2000);
}
}
}

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2019, MariaDB Corporation. Copyright (c) 2017, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
@ -466,19 +466,13 @@ buf_flush_try_yield(
return(false); return(false);
} }
/******************************************************************//** /** Remove a single page from flush_list.
Removes a single page from a given tablespace inside a specific @param[in,out] buf_pool buffer pool
buffer pool instance. @param[in,out] bpage buffer page to remove
@param[in] flush whether to flush the page before removing
@return true if page was removed. */ @return true if page was removed. */
static MY_ATTRIBUTE((warn_unused_result)) static bool buf_flush_or_remove_page(buf_pool_t* buf_pool, buf_page_t* bpage,
bool bool flush)
buf_flush_or_remove_page(
/*=====================*/
buf_pool_t* buf_pool, /*!< in/out: buffer pool instance */
buf_page_t* bpage, /*!< in/out: bpage to remove */
bool flush) /*!< in: flush to disk if true but
don't remove else remove without
flushing to disk */
{ {
ut_ad(buf_pool_mutex_own(buf_pool)); ut_ad(buf_pool_mutex_own(buf_pool));
ut_ad(buf_flush_list_mutex_own(buf_pool)); ut_ad(buf_flush_list_mutex_own(buf_pool));
@ -551,17 +545,11 @@ tablespace. The pages still remain a part of LRU and are evicted from
the list as they age towards the tail of the LRU. the list as they age towards the tail of the LRU.
@param[in,out] buf_pool buffer pool @param[in,out] buf_pool buffer pool
@param[in] id tablespace identifier @param[in] id tablespace identifier
@param[in] observer flush observer (to check for interrupt), @param[in] flush whether to flush the pages before removing
or NULL if the files should not be written to
@param[in] first first page to be flushed or evicted @param[in] first first page to be flushed or evicted
@return whether all matching dirty pages were removed */ @return whether all matching dirty pages were removed */
static MY_ATTRIBUTE((warn_unused_result)) static bool buf_flush_or_remove_pages(buf_pool_t* buf_pool, ulint id,
bool bool flush, ulint first)
buf_flush_or_remove_pages(
buf_pool_t* buf_pool,
ulint id,
FlushObserver* observer,
ulint first)
{ {
buf_page_t* prev; buf_page_t* prev;
buf_page_t* bpage; buf_page_t* bpage;
@ -583,29 +571,12 @@ rescan:
prev = UT_LIST_GET_PREV(list, bpage); prev = UT_LIST_GET_PREV(list, bpage);
/* Flush the pages matching space id, if (id != bpage->id.space()) {
or pages matching the flush observer. */
if (observer && observer->is_partial_flush()) {
if (observer != bpage->flush_observer) {
/* Skip this block. */
} else if (!buf_flush_or_remove_page(
buf_pool, bpage,
!observer->is_interrupted())) {
all_freed = false;
} else if (!observer->is_interrupted()) {
/* The processing was successful. And during the
processing we have released the buf_pool mutex
when calling buf_page_flush(). We cannot trust
prev pointer. */
goto rescan;
}
} else if (id != bpage->id.space()) {
/* Skip this block, because it is for a /* Skip this block, because it is for a
different tablespace. */ different tablespace. */
} else if (bpage->id.page_no() < first) { } else if (bpage->id.page_no() < first) {
/* Skip this block, because it is below the limit. */ /* Skip this block, because it is below the limit. */
} else if (!buf_flush_or_remove_page( } else if (!buf_flush_or_remove_page(buf_pool, bpage, flush)) {
buf_pool, bpage, observer != NULL)) {
/* Remove was unsuccessful, we have to try again /* Remove was unsuccessful, we have to try again
by scanning the entire list from the end. by scanning the entire list from the end.
@ -628,7 +599,7 @@ rescan:
iteration. */ iteration. */
all_freed = false; all_freed = false;
} else if (observer) { } else if (flush) {
/* The processing was successful. And during the /* The processing was successful. And during the
processing we have released the buf_pool mutex processing we have released the buf_pool mutex
@ -646,12 +617,6 @@ rescan:
processed = 0; processed = 0;
} }
/* The check for trx is interrupted is expensive, we want
to check every N iterations. */
if (!processed && observer) {
observer->check_interrupted();
}
} }
buf_flush_list_mutex_exit(buf_pool); buf_flush_list_mutex_exit(buf_pool);
@ -665,21 +630,15 @@ list and will be evicted from the LRU list as they age and move towards
the tail of the LRU list. the tail of the LRU list.
@param[in,out] buf_pool buffer pool @param[in,out] buf_pool buffer pool
@param[in] id tablespace identifier @param[in] id tablespace identifier
@param[in] observer flush observer, @param[in] flush whether to flush the pages before removing
or NULL if the files should not be written to
@param[in] first first page to be flushed or evicted */ @param[in] first first page to be flushed or evicted */
static static void buf_flush_dirty_pages(buf_pool_t* buf_pool, ulint id, bool flush,
void
buf_flush_dirty_pages(
buf_pool_t* buf_pool,
ulint id,
FlushObserver* observer,
ulint first) ulint first)
{ {
for (;;) { for (;;) {
buf_pool_mutex_enter(buf_pool); buf_pool_mutex_enter(buf_pool);
bool freed = buf_flush_or_remove_pages(buf_pool, id, observer, bool freed = buf_flush_or_remove_pages(buf_pool, id, flush,
first); first);
buf_pool_mutex_exit(buf_pool); buf_pool_mutex_exit(buf_pool);
@ -694,28 +653,25 @@ buf_flush_dirty_pages(
ut_ad(buf_flush_validate(buf_pool)); ut_ad(buf_flush_validate(buf_pool));
} }
ut_ad((observer && observer->is_interrupted()) ut_ad(first
|| first || buf_pool_get_dirty_pages_count(buf_pool, id) == 0);
|| buf_pool_get_dirty_pages_count(buf_pool, id, observer) == 0);
} }
/** Empty the flush list for all pages belonging to a tablespace. /** Empty the flush list for all pages belonging to a tablespace.
@param[in] id tablespace identifier @param[in] id tablespace identifier
@param[in] observer flush observer, @param[in] flush whether to write the pages to files
or NULL if nothing is to be written
@param[in] first first page to be flushed or evicted */ @param[in] first first page to be flushed or evicted */
void buf_LRU_flush_or_remove_pages(ulint id, FlushObserver* observer, void buf_LRU_flush_or_remove_pages(ulint id, bool flush, ulint first)
ulint first)
{ {
/* Pages in the system tablespace must never be discarded. */ /* Pages in the system tablespace must never be discarded. */
ut_ad(id || observer); ut_ad(id || flush);
for (ulint i = 0; i < srv_buf_pool_instances; i++) { for (ulint i = 0; i < srv_buf_pool_instances; i++) {
buf_flush_dirty_pages(buf_pool_from_array(i), id, observer, buf_flush_dirty_pages(buf_pool_from_array(i), id, flush,
first); first);
} }
if (observer && !observer->is_interrupted()) { if (flush) {
/* Ensure that all asynchronous IO is completed. */ /* Ensure that all asynchronous IO is completed. */
os_aio_wait_until_no_pending_writes(); os_aio_wait_until_no_pending_writes();
fil_flush(id); fil_flush(id);
@ -1105,7 +1061,6 @@ loop:
memset(&block->page.zip, 0, sizeof block->page.zip); memset(&block->page.zip, 0, sizeof block->page.zip);
block->skip_flush_check = false; block->skip_flush_check = false;
block->page.flush_observer = NULL;
return(block); return(block);
} }

View File

@ -2253,11 +2253,7 @@ fil_close_tablespace(
buffer pool. Thus we can clean the tablespace out of the buffer pool buffer pool. Thus we can clean the tablespace out of the buffer pool
completely and permanently. The flag stop_new_ops also prevents completely and permanently. The flag stop_new_ops also prevents
fil_flush() from being applied to this tablespace. */ fil_flush() from being applied to this tablespace. */
buf_LRU_flush_or_remove_pages(id, true);
{
FlushObserver observer(space, trx, NULL);
buf_LRU_flush_or_remove_pages(id, &observer);
}
/* If the free is successful, the X lock will be released before /* If the free is successful, the X lock will be released before
the space memory data structure is freed. */ the space memory data structure is freed. */

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2019, MariaDB Corporation. Copyright (c) 2017, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
@ -515,8 +515,7 @@ void fil_space_t::modify_check(const mtr_t& mtr) const
break; break;
case MTR_LOG_NO_REDO: case MTR_LOG_NO_REDO:
ut_ad(purpose == FIL_TYPE_TEMPORARY ut_ad(purpose == FIL_TYPE_TEMPORARY
|| purpose == FIL_TYPE_IMPORT || purpose == FIL_TYPE_IMPORT);
|| redo_skipped_count);
return; return;
case MTR_LOG_ALL: case MTR_LOG_ALL:
/* We may only write redo log for a persistent /* We may only write redo log for a persistent
@ -1223,10 +1222,8 @@ fsp_alloc_free_page(
The page is marked as free and clean. The page is marked as free and clean.
@param[in,out] space tablespace @param[in,out] space tablespace
@param[in] offset page number @param[in] offset page number
@param[in] log whether to write MLOG_INIT_FREE_PAGE record
@param[in,out] mtr mini-transaction */ @param[in,out] mtr mini-transaction */
static void fsp_free_page(fil_space_t* space, page_no_t offset, static void fsp_free_page(fil_space_t* space, page_no_t offset, mtr_t* mtr)
bool log, mtr_t* mtr)
{ {
xdes_t* descr; xdes_t* descr;
ulint state; ulint state;
@ -1278,12 +1275,7 @@ static void fsp_free_page(fil_space_t* space, page_no_t offset,
return; return;
} }
if (UNIV_UNLIKELY(!log)) { if (byte* log_ptr = mlog_open(mtr, 11)) {
/* The last page freed in BtrBulk::finish() must be
written with redo logging disabled for the page
itself. The modifications of the allocation data
structures are covered by redo log. */
} else if (byte* log_ptr = mlog_open(mtr, 11)) {
log_ptr = mlog_write_initial_log_record_low( log_ptr = mlog_write_initial_log_record_low(
MLOG_INIT_FREE_PAGE, space->id, offset, log_ptr, mtr); MLOG_INIT_FREE_PAGE, space->id, offset, log_ptr, mtr);
mlog_close(mtr, log_ptr); mlog_close(mtr, log_ptr);
@ -1532,7 +1524,7 @@ static void fsp_free_seg_inode(
/* There are no other used headers left on the page: free it */ /* There are no other used headers left on the page: free it */
flst_remove(header, FSP_HEADER_OFFSET + FSP_SEG_INODES_FREE, flst_remove(header, FSP_HEADER_OFFSET + FSP_SEG_INODES_FREE,
iblock, FSEG_INODE_PAGE_NODE, mtr); iblock, FSEG_INODE_PAGE_NODE, mtr);
fsp_free_page(space, iblock->page.id.page_no(), true, mtr); fsp_free_page(space, iblock->page.id.page_no(), mtr);
} }
} }
@ -2529,7 +2521,6 @@ try_to_extend:
@param[in] offset page number @param[in] offset page number
@param[in] ahi whether we may need to drop the adaptive @param[in] ahi whether we may need to drop the adaptive
hash index hash index
@param[in] log whether to write MLOG_INIT_FREE_PAGE record
@param[in,out] mtr mini-transaction */ @param[in,out] mtr mini-transaction */
static static
void void
@ -2541,7 +2532,6 @@ fseg_free_page_low(
#ifdef BTR_CUR_HASH_ADAPT #ifdef BTR_CUR_HASH_ADAPT
bool ahi, bool ahi,
#endif /* BTR_CUR_HASH_ADAPT */ #endif /* BTR_CUR_HASH_ADAPT */
bool log,
mtr_t* mtr) mtr_t* mtr)
{ {
ib_id_t descr_id; ib_id_t descr_id;
@ -2592,7 +2582,7 @@ fseg_free_page_low(
break; break;
} }
fsp_free_page(space, offset, log, mtr); fsp_free_page(space, offset, mtr);
return; return;
} }
@ -2647,8 +2637,8 @@ fseg_free_page_low(
} }
#ifndef BTR_CUR_HASH_ADAPT #ifndef BTR_CUR_HASH_ADAPT
# define fseg_free_page_low(inode, space, offset, ahi, log, mtr) \ # define fseg_free_page_low(inode, space, offset, ahi, mtr) \
fseg_free_page_low(inode, space, offset, log, mtr) fseg_free_page_low(inode, space, offset, mtr)
#endif /* !BTR_CUR_HASH_ADAPT */ #endif /* !BTR_CUR_HASH_ADAPT */
/** Free a page in a file segment. /** Free a page in a file segment.
@ -2657,7 +2647,6 @@ fseg_free_page_low(
@param[in] offset page number @param[in] offset page number
@param[in] ahi whether we may need to drop the adaptive @param[in] ahi whether we may need to drop the adaptive
hash index hash index
@param[in] log whether to write MLOG_INIT_FREE_PAGE record
@param[in,out] mtr mini-transaction */ @param[in,out] mtr mini-transaction */
void void
fseg_free_page_func( fseg_free_page_func(
@ -2667,7 +2656,6 @@ fseg_free_page_func(
#ifdef BTR_CUR_HASH_ADAPT #ifdef BTR_CUR_HASH_ADAPT
bool ahi, bool ahi,
#endif /* BTR_CUR_HASH_ADAPT */ #endif /* BTR_CUR_HASH_ADAPT */
bool log,
mtr_t* mtr) mtr_t* mtr)
{ {
DBUG_ENTER("fseg_free_page"); DBUG_ENTER("fseg_free_page");
@ -2685,7 +2673,7 @@ fseg_free_page_func(
fil_block_check_type(*iblock, FIL_PAGE_INODE, mtr); fil_block_check_type(*iblock, FIL_PAGE_INODE, mtr);
} }
fseg_free_page_low(seg_inode, iblock, space, offset, ahi, log, mtr); fseg_free_page_low(seg_inode, iblock, space, offset, ahi, mtr);
ut_d(buf_page_set_file_page_was_freed(page_id_t(space->id, offset))); ut_d(buf_page_set_file_page_was_freed(page_id_t(space->id, offset)));
@ -2878,7 +2866,7 @@ fseg_free_step_func(
fseg_free_page_low( fseg_free_page_low(
inode, iblock, space, inode, iblock, space,
fseg_get_nth_frag_page_no(inode, n, mtr), fseg_get_nth_frag_page_no(inode, n, mtr),
ahi, true, mtr); ahi, mtr);
n = fseg_find_last_used_frag_page_slot(inode, mtr); n = fseg_find_last_used_frag_page_slot(inode, mtr);
@ -2951,7 +2939,7 @@ fseg_free_step_not_header_func(
return(true); return(true);
} }
fseg_free_page_low(inode, iblock, space, page_no, ahi, true, mtr); fseg_free_page_low(inode, iblock, space, page_no, ahi, mtr);
return(false); return(false);
} }

View File

@ -3470,6 +3470,11 @@ static my_bool innodb_log_checksums;
/** Deprecation message for innodb_log_checksums */ /** Deprecation message for innodb_log_checksums */
static const char* innodb_log_checksums_deprecated static const char* innodb_log_checksums_deprecated
= "The parameter innodb_log_checksums is deprecated and has no effect."; = "The parameter innodb_log_checksums is deprecated and has no effect.";
/** Deprecated parameter with no effect */
static my_bool innodb_log_optimize_ddl;
static const char* innodb_log_optimize_ddl_deprecated
= "The parameter innodb_log_optimize_ddl is deprecated and has no effect.";
/** Deprecated parameter with no effect */ /** Deprecated parameter with no effect */
static ulong innodb_undo_logs; static ulong innodb_undo_logs;
/** Deprecation message for innodb_undo_logs */ /** Deprecation message for innodb_undo_logs */
@ -3779,6 +3784,11 @@ static int innodb_init_params()
innodb_log_checksums = TRUE; innodb_log_checksums = TRUE;
} }
if (UNIV_UNLIKELY(innodb_log_optimize_ddl)) {
sql_print_warning(innodb_log_optimize_ddl_deprecated);
innodb_log_optimize_ddl = FALSE;
}
if (UNIV_UNLIKELY(innodb_undo_logs != TRX_SYS_N_RSEGS)) { if (UNIV_UNLIKELY(innodb_undo_logs != TRX_SYS_N_RSEGS)) {
sql_print_warning(innodb_undo_logs_deprecated); sql_print_warning(innodb_undo_logs_deprecated);
innodb_undo_logs = TRX_SYS_N_RSEGS; innodb_undo_logs = TRX_SYS_N_RSEGS;
@ -18886,6 +18896,16 @@ innodb_log_checksums_warn(THD* thd, st_mysql_sys_var*, void*, const void*)
innodb_log_checksums_deprecated); innodb_log_checksums_deprecated);
} }
/** Issue a deprecation warning for SET GLOBAL innodb_log_optimize_ddl.
@param[in,out] thd client connection */
static void
innodb_log_optimize_ddl_warn(THD* thd, st_mysql_sys_var*, void*, const void*)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
HA_ERR_UNSUPPORTED,
innodb_log_optimize_ddl_deprecated);
}
/** Issue a deprecation warning for SET GLOBAL innodb_undo_logs. /** Issue a deprecation warning for SET GLOBAL innodb_undo_logs.
@param[in,out] thd client connection */ @param[in,out] thd client connection */
static void static void
@ -19407,10 +19427,7 @@ static MYSQL_SYSVAR_BOOL(log_compressed_pages, page_zip_log_pages,
static MYSQL_SYSVAR_BOOL(log_optimize_ddl, innodb_log_optimize_ddl, static MYSQL_SYSVAR_BOOL(log_optimize_ddl, innodb_log_optimize_ddl,
PLUGIN_VAR_OPCMDARG, PLUGIN_VAR_OPCMDARG,
"Reduce redo logging when natively creating indexes or rebuilding tables." innodb_deprecated_ignored, NULL, innodb_log_optimize_ddl_warn, FALSE);
" Setting this OFF avoids delay due to page flushing and"
" allows concurrent backup.",
NULL, NULL, TRUE);
static MYSQL_SYSVAR_ULONG(autoextend_increment, static MYSQL_SYSVAR_ULONG(autoextend_increment,
sys_tablespace_auto_extend_increment, sys_tablespace_auto_extend_increment,

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2016, 2019, MariaDB Corporation. Copyright (c) 2016, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
@ -1963,7 +1963,7 @@ ibuf_remove_free_page(void)
compile_time_assert(IBUF_SPACE_ID == 0); compile_time_assert(IBUF_SPACE_ID == 0);
fseg_free_page(header_page + IBUF_HEADER + IBUF_TREE_SEG_HEADER, fseg_free_page(header_page + IBUF_HEADER + IBUF_TREE_SEG_HEADER,
fil_system.sys_space, page_no, false, true, &mtr); fil_system.sys_space, page_no, false, &mtr);
const page_id_t page_id(IBUF_SPACE_ID, page_no); const page_id_t page_id(IBUF_SPACE_ID, page_no);

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 2014, 2015, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2014, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2019, MariaDB Corporation. Copyright (c) 2019, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
@ -53,14 +53,12 @@ public:
@param[in] index B-tree index @param[in] index B-tree index
@param[in] page_no page number @param[in] page_no page number
@param[in] level page level @param[in] level page level
@param[in] trx_id transaction id @param[in] trx_id transaction id */
@param[in] observer flush observer */
PageBulk( PageBulk(
dict_index_t* index, dict_index_t* index,
trx_id_t trx_id, trx_id_t trx_id,
ulint page_no, ulint page_no,
ulint level, ulint level)
FlushObserver* observer)
: :
m_heap(NULL), m_heap(NULL),
m_index(index), m_index(index),
@ -81,7 +79,6 @@ public:
m_total_data(0), m_total_data(0),
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
m_modify_clock(0), m_modify_clock(0),
m_flush_observer(observer),
m_err(DB_SUCCESS) m_err(DB_SUCCESS)
{ {
ut_ad(!dict_index_is_spatial(m_index)); ut_ad(!dict_index_is_spatial(m_index));
@ -274,9 +271,6 @@ private:
when the block is re-pinned */ when the block is re-pinned */
ib_uint64_t m_modify_clock; ib_uint64_t m_modify_clock;
/** Flush observer, or NULL if redo logging is enabled */
FlushObserver* m_flush_observer;
/** Operation result DB_SUCCESS or error code */ /** Operation result DB_SUCCESS or error code */
dberr_t m_err; dberr_t m_err;
}; };
@ -289,31 +283,15 @@ class BtrBulk
public: public:
/** Constructor /** Constructor
@param[in] index B-tree index @param[in] index B-tree index
@param[in] trx transaction @param[in] trx transaction */
@param[in] observer flush observer */
BtrBulk( BtrBulk(
dict_index_t* index, dict_index_t* index,
const trx_t* trx, const trx_t* trx)
FlushObserver* observer)
: :
m_index(index), m_index(index),
m_trx(trx), m_trx(trx)
m_flush_observer(observer)
{ {
ut_ad(!dict_index_is_spatial(index)); ut_ad(!dict_index_is_spatial(index));
#ifdef UNIV_DEBUG
if (m_flush_observer)
m_index->table->space->redo_skipped_count++;
#endif /* UNIV_DEBUG */
}
/** Destructor */
~BtrBulk()
{
#ifdef UNIV_DEBUG
if (m_flush_observer)
m_index->table->space->redo_skipped_count--;
#endif /* UNIV_DEBUG */
} }
/** Insert a tuple /** Insert a tuple
@ -385,9 +363,6 @@ private:
/** Root page level */ /** Root page level */
ulint m_root_level; ulint m_root_level;
/** Flush observer, or NULL if redo logging is enabled */
FlushObserver*const m_flush_observer;
/** Page cursor vector for all level */ /** Page cursor vector for all level */
page_bulk_vector m_page_bulks; page_bulk_vector m_page_bulks;
}; };

View File

@ -1526,8 +1526,6 @@ public:
== (state == BUF_BLOCK_NOT_USED) */ == (state == BUF_BLOCK_NOT_USED) */
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
FlushObserver* flush_observer; /*!< flush observer */
lsn_t oldest_modification; lsn_t oldest_modification;
/*!< log sequence number of /*!< log sequence number of
the START of the log entry the START of the log entry

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2014, 2018, MariaDB Corporation. Copyright (c) 2014, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
@ -186,9 +186,8 @@ buf_flush_note_modification(
buf_block_t* block, /*!< in: block which is modified */ buf_block_t* block, /*!< in: block which is modified */
lsn_t start_lsn, /*!< in: start lsn of the first mtr in a lsn_t start_lsn, /*!< in: start lsn of the first mtr in a
set of mtr's */ set of mtr's */
lsn_t end_lsn, /*!< in: end lsn of the last mtr in the lsn_t end_lsn); /*!< in: end lsn of the last mtr in the
set of mtr's */ set of mtr's */
FlushObserver* observer); /*!< in: flush observer */
/********************************************************************//** /********************************************************************//**
Returns TRUE if the file page block is immediately suitable for replacement, Returns TRUE if the file page block is immediately suitable for replacement,
i.e., transition FILE_PAGE => NOT_USED allowed. i.e., transition FILE_PAGE => NOT_USED allowed.
@ -297,8 +296,7 @@ ulint
buf_pool_get_dirty_pages_count( buf_pool_get_dirty_pages_count(
/*===========================*/ /*===========================*/
buf_pool_t* buf_pool, /*!< in: buffer pool */ buf_pool_t* buf_pool, /*!< in: buffer pool */
ulint id, /*!< in: space id to check */ ulint id); /*!< in: space id to check */
FlushObserver* observer); /*!< in: flush observer to check */
/*******************************************************************//** /*******************************************************************//**
Synchronously flush dirty blocks from the end of the flush list of all buffer Synchronously flush dirty blocks from the end of the flush list of all buffer
@ -314,88 +312,6 @@ void
buf_flush_request_force( buf_flush_request_force(
lsn_t lsn_limit); lsn_t lsn_limit);
/** We use FlushObserver to track flushing of non-redo logged pages in bulk
create index(BtrBulk.cc).Since we disable redo logging during a index build,
we need to make sure that all dirty pages modifed by the index build are
flushed to disk before any redo logged operations go to the index. */
class FlushObserver {
public:
/** Constructor
@param[in,out] space tablespace
@param[in] trx trx instance
@param[in] stage performance schema accounting object,
used by ALTER TABLE. It is passed to log_preflush_pool_modified_pages()
for accounting. */
FlushObserver(fil_space_t* space, trx_t* trx, ut_stage_alter_t* stage);
/** Deconstructor */
~FlushObserver();
/** Check pages have been flushed and removed from the flush list
in a buffer pool instance.
@param[in] instance_no buffer pool instance no
@return true if the pages were removed from the flush list */
bool is_complete(ulint instance_no)
{
return(m_flushed->at(instance_no) == m_removed->at(instance_no)
|| m_interrupted);
}
/** @return whether to flush only some pages of the tablespace */
bool is_partial_flush() const { return m_stage != NULL; }
/** @return whether the operation was interrupted */
bool is_interrupted() const { return m_interrupted; }
/** Interrupt observer not to wait. */
void interrupted()
{
m_interrupted = true;
}
/** Check whether the operation has been interrupted */
void check_interrupted();
/** Flush dirty pages. */
void flush();
/** Notify observer of flushing a page
@param[in] buf_pool buffer pool instance
@param[in] bpage buffer page to flush */
void notify_flush(
buf_pool_t* buf_pool,
buf_page_t* bpage);
/** Notify observer of removing a page from flush list
@param[in] buf_pool buffer pool instance
@param[in] bpage buffer page flushed */
void notify_remove(
buf_pool_t* buf_pool,
buf_page_t* bpage);
private:
/** Tablespace */
fil_space_t* m_space;
/** Trx instance */
const trx_t* const m_trx;
/** Performance schema accounting object, used by ALTER TABLE.
If not NULL, then stage->begin_phase_flush() will be called initially,
specifying the number of pages to be attempted to be flushed and
subsequently, stage->inc() will be called for each page we attempt to
flush. */
ut_stage_alter_t* m_stage;
/* Flush request sent */
std::vector<ulint>* m_flushed;
/* Flush request finished */
std::vector<ulint>* m_removed;
/* True if the operation was interrupted. */
bool m_interrupted;
};
#include "buf0flu.ic" #include "buf0flu.ic"
#endif #endif

View File

@ -1,6 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2019, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
@ -48,9 +49,8 @@ buf_flush_note_modification(
buf_block_t* block, /*!< in: block which is modified */ buf_block_t* block, /*!< in: block which is modified */
lsn_t start_lsn, /*!< in: start lsn of the mtr that lsn_t start_lsn, /*!< in: start lsn of the mtr that
modified this block */ modified this block */
lsn_t end_lsn, /*!< in: end lsn of the mtr that lsn_t end_lsn) /*!< in: end lsn of the mtr that
modified this block */ modified this block */
FlushObserver* observer) /*!< in: flush observer */
{ {
mutex_enter(&block->mutex); mutex_enter(&block->mutex);
ut_ad(!srv_read_only_mode ut_ad(!srv_read_only_mode
@ -67,12 +67,6 @@ buf_flush_note_modification(
+ block->frame); + block->frame);
} }
/* Don't allow to set flush observer from non-null to null,
or from one observer to another. */
ut_ad(block->page.flush_observer == NULL
|| block->page.flush_observer == observer);
block->page.flush_observer = observer;
if (block->page.oldest_modification == 0) { if (block->page.oldest_modification == 0) {
buf_pool_t* buf_pool = buf_pool_from_block(block); buf_pool_t* buf_pool = buf_pool_from_block(block);

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2019, MariaDB Corporation. Copyright (c) 2017, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
@ -63,11 +63,9 @@ bool buf_LRU_drop_page_hash_for_tablespace(dict_table_t* table)
/** Empty the flush list for all pages belonging to a tablespace. /** Empty the flush list for all pages belonging to a tablespace.
@param[in] id tablespace identifier @param[in] id tablespace identifier
@param[in,out] observer flush observer, @param[in] flush whether to write the pages to files
or NULL if nothing is to be written
@param[in] first first page to be flushed or evicted */ @param[in] first first page to be flushed or evicted */
void buf_LRU_flush_or_remove_pages(ulint id, FlushObserver* observer, void buf_LRU_flush_or_remove_pages(ulint id, bool flush, ulint first = 0);
ulint first = 0);
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
/********************************************************************//** /********************************************************************//**

View File

@ -44,8 +44,6 @@ struct buf_pool_stat_t;
struct buf_buddy_stat_t; struct buf_buddy_stat_t;
/** Doublewrite memory struct */ /** Doublewrite memory struct */
struct buf_dblwr_t; struct buf_dblwr_t;
/** Flush observer for bulk create index */
class FlushObserver;
/** A buffer frame. @see page_t */ /** A buffer frame. @see page_t */
typedef byte buf_frame_t; typedef byte buf_frame_t;

View File

@ -42,8 +42,6 @@ Created 10/25/1995 Heikki Tuuri
struct unflushed_spaces_tag_t; struct unflushed_spaces_tag_t;
struct rotation_list_tag_t; struct rotation_list_tag_t;
/** whether to reduce redo logging during ALTER TABLE */
extern my_bool innodb_log_optimize_ddl;
// Forward declaration // Forward declaration
extern my_bool srv_use_doublewrite_buf; extern my_bool srv_use_doublewrite_buf;
extern struct buf_dblwr_t* buf_dblwr; extern struct buf_dblwr_t* buf_dblwr;
@ -114,11 +112,6 @@ struct fil_space_t
bool stop_new_ops; bool stop_new_ops;
/** whether undo tablespace truncation is in progress */ /** whether undo tablespace truncation is in progress */
bool is_being_truncated; bool is_being_truncated;
#ifdef UNIV_DEBUG
/** reference count for operations who want to skip redo log in the
file space in order to make modify_check() pass. */
Atomic_counter<ulint> redo_skipped_count;
#endif
fil_type_t purpose;/*!< purpose */ fil_type_t purpose;/*!< purpose */
UT_LIST_BASE_NODE_T(fil_node_t) chain; UT_LIST_BASE_NODE_T(fil_node_t) chain;
/*!< base node for the file chain */ /*!< base node for the file chain */

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2013, 2019, MariaDB Corporation. Copyright (c) 2013, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
@ -494,7 +494,6 @@ fsp_reserve_free_extents(
@param[in] offset page number @param[in] offset page number
@param[in] ahi whether we may need to drop the adaptive @param[in] ahi whether we may need to drop the adaptive
hash index hash index
@param[in] log whether to write MLOG_INIT_FREE_PAGE record
@param[in,out] mtr mini-transaction */ @param[in,out] mtr mini-transaction */
void void
fseg_free_page_func( fseg_free_page_func(
@ -504,14 +503,13 @@ fseg_free_page_func(
#ifdef BTR_CUR_HASH_ADAPT #ifdef BTR_CUR_HASH_ADAPT
bool ahi, bool ahi,
#endif /* BTR_CUR_HASH_ADAPT */ #endif /* BTR_CUR_HASH_ADAPT */
bool log,
mtr_t* mtr); mtr_t* mtr);
#ifdef BTR_CUR_HASH_ADAPT #ifdef BTR_CUR_HASH_ADAPT
# define fseg_free_page(header, space, offset, ahi, log, mtr) \ # define fseg_free_page(header, space, offset, ahi, mtr) \
fseg_free_page_func(header, space, offset, ahi, log, mtr) fseg_free_page_func(header, space, offset, ahi, mtr)
#else /* BTR_CUR_HASH_ADAPT */ #else /* BTR_CUR_HASH_ADAPT */
# define fseg_free_page(header, space, offset, ahi, log, mtr) \ # define fseg_free_page(header, space, offset, ahi, mtr) \
fseg_free_page_func(header, space, offset, log, mtr) fseg_free_page_func(header, space, offset, mtr)
#endif /* BTR_CUR_HASH_ADAPT */ #endif /* BTR_CUR_HASH_ADAPT */
/** Determine whether a page is free. /** Determine whether a page is free.
@param[in,out] space tablespace @param[in,out] space tablespace
@ -636,10 +634,8 @@ inline void fsp_init_file_page(
block->page.id.space(), block->page.id.page_no(), block->page.id.space(), block->page.id.page_no(),
log_ptr, mtr); log_ptr, mtr);
mlog_close(mtr, log_ptr); mlog_close(mtr, log_ptr);
if (!innodb_log_optimize_ddl) {
block->page.init_on_flush = true; block->page.init_on_flush = true;
} }
}
} }
#ifndef UNIV_DEBUG #ifndef UNIV_DEBUG

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2019, MariaDB Corporation. Copyright (c) 2017, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
@ -138,7 +138,6 @@ mlog_write_initial_log_record_low(
|| type == MLOG_FILE_DELETE || type == MLOG_FILE_DELETE
|| type == MLOG_FILE_CREATE2 || type == MLOG_FILE_CREATE2
|| type == MLOG_FILE_RENAME2 || type == MLOG_FILE_RENAME2
|| type == MLOG_INDEX_LOAD
|| mtr->is_named_space(space_id)); || mtr->is_named_space(space_id));
mach_write_to_1(log_ptr, type); mach_write_to_1(log_ptr, type);

View File

@ -325,18 +325,6 @@ struct mtr_t {
/** @return true if we are inside the change buffer code */ /** @return true if we are inside the change buffer code */
bool is_inside_ibuf() const { return m_inside_ibuf; } bool is_inside_ibuf() const { return m_inside_ibuf; }
/** Get flush observer
@return flush observer */
FlushObserver* get_flush_observer() const { return m_flush_observer; }
/** Set flush observer
@param[in] observer flush observer */
void set_flush_observer(FlushObserver* observer)
{
ut_ad(observer == NULL || m_log_mode == MTR_LOG_NO_REDO);
m_flush_observer = observer;
}
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
/** Check if memo contains the given item. /** Check if memo contains the given item.
@param memo memo stack @param memo memo stack
@ -527,9 +515,6 @@ private:
/** user tablespace that is being modified by the mini-transaction */ /** user tablespace that is being modified by the mini-transaction */
fil_space_t* m_user_space; fil_space_t* m_user_space;
/** page flush observer for innodb_log_optimize_ddl=ON */
FlushObserver *m_flush_observer;
/** LSN at commit time */ /** LSN at commit time */
lsn_t m_commit_lsn; lsn_t m_commit_lsn;
}; };

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2015, 2019, MariaDB Corporation. Copyright (c) 2015, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
@ -292,12 +292,6 @@ row_merge_drop_table(
dict_table_t* table) /*!< in: table instance to drop */ dict_table_t* table) /*!< in: table instance to drop */
MY_ATTRIBUTE((nonnull, warn_unused_result)); 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 /** Build indexes on a table by reading a clustered index, creating a temporary
file containing index entries, merge sorting these index entries and inserting file containing index entries, merge sorting these index entries and inserting
sorted index entries to indexes. sorted index entries to indexes.

View File

@ -3,7 +3,7 @@
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved. Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2008, 2009, Google Inc. Copyright (c) 2008, 2009, Google Inc.
Copyright (c) 2009, Percona Inc. Copyright (c) 2009, Percona Inc.
Copyright (c) 2013, 2019, MariaDB Corporation. Copyright (c) 2013, 2020, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described Google, Inc. Those modifications are gratefully acknowledged and are described
@ -598,10 +598,6 @@ do { \
everything after flush log_make_checkpoint(). */ everything after flush log_make_checkpoint(). */
extern PSI_stage_info srv_stage_alter_table_end; extern PSI_stage_info srv_stage_alter_table_end;
/** Performance schema stage event for monitoring ALTER TABLE progress
log_make_checkpoint(). */
extern PSI_stage_info srv_stage_alter_table_flush;
/** Performance schema stage event for monitoring ALTER TABLE progress /** Performance schema stage event for monitoring ALTER TABLE progress
row_merge_insert_index_tuples(). */ row_merge_insert_index_tuples(). */
extern PSI_stage_info srv_stage_alter_table_insert; extern PSI_stage_info srv_stage_alter_table_insert;

View File

@ -41,7 +41,6 @@ Created 3/26/1996 Heikki Tuuri
// Forward declaration // Forward declaration
struct mtr_t; struct mtr_t;
class FlushObserver;
struct rw_trx_hash_element_t; struct rw_trx_hash_element_t;
/******************************************************************//** /******************************************************************//**
@ -1044,11 +1043,6 @@ public:
/*------------------------------*/ /*------------------------------*/
char* detailed_error; /*!< detailed error message for last char* detailed_error; /*!< detailed error message for last
error, or empty. */ error, or empty. */
private:
/** flush observer used to track flushing of non-redo logged pages
during bulk create index */
FlushObserver* flush_observer;
public:
/* Lock wait statistics */ /* Lock wait statistics */
ulint n_rec_lock_waits; ulint n_rec_lock_waits;
/*!< Number of record lock waits, /*!< Number of record lock waits,
@ -1101,20 +1095,6 @@ public:
return(assign_temp_rseg()); return(assign_temp_rseg());
} }
/** Set the innodb_log_optimize_ddl page flush observer
@param[in,out] space tablespace
@param[in,out] stage performance_schema accounting */
void set_flush_observer(fil_space_t* space, ut_stage_alter_t* stage);
/** Remove the flush observer */
void remove_flush_observer();
/** @return the flush observer */
FlushObserver* get_flush_observer() const
{
return flush_observer;
}
/** Transition to committed state, to release implicit locks. */ /** Transition to committed state, to release implicit locks. */
inline void commit_state(); inline void commit_state();

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 2014, 2015, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2014, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation. Copyright (c) 2017, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
@ -62,9 +62,6 @@ if any new indexes are being added, for each one:
being_phase_log_index() being_phase_log_index()
multiple times: multiple times:
inc() // once per log-block applied inc() // once per log-block applied
begin_phase_flush()
multiple times:
inc() // once per page flushed
begin_phase_log_table() begin_phase_log_table()
multiple times: multiple times:
inc() // once per log-block applied inc() // once per log-block applied
@ -86,7 +83,6 @@ public:
m_n_pk_recs(0), m_n_pk_recs(0),
m_n_pk_pages(0), m_n_pk_pages(0),
m_n_recs_processed(0), m_n_recs_processed(0),
m_n_flush_pages(0),
m_cur_phase(NOT_STARTED) m_cur_phase(NOT_STARTED)
{ {
} }
@ -134,13 +130,6 @@ public:
void void
begin_phase_insert(); begin_phase_insert();
/** Flag the beginning of the flush phase.
@param[in] n_flush_pages this many pages are going to be
flushed */
void
begin_phase_flush(
ulint n_flush_pages);
/** Flag the beginning of the log index phase. */ /** Flag the beginning of the log index phase. */
void void
begin_phase_log_index(); begin_phase_log_index();
@ -195,16 +184,12 @@ private:
recs-per-page records. */ recs-per-page records. */
ulint m_n_recs_processed; ulint m_n_recs_processed;
/** Number of pages to flush. */
ulint m_n_flush_pages;
/** Current phase. */ /** Current phase. */
enum { enum {
NOT_STARTED = 0, NOT_STARTED = 0,
READ_PK = 1, READ_PK = 1,
SORT = 2, SORT = 2,
INSERT = 3, INSERT = 3,
FLUSH = 4,
/* JAN: TODO: MySQL 5.7 vrs. MariaDB sql/log.h /* JAN: TODO: MySQL 5.7 vrs. MariaDB sql/log.h
LOG_INDEX = 5, LOG_INDEX = 5,
LOG_TABLE = 6, */ LOG_TABLE = 6, */
@ -317,8 +302,6 @@ ut_stage_alter_t::inc(ulint)
break; break;
} }
case FLUSH:
break;
/* JAN: TODO: MySQL 5.7 /* JAN: TODO: MySQL 5.7
case LOG_INDEX: case LOG_INDEX:
break; break;
@ -387,21 +370,6 @@ ut_stage_alter_t::begin_phase_insert()
change_phase(&srv_stage_alter_table_insert); change_phase(&srv_stage_alter_table_insert);
} }
/** Flag the beginning of the flush phase.
@param[in] n_flush_pages this many pages are going to be
flushed */
inline
void
ut_stage_alter_t::begin_phase_flush(
ulint n_flush_pages)
{
m_n_flush_pages = n_flush_pages;
reestimate();
change_phase(&srv_stage_alter_table_flush);
}
/** Flag the beginning of the log index phase. */ /** Flag the beginning of the log index phase. */
inline inline
void void
@ -458,20 +426,12 @@ ut_stage_alter_t::reestimate()
? m_n_pk_pages ? m_n_pk_pages
: m_pk->stat_n_leaf_pages; : m_pk->stat_n_leaf_pages;
/* If flush phase has not started yet and we do not know how
many pages are to be flushed, then use a wild guess - the
number of pages in the PK / 2. */
if (m_n_flush_pages == 0) {
m_n_flush_pages = n_pk_pages / 2;
}
ulonglong estimate __attribute__((unused)) ulonglong estimate __attribute__((unused))
= n_pk_pages = n_pk_pages
* (1 /* read PK */ * (1 /* read PK */
+ m_n_sort_indexes /* row_merge_buf_sort() inside the + m_n_sort_indexes /* row_merge_buf_sort() inside the
read PK per created index */ read PK per created index */
+ m_n_sort_indexes * 2 /* sort & insert per created index */) + m_n_sort_indexes * 2 /* sort & insert per created index */)
+ m_n_flush_pages
+ row_log_estimate_work(m_pk); + row_log_estimate_work(m_pk);
/* Prevent estimate < completed */ /* Prevent estimate < completed */
@ -500,8 +460,6 @@ ut_stage_alter_t::change_phase(
m_cur_phase = SORT; m_cur_phase = SORT;
} else if (new_stage == &srv_stage_alter_table_insert) { } else if (new_stage == &srv_stage_alter_table_insert) {
m_cur_phase = INSERT; m_cur_phase = INSERT;
} else if (new_stage == &srv_stage_alter_table_flush) {
m_cur_phase = FLUSH;
/* JAN: TODO: MySQL 5.7 used LOG_INDEX and LOG_TABLE */ /* JAN: TODO: MySQL 5.7 used LOG_INDEX and LOG_TABLE */
} else if (new_stage == &srv_stage_alter_table_log_index) { } else if (new_stage == &srv_stage_alter_table_log_index) {
m_cur_phase = LOG_INNODB_INDEX; m_cur_phase = LOG_INNODB_INDEX;
@ -542,8 +500,6 @@ public:
void begin_phase_insert() {} void begin_phase_insert() {}
void begin_phase_flush(ulint) {}
void begin_phase_log_index() {} void begin_phase_log_index() {}
void begin_phase_log_table() {} void begin_phase_log_table() {}

View File

@ -2076,7 +2076,7 @@ static void recv_recover_page(buf_block_t* block, mtr_t& mtr,
if (start_lsn) { if (start_lsn) {
log_flush_order_mutex_enter(); log_flush_order_mutex_enter();
buf_flush_note_modification(block, start_lsn, end_lsn, NULL); buf_flush_note_modification(block, start_lsn, end_lsn);
log_flush_order_mutex_exit(); log_flush_order_mutex_exit();
} else if (free_page && init) { } else if (free_page && init) {
/* There have been no operations than MLOG_INIT_FREE_PAGE. /* There have been no operations than MLOG_INIT_FREE_PAGE.

View File

@ -297,11 +297,10 @@ struct DebugCheck {
/** Release a resource acquired by the mini-transaction. */ /** Release a resource acquired by the mini-transaction. */
struct ReleaseBlocks { struct ReleaseBlocks {
/** Release specific object */ /** Release specific object */
ReleaseBlocks(lsn_t start_lsn, lsn_t end_lsn, FlushObserver* observer) ReleaseBlocks(lsn_t start_lsn, lsn_t end_lsn)
: :
m_end_lsn(end_lsn), m_end_lsn(end_lsn),
m_start_lsn(start_lsn), m_start_lsn(start_lsn)
m_flush_observer(observer)
{ {
/* Do nothing */ /* Do nothing */
} }
@ -316,8 +315,7 @@ struct ReleaseBlocks {
block = reinterpret_cast<buf_block_t*>(slot->object); block = reinterpret_cast<buf_block_t*>(slot->object);
buf_flush_note_modification(block, m_start_lsn, buf_flush_note_modification(block, m_start_lsn, m_end_lsn);
m_end_lsn, m_flush_observer);
} }
/** @return true always. */ /** @return true always. */
@ -340,9 +338,6 @@ struct ReleaseBlocks {
/** Mini-transaction REDO end LSN */ /** Mini-transaction REDO end LSN */
lsn_t m_start_lsn; lsn_t m_start_lsn;
/** Flush observer */
FlushObserver* m_flush_observer;
}; };
/** Write the block contents to the REDO log */ /** Write the block contents to the REDO log */
@ -393,7 +388,6 @@ void mtr_t::start()
m_log_mode= MTR_LOG_ALL; m_log_mode= MTR_LOG_ALL;
ut_d(m_user_space_id= TRX_SYS_SPACE); ut_d(m_user_space_id= TRX_SYS_SPACE);
m_user_space= nullptr; m_user_space= nullptr;
m_flush_observer= nullptr;
m_commit_lsn= 0; m_commit_lsn= 0;
} }
@ -437,8 +431,7 @@ void mtr_t::commit()
log_mutex_exit(); log_mutex_exit();
m_memo.for_each_block_in_reverse(CIterate<const ReleaseBlocks> m_memo.for_each_block_in_reverse(CIterate<const ReleaseBlocks>
(ReleaseBlocks(start_lsn, m_commit_lsn, (ReleaseBlocks(start_lsn, m_commit_lsn)));
m_flush_observer)));
if (m_made_dirty) if (m_made_dirty)
log_flush_order_mutex_exit(); log_flush_order_mutex_exit();
@ -559,8 +552,7 @@ mtr_t::x_lock_space(ulint space_id, const char* file, unsigned line)
space = fil_space_get(space_id); space = fil_space_get(space_id);
ut_ad(get_log_mode() != MTR_LOG_NO_REDO ut_ad(get_log_mode() != MTR_LOG_NO_REDO
|| space->purpose == FIL_TYPE_TEMPORARY || space->purpose == FIL_TYPE_TEMPORARY
|| space->purpose == FIL_TYPE_IMPORT || space->purpose == FIL_TYPE_IMPORT);
|| space->redo_skipped_count > 0);
} }
ut_ad(space); ut_ad(space);

View File

@ -424,9 +424,7 @@ static void page_zip_compress_write_log(buf_block_t* block,
/* Write the uncompressed trailer of the compressed page. */ /* Write the uncompressed trailer of the compressed page. */
mlog_catenate_string(mtr, page_zip->data + page_zip_get_size(page_zip) mlog_catenate_string(mtr, page_zip->data + page_zip_get_size(page_zip)
- trailer_size, trailer_size); - trailer_size, trailer_size);
if (!innodb_log_optimize_ddl) {
block->page.init_on_flush = true; block->page.init_on_flush = true;
}
} }
/******************************************************//** /******************************************************//**

View File

@ -1640,9 +1640,7 @@ row_fts_merge_insert(
== UT_BITS_IN_BYTES(aux_index->n_nullable)); == UT_BITS_IN_BYTES(aux_index->n_nullable));
/* Create bulk load instance */ /* Create bulk load instance */
ins_ctx.btr_bulk = UT_NEW_NOKEY( ins_ctx.btr_bulk = UT_NEW_NOKEY(BtrBulk(aux_index, trx));
BtrBulk(aux_index, trx, psort_info[0].psort_common->trx
->get_flush_observer()));
/* Create tuple for insert */ /* Create tuple for insert */
ins_ctx.tuple = dtuple_create(heap, dict_index_get_n_fields(aux_index)); ins_ctx.tuple = dtuple_create(heap, dict_index_get_n_fields(aux_index));
@ -1775,9 +1773,5 @@ exit:
ib::info() << "InnoDB_FTS: inserted " << count << " records"; 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); return(error);
} }

View File

@ -4192,18 +4192,7 @@ row_import_for_mysql(
/* Ensure that all pages dirtied during the IMPORT make it to disk. /* Ensure that all pages dirtied during the IMPORT make it to disk.
The only dirty pages generated should be from the pessimistic purge The only dirty pages generated should be from the pessimistic purge
of delete marked records that couldn't be purged in Phase I. */ of delete marked records that couldn't be purged in Phase I. */
buf_LRU_flush_or_remove_pages(prebuilt->table->space_id, true);
{
FlushObserver observer(prebuilt->table->space, trx, NULL);
buf_LRU_flush_or_remove_pages(prebuilt->table->space_id,
&observer);
if (observer.is_interrupted()) {
ib::info() << "Phase III - Flush interrupted";
return(row_import_error(prebuilt, trx,
DB_INTERRUPTED));
}
}
ib::info() << "Phase IV - Flush complete"; ib::info() << "Phase IV - Flush complete";
prebuilt->table->space->set_imported(); prebuilt->table->space->set_imported();

View File

@ -2355,15 +2355,6 @@ write_buffers:
conv_heap, &err, conv_heap, &err,
&v_heap, eval_table, trx)))) { &v_heap, eval_table, trx)))) {
/* Set the page flush observer for the
transaction when buffering the very first
record for a non-redo-logged operation. */
if (file->n_rec == 0 && i == 0
&& innodb_log_optimize_ddl) {
trx->set_flush_observer(
new_table->space, stage);
}
/* If we are creating FTS index, /* If we are creating FTS index,
a single row can generate more a single row can generate more
records for tokenized word */ records for tokenized word */
@ -2504,8 +2495,7 @@ write_buffers:
if (clust_btr_bulk == NULL) { if (clust_btr_bulk == NULL) {
clust_btr_bulk = UT_NEW_NOKEY( clust_btr_bulk = UT_NEW_NOKEY(
BtrBulk(index[i], BtrBulk(index[i],
trx, trx));
trx->get_flush_observer()));
} else { } else {
clust_btr_bulk->latch(); clust_btr_bulk->latch();
} }
@ -2620,9 +2610,7 @@ write_buffers:
trx->error_key_num = i; trx->error_key_num = i;
goto all_done;); goto all_done;);
BtrBulk btr_bulk( BtrBulk btr_bulk(index[i], trx);
index[i], trx,
trx->get_flush_observer());
err = row_merge_insert_index_tuples( err = row_merge_insert_index_tuples(
index[i], old_table, index[i], old_table,
@ -4475,26 +4463,6 @@ row_merge_drop_table(
trx, SQLCOM_DROP_TABLE, false, false)); trx, SQLCOM_DROP_TABLE, false, false));
} }
/** 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)
{
ut_ad(!index->table->is_temporary());
ut_ad(!(index->type & (DICT_SPATIAL | DICT_FTS)));
mtr_t mtr;
mtr.start();
byte* log_ptr = mlog_open(&mtr, 11 + 8);
log_ptr = mlog_write_initial_log_record_low(
MLOG_INDEX_LOAD,
index->table->space_id, index->page, log_ptr, &mtr);
mach_write_to_8(log_ptr, index->id);
mlog_close(&mtr, log_ptr + 8);
mtr.commit();
}
/** Build indexes on a table by reading a clustered index, creating a temporary /** Build indexes on a table by reading a clustered index, creating a temporary
file containing index entries, merge sorting these index entries and inserting file containing index entries, merge sorting these index entries and inserting
sorted index entries to indexes. sorted index entries to indexes.
@ -4795,8 +4763,7 @@ row_merge_build_indexes(
os_thread_sleep(20000000);); /* 20 sec */ os_thread_sleep(20000000);); /* 20 sec */
if (error == DB_SUCCESS) { if (error == DB_SUCCESS) {
BtrBulk btr_bulk(sort_idx, trx, BtrBulk btr_bulk(sort_idx, trx);
trx->get_flush_observer());
pct_cost = (COST_BUILD_INDEX_STATIC + pct_cost = (COST_BUILD_INDEX_STATIC +
(total_dynamic_cost * merge_files[k].offset / (total_dynamic_cost * merge_files[k].offset /
@ -4842,21 +4809,10 @@ row_merge_build_indexes(
if (indexes[i]->type & DICT_FTS) { if (indexes[i]->type & DICT_FTS) {
row_fts_psort_info_destroy(psort_info, merge_info); row_fts_psort_info_destroy(psort_info, merge_info);
fts_psort_initiated = false; fts_psort_initiated = false;
} else if (dict_index_is_spatial(indexes[i])) {
/* We never disable redo logging for
creating SPATIAL INDEX. Avoid writing any
unnecessary MLOG_INDEX_LOAD record. */
} else if (old_table != new_table) { } else if (old_table != new_table) {
ut_ad(!sort_idx->online_log); ut_ad(!sort_idx->online_log);
ut_ad(sort_idx->online_status ut_ad(sort_idx->online_status
== ONLINE_INDEX_COMPLETE); == ONLINE_INDEX_COMPLETE);
} else if (FlushObserver* flush_observer =
trx->get_flush_observer()) {
if (error != DB_SUCCESS) {
flush_observer->interrupted();
}
flush_observer->flush();
row_merge_write_redo(indexes[i]);
} }
if (old_table != new_table if (old_table != new_table
@ -4958,37 +4914,5 @@ func_exit:
} }
DBUG_EXECUTE_IF("ib_index_crash_after_bulk_load", DBUG_SUICIDE();); DBUG_EXECUTE_IF("ib_index_crash_after_bulk_load", DBUG_SUICIDE(););
if (FlushObserver* flush_observer = trx->get_flush_observer()) {
DBUG_EXECUTE_IF("ib_index_build_fail_before_flush",
error = DB_INTERRUPTED;
);
if (error != DB_SUCCESS) {
flush_observer->interrupted();
}
flush_observer->flush();
if (old_table != new_table) {
for (const dict_index_t* index
= dict_table_get_first_index(new_table);
index != NULL;
index = dict_table_get_next_index(index)) {
if (!(index->type
& (DICT_FTS | DICT_SPATIAL))) {
row_merge_write_redo(index);
}
}
}
trx->remove_flush_observer();
if (trx_is_interrupted(trx)) {
error = DB_INTERRUPTED;
}
}
DBUG_RETURN(error); DBUG_RETURN(error);
} }

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 2012, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2019, MariaDB Corporation. Copyright (c) 2017, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
@ -535,19 +535,10 @@ row_quiesce_table_start(
} }
if (!trx_is_interrupted(trx)) { if (!trx_is_interrupted(trx)) {
{ buf_LRU_flush_or_remove_pages(table->space_id, true);
FlushObserver observer(table->space, trx, NULL);
buf_LRU_flush_or_remove_pages(table->space_id,
&observer);
}
if (trx_is_interrupted(trx)) { if (row_quiesce_write_cfg(table, trx->mysql_thd)
ib::warn() << "Quiesce aborted!";
} else if (row_quiesce_write_cfg(table, trx->mysql_thd)
!= DB_SUCCESS) { != DB_SUCCESS) {
ib::warn() << "There was an error writing to the" ib::warn() << "There was an error writing to the"
" meta data file"; " meta data file";
} else { } else {

View File

@ -619,11 +619,6 @@ everything after flush log_make_checkpoint(). */
PSI_stage_info srv_stage_alter_table_end PSI_stage_info srv_stage_alter_table_end
= {0, "alter table (end)", PSI_FLAG_STAGE_PROGRESS}; = {0, "alter table (end)", PSI_FLAG_STAGE_PROGRESS};
/** Performance schema stage event for monitoring ALTER TABLE progress
log_make_checkpoint(). */
PSI_stage_info srv_stage_alter_table_flush
= {0, "alter table (flush)", PSI_FLAG_STAGE_PROGRESS};
/** Performance schema stage event for monitoring ALTER TABLE progress /** Performance schema stage event for monitoring ALTER TABLE progress
row_merge_insert_index_tuples(). */ row_merge_insert_index_tuples(). */
PSI_stage_info srv_stage_alter_table_insert PSI_stage_info srv_stage_alter_table_insert

View File

@ -3,7 +3,7 @@
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved. Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2008, Google Inc. Copyright (c) 2008, Google Inc.
Copyright (c) 2009, Percona Inc. Copyright (c) 2009, Percona Inc.
Copyright (c) 2013, 2019, MariaDB Corporation. Copyright (c) 2013, 2020, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described Google, Inc. Those modifications are gratefully acknowledged and are described
@ -186,7 +186,6 @@ performance schema. */
static PSI_stage_info* srv_stages[] = static PSI_stage_info* srv_stages[] =
{ {
&srv_stage_alter_table_end, &srv_stage_alter_table_end,
&srv_stage_alter_table_flush,
&srv_stage_alter_table_insert, &srv_stage_alter_table_insert,
&srv_stage_alter_table_log_index, &srv_stage_alter_table_log_index,
&srv_stage_alter_table_log_table, &srv_stage_alter_table_log_table,

View File

@ -671,14 +671,7 @@ not_free:
mini-transaction commit and the server was killed, then mini-transaction commit and the server was killed, then
discarding the to-be-trimmed pages without flushing would discarding the to-be-trimmed pages without flushing would
break crash recovery. So, we cannot avoid the write. */ break crash recovery. So, we cannot avoid the write. */
{ buf_LRU_flush_or_remove_pages(space.id, true);
FlushObserver observer(
purge_sys.truncate.current,
UT_LIST_GET_FIRST(purge_sys.query->thrs)
->graph->trx,
NULL);
buf_LRU_flush_or_remove_pages(space.id, &observer);
}
log_free_check(); log_free_check();

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2015, 2019, MariaDB Corporation. Copyright (c) 2015, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
@ -161,8 +161,6 @@ trx_init(
trx->lock.rec_cached = 0; trx->lock.rec_cached = 0;
trx->lock.table_cached = 0; trx->lock.table_cached = 0;
ut_ad(trx->get_flush_observer() == NULL);
} }
/** For managing the life-cycle of the trx_t instance that we get /** For managing the life-cycle of the trx_t instance that we get
@ -902,21 +900,6 @@ static trx_rseg_t* trx_assign_rseg_low()
return(rseg); return(rseg);
} }
/** Set the innodb_log_optimize_ddl page flush observer
@param[in,out] space tablespace
@param[in,out] stage performance_schema accounting */
void trx_t::set_flush_observer(fil_space_t* space, ut_stage_alter_t* stage)
{
flush_observer = UT_NEW_NOKEY(FlushObserver(space, this, stage));
}
/** Remove the flush observer */
void trx_t::remove_flush_observer()
{
UT_DELETE(flush_observer);
flush_observer = NULL;
}
/** Assign a rollback segment for modifying temporary tables. /** Assign a rollback segment for modifying temporary tables.
@return the assigned rollback segment */ @return the assigned rollback segment */
trx_rseg_t* trx_rseg_t*

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2014, 2019, MariaDB Corporation. Copyright (c) 2014, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
@ -752,7 +752,7 @@ trx_undo_free_page(
fseg_free_page(TRX_UNDO_SEG_HDR + TRX_UNDO_FSEG_HEADER fseg_free_page(TRX_UNDO_SEG_HDR + TRX_UNDO_FSEG_HEADER
+ header_block->frame, + header_block->frame,
rseg->space, page_no, false, true, mtr); rseg->space, page_no, false, mtr);
const fil_addr_t last_addr = flst_get_last( const fil_addr_t last_addr = flst_get_last(
TRX_UNDO_SEG_HDR + TRX_UNDO_PAGE_LIST + header_block->frame); TRX_UNDO_SEG_HDR + TRX_UNDO_PAGE_LIST + header_block->frame);