diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-03-31 14:37:11 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-03-31 14:37:11 +0300 |
commit | 14c72bd3e0140aa352d0f0cd2ca46069bfecdd81 (patch) | |
tree | 3aef7908c87d39c2f96a0cd86637e9281f5d806c | |
parent | b2bc837ebe073a53c6ba5e756d4c0a6f586fa12f (diff) | |
download | mariadb-git-14c72bd3e0140aa352d0f0cd2ca46069bfecdd81.tar.gz |
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).
-rw-r--r-- | storage/innobase/dict/dict0stats.cc | 18 | ||||
-rw-r--r-- | storage/innobase/fil/fil0fil.cc | 6 | ||||
-rw-r--r-- | storage/innobase/include/dict0stats.h | 14 | ||||
-rw-r--r-- | storage/innobase/include/fil0fil.h | 5 | ||||
-rw-r--r-- | storage/innobase/include/srv0srv.h | 17 | ||||
-rw-r--r-- | storage/innobase/row/row0mysql.cc | 1 | ||||
-rw-r--r-- | storage/innobase/row/row0upd.cc | 5 | ||||
-rw-r--r-- | storage/innobase/srv/srv0srv.cc | 16 | ||||
-rw-r--r-- | storage/innobase/srv/srv0start.cc | 6 |
9 files changed, 43 insertions, 45 deletions
diff --git a/storage/innobase/dict/dict0stats.cc b/storage/innobase/dict/dict0stats.cc index 1c8e859c719..61810a88889 100644 --- a/storage/innobase/dict/dict0stats.cc +++ b/storage/innobase/dict/dict0stats.cc @@ -3332,16 +3332,18 @@ transient: 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( diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 788fd34bd52..fd0a94b4c64 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -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: diff --git a/storage/innobase/include/dict0stats.h b/storage/innobase/include/dict0stats.h index ab001130364..b803e9c5f49 100644 --- a/storage/innobase/include/dict0stats.h +++ b/storage/innobase/include/dict0stats.h @@ -1,7 +1,7 @@ /***************************************************************************** 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( diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index 170f492f0ec..621b9130efc 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -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. */ diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index e05c2a586e3..b0d36d6ad48 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -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); diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index 3f567946ce4..17df8e2aa0e 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -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" diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc index e797d527969..cacb929eff4 100644 --- a/storage/innobase/row/row0upd.cc +++ b/storage/innobase/row/row0upd.cc @@ -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), diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 47273b79e81..726fe613f46 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -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; diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index d226754bf12..8c57980c10b 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -1993,11 +1993,9 @@ skip_monitors: } 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(); } |