summaryrefslogtreecommitdiff
path: root/storage/xtradb
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-04-04 07:59:25 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2017-04-04 07:59:25 +0300
commit6e105d75351dfcfd103c7b60838e59f1fd6b4749 (patch)
tree89d49783fbf16fdfc3e82a8b19a995bfeacda018 /storage/xtradb
parent00ab154d49853e20f48a516897e14bf67c58671e (diff)
parent9505c9683930290c1e028043940ae8512a6ca040 (diff)
downloadmariadb-git-6e105d75351dfcfd103c7b60838e59f1fd6b4749.tar.gz
Merge 10.1 into 10.2
Diffstat (limited to 'storage/xtradb')
-rw-r--r--storage/xtradb/btr/btr0scrub.cc35
-rw-r--r--storage/xtradb/buf/buf0buf.cc10
-rw-r--r--storage/xtradb/fil/fil0fil.cc52
-rw-r--r--storage/xtradb/include/fil0fil.h17
4 files changed, 54 insertions, 60 deletions
diff --git a/storage/xtradb/btr/btr0scrub.cc b/storage/xtradb/btr/btr0scrub.cc
index 560d2ece6c0..e9434c9f778 100644
--- a/storage/xtradb/btr/btr0scrub.cc
+++ b/storage/xtradb/btr/btr0scrub.cc
@@ -129,15 +129,15 @@ btr_scrub_lock_dict_func(ulint space_id, bool lock_to_close_table,
* if we don't lock to close a table, we check if space
* is closing, and then instead give up
*/
- if (lock_to_close_table == false) {
- fil_space_t* space = fil_space_acquire(space_id);
- if (!space || space->stop_new_ops) {
- if (space) {
- fil_space_release(space);
- }
+ if (lock_to_close_table) {
+ } else if (fil_space_t* space = fil_space_acquire(space_id)) {
+ bool stopping = space->is_stopping();
+ fil_space_release(space);
+ if (stopping) {
return false;
}
- fil_space_release(space);
+ } else {
+ return false;
}
os_thread_sleep(250000);
@@ -197,18 +197,15 @@ btr_scrub_table_close_for_thread(
return;
}
- fil_space_t* space = fil_space_acquire(scrub_data->space);
-
- /* If tablespace is not marked as stopping perform
- the actual close. */
- if (space && !space->is_stopping()) {
- mutex_enter(&dict_sys->mutex);
- /* perform the actual closing */
- btr_scrub_table_close(scrub_data->current_table);
- mutex_exit(&dict_sys->mutex);
- }
-
- if (space) {
+ if (fil_space_t* space = fil_space_acquire(scrub_data->space)) {
+ /* If tablespace is not marked as stopping perform
+ the actual close. */
+ if (!space->is_stopping()) {
+ mutex_enter(&dict_sys->mutex);
+ /* perform the actual closing */
+ btr_scrub_table_close(scrub_data->current_table);
+ mutex_exit(&dict_sys->mutex);
+ }
fil_space_release(space);
}
diff --git a/storage/xtradb/buf/buf0buf.cc b/storage/xtradb/buf/buf0buf.cc
index c9a3f6aa6ec..70cd9610b18 100644
--- a/storage/xtradb/buf/buf0buf.cc
+++ b/storage/xtradb/buf/buf0buf.cc
@@ -6413,14 +6413,12 @@ buf_page_decrypt_after_read(
return (true);
}
- fil_space_t* space = fil_space_acquire(bpage->space);
-
- fil_space_crypt_t* crypt_data = space->crypt_data;
+ fil_space_t* space = fil_space_acquire(bpage->space, true);
/* Page is encrypted if encryption information is found from
tablespace and page contains used key_version. This is true
also for pages first compressed and then encrypted. */
- if (!crypt_data) {
+ if (!space || !space->crypt_data) {
key_version = 0;
}
@@ -6504,6 +6502,8 @@ buf_page_decrypt_after_read(
}
}
- fil_space_release(space);
+ if (space != NULL) {
+ fil_space_release(space);
+ }
return (success);
}
diff --git a/storage/xtradb/fil/fil0fil.cc b/storage/xtradb/fil/fil0fil.cc
index a116bfad99d..e7244d719c8 100644
--- a/storage/xtradb/fil/fil0fil.cc
+++ b/storage/xtradb/fil/fil0fil.cc
@@ -6389,16 +6389,12 @@ fil_flush(
{
mutex_enter(&fil_system->mutex);
- fil_space_t* space = fil_space_get_by_id(space_id);
-
- if (!space || space->stop_new_ops) {
- mutex_exit(&fil_system->mutex);
-
- return;
+ if (fil_space_t* space = fil_space_get_by_id(space_id)) {
+ if (!space->is_stopping()) {
+ fil_flush_low(space);
+ }
}
- fil_flush_low(space);
-
mutex_exit(&fil_system->mutex);
}
@@ -6438,8 +6434,7 @@ fil_flush_file_spaces(
space;
space = UT_LIST_GET_NEXT(unflushed_spaces, space)) {
- if (space->purpose == purpose && !space->stop_new_ops) {
-
+ if (space->purpose == purpose && !space->is_stopping()) {
space_ids[n_space_ids++] = space->id;
}
}
@@ -7388,12 +7383,13 @@ Used by background threads that do not necessarily hold proper locks
for concurrency control.
@param[in] id tablespace ID
@param[in] silent whether to silently ignore missing tablespaces
-@return the tablespace, or NULL if missing or being deleted */
+@param[in] for_io whether to look up the tablespace while performing I/O
+ (possibly executing TRUNCATE)
+@return the tablespace
+@retval NULL if missing or being deleted or truncated */
inline
fil_space_t*
-fil_space_acquire_low(
- ulint id,
- bool silent)
+fil_space_acquire_low(ulint id, bool silent, bool for_io = false)
{
fil_space_t* space;
@@ -7407,7 +7403,7 @@ fil_space_acquire_low(
" tablespace " ULINTPF ".", id);
ut_error;
}
- } else if (space->stop_new_ops) {
+ } else if (!for_io && space->is_stopping()) {
space = NULL;
} else {
space->n_pending_ops++;
@@ -7422,22 +7418,24 @@ fil_space_acquire_low(
Used by background threads that do not necessarily hold proper locks
for concurrency control.
@param[in] id tablespace ID
-@return the tablespace, or NULL if missing or being deleted */
+@param[in] for_io whether to look up the tablespace while performing I/O
+ (possibly executing TRUNCATE)
+@return the tablespace
+@retval NULL if missing or being deleted or truncated */
fil_space_t*
-fil_space_acquire(
- ulint id)
+fil_space_acquire(ulint id, bool for_io)
{
- return(fil_space_acquire_low(id, false));
+ return(fil_space_acquire_low(id, false, for_io));
}
/** Acquire a tablespace that may not exist.
Used by background threads that do not necessarily hold proper locks
for concurrency control.
@param[in] id tablespace ID
-@return the tablespace, or NULL if missing or being deleted */
+@return the tablespace
+@retval NULL if missing or being deleted */
fil_space_t*
-fil_space_acquire_silent(
- ulint id)
+fil_space_acquire_silent(ulint id)
{
return(fil_space_acquire_low(id, true));
}
@@ -7445,8 +7443,7 @@ fil_space_acquire_silent(
/** Release a tablespace acquired with fil_space_acquire().
@param[in,out] space tablespace to release */
void
-fil_space_release(
- fil_space_t* space)
+fil_space_release(fil_space_t* space)
{
mutex_enter(&fil_system->mutex);
ut_ad(space->magic_n == FIL_SPACE_MAGIC_N);
@@ -7464,8 +7461,7 @@ If NULL, use the first fil_space_t on fil_system->space_list.
@return pointer to the next fil_space_t.
@retval NULL if this was the last*/
fil_space_t*
-fil_space_next(
- fil_space_t* prev_space)
+fil_space_next(fil_space_t* prev_space)
{
fil_space_t* space=prev_space;
@@ -7488,8 +7484,8 @@ fil_space_next(
fil_ibd_create(), or dropped, or !tablespace. */
while (space != NULL
&& (UT_LIST_GET_LEN(space->chain) == 0
- || space->stop_new_ops
- || space->purpose != FIL_TABLESPACE)) {
+ || space->is_stopping()
+ || space->purpose != FIL_TABLESPACE)) {
space = UT_LIST_GET_NEXT(space_list, space);
}
diff --git a/storage/xtradb/include/fil0fil.h b/storage/xtradb/include/fil0fil.h
index b80df057351..698039afede 100644
--- a/storage/xtradb/include/fil0fil.h
+++ b/storage/xtradb/include/fil0fil.h
@@ -650,27 +650,28 @@ fil_write_flushed_lsn_to_data_files(
Used by background threads that do not necessarily hold proper locks
for concurrency control.
@param[in] id tablespace ID
-@return the tablespace, or NULL if missing or being deleted */
+@param[in] for_io whether to look up the tablespace while performing I/O
+ (possibly executing TRUNCATE)
+@return the tablespace
+@retval NULL if missing or being deleted or truncated */
fil_space_t*
-fil_space_acquire(
- ulint id)
+fil_space_acquire(ulint id, bool for_io = false)
MY_ATTRIBUTE((warn_unused_result));
/** Acquire a tablespace that may not exist.
Used by background threads that do not necessarily hold proper locks
for concurrency control.
@param[in] id tablespace ID
-@return the tablespace, or NULL if missing or being deleted */
+@return the tablespace
+@retval NULL if missing or being deleted */
fil_space_t*
-fil_space_acquire_silent(
- ulint id)
+fil_space_acquire_silent(ulint id)
MY_ATTRIBUTE((warn_unused_result));
/** Release a tablespace acquired with fil_space_acquire().
@param[in,out] space tablespace to release */
void
-fil_space_release(
- fil_space_t* space);
+fil_space_release(fil_space_t* space);
/** Return the next fil_space_t.
Once started, the caller must keep calling this until it returns NULL.