Commit c36a2a0d authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.5 into 10.6

parents af1335c2 1fe3dd00
......@@ -88,6 +88,10 @@ IF(WIN32)
SET(INSTALL_MYSQLTESTDIR "" CACHE STRING "")
SET(INSTALL_SQLBENCHDIR "" CACHE STRING "")
SET(INSTALL_SUPPORTFILESDIR "" CACHE STRING "")
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "AIX")
# AIX freesource is RPM, but different than Linux RPM
SET(WITH_SSL system CACHE STRING "")
SET(WITH_ZLIB system CACHE STRING "")
ELSEIF(RPM)
SET(WITH_SSL system CACHE STRING "")
SET(WITH_ZLIB system CACHE STRING "")
......
......@@ -40,7 +40,11 @@ FOREACH(F ${MY_WARNING_FLAGS})
MY_CHECK_AND_SET_COMPILER_FLAG(${F} DEBUG RELWITHDEBINFO)
ENDFOREACH()
SET(MY_ERROR_FLAGS -Werror)
IF(CMAKE_SYSTEM_NAME MATCHES AIX)
SET(MY_ERROR_FLAGS "")
ELSE()
SET(MY_ERROR_FLAGS -Werror)
ENDIF()
IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "6.0.0")
SET(MY_ERROR_FLAGS ${MY_ERROR_FLAGS} -Wno-error=maybe-uninitialized)
......
......@@ -16,7 +16,12 @@
#Enable 64 bit file offsets
SET(_LARGE_FILES 1)
SET(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> -X32_64 qc <TARGET> <LINK_FLAGS> <OBJECTS>")
SET(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> -X32_64 q <TARGET> <LINK_FLAGS> <OBJECTS>")
SET(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> -X32_64 qc <TARGET> <LINK_FLAGS> <OBJECTS>")
SET(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> -X32_64 q <TARGET> <LINK_FLAGS> <OBJECTS>")
IF(__AIX_COMPILER_XL)
# Fix xlC oddity - it complains about same inline function defined multiple times
# in different compilation units
INCLUDE(CheckCXXCompilerFlag)
......@@ -24,10 +29,7 @@ INCLUDE(CheckCXXCompilerFlag)
IF(HAVE_QSTATICINLINE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -qstaticinline")
ENDIF()
# The following is required to export all symbols
# (also with leading underscore)
STRING(REPLACE "-bexpall" "-bexpfull" CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS
"${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS}")
STRING(REPLACE "-bexpall" "-bexpfull" CMAKE_SHARED_LIBRARY_LINK_C_FLAGS
"${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS}")
ELSE()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -maix64 -pthread -mcmodel=large")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -maix64 -pthread -mcmodel=large")
ENDIF()
......@@ -209,6 +209,10 @@ MACRO(MYSQL_ADD_PLUGIN)
TARGET_LINK_LIBRARIES (${target} mysqlservices ${ARG_LINK_LIBRARIES})
IF(CMAKE_SYSTEM_NAME MATCHES AIX)
TARGET_LINK_OPTIONS(${target} PRIVATE "-Wl,-bE:${CMAKE_SOURCE_DIR}/libservices/mysqlservices_aix.def")
ENDIF()
# Server plugins use symbols defined in mysqld executable.
# Some operating systems like Windows and OSX and are pretty strict about
# unresolved symbols. Others are less strict and allow unresolved symbols
......@@ -217,7 +221,7 @@ MACRO(MYSQL_ADD_PLUGIN)
# Thus we skip TARGET_LINK_LIBRARIES on Linux, as it would only generate
# an additional dependency.
IF(ARG_RECOMPILE_FOR_EMBEDDED OR ARG_STORAGE_ENGINE)
IF(MSVC)
IF(MSVC OR CMAKE_SYSTEM_NAME MATCHES AIX)
TARGET_LINK_LIBRARIES(${target} server)
ELSEIF(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
TARGET_LINK_LIBRARIES (${target} mariadbd)
......
......@@ -263,6 +263,7 @@ int main(int argc,char *argv[])
const char *msg;
const char *name;
char *unknown_error = 0;
char unknow_aix[30];
#if defined(_WIN32)
my_bool skip_win_message= 0;
#endif
......@@ -320,6 +321,9 @@ int main(int argc,char *argv[])
code=atoi(*argv);
msg = strerror(code);
// On AIX, unknow error return " Error <CODE> occurred."
snprintf(unknow_aix, sizeof(unknow_aix), " Error %3d occurred.", code);
/*
We don't print the OS error message if it is the same as the
unknown_error message we retrieved above, or it starts with
......@@ -330,11 +334,18 @@ int main(int argc,char *argv[])
(const uchar*) "Unknown Error", 13) &&
(!unknown_error || strcmp(msg, unknown_error)))
{
found= 1;
if (verbose)
printf("OS error code %3d: %s\n", code, msg);
else
puts(msg);
#ifdef _AIX
if (!strcmp(msg, unknow_aix))
{
#endif
found= 1;
if (verbose)
printf("OS error code %3d: %s\n", code, msg);
else
puts(msg);
#ifdef _AIX
}
#endif
}
if ((msg= get_ha_error_msg(code)))
{
......
......@@ -135,13 +135,6 @@
#endif /* _WIN32*/
/* Workaround for _LARGE_FILES and _LARGE_FILE_API incompatibility on AIX */
#if defined(_AIX) && defined(_LARGE_FILE_API)
#undef _LARGE_FILE_API
#undef __GNUG__
#endif
/*
The macros below are used to allow build of Universal/fat binaries of
MySQL and MySQL applications under darwin.
......@@ -270,22 +263,6 @@ C_MODE_END
#endif
#endif /* !defined(__WIN__) */
/* Go around some bugs in different OS and compilers */
#ifdef _AIX /* By soren@t.dk */
#define _H_STRINGS
#define _SYS_STREAM_H
/* #define _AIX32_CURSES */ /* XXX: this breaks AIX 4.3.3 (others?). */
#define ulonglong2double(A) my_ulonglong2double(A)
#define my_off_t2double(A) my_ulonglong2double(A)
C_MODE_START
inline double my_ulonglong2double(unsigned long long A) { return (double)A; }
C_MODE_END
#endif /* _AIX */
#ifdef UNDEF_HAVE_INITGROUPS /* For AIX 4.3 */
#undef HAVE_INITGROUPS
#endif
/* gcc/egcs issues */
#if defined(__GNUC) && defined(__EXCEPTIONS)
......@@ -295,16 +272,6 @@ C_MODE_END
#if defined(_lint) && !defined(lint)
#define lint
#endif
#if SIZEOF_LONG_LONG > 4 && !defined(_LONG_LONG)
#define _LONG_LONG 1 /* For AIX string library */
#endif
/* Workaround for _LARGE_FILES and _LARGE_FILE_API incompatibility on AIX */
#if defined(_AIX) && defined(_LARGE_FILE_API)
#undef _LARGE_FILE_API
#undef __GNUG__
#endif
#ifndef stdin
#include <stdio.h>
......@@ -332,13 +299,6 @@ C_MODE_END
#include <sys/types.h>
#endif
/* Workaround for _LARGE_FILES and _LARGE_FILE_API incompatibility on AIX */
#if defined(_AIX) && defined(_LARGE_FILE_API)
#undef _LARGE_FILE_API
#undef __GNUG__
#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
......@@ -1197,12 +1157,6 @@ typedef struct { const char *dli_fname, dli_fbase; } Dl_info;
#define HAVE_EXTERNAL_CLIENT
#endif /* EMBEDDED_LIBRARY */
/* Workaround for _LARGE_FILES and _LARGE_FILE_API incompatibility on AIX */
#if defined(_AIX) && defined(_LARGE_FILE_API)
#undef _LARGE_FILE_API
#undef __GNUG__
#endif
/*
Provide defaults for the CPU cache line size, if it has not been detected by
CMake using getconf
......
......@@ -138,6 +138,10 @@ typedef void (*memory_free_v1_t)
/** @} (end of group Group_PSI_v1) */
#ifdef _AIX
PSI_memory_key key_memory_log_event;
#endif
#endif /* HAVE_PSI_1 */
#ifdef HAVE_PSI_2
......
#! .
base64_service
debug_sync_service
encryption_scheme_service
encryption_service
json_service
logger_service
my_crypt_service
my_md5_service
my_print_error_service
my_sha1_service
my_sha2_service
my_snprintf_service
progress_report_service
thd_alloc_service
thd_autoinc_service
thd_error_context_service
thd_kill_statement_service
thd_rnd_service
thd_specifics_service
thd_timezone_service
thd_wait_service
wsrep_service
......@@ -11,7 +11,7 @@ insert t1 values (1);
--system ln -s $MYSQL_TMP_DIR/foobar5543 $MYSQL_TMP_DIR/t1.TMD
--echo # Some systems fail with errcode 40, or 90 (MIPS) when doing openat,
--echo # while others don't have openat and fail with errcode 20.
--replace_regex / '.*\/t1/ 'MYSQL_TMP_DIR\/t1/ /[49]0/20/ /".*"/"<errmsg>"/
--replace_regex / '.*\/t1/ 'MYSQL_TMP_DIR\/t1/ /[49]0/20/ /85/20/ /".*"/"<errmsg>"/
repair table t1;
drop table t1;
......@@ -19,7 +19,7 @@ drop table t1;
eval create table t2 (a int) engine=aria data directory='$MYSQL_TMP_DIR';
insert t2 values (1);
--system ln -s $MYSQL_TMP_DIR/foobar5543 $MYSQL_TMP_DIR/t2.TMD
--replace_regex / '.*\/t2/ 'MYSQL_TMP_DIR\/t2/ /[49]0/20/ /".*"/"<errmsg>"/
--replace_regex / '.*\/t2/ 'MYSQL_TMP_DIR\/t2/ /[49]0/20/ /85/20/ /".*"/"<errmsg>"/
repair table t2;
drop table t2;
......
......@@ -25,7 +25,7 @@ exec rm -r $MYSQLTEST_VARDIR/tmp/foo;
exec ln -s $datadir/mysql $MYSQLTEST_VARDIR/tmp/foo;
set debug_sync='now SIGNAL go';
connection default;
replace_regex / '.*\/tmp\// 'MYSQLTEST_VARDIR\/tmp\// /31/20/ /40/20/ /20.*/20 <errmsg>)/;
replace_regex / '.*\/tmp\// 'MYSQLTEST_VARDIR\/tmp\// /31/20/ /40/20/ /85/20/ /20.*/20 <errmsg>)/;
error 29;
reap;
flush tables;
......@@ -49,7 +49,7 @@ exec rm -r $MYSQLTEST_VARDIR/tmp/foo;
exec ln -s $datadir/mysql $MYSQLTEST_VARDIR/tmp/foo;
set debug_sync='now SIGNAL run';
connection default;
replace_regex / '.*\/test\// '.\/test\// /31/20/ /40/20/ /20.*/20 <errmsg>)/;
replace_regex / '.*\/test\// '.\/test\// /31/20/ /40/20/ /85/20/ /20.*/20 <errmsg>)/;
error ER_FILE_NOT_FOUND;
reap;
flush tables;
......
--innodb-encryption-rotate-key-age=2
--innodb-encryption-threads=1
--innodb-encryption-rotate-key-age=0
--innodb-encryption-threads=4
--innodb-tablespaces-encryption
--plugin-load-add=$FILE_KEY_MANAGEMENT_SO
--loose-file-key-management
......
......@@ -5,6 +5,15 @@
plugin-maturity = gamma
plugin-load-add=@ENV.HA_S3_SO
s3=ON
s3-host-name=@ENV.S3_HOST_NAME
s3-protocol-version=@ENV.S3_PROTOCOL_VERSION
s3-bucket=@ENV.S3_BUCKET
s3-access-key=@ENV.S3_ACCESS_KEY
s3-secret-key=@ENV.S3_SECRET_KEY
s3-region=@ENV.S3_REGION
s3-port=@ENV.S3_PORT
s3-use-http=@ENV.S3_USE_HTTP
#s3-host-name=s3.amazonaws.com
#s3-protocol-version=Amazon
#s3-bucket=MariaDB
......@@ -15,11 +24,11 @@ s3=ON
##
## Configuration for local MinIO
##
s3-host-name="127.0.0.1"
# Note: s3-host-name="localhost" doesn't work. It causes
# libmarias3 to use the wrong variant of the protocol.
s3-bucket=storage-engine
s3-access-key=minio
s3-secret-key=minioadmin
s3-port=9000
s3-use-http=ON
#s3-host-name="127.0.0.1"
## Note: s3-host-name="localhost" doesn't work. It causes
## libmarias3 to use the wrong variant of the protocol.
#s3-bucket=storage-engine
#s3-access-key=minio
#s3-secret-key=minioadmin
#s3-port=9000
#s3-use-http=ON
......@@ -3,6 +3,14 @@ plugin-maturity = gamma
plugin-load-add=@ENV.HA_S3_SO
s3=ON
s3-slave-ignore-updates=1
s3-host-name=@ENV.S3_HOST_NAME
s3-protocol-version=@ENV.S3_PROTOCOL_VERSION
s3-bucket=@ENV.S3_BUCKET
s3-access-key=@ENV.S3_ACCESS_KEY
s3-secret-key=@ENV.S3_SECRET_KEY
s3-region=@ENV.S3_REGION
s3-port=@ENV.S3_PORT
s3-use-http=@ENV.S3_USE_HTTP
# You can change the following when running the tests against
# your own S3 setup
......@@ -17,11 +25,11 @@ s3-slave-ignore-updates=1
##
## Configuration for local MinIO
##
s3-host-name="127.0.0.1"
# Note: s3-host-name="localhost" doesn't work. It causes
# libmarias3 to use the wrong variant of the protocol.
s3-bucket=storage-engine
s3-access-key=minio
s3-secret-key=minioadmin
s3-port=9000
s3-use-http=ON
#s3-host-name="127.0.0.1"
## Note: s3-host-name="localhost" doesn't work. It causes
## libmarias3 to use the wrong variant of the protocol.
#s3-bucket=storage-engine
#s3-access-key=minio
#s3-secret-key=minioadmin
#s3-port=9000
#s3-use-http=ON
package My::Suite::S3;
use Socket;
@ISA = qw(My::Suite);
return "Need S3 engine" unless $::mysqld_variables{'s3'} eq "ON" or $ENV{HA_S3_SO};
my $paddr = sockaddr_in(9000, INADDR_ANY);
my $protocol = getprotobyname("tcp");
socket(SOCK, PF_INET, SOCK_STREAM, $protocol);
if(connect(SOCK, $paddr))
{
$ENV{'S3_HOST_NAME'} = "127.0.0.1";
$ENV{'S3_PORT'} = 9000;
$ENV{'S3_BUCKET'} = "storage-engine";
$ENV{'S3_ACCESS_KEY'} = "minio";
$ENV{'S3_SECRET_KEY'} = "minioadmin";
$ENV{'S3_REGION'} = "";
$ENV{'S3_PROTOCOL_VERSION'} = "Auto";
$ENV{'S3_USE_HTTP'} = "ON";
}
else
{
if (!$ENV{'S3_HOST_NAME'})
{
return "Environment variable S3_HOST_NAME need to be set";
}
if (!$ENV{'S3_BUCKET'})
{
return "Environment variable S3_BUCKET need to be set";
}
if (!$ENV{'S3_REGION'})
{
$ENV{'S3_REGION'} = "";
}
if (!$ENV{'S3_ACCESS_KEY'})
{
return "Environment variable S3_ACCESS_KEY need to be set";
}
if (!$ENV{'S3_SECRET_KEY'})
{
return "Environment variable S3_SECRET_KEY need to be set";
}
if (!$ENV{'S3_PROTOCOL_VERSION'})
{
$ENV{'S3_PROTOCOL_VERSION'} = "Auto";
}
if (!$ENV{'S3_PORT'})
{
$ENV{'S3_PORT'} = 0;
}
if (!$ENV{'S3_USE_HTTP'})
{
$ENV{'S3_USE_HTTP'} = "OFF";
}
}
bless { };
......@@ -58,7 +58,11 @@ else(GSSAPI_LIBS AND GSSAPI_FLAVOR)
message(STATUS "GSSAPI configure check failed.")
set(HAVE_KRB5_GSSAPI FALSE)
endif(_return_VALUE)
IF(CMAKE_SYSTEM_NAME MATCHES AIX)
string(REGEX REPLACE "-Wl[A-Za-z0-9_/,:-]*[ $]?" "" GSSAPI_LIBS "${GSSAPI_LIBS}")
string(REGEX REPLACE "-L[A-Za-z0-9_/,:-]*[ $]?" "" GSSAPI_LIBS "${GSSAPI_LIBS}")
ENDIF()
exec_program(${KRB5_CONFIG} ARGS --cflags gssapi RETURN_VALUE _return_VALUE OUTPUT_VARIABLE GSSAPI_INCS)
string(REGEX REPLACE "(\r?\n)+$" "" GSSAPI_INCS "${GSSAPI_INCS}")
string(REGEX REPLACE " *-I" ";" GSSAPI_INCS "${GSSAPI_INCS}")
......
......@@ -83,6 +83,19 @@ IF (HAVE_GETPEERUCRED AND HAVE_GETPWUID_POSIX_FINAL)
SET(ok 1)
ELSE()
# AIX also!
CHECK_CXX_SOURCE_COMPILES(
"#include <sys/socket.h>
int main() {
struct peercred_struct cred;
getsockopt(0, SOL_SOCKET, SO_PEERID, &cred, 0);
}" HAVE_PEERCRED_STRUCT)
IF (HAVE_PEERCRED_STRUCT)
ADD_DEFINITIONS(-DHAVE_PEERCRED_STRUCT)
SET(ok 1)
ELSE()
# Who else? Anyone?
# C'mon, show your creativity, be different! ifdef's are fun, aren't they?
......@@ -90,6 +103,7 @@ ENDIF()
ENDIF()
ENDIF()
ENDIF()
ENDIF()
IF(ok)
MYSQL_ADD_PLUGIN(auth_socket auth_socket.c DEFAULT)
......
......@@ -50,6 +50,12 @@
#elif defined HAVE_GETPEERUCRED
#include <ucred.h>
#elif defined HAVE_PEERCRED_STRUCT
#define level SOL_SOCKET
#define SO_PEERCRED SO_PEERID
#define uid euid
#define ucred peercred_struct
#else
#error impossible
#endif
......
......@@ -214,17 +214,22 @@ ELSE()
SET(MYSQLD_SOURCE main.cc ${DTRACE_PROBES_ALL})
ENDIF()
IF(MSVC)
IF(MSVC OR CMAKE_SYSTEM_NAME MATCHES AIX)
SET(libs_to_export_symbols sql mysys dbug strings)
# Create shared library of already compiled object
# Export all symbols from selected libraries, to be used
# by plugins
IF(MSVC)
SET(VERSIONINFO_RC ${PROJECT_BINARY_DIR}/versioninfo_dll.rc)
ELSE()
SET(VERSIONINFO_RC)
ENDIF()
ADD_LIBRARY(server SHARED
$<TARGET_OBJECTS:sql>
$<TARGET_OBJECTS:mysys>
$<TARGET_OBJECTS:dbug>
$<TARGET_OBJECTS:strings>
${PROJECT_BINARY_DIR}/versioninfo_dll.rc
${VERSIONINFO_RC}
)
# We need to add all dependencies of sql/mysys/dbug/strings
......@@ -245,7 +250,11 @@ IF(MSVC)
${all_deps}
sql_builtins
)
SET_TARGET_PROPERTIES(server PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
IF(MSVC)
SET_TARGET_PROPERTIES(server PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
ELSE()
SET_TARGET_PROPERTIES(server PROPERTIES AIX_EXPORT_ALL_SYMBOLS TRUE)
ENDIF()
MYSQL_INSTALL_TARGETS(server DESTINATION ${INSTALL_BINDIR} COMPONENT Server)
ENDIF()
......@@ -272,7 +281,7 @@ IF(NOT WITHOUT_DYNAMIC_PLUGINS)
ENDIF()
ENDIF(NOT WITHOUT_DYNAMIC_PLUGINS)
IF(MSVC)
IF(MSVC OR CMAKE_SYSTEM_NAME MATCHES AIX)
TARGET_LINK_LIBRARIES(mariadbd server)
ELSE()
TARGET_LINK_LIBRARIES(mariadbd LINK_PRIVATE sql sql_builtins)
......
......@@ -56,7 +56,9 @@
#define my_b_write_string(A, B) my_b_write((A), (uchar*)(B), (uint) (sizeof(B) - 1))
#ifndef _AIX
PSI_memory_key key_memory_log_event;
#endif
PSI_memory_key key_memory_Incident_log_event_message;
PSI_memory_key key_memory_Rows_query_log_event_rows_query;
......
......@@ -2763,7 +2763,7 @@ int write_delayed(THD *thd, TABLE *table, enum_duplicates duplic,
delayed_row *row= 0;
Delayed_insert *di=thd->di;
const Discrete_interval *forced_auto_inc;
size_t user_len, host_len, ip_len;
size_t user_len, host_len, ip_length;
DBUG_ENTER("write_delayed");
DBUG_PRINT("enter", ("query = '%s' length %lu", query.str,
(ulong) query.length));
......@@ -2798,7 +2798,7 @@ int write_delayed(THD *thd, TABLE *table, enum_duplicates duplic,
goto err;
}
user_len= host_len= ip_len= 0;
user_len= host_len= ip_length= 0;
row->user= row->host= row->ip= NULL;
if (thd->security_ctx)
{
......@@ -2807,12 +2807,12 @@ int write_delayed(THD *thd, TABLE *table, enum_duplicates duplic,
if (thd->security_ctx->host)
host_len= strlen(thd->security_ctx->host) + 1;
if (thd->security_ctx->ip)
ip_len= strlen(thd->security_ctx->ip) + 1;
ip_length= strlen(thd->security_ctx->ip) + 1;
}
/* This can't be THREAD_SPECIFIC as it's freed in delayed thread */
if (!(row->record= (char*) my_malloc(PSI_INSTRUMENT_ME,
table->s->reclength +
user_len + host_len + ip_len,
user_len + host_len + ip_length,
MYF(MY_WME))))
goto err;
memcpy(row->record, table->record[0], table->s->reclength);
......@@ -2832,7 +2832,7 @@ int write_delayed(THD *thd, TABLE *table, enum_duplicates duplic,
if (thd->security_ctx->ip)
{
row->ip= row->record + table->s->reclength + user_len + host_len;
memcpy(row->ip, thd->security_ctx->ip, ip_len);
memcpy(row->ip, thd->security_ctx->ip, ip_length);
}
}
row->query_id= thd->query_id;
......
......@@ -178,7 +178,11 @@ void _CONCAT_UNDERSCORED(turn_parser_debug_on,yyparse)()
The result will be in the process stderr (var/log/master.err)
*/
#ifndef _AIX
extern int yydebug;
#else
static int yydebug;
#endif
yydebug= 1;
}
#endif
......
......@@ -21,6 +21,11 @@ SET(HEAP_SOURCES _check.c _rectest.c hp_block.c hp_clear.c hp_close.c hp_create
MYSQL_ADD_PLUGIN(heap ${HEAP_SOURCES} STORAGE_ENGINE MANDATORY RECOMPILE_FOR_EMBEDDED)
IF(CMAKE_SYSTEM_NAME MATCHES AIX AND CMAKE_BUILD_TYPE STREQUAL "DEBUG")
# Workaround linker bug on AIX
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-berok")
ENDIF()
IF(WITH_UNIT_TESTS)
ADD_EXECUTABLE(hp_test1 hp_test1.c)
TARGET_LINK_LIBRARIES(hp_test1 heap mysys dbug strings)
......
......@@ -1377,18 +1377,20 @@ static bool fil_crypt_realloc_iops(rotate_thread_t *state)
return true;
}
/** Release allocated iops.
@param[in,out] state Rotation state */
static void fil_crypt_return_iops(rotate_thread_t *state)
/** Release excess allocated iops
@param state rotation state
@param wake whether to wake up other threads */
static void fil_crypt_return_iops(rotate_thread_t *state, bool wake= true)
{
mysql_mutex_assert_owner(&fil_crypt_threads_mutex);
if (uint iops = state->allocated_iops)
if (uint iops= state->allocated_iops)
{
ut_ad(n_fil_crypt_iops_allocated >= iops);
n_fil_crypt_iops_allocated-= iops;
state->allocated_iops= 0;
mysql_cond_broadcast(&fil_crypt_threads_cond);
if (wake)
mysql_cond_broadcast(&fil_crypt_threads_cond);
}
fil_crypt_update_total_stat(state);
......@@ -1400,7 +1402,8 @@ static void fil_crypt_return_iops(rotate_thread_t *state)
the encryption parameters were changed
@param encrypt expected state of innodb_encrypt_tables
@return the next tablespace to process (n_pending_ops incremented)
@retval NULL if this was the last */
@retval fil_system.temp_space if there is no work to do
@retval nullptr upon reaching the end of the iteration */
inline fil_space_t *fil_system_t::keyrotate_next(fil_space_t *space,
bool recheck, bool encrypt)
{
......@@ -1435,15 +1438,20 @@ inline fil_space_t *fil_system_t::keyrotate_next(fil_space_t *space,
}
}
while (it != end)
if (it == end)
return temp_space;
do
{
space= &*it;
if (space->acquire_if_not_stopped(true))
return space;
while (++it != end && (!UT_LIST_GET_LEN(it->chain) || it->is_stopping()));
if (++it == end)
return nullptr;
}
while (!UT_LIST_GET_LEN(it->chain) || it->is_stopping());
return NULL;
return nullptr;
}
/** Determine the next tablespace for encryption key rotation.
......@@ -1452,6 +1460,7 @@ inline fil_space_t *fil_system_t::keyrotate_next(fil_space_t *space,
encryption parameters were changed
@param encrypt expected state of innodb_encrypt_tables
@return the next tablespace
@retval fil_system.temp_space if there is no work to do
@retval nullptr upon reaching the end of the iteration */
inline fil_space_t *fil_space_t::next(fil_space_t *space, bool recheck,
bool encrypt)
......@@ -1520,7 +1529,13 @@ static bool fil_crypt_find_space_to_rotate(
state->space = fil_space_t::next(state->space, *recheck,
key_state->key_version != 0);
while (!state->should_shutdown() && state->space) {
bool wake = true;
while (state->space && !state->should_shutdown()) {
if (state->space == fil_system.temp_space) {
wake = false;
goto done;
}
mysql_mutex_unlock(&fil_crypt_threads_mutex);
/* If there is no crypt data and we have not yet read
page 0 for this tablespace, we need to read it before
......@@ -1545,11 +1560,12 @@ static bool fil_crypt_find_space_to_rotate(
if (state->space) {
state->space->release();
done:
state->space = NULL;
}
/* no work to do; release our allocation of I/O capacity */
fil_crypt_return_iops(state);
fil_crypt_return_iops(state, wake);
return true;
}
......
......@@ -401,6 +401,12 @@ in both 32-bit and 64-bit environments. */
# define INT64PF "%lld"
# define UINT64scan "llu"
# define UINT64PFx "%016llx"
#elif defined _AIX
/* Workaround for macros expension trouble */
# define UINT32PF "%u"
# define INT64PF "%lld"
# define UINT64scan "lu"
# define UINT64PFx "%016llx"
#else
/* Use the integer types and formatting strings defined in the C99 standard. */
# define UINT32PF "%" PRIu32
......
......@@ -52,6 +52,11 @@ IF(APPLE)
ADD_DEFINITIONS(-fno-common)
ENDIF()
IF(CMAKE_SYSTEM_NAME MATCHES AIX)
# Workaround linker bug on AIX
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-berok")
ENDIF()
MYSQL_ADD_PLUGIN(aria ${ARIA_SOURCES} STORAGE_ENGINE MANDATORY
LINK_LIBRARIES myisam mysys mysys_ssl
RECOMPILE_FOR_EMBEDDED)
......
......@@ -27,6 +27,11 @@ SET(MYISAM_SOURCES ft_boolean_search.c ft_nlq_search.c ft_parser.c ft_static.c
rt_split.c sort.c sp_key.c mi_extrafunc.h myisamdef.h
rt_index.h mi_rkey.c)
IF(CMAKE_SYSTEM_NAME MATCHES AIX)
# Workaround linker bug on AIX
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-berok")
ENDIF()
MYSQL_ADD_PLUGIN(myisam ${MYISAM_SOURCES}
STORAGE_ENGINE
MANDATORY
......
......@@ -33,6 +33,11 @@ IF (SSL_DEFINES)
ADD_DEFINITIONS(${SSL_DEFINES})
ENDIF()
IF(CMAKE_SYSTEM_NAME MATCHES AIX)
# Workaround linker bug on AIX
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-berok")
ENDIF()
#
# Maintainer: keep this list sorted, to avoid merge collisions.
# Tip: ls -1 *.h, ls -1 *.cc
......
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