Commit 14c72bd3 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-19514: Correct a few outdated comments

There is no background change buffer merge any more.
Change buffer merge will only take place during a slow shutdown
(a shutdown initiated after SET GLOBAL innodb_fast_shutdown=0).
parent b2bc837e
......@@ -3332,16 +3332,18 @@ dict_stats_update(
return(DB_SUCCESS);
}
/*********************************************************************//**
Removes the information for a particular index's stats from the persistent
/** Remove the information for a particular index's stats from the persistent
storage if it exists and if there is data stored for this index.
This function creates its own trx and commits it.
A note from Marko why we cannot edit user and sys_* tables in one trx:
marko: The problem is that ibuf merges should be disabled while we are
rolling back dict transactions.
marko: If ibuf merges are not disabled, we need to scan the *.ibd files.
But we shouldn't open *.ibd files before we have rolled back dict
transactions and opened the SYS_* records for the *.ibd files.
We must modify system tables in a separate transaction in order to
adhere to the InnoDB design constraint that dict_sys.latch prevents
lock waits on system tables. If we modified system and user tables in
the same transaction, we should exclusively hold dict_sys.latch until
the transaction is committed, and effectively block other transactions
that will attempt to open any InnoDB tables. Because we have no
guarantee that user transactions will be committed fast, we cannot
afford to keep the system tables locked in a user transaction.
@return DB_SUCCESS or error code */
dberr_t
dict_stats_drop_index(
......
......@@ -2200,8 +2200,8 @@ fil_close_tablespace(
/* Invalidate in the buffer pool all pages belonging to the
tablespace. Since we have set space->stop_new_ops = true, readahead
or ibuf merge can no longer read more pages of this tablespace to the
buffer pool. Thus we can clean the tablespace out of the buffer pool
can no longer read more pages of this tablespace to buf_pool.
Thus we can clean the tablespace out of buf_pool
completely and permanently. The flag stop_new_ops also prevents
fil_flush() from being applied to this tablespace. */
buf_LRU_flush_or_remove_pages(id, true);
......@@ -2279,7 +2279,7 @@ dberr_t fil_delete_tablespace(ulint id, bool if_exists)
ut_a(path != 0);
/* IMPORTANT: Because we have set space::stop_new_ops there
can't be any new ibuf merges, reads or flushes. We are here
can't be any new reads or flushes. We are here
because node::n_pending was zero above. However, it is still
possible to have pending read and write requests:
......
/*****************************************************************************
Copyright (c) 2009, 2018, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2018, MariaDB Corporation.
Copyright (c) 2017, 2020, 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
......@@ -140,10 +140,18 @@ dict_stats_update(
the stats or to fetch them from
the persistent storage */
/*********************************************************************//**
Removes the information for a particular index's stats from the persistent
/** Remove the information for a particular index's stats from the persistent
storage if it exists and if there is data stored for this index.
This function creates its own trx and commits it.
We must modify system tables in a separate transaction in order to
adhere to the InnoDB design constraint that dict_sys.latch prevents
lock waits on system tables. If we modified system and user tables in
the same transaction, we should exclusively hold dict_sys.latch until
the transaction is committed, and effectively block other transactions
that will attempt to open any InnoDB tables. Because we have no
guarantee that user transactions will be committed fast, we cannot
afford to keep the system tables locked in a user transaction.
@return DB_SUCCESS or error code */
dberr_t
dict_stats_drop_index(
......
......@@ -100,9 +100,8 @@ struct fil_space_t
tablespace will be in named_spaces. */
/** set when an .ibd file is about to be deleted,
or an undo tablespace is about to be truncated.
When this is set following new ops are not allowed:
When this is set, the following new ops are not allowed:
* read IO request
* ibuf merge
* file flush
Note that we can still possibly have new write operations
because we don't check this flag when doing flush batches. */
......@@ -134,7 +133,7 @@ struct fil_space_t
/** Number of pending buffer pool operations accessing the tablespace
without holding a table lock or dict_sys.latch S-latch
that would prevent the table (and tablespace) from being
dropped. An example is change buffer merge.
dropped. An example is fil_crypt_thread.
The tablespace cannot be dropped while this is nonzero,
or while fil_node_t::n_pending is nonzero.
Protected by fil_system.mutex and std::atomic. */
......
......@@ -417,13 +417,11 @@ extern ulong srv_flushing_avg_loops;
extern ulong srv_force_recovery;
extern uint srv_fast_shutdown; /*!< If this is 1, do not do a
purge and index buffer merge.
If this 2, do not even flush the
buffer pool to data files at the
shutdown: we effectively 'crash'
InnoDB (but lose no committed
transactions). */
/** innodb_fast_shutdown=1 skips purge and change buffer merge.
innodb_fast_shutdown=2 effectively crashes the server (no log checkpoint).
innodb_fast_shutdown=3 is a clean shutdown that skips the rollback
of active transaction (to be done on restart). */
extern uint srv_fast_shutdown;
extern ibool srv_innodb_status;
......@@ -776,9 +774,8 @@ void srv_master_callback(void*);
/**
Perform shutdown tasks such as background drop,
and optionally ibuf merge.
*/
Complete the shutdown tasks such as background DROP TABLE,
and optionally change buffer merge (on innodb_fast_shutdown=0). */
void srv_shutdown(bool ibuf_merge);
......
......@@ -54,7 +54,6 @@ Created 9/17/2000 Heikki Tuuri
#include "rem0cmp.h"
#include "row0import.h"
#include "row0ins.h"
#include "row0merge.h"
#include "row0row.h"
#include "row0sel.h"
#include "row0upd.h"
......
......@@ -503,11 +503,6 @@ row_upd_changes_field_size_or_external(
ut_ad(new_len != UNIV_SQL_DEFAULT);
if (dfield_is_null(new_val) && !rec_offs_comp(offsets)) {
/* A bug fixed on Dec 31st, 2004: we looked at the
SQL NULL size from the wrong field! We may backport
this fix also to 4.0. The merge to 5.0 will be made
manually immediately after we commit this to 4.1. */
new_len = dict_col_get_sql_null_size(
dict_index_get_nth_col(index,
upd_field->field_no),
......
......@@ -306,10 +306,10 @@ my_bool srv_print_all_deadlocks;
INFORMATION_SCHEMA.innodb_cmp_per_index */
my_bool srv_cmp_per_index_enabled;
/** innodb_fast_shutdown; if 1 then we do not run purge and insert buffer
merge to completion before shutdown. If it is set to 2, do not even flush the
buffer pool to data files at the shutdown: we effectively 'crash'
InnoDB (but lose no committed transactions). */
/** innodb_fast_shutdown=1 skips purge and change buffer merge.
innodb_fast_shutdown=2 effectively crashes the server (no log checkpoint).
innodb_fast_shutdown=3 is a clean shutdown that skips the rollback
of active transaction (to be done on restart). */
uint srv_fast_shutdown;
/** copy of innodb_status_file; generate a innodb_status.<pid> file */
......@@ -1949,10 +1949,10 @@ srv_master_do_idle_tasks(void)
counter_time);
}
/** Perform shutdown tasks.
@param[in] ibuf_merge whether to complete the change buffer merge */
void
srv_shutdown(bool ibuf_merge)
/**
Complete the shutdown tasks such as background DROP TABLE,
and optionally change buffer merge (on innodb_fast_shutdown=0). */
void srv_shutdown(bool ibuf_merge)
{
ulint n_bytes_merged = 0;
ulint n_tables_to_drop;
......
......@@ -1993,11 +1993,9 @@ dberr_t srv_start(bool create_new_db)
}
if (srv_force_recovery == 0) {
/* In the insert buffer we may have even bigger tablespace
/* In the change buffer we may have even bigger tablespace
id's, because we may have dropped those tablespaces, but
insert buffer merge has not had time to clean the records from
the ibuf tree. */
the buffered records have not been cleaned yet. */
ibuf_update_max_tablespace_id();
}
......
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