mirror of
https://github.com/MariaDB/server.git
synced 2026-04-22 08:15:31 +02:00
Merge 10.1 into 10.2
This commit is contained in:
commit
6e105d7535
10 changed files with 141 additions and 137 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -97,6 +97,9 @@ pcre/pcre_chartables.c
|
||||||
pcre/pcregrep
|
pcre/pcregrep
|
||||||
pcre/pcretest
|
pcre/pcretest
|
||||||
pcre/test*grep
|
pcre/test*grep
|
||||||
|
plugin/aws_key_management/aws-sdk-cpp
|
||||||
|
plugin/aws_key_management/aws_sdk_cpp
|
||||||
|
plugin/aws_key_management/aws_sdk_cpp-prefix
|
||||||
scripts/comp_sql
|
scripts/comp_sql
|
||||||
scripts/make_binary_distribution
|
scripts/make_binary_distribution
|
||||||
scripts/msql2mysql
|
scripts/msql2mysql
|
||||||
|
|
|
||||||
|
|
@ -51,10 +51,11 @@ ENDIF()
|
||||||
FIND_LIBRARY(AWS_CPP_SDK_CORE NAMES aws-cpp-sdk-core PATH_SUFFIXES "${SDK_INSTALL_BINARY_PREFIX}")
|
FIND_LIBRARY(AWS_CPP_SDK_CORE NAMES aws-cpp-sdk-core PATH_SUFFIXES "${SDK_INSTALL_BINARY_PREFIX}")
|
||||||
FIND_LIBRARY(AWS_CPP_SDK_KMS NAMES aws-cpp-sdk-kms PATH_SUFFIXES "${SDK_INSTALL_BINARY_PREFIX}")
|
FIND_LIBRARY(AWS_CPP_SDK_KMS NAMES aws-cpp-sdk-kms PATH_SUFFIXES "${SDK_INSTALL_BINARY_PREFIX}")
|
||||||
SET(CMAKE_REQUIRED_FLAGS ${CXX11_FLAGS})
|
SET(CMAKE_REQUIRED_FLAGS ${CXX11_FLAGS})
|
||||||
CHECK_INCLUDE_FILE_CXX(aws/kms/KMSClient.h HAVE_AWS_HEADERS)
|
FIND_PATH(AWS_CPP_SDK_INCLUDE_DIR NAMES aws/kms/KMSClient.h)
|
||||||
|
|
||||||
IF(AWS_CPP_SDK_CORE AND AWS_CPP_SDK_KMS AND HAVE_AWS_HEADERS)
|
IF(AWS_CPP_SDK_CORE AND AWS_CPP_SDK_KMS AND AWS_CPP_SDK_INCLUDE_DIR)
|
||||||
# AWS C++ SDK installed
|
# AWS C++ SDK installed
|
||||||
|
INCLUDE_DIRECTORIES(${AWS_CPP_SDK_INCLUDE_DIR})
|
||||||
SET(AWS_SDK_LIBS ${AWS_CPP_SDK_CORE} ${AWS_CPP_SDK_KMS})
|
SET(AWS_SDK_LIBS ${AWS_CPP_SDK_CORE} ${AWS_CPP_SDK_KMS})
|
||||||
ELSE()
|
ELSE()
|
||||||
OPTION(AWS_SDK_EXTERNAL_PROJECT "Allow download and build AWS C++ SDK" OFF)
|
OPTION(AWS_SDK_EXTERNAL_PROJECT "Allow download and build AWS C++ SDK" OFF)
|
||||||
|
|
@ -95,14 +96,26 @@ ELSE()
|
||||||
SET(EXTRA_SDK_CMAKE_FLAGS ${EXTRA_SDK_CMAKE_FLAGS} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER})
|
SET(EXTRA_SDK_CMAKE_FLAGS ${EXTRA_SDK_CMAKE_FLAGS} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER})
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
SET(byproducts )
|
||||||
|
# We do not need to build the whole SDK , just 2 of its libs
|
||||||
|
set(AWS_SDK_LIBS aws-cpp-sdk-core aws-cpp-sdk-kms)
|
||||||
|
FOREACH(lib ${AWS_SDK_LIBS})
|
||||||
|
ADD_LIBRARY(${lib} STATIC IMPORTED GLOBAL)
|
||||||
|
ADD_DEPENDENCIES(${lib} aws_sdk_cpp)
|
||||||
|
SET(loc "${CMAKE_CURRENT_BINARY_DIR}/aws_sdk_cpp/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||||
|
SET(byproducts ${byproducts} BUILD_BYPRODUCTS ${loc})
|
||||||
|
SET_TARGET_PROPERTIES(${lib} PROPERTIES IMPORTED_LOCATION ${loc})
|
||||||
|
ENDFOREACH()
|
||||||
|
|
||||||
SET(AWS_SDK_PATCH_COMMAND )
|
SET(AWS_SDK_PATCH_COMMAND )
|
||||||
ExternalProject_Add(
|
ExternalProject_Add(
|
||||||
aws_sdk_cpp
|
aws_sdk_cpp
|
||||||
GIT_REPOSITORY "https://github.com/awslabs/aws-sdk-cpp.git"
|
GIT_REPOSITORY "https://github.com/awslabs/aws-sdk-cpp.git"
|
||||||
GIT_TAG "1.0.8"
|
GIT_TAG "1.0.8"
|
||||||
UPDATE_COMMAND ""
|
UPDATE_COMMAND ""
|
||||||
SOURCE_DIR "${CMAKE_BINARY_DIR}/aws-sdk-cpp"
|
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/aws-sdk-cpp"
|
||||||
CMAKE_ARGS
|
${byproducts}
|
||||||
|
CMAKE_ARGS
|
||||||
-DBUILD_ONLY=kms
|
-DBUILD_ONLY=kms
|
||||||
-DBUILD_SHARED_LIBS=OFF
|
-DBUILD_SHARED_LIBS=OFF
|
||||||
-DFORCE_SHARED_CRT=OFF
|
-DFORCE_SHARED_CRT=OFF
|
||||||
|
|
@ -111,30 +124,17 @@ ELSE()
|
||||||
"-DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE} ${PIC_FLAG}"
|
"-DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE} ${PIC_FLAG}"
|
||||||
"-DCMAKE_CXX_FLAGS_MINSIZEREL=${CMAKE_CXX_FLAGS_MINSIZEREL} ${PIC_FLAG}"
|
"-DCMAKE_CXX_FLAGS_MINSIZEREL=${CMAKE_CXX_FLAGS_MINSIZEREL} ${PIC_FLAG}"
|
||||||
${EXTRA_SDK_CMAKE_FLAGS}
|
${EXTRA_SDK_CMAKE_FLAGS}
|
||||||
-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/aws_sdk_cpp
|
-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/aws_sdk_cpp
|
||||||
TEST_COMMAND ""
|
TEST_COMMAND ""
|
||||||
)
|
)
|
||||||
SET_TARGET_PROPERTIES(aws_sdk_cpp PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
SET_TARGET_PROPERTIES(aws_sdk_cpp PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
||||||
# We do not need to build the whole SDK , just 2 of its libs
|
|
||||||
set(AWS_SDK_LIBS aws-cpp-sdk-core aws-cpp-sdk-kms)
|
|
||||||
FOREACH(lib ${AWS_SDK_LIBS})
|
|
||||||
ADD_LIBRARY(${lib} STATIC IMPORTED GLOBAL)
|
|
||||||
ADD_DEPENDENCIES(${lib} aws_sdk_cpp)
|
|
||||||
SET(loc "${CMAKE_BINARY_DIR}/aws_sdk_cpp/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
|
||||||
SET_TARGET_PROPERTIES(${lib} PROPERTIES IMPORTED_LOCATION ${loc})
|
|
||||||
IF(WIN32)
|
|
||||||
SET_TARGET_PROPERTIES(${lib} PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES "bcrypt;winhttp;wininet;userenv")
|
|
||||||
ELSE()
|
|
||||||
SET_TARGET_PROPERTIES(${lib} PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES "${SSL_LIBRARIES};${CURL_LIBRARIES};${UUID_LIBRARIES}")
|
|
||||||
ENDIF()
|
|
||||||
ENDFOREACH()
|
|
||||||
|
|
||||||
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||||
# Need whole-archive , otherwise static libraries are not linked
|
# Need whole-archive , otherwise static libraries are not linked
|
||||||
SET(AWS_SDK_LIBS -Wl,--whole-archive ${AWS_SDK_LIBS} -Wl,--no-whole-archive)
|
SET(AWS_SDK_LIBS -Wl,--whole-archive ${AWS_SDK_LIBS} -Wl,--no-whole-archive)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
SET_TARGET_PROPERTIES(aws_sdk_cpp PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
SET_TARGET_PROPERTIES(aws_sdk_cpp PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
||||||
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/aws_sdk_cpp/include)
|
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/aws_sdk_cpp/include)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
ADD_DEFINITIONS(${SSL_DEFINES}) # Need to know whether openssl should be initialized
|
ADD_DEFINITIONS(${SSL_DEFINES}) # Need to know whether openssl should be initialized
|
||||||
|
|
@ -142,3 +142,11 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX11_FLAGS}")
|
||||||
MYSQL_ADD_PLUGIN(aws_key_management aws_key_management_plugin.cc
|
MYSQL_ADD_PLUGIN(aws_key_management aws_key_management_plugin.cc
|
||||||
LINK_LIBRARIES ${AWS_SDK_LIBS}
|
LINK_LIBRARIES ${AWS_SDK_LIBS}
|
||||||
COMPONENT aws-key-management)
|
COMPONENT aws-key-management)
|
||||||
|
|
||||||
|
IF(WIN32)
|
||||||
|
SET(AWS_CPP_SDK_DEPENDENCIES bcrypt winhttp wininet userenv version)
|
||||||
|
ELSE()
|
||||||
|
SET(AWS_CPP_SDK_DEPENDENCIES ${SSL_LIBRARIES} ${CURL_LIBRARIES} ${UUID_LIBRARIES})
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
TARGET_LINK_LIBRARIES(aws_key_management ${AWS_SDK_LIBS} ${AWS_CPP_SDK_DEPENDENCIES})
|
||||||
|
|
|
||||||
|
|
@ -136,15 +136,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
|
* if we don't lock to close a table, we check if space
|
||||||
* is closing, and then instead give up
|
* is closing, and then instead give up
|
||||||
*/
|
*/
|
||||||
if (lock_to_close_table == false) {
|
if (lock_to_close_table) {
|
||||||
fil_space_t* space = fil_space_acquire(space_id);
|
} else if (fil_space_t* space = fil_space_acquire(space_id)) {
|
||||||
if (!space || space->stop_new_ops) {
|
bool stopping = space->is_stopping();
|
||||||
if (space) {
|
fil_space_release(space);
|
||||||
fil_space_release(space);
|
if (stopping) {
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
fil_space_release(space);
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
os_thread_sleep(250000);
|
os_thread_sleep(250000);
|
||||||
|
|
||||||
|
|
@ -206,18 +206,15 @@ btr_scrub_table_close_for_thread(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fil_space_t* space = fil_space_acquire(scrub_data->space);
|
if (fil_space_t* space = fil_space_acquire(scrub_data->space)) {
|
||||||
|
/* If tablespace is not marked as stopping perform
|
||||||
/* If tablespace is not marked as stopping perform
|
the actual close. */
|
||||||
the actual close. */
|
if (!space->is_stopping()) {
|
||||||
if (space && !space->is_stopping()) {
|
mutex_enter(&dict_sys->mutex);
|
||||||
mutex_enter(&dict_sys->mutex);
|
/* perform the actual closing */
|
||||||
/* perform the actual closing */
|
btr_scrub_table_close(scrub_data->current_table);
|
||||||
btr_scrub_table_close(scrub_data->current_table);
|
mutex_exit(&dict_sys->mutex);
|
||||||
mutex_exit(&dict_sys->mutex);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (space) {
|
|
||||||
fil_space_release(space);
|
fil_space_release(space);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7535,12 +7535,12 @@ buf_page_decrypt_after_read(buf_page_t* bpage)
|
||||||
return (true);
|
return (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
FilSpace space(bpage->id.space());
|
FilSpace space(bpage->id.space(), true);
|
||||||
|
|
||||||
/* Page is encrypted if encryption information is found from
|
/* Page is encrypted if encryption information is found from
|
||||||
tablespace and page contains used key_version. This is true
|
tablespace and page contains used key_version. This is true
|
||||||
also for pages first compressed and then encrypted. */
|
also for pages first compressed and then encrypted. */
|
||||||
if (!space()->crypt_data) {
|
if (!space() || !space()->crypt_data) {
|
||||||
key_version = 0;
|
key_version = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2268,12 +2268,13 @@ Used by background threads that do not necessarily hold proper locks
|
||||||
for concurrency control.
|
for concurrency control.
|
||||||
@param[in] id tablespace ID
|
@param[in] id tablespace ID
|
||||||
@param[in] silent whether to silently ignore missing tablespaces
|
@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
|
inline
|
||||||
fil_space_t*
|
fil_space_t*
|
||||||
fil_space_acquire_low(
|
fil_space_acquire_low(ulint id, bool silent, bool for_io = false)
|
||||||
ulint id,
|
|
||||||
bool silent)
|
|
||||||
{
|
{
|
||||||
fil_space_t* space;
|
fil_space_t* space;
|
||||||
|
|
||||||
|
|
@ -2286,7 +2287,7 @@ fil_space_acquire_low(
|
||||||
ib::warn() << "Trying to access missing"
|
ib::warn() << "Trying to access missing"
|
||||||
" tablespace " << id;
|
" tablespace " << id;
|
||||||
}
|
}
|
||||||
} else if (space->stop_new_ops || space->is_being_truncated) {
|
} else if (!for_io && space->is_stopping()) {
|
||||||
space = NULL;
|
space = NULL;
|
||||||
} else {
|
} else {
|
||||||
space->n_pending_ops++;
|
space->n_pending_ops++;
|
||||||
|
|
@ -2301,22 +2302,24 @@ fil_space_acquire_low(
|
||||||
Used by background threads that do not necessarily hold proper locks
|
Used by background threads that do not necessarily hold proper locks
|
||||||
for concurrency control.
|
for concurrency control.
|
||||||
@param[in] id tablespace ID
|
@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_t*
|
||||||
fil_space_acquire(
|
fil_space_acquire(ulint id, bool for_io)
|
||||||
ulint id)
|
|
||||||
{
|
{
|
||||||
return(fil_space_acquire_low(id, false));
|
return(fil_space_acquire_low(id, false, for_io));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Acquire a tablespace that may not exist.
|
/** Acquire a tablespace that may not exist.
|
||||||
Used by background threads that do not necessarily hold proper locks
|
Used by background threads that do not necessarily hold proper locks
|
||||||
for concurrency control.
|
for concurrency control.
|
||||||
@param[in] id tablespace ID
|
@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_t*
|
||||||
fil_space_acquire_silent(
|
fil_space_acquire_silent(ulint id)
|
||||||
ulint id)
|
|
||||||
{
|
{
|
||||||
return(fil_space_acquire_low(id, true));
|
return(fil_space_acquire_low(id, true));
|
||||||
}
|
}
|
||||||
|
|
@ -2324,8 +2327,7 @@ fil_space_acquire_silent(
|
||||||
/** Release a tablespace acquired with fil_space_acquire().
|
/** Release a tablespace acquired with fil_space_acquire().
|
||||||
@param[in,out] space tablespace to release */
|
@param[in,out] space tablespace to release */
|
||||||
void
|
void
|
||||||
fil_space_release(
|
fil_space_release(fil_space_t* space)
|
||||||
fil_space_t* space)
|
|
||||||
{
|
{
|
||||||
mutex_enter(&fil_system->mutex);
|
mutex_enter(&fil_system->mutex);
|
||||||
ut_ad(space->magic_n == FIL_SPACE_MAGIC_N);
|
ut_ad(space->magic_n == FIL_SPACE_MAGIC_N);
|
||||||
|
|
@ -5479,8 +5481,7 @@ fil_flush(
|
||||||
|
|
||||||
if (fil_space_t* space = fil_space_get_by_id(space_id)) {
|
if (fil_space_t* space = fil_space_get_by_id(space_id)) {
|
||||||
if (space->purpose != FIL_TYPE_TEMPORARY
|
if (space->purpose != FIL_TYPE_TEMPORARY
|
||||||
&& !space->stop_new_ops
|
&& !space->is_stopping()) {
|
||||||
&& !space->is_being_truncated) {
|
|
||||||
fil_flush_low(space);
|
fil_flush_low(space);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -5524,8 +5525,7 @@ fil_flush_file_spaces(
|
||||||
space = UT_LIST_GET_NEXT(unflushed_spaces, space)) {
|
space = UT_LIST_GET_NEXT(unflushed_spaces, space)) {
|
||||||
|
|
||||||
if (space->purpose == purpose
|
if (space->purpose == purpose
|
||||||
&& !space->stop_new_ops
|
&& !space->is_stopping()) {
|
||||||
&& !space->is_being_truncated) {
|
|
||||||
|
|
||||||
space_ids[n_space_ids++] = space->id;
|
space_ids[n_space_ids++] = space->id;
|
||||||
}
|
}
|
||||||
|
|
@ -6701,8 +6701,7 @@ If NULL, use the first fil_space_t on fil_system->space_list.
|
||||||
@return pointer to the next fil_space_t.
|
@return pointer to the next fil_space_t.
|
||||||
@retval NULL if this was the last*/
|
@retval NULL if this was the last*/
|
||||||
fil_space_t*
|
fil_space_t*
|
||||||
fil_space_next(
|
fil_space_next(fil_space_t* prev_space)
|
||||||
fil_space_t* prev_space)
|
|
||||||
{
|
{
|
||||||
fil_space_t* space=prev_space;
|
fil_space_t* space=prev_space;
|
||||||
|
|
||||||
|
|
@ -6725,8 +6724,8 @@ fil_space_next(
|
||||||
fil_ibd_create(), or dropped, or !tablespace. */
|
fil_ibd_create(), or dropped, or !tablespace. */
|
||||||
while (space != NULL
|
while (space != NULL
|
||||||
&& (UT_LIST_GET_LEN(space->chain) == 0
|
&& (UT_LIST_GET_LEN(space->chain) == 0
|
||||||
|| space->stop_new_ops
|
|| space->is_stopping()
|
||||||
|| space->purpose != FIL_TYPE_TABLESPACE)) {
|
|| space->purpose != FIL_TYPE_TABLESPACE)) {
|
||||||
space = UT_LIST_GET_NEXT(space_list, space);
|
space = UT_LIST_GET_NEXT(space_list, space);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -735,27 +735,28 @@ MY_ATTRIBUTE((warn_unused_result));
|
||||||
Used by background threads that do not necessarily hold proper locks
|
Used by background threads that do not necessarily hold proper locks
|
||||||
for concurrency control.
|
for concurrency control.
|
||||||
@param[in] id tablespace ID
|
@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_t*
|
||||||
fil_space_acquire(
|
fil_space_acquire(ulint id, bool for_io = false)
|
||||||
ulint id)
|
|
||||||
MY_ATTRIBUTE((warn_unused_result));
|
MY_ATTRIBUTE((warn_unused_result));
|
||||||
|
|
||||||
/** Acquire a tablespace that may not exist.
|
/** Acquire a tablespace that may not exist.
|
||||||
Used by background threads that do not necessarily hold proper locks
|
Used by background threads that do not necessarily hold proper locks
|
||||||
for concurrency control.
|
for concurrency control.
|
||||||
@param[in] id tablespace ID
|
@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_t*
|
||||||
fil_space_acquire_silent(
|
fil_space_acquire_silent(ulint id)
|
||||||
ulint id)
|
|
||||||
MY_ATTRIBUTE((warn_unused_result));
|
MY_ATTRIBUTE((warn_unused_result));
|
||||||
|
|
||||||
/** Release a tablespace acquired with fil_space_acquire().
|
/** Release a tablespace acquired with fil_space_acquire().
|
||||||
@param[in,out] space tablespace to release */
|
@param[in,out] space tablespace to release */
|
||||||
void
|
void
|
||||||
fil_space_release(
|
fil_space_release(fil_space_t* space);
|
||||||
fil_space_t* space);
|
|
||||||
|
|
||||||
/** Return the next fil_space_t.
|
/** Return the next fil_space_t.
|
||||||
Once started, the caller must keep calling this until it returns NULL.
|
Once started, the caller must keep calling this until it returns NULL.
|
||||||
|
|
@ -792,17 +793,19 @@ public:
|
||||||
FilSpace() : m_space(NULL) {}
|
FilSpace() : m_space(NULL) {}
|
||||||
|
|
||||||
/** Constructor: Look up the tablespace and increment the
|
/** Constructor: Look up the tablespace and increment the
|
||||||
referece count if found.
|
reference count if found.
|
||||||
@param[in] space_id tablespace ID */
|
@param[in] space_id tablespace ID
|
||||||
explicit FilSpace(ulint space_id)
|
@param[in] for_io whether to look up the tablespace
|
||||||
: m_space(fil_space_acquire(space_id)) {}
|
while performing I/O
|
||||||
|
(possibly executing TRUNCATE) */
|
||||||
|
explicit FilSpace(ulint space_id, bool for_io = false)
|
||||||
|
: m_space(fil_space_acquire(space_id, for_io)) {}
|
||||||
|
|
||||||
/** Assignment operator: This assumes that fil_space_acquire()
|
/** Assignment operator: This assumes that fil_space_acquire()
|
||||||
has already been done for the fil_space_t. The caller must
|
has already been done for the fil_space_t. The caller must
|
||||||
assign NULL if it calls fil_space_release().
|
assign NULL if it calls fil_space_release().
|
||||||
@param[in] space tablespace to assign */
|
@param[in] space tablespace to assign */
|
||||||
class FilSpace& operator=(
|
class FilSpace& operator=(fil_space_t* space)
|
||||||
fil_space_t* space)
|
|
||||||
{
|
{
|
||||||
/* fil_space_acquire() must have been invoked. */
|
/* fil_space_acquire() must have been invoked. */
|
||||||
ut_ad(space == NULL || space->n_pending_ops > 0);
|
ut_ad(space == NULL || space->n_pending_ops > 0);
|
||||||
|
|
|
||||||
|
|
@ -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
|
* if we don't lock to close a table, we check if space
|
||||||
* is closing, and then instead give up
|
* is closing, and then instead give up
|
||||||
*/
|
*/
|
||||||
if (lock_to_close_table == false) {
|
if (lock_to_close_table) {
|
||||||
fil_space_t* space = fil_space_acquire(space_id);
|
} else if (fil_space_t* space = fil_space_acquire(space_id)) {
|
||||||
if (!space || space->stop_new_ops) {
|
bool stopping = space->is_stopping();
|
||||||
if (space) {
|
fil_space_release(space);
|
||||||
fil_space_release(space);
|
if (stopping) {
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
fil_space_release(space);
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
os_thread_sleep(250000);
|
os_thread_sleep(250000);
|
||||||
|
|
||||||
|
|
@ -197,18 +197,15 @@ btr_scrub_table_close_for_thread(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fil_space_t* space = fil_space_acquire(scrub_data->space);
|
if (fil_space_t* space = fil_space_acquire(scrub_data->space)) {
|
||||||
|
/* If tablespace is not marked as stopping perform
|
||||||
/* If tablespace is not marked as stopping perform
|
the actual close. */
|
||||||
the actual close. */
|
if (!space->is_stopping()) {
|
||||||
if (space && !space->is_stopping()) {
|
mutex_enter(&dict_sys->mutex);
|
||||||
mutex_enter(&dict_sys->mutex);
|
/* perform the actual closing */
|
||||||
/* perform the actual closing */
|
btr_scrub_table_close(scrub_data->current_table);
|
||||||
btr_scrub_table_close(scrub_data->current_table);
|
mutex_exit(&dict_sys->mutex);
|
||||||
mutex_exit(&dict_sys->mutex);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (space) {
|
|
||||||
fil_space_release(space);
|
fil_space_release(space);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6413,14 +6413,12 @@ buf_page_decrypt_after_read(
|
||||||
return (true);
|
return (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
fil_space_t* space = fil_space_acquire(bpage->space);
|
fil_space_t* space = fil_space_acquire(bpage->space, true);
|
||||||
|
|
||||||
fil_space_crypt_t* crypt_data = space->crypt_data;
|
|
||||||
|
|
||||||
/* Page is encrypted if encryption information is found from
|
/* Page is encrypted if encryption information is found from
|
||||||
tablespace and page contains used key_version. This is true
|
tablespace and page contains used key_version. This is true
|
||||||
also for pages first compressed and then encrypted. */
|
also for pages first compressed and then encrypted. */
|
||||||
if (!crypt_data) {
|
if (!space || !space->crypt_data) {
|
||||||
key_version = 0;
|
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);
|
return (success);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6389,16 +6389,12 @@ fil_flush(
|
||||||
{
|
{
|
||||||
mutex_enter(&fil_system->mutex);
|
mutex_enter(&fil_system->mutex);
|
||||||
|
|
||||||
fil_space_t* space = fil_space_get_by_id(space_id);
|
if (fil_space_t* space = fil_space_get_by_id(space_id)) {
|
||||||
|
if (!space->is_stopping()) {
|
||||||
if (!space || space->stop_new_ops) {
|
fil_flush_low(space);
|
||||||
mutex_exit(&fil_system->mutex);
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fil_flush_low(space);
|
|
||||||
|
|
||||||
mutex_exit(&fil_system->mutex);
|
mutex_exit(&fil_system->mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -6438,8 +6434,7 @@ fil_flush_file_spaces(
|
||||||
space;
|
space;
|
||||||
space = UT_LIST_GET_NEXT(unflushed_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;
|
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.
|
for concurrency control.
|
||||||
@param[in] id tablespace ID
|
@param[in] id tablespace ID
|
||||||
@param[in] silent whether to silently ignore missing tablespaces
|
@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
|
inline
|
||||||
fil_space_t*
|
fil_space_t*
|
||||||
fil_space_acquire_low(
|
fil_space_acquire_low(ulint id, bool silent, bool for_io = false)
|
||||||
ulint id,
|
|
||||||
bool silent)
|
|
||||||
{
|
{
|
||||||
fil_space_t* space;
|
fil_space_t* space;
|
||||||
|
|
||||||
|
|
@ -7407,7 +7403,7 @@ fil_space_acquire_low(
|
||||||
" tablespace " ULINTPF ".", id);
|
" tablespace " ULINTPF ".", id);
|
||||||
ut_error;
|
ut_error;
|
||||||
}
|
}
|
||||||
} else if (space->stop_new_ops) {
|
} else if (!for_io && space->is_stopping()) {
|
||||||
space = NULL;
|
space = NULL;
|
||||||
} else {
|
} else {
|
||||||
space->n_pending_ops++;
|
space->n_pending_ops++;
|
||||||
|
|
@ -7422,22 +7418,24 @@ fil_space_acquire_low(
|
||||||
Used by background threads that do not necessarily hold proper locks
|
Used by background threads that do not necessarily hold proper locks
|
||||||
for concurrency control.
|
for concurrency control.
|
||||||
@param[in] id tablespace ID
|
@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_t*
|
||||||
fil_space_acquire(
|
fil_space_acquire(ulint id, bool for_io)
|
||||||
ulint id)
|
|
||||||
{
|
{
|
||||||
return(fil_space_acquire_low(id, false));
|
return(fil_space_acquire_low(id, false, for_io));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Acquire a tablespace that may not exist.
|
/** Acquire a tablespace that may not exist.
|
||||||
Used by background threads that do not necessarily hold proper locks
|
Used by background threads that do not necessarily hold proper locks
|
||||||
for concurrency control.
|
for concurrency control.
|
||||||
@param[in] id tablespace ID
|
@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_t*
|
||||||
fil_space_acquire_silent(
|
fil_space_acquire_silent(ulint id)
|
||||||
ulint id)
|
|
||||||
{
|
{
|
||||||
return(fil_space_acquire_low(id, true));
|
return(fil_space_acquire_low(id, true));
|
||||||
}
|
}
|
||||||
|
|
@ -7445,8 +7443,7 @@ fil_space_acquire_silent(
|
||||||
/** Release a tablespace acquired with fil_space_acquire().
|
/** Release a tablespace acquired with fil_space_acquire().
|
||||||
@param[in,out] space tablespace to release */
|
@param[in,out] space tablespace to release */
|
||||||
void
|
void
|
||||||
fil_space_release(
|
fil_space_release(fil_space_t* space)
|
||||||
fil_space_t* space)
|
|
||||||
{
|
{
|
||||||
mutex_enter(&fil_system->mutex);
|
mutex_enter(&fil_system->mutex);
|
||||||
ut_ad(space->magic_n == FIL_SPACE_MAGIC_N);
|
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.
|
@return pointer to the next fil_space_t.
|
||||||
@retval NULL if this was the last*/
|
@retval NULL if this was the last*/
|
||||||
fil_space_t*
|
fil_space_t*
|
||||||
fil_space_next(
|
fil_space_next(fil_space_t* prev_space)
|
||||||
fil_space_t* prev_space)
|
|
||||||
{
|
{
|
||||||
fil_space_t* space=prev_space;
|
fil_space_t* space=prev_space;
|
||||||
|
|
||||||
|
|
@ -7488,8 +7484,8 @@ fil_space_next(
|
||||||
fil_ibd_create(), or dropped, or !tablespace. */
|
fil_ibd_create(), or dropped, or !tablespace. */
|
||||||
while (space != NULL
|
while (space != NULL
|
||||||
&& (UT_LIST_GET_LEN(space->chain) == 0
|
&& (UT_LIST_GET_LEN(space->chain) == 0
|
||||||
|| space->stop_new_ops
|
|| space->is_stopping()
|
||||||
|| space->purpose != FIL_TABLESPACE)) {
|
|| space->purpose != FIL_TABLESPACE)) {
|
||||||
space = UT_LIST_GET_NEXT(space_list, space);
|
space = UT_LIST_GET_NEXT(space_list, space);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -650,27 +650,28 @@ fil_write_flushed_lsn_to_data_files(
|
||||||
Used by background threads that do not necessarily hold proper locks
|
Used by background threads that do not necessarily hold proper locks
|
||||||
for concurrency control.
|
for concurrency control.
|
||||||
@param[in] id tablespace ID
|
@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_t*
|
||||||
fil_space_acquire(
|
fil_space_acquire(ulint id, bool for_io = false)
|
||||||
ulint id)
|
|
||||||
MY_ATTRIBUTE((warn_unused_result));
|
MY_ATTRIBUTE((warn_unused_result));
|
||||||
|
|
||||||
/** Acquire a tablespace that may not exist.
|
/** Acquire a tablespace that may not exist.
|
||||||
Used by background threads that do not necessarily hold proper locks
|
Used by background threads that do not necessarily hold proper locks
|
||||||
for concurrency control.
|
for concurrency control.
|
||||||
@param[in] id tablespace ID
|
@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_t*
|
||||||
fil_space_acquire_silent(
|
fil_space_acquire_silent(ulint id)
|
||||||
ulint id)
|
|
||||||
MY_ATTRIBUTE((warn_unused_result));
|
MY_ATTRIBUTE((warn_unused_result));
|
||||||
|
|
||||||
/** Release a tablespace acquired with fil_space_acquire().
|
/** Release a tablespace acquired with fil_space_acquire().
|
||||||
@param[in,out] space tablespace to release */
|
@param[in,out] space tablespace to release */
|
||||||
void
|
void
|
||||||
fil_space_release(
|
fil_space_release(fil_space_t* space);
|
||||||
fil_space_t* space);
|
|
||||||
|
|
||||||
/** Return the next fil_space_t.
|
/** Return the next fil_space_t.
|
||||||
Once started, the caller must keep calling this until it returns NULL.
|
Once started, the caller must keep calling this until it returns NULL.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue