summaryrefslogtreecommitdiff
path: root/storage/innobase/include/fil0fil.h
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase/include/fil0fil.h')
-rw-r--r--storage/innobase/include/fil0fil.h92
1 files changed, 17 insertions, 75 deletions
diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
index 5f52e6e34b1..940e1b68458 100644
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
@@ -353,13 +353,10 @@ struct fil_space_t final
/** fil_system.spaces chain node */
fil_space_t *hash;
- lsn_t max_lsn;
- /*!< LSN of the most recent
- fil_names_write_if_was_clean().
- Reset to 0 by fil_names_clear().
- Protected by log_sys.mutex.
- If and only if this is nonzero, the
- tablespace will be in named_spaces. */
+ /** LSN of the most recent fil_names_write_if_was_clean().
+ Reset to 0 by fil_names_clear(). Protected by exclusive log_sys.latch.
+ If and only if max_lsn is nonzero, this is in fil_system.named_spaces. */
+ lsn_t max_lsn;
/** tablespace identifier */
uint32_t id;
/** whether undo tablespace truncation is in progress */
@@ -427,9 +424,10 @@ private:
/** Whether any corrupton of this tablespace has been reported */
mutable std::atomic_flag is_corrupted;
+public:
/** mutex to protect freed_ranges and last_freed_lsn */
std::mutex freed_range_mutex;
-
+private:
/** Ranges of freed page numbers; protected by freed_range_mutex */
range_set freed_ranges;
@@ -644,11 +642,7 @@ public:
/** @return last_freed_lsn */
lsn_t get_last_freed_lsn() { return last_freed_lsn; }
/** Update last_freed_lsn */
- void update_last_freed_lsn(lsn_t lsn)
- {
- std::lock_guard<std::mutex> freed_lock(freed_range_mutex);
- last_freed_lsn= lsn;
- }
+ void update_last_freed_lsn(lsn_t lsn) { last_freed_lsn= lsn; }
/** Note that the file will need fsync().
@return whether this needs to be added to fil_system.unflushed_spaces */
@@ -669,11 +663,7 @@ public:
/** Clear all freed ranges for undo tablespace when InnoDB
encounters TRIM redo log record */
- void clear_freed_ranges()
- {
- std::lock_guard<std::mutex> freed_lock(freed_range_mutex);
- freed_ranges.clear();
- }
+ void clear_freed_ranges() { freed_ranges.clear(); }
#endif /* !UNIV_INNOCHECKSUM */
/** FSP_SPACE_FLAGS and FSP_FLAGS_MEM_ flags;
check fsp0types.h to more info about flags. */
@@ -946,7 +936,6 @@ public:
/** Add the set of freed page ranges */
void add_free_range(const range_t range)
{
- std::lock_guard<std::mutex> freed_lock(freed_range_mutex);
freed_ranges.add_range(range);
}
@@ -1049,7 +1038,7 @@ struct fil_node_t final
{
/** tablespace containing this file */
fil_space_t *space;
- /** file name; protected by fil_system.mutex and log_sys.mutex */
+ /** file name; protected by fil_system.mutex and exclusive log_sys.latch */
char *name;
/** file handle */
pfs_os_file_t handle;
@@ -1436,14 +1425,12 @@ public:
/** nonzero if fil_node_open_file_low() should avoid moving the tablespace
to the end of space_list, for FIFO policy of try_to_close() */
ulint freeze_space_list;
+ /** list of all tablespaces */
ilist<fil_space_t, space_list_tag_t> space_list;
- /*!< list of all file spaces */
+ /** list of all tablespaces for which a FILE_MODIFY record has been written
+ since the latest redo log checkpoint.
+ Protected only by exclusive log_sys.latch. */
ilist<fil_space_t, named_spaces_tag_t> named_spaces;
- /*!< list of all file spaces
- for which a FILE_MODIFY
- record has been written since
- the latest redo log checkpoint.
- Protected only by log_sys.mutex. */
/** list of all ENCRYPTED=DEFAULT tablespaces that need
to be converted to the current value of innodb_encrypt_tables */
@@ -1596,15 +1583,6 @@ Sets the max tablespace id counter if the given number is bigger than the
previous value. */
void fil_set_max_space_id_if_bigger(uint32_t max_id);
-/** Write the flushed LSN to the page header of the first page in the
-system tablespace.
-@param[in] lsn flushed LSN
-@return DB_SUCCESS or error number */
-dberr_t
-fil_write_flushed_lsn(
- lsn_t lsn)
-MY_ATTRIBUTE((warn_unused_result));
-
MY_ATTRIBUTE((warn_unused_result))
/** Delete a tablespace and associated .ibd file.
@param id tablespace identifier
@@ -1773,50 +1751,14 @@ void
fil_names_dirty(
fil_space_t* space);
-/** Write FILE_MODIFY records when a non-predefined persistent
-tablespace was modified for the first time since the latest
-fil_names_clear().
-@param[in,out] space tablespace */
-void fil_names_dirty_and_write(fil_space_t* space);
-
-/** Write FILE_MODIFY records if a persistent tablespace was modified
-for the first time since the latest fil_names_clear().
-@param[in,out] space tablespace
-@param[in,out] mtr mini-transaction
-@return whether any FILE_MODIFY record was written */
-inline bool fil_names_write_if_was_clean(fil_space_t* space)
-{
- mysql_mutex_assert_owner(&log_sys.mutex);
-
- if (space == NULL) {
- return(false);
- }
-
- const bool was_clean = space->max_lsn == 0;
- ut_ad(space->max_lsn <= log_sys.get_lsn());
- space->max_lsn = log_sys.get_lsn();
-
- if (was_clean) {
- fil_names_dirty_and_write(space);
- }
-
- return(was_clean);
-}
-
bool fil_comp_algo_loaded(ulint comp_algo);
/** On a log checkpoint, reset fil_names_dirty_and_write() flags
-and write out FILE_MODIFY and FILE_CHECKPOINT if needed.
-@param[in] lsn checkpoint LSN
-@param[in] do_write whether to always write FILE_CHECKPOINT
-@return whether anything was written to the redo log
-@retval false if no flags were set and nothing written
-@retval true if anything was written to the redo log */
-bool
-fil_names_clear(
- lsn_t lsn,
- bool do_write);
+and write out FILE_MODIFY if needed, and write FILE_CHECKPOINT.
+@param lsn checkpoint LSN
+@return current LSN */
+lsn_t fil_names_clear(lsn_t lsn);
#ifdef UNIV_ENABLE_UNIT_TEST_MAKE_FILEPATH
void test_make_filepath();