Merge branch '10.3' into 10.4

This commit is contained in:
Igor Babaev 2018-06-03 10:34:41 -07:00
commit cab1d63826
1308 changed files with 50217 additions and 28761 deletions

1
.gitattributes vendored
View File

@ -25,6 +25,7 @@ pcre/testdata/greppatN4 -text
*.MYD binary
*.MYI binary
*.class binary
*.jar binary
*.c diff=cpp
*.h diff=cpp

2
.gitignore vendored
View File

@ -220,6 +220,8 @@ storage/tokudb/PerconaFT/tools/tokudb_load
storage/tokudb/PerconaFT/tools/tokuftdump
storage/tokudb/PerconaFT/tools/tokuft_logprint
storage/tokudb/PerconaFT/xz/
storage/tokudb/tokudb.cnf
storage/tokudb/tokudb.conf
strings/conf_to_src
support-files/MySQL-shared-compat.spec
support-files/binary-configure

View File

@ -140,7 +140,7 @@ elif [ "x$warning_mode" = "xmaintainer" ]; then
debug_extra_cflags="-g3"
else
# Both C and C++ warnings
warnings="-Wall -Wextra -Wunused -Wwrite-strings -Wno-uninitialized"
warnings="-Wall -Wextra -Wunused -Wwrite-strings -Wno-uninitialized -Wno-strict-aliasing"
# For more warnings, uncomment the following line
# warnings="$warnings -Wshadow"

View File

@ -1,24 +0,0 @@
#! /bin/sh
# Copyright (C) 2000, 2002 MySQL AB
# Use is subject to license terms
# 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 Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$alpha_cflags $fast_cflags"
extra_configs="$alpha_configs $static_link"
. "$path/FINISH.sh"

View File

@ -1,12 +0,0 @@
#! /bin/sh
/bin/rm -f */.deps/*.P */*.o
make -k maintainer-clean
/bin/rm -f */.deps/*.P */*.o
/bin/rm -f */.deps/*.P config.cache storage/innobase/config.cache mysql-*.tar.gz
path=`dirname $0`
. "$path/autorun.sh"
CFLAGS=-O1 CC=gcc CXX=g++ CXXFLAGS="-O1 -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --with-debug --with-extra-charsets=complex --without-extra-tools
make

0
BUILD/compile-amd64-debug-wsrep Normal file → Executable file
View File

0
BUILD/compile-amd64-wsrep Normal file → Executable file
View File

View File

@ -1,25 +0,0 @@
#! /bin/sh
# Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
#
# 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 Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
gmake -k maintainer-clean || true
/bin/rm -f */.deps/*.P config.cache storage/innobase/config.cache
path=`dirname $0`
. "$path/autorun.sh"
CC=ecc CFLAGS="-w1 -DEXTRA_DEBUG -DSAFE_MUTEX -O2" CXX=ecc CXXFLAGS="-w1 -DEXTRA_DEBUG -DSAFE_MUTEX -O2" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --with-debug --with-innodb --with-embedded-server --with-archive-storage-engine
gmake

View File

@ -1,25 +0,0 @@
#!/bin/sh
#
# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
#
# 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
# Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St,
# Fifth Floor, Boston, MA 02110-1301 USA
#
# we assume this script is in storage/innobase/
MYSQL_ROOT="$(dirname ${0})/../.."
cd ${MYSQL_ROOT}
cmake -DWITH_INNOBASE_STORAGE_ENGINE:BOOL=ON
make -j$(nproc)

View File

@ -1,10 +0,0 @@
#! /bin/sh
path=`dirname $0`
set -- "$@" --with-debug=full
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $debug_cflags"
extra_configs="$pentium_configs $debug_configs $all_configs $error_inject --with-experimental-collations $disable_64_bit_plugins"
. "$path/FINISH.sh"

View File

@ -1,25 +0,0 @@
#! /bin/sh
# Copyright (c) 2004-2006 MySQL AB
# Use is subject to license terms
#
# 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 Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $debug_cflags"
extra_configs="$pentium_configs $debug_configs $max_no_embedded_configs $disable_64_bit_plugins"
. "$path/FINISH.sh"

View File

@ -1,12 +0,0 @@
#! /bin/sh -x
path=`dirname $0`
set -- "$@" --with-debug=full
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $debug_cflags -g -O0 $wsrep_cflags"
c_warnings="$c_warnings $debug_extra_warnings"
cxx_warnings="$cxx_warnings $debug_extra_warnings"
extra_configs="$pentium_configs $debug_configs $wsrep_configs --with-wsrep $disable_64_bit_plugins"
. "$path/FINISH.sh"

View File

@ -1,26 +0,0 @@
#! /bin/sh
# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
#
# 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 Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $debug_cflags"
extra_configs="$pentium_configs $debug_configs"
extra_configs="$extra_configs --with-debug --with-ssl"
. "$path/FINISH.sh"

0
BUILD/compile-pentium-icc-yassl Normal file → Executable file
View File

View File

0
BUILD/compile-pentium64-wsrep Normal file → Executable file
View File

View File

@ -1,11 +0,0 @@
#!/bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="-D__sun -m32"
extra_configs="$max_configs --with-libevent"
LDFLAGS="-lmtmalloc -R/usr/sfw/lib"
export LDFLAGS
. "$path/FINISH.sh"

View File

@ -1,11 +0,0 @@
#!/bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="-D__sun -m32 $debug_cflags"
extra_configs="$max_configs --with-libevent $debug_configs"
LDFLAGS="-lmtmalloc -R/usr/sfw/lib"
export LDFLAGS
. "$path/FINISH.sh"

View File

@ -1,27 +0,0 @@
#!/bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
# Take only #define options - the others are gcc specific.
# (real fix is for SETUP.sh not to put gcc specific options in $debug_cflags)
DEFS=""
for F in $debug_cflags ; do
expr "$F" : "^-D" && DEFS="$DEFS $F"
done
debug_cflags="-O0 -g $DEFS"
extra_flags="-m32 -mt -D_FORTEC_ -xbuiltin=%all -xlibmil -xlibmopt -fns=no -xprefetch=auto -xprefetch_level=3 $debug_cflags"
extra_configs="$max_configs --with-libevent $debug_configs"
warnings=""
c_warnings=""
cxx_warnings=""
base_cxxflags="-noex"
CC=cc
CFLAGS="-xstrconst"
CXX=CC
LDFLAGS="-lmtmalloc"
. "$path/FINISH.sh"

View File

@ -1,19 +0,0 @@
#!/bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="-m32 -mt -D_FORTEC_ -xbuiltin=%all -xlibmil -xlibmopt -fns=no -xprefetch=auto -xprefetch_level=3"
extra_configs="$max_configs --with-libevent"
warnings=""
c_warnings=""
cxx_warnings=""
base_cxxflags="-noex"
CC=cc
CFLAGS="-xstrconst"
CXX=CC
LDFLAGS="-lmtmalloc"
. "$path/FINISH.sh"

View File

@ -129,6 +129,9 @@ IF(DEFINED ENV{CPPFLAGS})
ADD_DEFINITIONS($ENV{CPPFLAGS})
ENDIF()
# NUMA
SET(WITH_NUMA "AUTO" CACHE STRING "Build with non-uniform memory access, allowing --innodb-numa-interleave. Options are ON|OFF|AUTO. ON = enabled (requires NUMA library), OFF = disabled, AUTO = enabled if NUMA library found.")
SET(MYSQL_MAINTAINER_MODE "AUTO" CACHE STRING "MySQL maintainer-specific development environment. Options are: ON OFF AUTO.")
# Packaging
@ -163,7 +166,7 @@ INCLUDE(install_macros)
INCLUDE(systemd)
INCLUDE(mysql_add_executable)
INCLUDE(compile_flags)
INCLUDE(crc32-vpmsum)
INCLUDE(crc32)
# Handle options
OPTION(DISABLE_SHARED

View File

@ -1,4 +1,4 @@
MYSQL_VERSION_MAJOR=10
MYSQL_VERSION_MINOR=3
MYSQL_VERSION_PATCH=6
SERVER_MATURITY=gamma
MYSQL_VERSION_PATCH=8
SERVER_MATURITY=stable

View File

@ -61,6 +61,7 @@ enum options_client
OPT_USE_THREADS,
OPT_IMPORT_USE_THREADS,
OPT_MYSQL_NUMBER_OF_QUERY,
OPT_IGNORE_DATABASE,
OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_SHOW_WARNINGS,OPT_DROP_DATABASE,
OPT_TZ_UTC, OPT_CREATE_SLAP_SCHEMA,
OPT_MYSQLDUMP_SLAVE_APPLY,

View File

@ -3130,7 +3130,7 @@ static int
com_help(String *buffer __attribute__((unused)),
char *line __attribute__((unused)))
{
reg1 int i, j;
int i, j;
char * help_arg= strchr(line,' '), buff[32], *end;
if (help_arg)
{
@ -4205,8 +4205,7 @@ com_edit(String *buffer,char *line __attribute__((unused)))
const char *editor;
MY_STAT stat_arg;
if ((fd=create_temp_file(filename,NullS,"sql", O_CREAT | O_WRONLY,
MYF(MY_WME))) < 0)
if ((fd= create_temp_file(filename,NullS,"sql", 0, MYF(MY_WME))) < 0)
goto err;
if (buffer->is_empty() && !old_buffer.is_empty())
(void) my_write(fd,(uchar*) old_buffer.ptr(),old_buffer.length(),

View File

@ -159,8 +159,7 @@ static int make_tempfile(char *filename, const char *ext)
{
int fd= 0;
if ((fd=create_temp_file(filename, NullS, ext, O_CREAT | O_WRONLY,
MYF(MY_WME))) < 0)
if ((fd= create_temp_file(filename, NullS, ext, 0, MYF(MY_WME))) < 0)
{
fprintf(stderr, "ERROR: Cannot generate temporary file. Error code: %d.\n",
fd);
@ -365,6 +364,12 @@ static int get_default_values()
}
/* Now open the file and read the defaults we want. */
file= fopen(defaults_file, "r");
if (file == NULL)
{
fprintf(stderr, "ERROR: failed to open file %s: %s.\n", defaults_file,
strerror(errno));
goto exit;
}
while (fgets(line, FN_REFLEN, file) != NULL)
{
char *value= 0;

View File

@ -558,8 +558,7 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res,
DBUG_PRINT("enter", ("query: %s", query));
if ((fd= create_temp_file(query_file_path,
opt_tmpdir[0] ? opt_tmpdir : NULL,
"sql", O_CREAT | O_SHARE | O_RDWR,
MYF(MY_WME))) < 0)
"sql", O_SHARE, MYF(MY_WME))) < 0)
die("Failed to create temporary file for defaults");
/*
@ -1144,7 +1143,7 @@ int main(int argc, char **argv)
load_defaults_or_exit("my", load_default_groups, &argc, &argv);
defaults_argv= argv; /* Must be freed by 'free_defaults' */
#if __WIN__
#if defined(__WIN__)
if (GetModuleFileName(NULL, self_name, FN_REFLEN) == 0)
#endif
{
@ -1176,7 +1175,7 @@ int main(int argc, char **argv)
cnf_file_path= strmov(defaults_file, "--defaults-file=");
{
int fd= create_temp_file(cnf_file_path, opt_tmpdir[0] ? opt_tmpdir : NULL,
"mysql_upgrade-", O_CREAT | O_WRONLY, MYF(MY_FAE));
"mysql_upgrade-", 0, MYF(MY_FAE));
if (fd < 0)
die(NULL);
my_write(fd, USTRING_WITH_LEN( "[client]\n"), MYF(MY_FAE));

View File

@ -2904,7 +2904,7 @@ static Exit_status dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
stdin in binary mode. Errors on setting this mode result in
halting the function and printing an error message to stderr.
*/
#if defined (__WIN__) || (_WIN64)
#if defined (__WIN__) || defined(_WIN64)
if (_setmode(fileno(stdin), O_BINARY) == -1)
{
error("Could not set binary mode on stdin.");

View File

@ -212,7 +212,9 @@ TYPELIB compatible_mode_typelib= {array_elements(compatible_mode_names) - 1,
#define MED_ENGINES "MRG_MyISAM, MRG_ISAM, CONNECT, OQGRAPH, SPIDER, VP, FEDERATED"
HASH ignore_table;
static HASH ignore_table;
static HASH ignore_database;
static struct my_option my_long_options[] =
{
@ -376,6 +378,11 @@ static struct my_option my_long_options[] =
&opt_hex_blob, &opt_hex_blob, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", &current_host,
&current_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"ignore-database", OPT_IGNORE_DATABASE,
"Do not dump the specified database. To specify more than one database to ignore, "
"use the directive multiple times, once for each database. Only takes effect "
"when used together with --all-databases|-A",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"ignore-table", OPT_IGNORE_TABLE,
"Do not dump the specified table. To specify more than one table to ignore, "
"use the directive multiple times, once for each table. Each table must "
@ -900,6 +907,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case (int) OPT_TABLES:
opt_databases=0;
break;
case (int) OPT_IGNORE_DATABASE:
if (my_hash_insert(&ignore_database, (uchar*) my_strdup(argument, MYF(0))))
exit(EX_EOM);
break;
case (int) OPT_IGNORE_TABLE:
{
if (!strchr(argument, '.'))
@ -984,6 +995,9 @@ static int get_options(int *argc, char ***argv)
load_defaults_or_exit("my", load_default_groups, argc, argv);
defaults_argv= *argv;
if (my_hash_init(&ignore_database, charset_info, 16, 0, 0,
(my_hash_get_key) get_table_key, my_free, 0))
return(EX_EOM);
if (my_hash_init(&ignore_table, charset_info, 16, 0, 0,
(my_hash_get_key) get_table_key, my_free, 0))
return(EX_EOM);
@ -1056,6 +1070,13 @@ static int get_options(int *argc, char ***argv)
my_progname_short);
return(EX_USAGE);
}
if (ignore_database.records && !opt_alldbs)
{
fprintf(stderr,
"%s: --ignore-database can only be used together with --all-databases.\n",
my_progname_short);
return(EX_USAGE);
}
if (strcmp(default_charset, charset_info->csname) &&
!(charset_info= get_charset_by_csname(default_charset,
MY_CS_PRIMARY, MYF(MY_WME))))
@ -1642,6 +1663,8 @@ static void free_resources()
my_free(opt_password);
my_free(current_host);
free_root(&glob_root, MYF(0));
if (my_hash_inited(&ignore_database))
my_hash_free(&ignore_database);
if (my_hash_inited(&ignore_table))
my_hash_free(&ignore_table);
dynstr_free(&extended_row);
@ -2491,7 +2514,7 @@ static uint dump_routines_for_db(char *db)
"Create Package Body"};
char db_name_buff[NAME_LEN*2+3], name_buff[NAME_LEN*2+3];
char *routine_name;
int i;
uint i;
FILE *sql_file= md_result_file;
MYSQL_ROW row, routine_list_row;
@ -2527,7 +2550,7 @@ static uint dump_routines_for_db(char *db)
fputs("\t<routines>\n", sql_file);
/* 0, retrieve and dump functions, 1, procedures, etc. */
for (i= 0; i < 4; i++)
for (i= 0; i < array_elements(routine_type); i++)
{
my_snprintf(query_buff, sizeof(query_buff),
"SHOW %s STATUS WHERE Db = '%s'",
@ -4214,6 +4237,7 @@ static int dump_tablespaces_for_tables(char *db, char **table_names, int tables)
return r;
}
static int dump_tablespaces_for_databases(char** databases)
{
int r;
@ -4243,6 +4267,7 @@ static int dump_tablespaces_for_databases(char** databases)
return r;
}
static int dump_tablespaces(char* ts_where)
{
MYSQL_ROW row;
@ -4429,6 +4454,14 @@ static int dump_tablespaces(char* ts_where)
DBUG_RETURN(0);
}
/* Return 1 if we should copy the database */
static my_bool include_database(const char *hash_key)
{
return !my_hash_search(&ignore_database, (uchar*) hash_key, strlen(hash_key));
}
static int dump_all_databases()
{
MYSQL_ROW row;
@ -4447,8 +4480,9 @@ static int dump_all_databases()
!my_strcasecmp(&my_charset_latin1, row[0], PERFORMANCE_SCHEMA_DB_NAME))
continue;
if (dump_all_tables_in_db(row[0]))
result=1;
if (include_database(row[0]))
if (dump_all_tables_in_db(row[0]))
result=1;
}
mysql_free_result(tableres);
if (seen_views)
@ -4470,8 +4504,9 @@ static int dump_all_databases()
!my_strcasecmp(&my_charset_latin1, row[0], PERFORMANCE_SCHEMA_DB_NAME))
continue;
if (dump_all_views_in_db(row[0]))
result=1;
if (include_database(row[0]))
if (dump_all_views_in_db(row[0]))
result=1;
}
mysql_free_result(tableres);
}
@ -6055,7 +6090,6 @@ int main(int argc, char **argv)
sf_leaking_memory=1; /* don't report memory leaks on early exits */
compatible_mode_normal_str[0]= 0;
default_charset= (char *)mysql_universal_client_charset;
bzero((char*) &ignore_table, sizeof(ignore_table));
exit_code= get_options(&argc, &argv);
if (exit_code)

View File

@ -949,6 +949,8 @@ pthread_handler_t connection_thread(void *arg)
end_thread:
cn->query_done= 1;
mysql_close(cn->mysql);
cn->mysql= 0;
mysql_thread_end();
pthread_exit(0);
return 0;
@ -1462,7 +1464,7 @@ void close_statements()
for (con= connections; con < next_con; con++)
{
if (con->stmt)
mysql_stmt_close(con->stmt);
do_stmt_close(con);
con->stmt= 0;
}
DBUG_VOID_RETURN;
@ -2209,8 +2211,7 @@ int dyn_string_cmp(DYNAMIC_STRING* ds, const char *fname)
DBUG_ENTER("dyn_string_cmp");
DBUG_PRINT("enter", ("fname: %s", fname));
if ((fd= create_temp_file(temp_file_path, TMPDIR,
"tmp", O_CREAT | O_SHARE | O_RDWR,
if ((fd= create_temp_file(temp_file_path, TMPDIR, "tmp", O_SHARE,
MYF(MY_WME))) < 0)
die("Failed to create temporary file for ds");
@ -4684,8 +4685,7 @@ void do_perl(struct st_command *command)
/* Create temporary file name */
if ((fd= create_temp_file(temp_file_path, getenv("MYSQLTEST_VARDIR"),
"tmp", O_CREAT | O_SHARE | O_RDWR,
MYF(MY_WME))) < 0)
"tmp", O_SHARE, MYF(MY_WME))) < 0)
die("Failed to create temporary file for perl command");
my_close(fd, MYF(0));

View File

@ -1,5 +0,0 @@
IF(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le")
SET(HAVE_CRC32_VPMSUM 1)
SET(CRC32_VPMSUM_LIBRARY crc32-vpmsum)
ADD_SUBDIRECTORY(extra/crc32-vpmsum)
ENDIF()

5
cmake/crc32.cmake Normal file
View File

@ -0,0 +1,5 @@
IF(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64")
SET(HAVE_CRC32_VPMSUM 1)
SET(CRC32_LIBRARY crc32-vpmsum)
ADD_SUBDIRECTORY(extra/crc32-vpmsum)
ENDIF()

View File

@ -34,5 +34,9 @@ ENDIF()
SET(PLUGIN_INSTALL_DIR ${INSTALL_PLUGINDIR})
SET(MARIADB_UNIX_ADDR ${MYSQL_UNIX_ADDR})
SET(CLIENT_PLUGIN_PVIO_NPIPE STATIC)
SET(CLIENT_PLUGIN_PVIO_SHMEM STATIC)
SET(CLIENT_PLUGIN_PVIO_SOCKET STATIC)
MESSAGE("== Configuring MariaDB Connector/C")
ADD_SUBDIRECTORY(libmariadb)

View File

@ -1,16 +1,18 @@
MACRO (MYSQL_CHECK_NUMA)
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
STRING(TOLOWER "${WITH_NUMA}" WITH_NUMA_LOWERCASE)
IF(NOT WITH_NUMA)
MESSAGE(STATUS "WITH_NUMA=OFF: NUMA memory allocation policy disabled")
ELSEIF(NOT WITH_NUMA_LOWERCASE STREQUAL "auto" AND NOT WITH_NUMA_LOWERCASE STREQUAL "on")
MESSAGE(FATAL_ERROR "Wrong value for WITH_NUMA")
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
CHECK_INCLUDE_FILES(numa.h HAVE_NUMA_H)
CHECK_INCLUDE_FILES(numaif.h HAVE_NUMAIF_H)
IF(HAVE_NUMA_H AND HAVE_NUMAIF_H)
OPTION(WITH_NUMA "Explicitly set NUMA memory allocation policy" ON)
ELSE()
OPTION(WITH_NUMA "Explicitly set NUMA memory allocation policy" OFF)
ENDIF()
IF(WITH_NUMA AND HAVE_NUMA_H AND HAVE_NUMAIF_H)
SET(SAVE_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} numa)
CHECK_C_SOURCE_COMPILES(
@ -31,12 +33,19 @@ MACRO (MYSQL_CHECK_NUMA)
ENDIF()
ENDIF()
IF(WITH_NUMA AND NOT HAVE_LIBNUMA)
IF(WITH_NUMA_LOWERCASE STREQUAL "auto" AND HAVE_LIBNUMA)
MESSAGE(STATUS "WITH_NUMA=AUTO: NUMA memory allocation policy enabled")
ELSEIF(WITH_NUMA_LOWERCASE STREQUAL "auto" AND NOT HAVE_LIBNUMA)
MESSAGE(STATUS "WITH_NUMA=AUTO: NUMA memory allocation policy disabled")
ELSEIF(HAVE_LIBNUMA)
MESSAGE(STATUS "WITH_NUMA=ON: NUMA memory allocation policy enabled")
ELSE()
# Forget it in cache, abort the build.
UNSET(WITH_NUMA CACHE)
UNSET(NUMA_LIBRARY CACHE)
MESSAGE(FATAL_ERROR "Could not find numa headers/libraries")
MESSAGE(FATAL_ERROR "WITH_NUMA=ON: Could not find NUMA headers/libraries")
ENDIF()
ENDIF()
ENDMACRO()

View File

@ -261,8 +261,6 @@ CHECK_SYMBOL_REPLACEMENT(S_IROTH _S_IREAD sys/stat.h)
CHECK_SYMBOL_REPLACEMENT(S_IFIFO _S_IFIFO sys/stat.h)
CHECK_SYMBOL_REPLACEMENT(SIGQUIT SIGTERM signal.h)
CHECK_SYMBOL_REPLACEMENT(SIGPIPE SIGINT signal.h)
CHECK_SYMBOL_REPLACEMENT(isnan _isnan "math.h;float.h")
CHECK_SYMBOL_REPLACEMENT(finite _finite "math;float.h")
CHECK_FUNCTION_REPLACEMENT(popen _popen)
CHECK_FUNCTION_REPLACEMENT(pclose _pclose)
CHECK_FUNCTION_REPLACEMENT(access _access)

View File

@ -52,8 +52,6 @@ SET(HAVE_DECL_FDATASYNC CACHE INTERNAL "")
SET(HAVE_FEDISABLEEXCEPT CACHE INTERNAL "")
SET(HAVE_FENV_H CACHE INTERNAL "")
SET(HAVE_FESETROUND CACHE INTERNAL "")
SET(HAVE_FINITE CACHE INTERNAL "")
SET(HAVE_FINITE_IN_MATH_H CACHE INTERNAL "")
SET(HAVE_FLOAT_H 1 CACHE INTERNAL "")
SET(HAVE_FNMATCH_H CACHE INTERNAL "")
SET(HAVE_FPU_CONTROL_H CACHE INTERNAL "")
@ -89,7 +87,6 @@ SET(HAVE_LDIV 1 CACHE INTERNAL "")
SET(HAVE_LIMITS_H 1 CACHE INTERNAL "")
SET(HAVE_LOCALE_H 1 CACHE INTERNAL "")
SET(HAVE_LOCALTIME_R 1 CACHE INTERNAL "")
#SET(HAVE_LOG2 CACHE INTERNAL "")
SET(HAVE_LRAND48 CACHE INTERNAL "")
SET(HAVE_LSTAT CACHE INTERNAL "")
SET(HAVE_MADVISE CACHE INTERNAL "")
@ -100,6 +97,7 @@ SET(HAVE_MEMCPY 1 CACHE INTERNAL "")
SET(HAVE_MEMMOVE 1 CACHE INTERNAL "")
SET(HAVE_MEMORY_H 1 CACHE INTERNAL "")
SET(HAVE_MKSTEMP CACHE INTERNAL "")
SET(HAVE_MKOSTEMP CACHE INTERNAL "")
SET(HAVE_MLOCK CACHE INTERNAL "")
SET(HAVE_MLOCKALL CACHE INTERNAL "")
SET(HAVE_MMAP CACHE INTERNAL "")
@ -140,7 +138,6 @@ SET(HAVE_READLINK CACHE INTERNAL "")
SET(HAVE_READ_REAL_TIME CACHE INTERNAL "")
SET(HAVE_REALPATH CACHE INTERNAL "")
SET(HAVE_RENAME 1 CACHE INTERNAL "")
#SET(HAVE_RINT CACHE INTERNAL "")
SET(HAVE_RWLOCK_INIT CACHE INTERNAL "")
SET(HAVE_SCHED_H CACHE INTERNAL "")
SET(HAVE_SCHED_YIELD CACHE INTERNAL "")
@ -239,7 +236,6 @@ SET(HAVE_SYS_VADVISE_H CACHE INTERNAL "")
SET(HAVE_SYS_WAIT_H CACHE INTERNAL "")
SET(HAVE_TCGETATTR CACHE INTERNAL "")
SET(HAVE_TELL 1 CACHE INTERNAL "")
SET(HAVE_TEMPNAM 1 CACHE INTERNAL "")
SET(HAVE_TERMCAP_H CACHE INTERNAL "")
SET(HAVE_TERMIOS_H CACHE INTERNAL "")
SET(HAVE_TERMIO_H CACHE INTERNAL "")

View File

@ -140,7 +140,6 @@
#cmakedefine HAVE_DECL_FDATASYNC 1
#cmakedefine HAVE_FEDISABLEEXCEPT 1
#cmakedefine HAVE_FESETROUND 1
#cmakedefine HAVE_FINITE 1
#cmakedefine HAVE_FP_EXCEPT 1
#cmakedefine HAVE_FSEEKO 1
#cmakedefine HAVE_FSYNC 1
@ -162,13 +161,10 @@
#cmakedefine gmtime_r @gmtime_r@
#cmakedefine HAVE_IN_ADDR_T 1
#cmakedefine HAVE_INITGROUPS 1
#cmakedefine HAVE_ISNAN 1
#cmakedefine HAVE_ISINF 1
#cmakedefine HAVE_LARGE_PAGE_OPTION 1
#cmakedefine HAVE_LDIV 1
#cmakedefine HAVE_LRAND48 1
#cmakedefine HAVE_LOCALTIME_R 1
#cmakedefine HAVE_LOG2 1
#cmakedefine HAVE_LSTAT 1
#cmakedefine HAVE_MEMALIGN 1
/* #cmakedefine HAVE_MLOCK 1 see Bug#54662 */
@ -181,6 +177,7 @@
#cmakedefine HAVE_MEMCPY 1
#cmakedefine HAVE_MEMMOVE 1
#cmakedefine HAVE_MKSTEMP 1
#cmakedefine HAVE_MKOSTEMP 1
#cmakedefine HAVE_MLOCKALL 1
#cmakedefine HAVE_MMAP 1
#cmakedefine HAVE_MMAP64 1
@ -212,7 +209,6 @@
#cmakedefine HAVE_READLINK 1
#cmakedefine HAVE_REALPATH 1
#cmakedefine HAVE_RENAME 1
#cmakedefine HAVE_RINT 1
#cmakedefine HAVE_RWLOCK_INIT 1
#cmakedefine HAVE_SCHED_YIELD 1
#cmakedefine HAVE_SELECT 1
@ -235,7 +231,6 @@
#cmakedefine HAVE_STRTOUL 1
#cmakedefine HAVE_STRTOULL 1
#cmakedefine HAVE_TELL 1
#cmakedefine HAVE_TEMPNAM 1
#cmakedefine HAVE_THR_SETCONCURRENCY 1
#cmakedefine HAVE_THR_YIELD 1
#cmakedefine HAVE_TIME 1
@ -421,8 +416,6 @@
#cmakedefine mode_t @mode_t@
#cmakedefine SIGQUIT @SIGQUIT@
#cmakedefine SIGPIPE @SIGPIPE@
#cmakedefine isnan @isnan@
#cmakedefine finite @finite@
#cmakedefine popen @popen@
#cmakedefine pclose @pclose@
#cmakedefine ssize_t @ssize_t@
@ -433,11 +426,11 @@
#cmakedefine strtoll @strtoll@
#cmakedefine strtoull @strtoull@
#cmakedefine vsnprintf @vsnprintf@
#if (_MSC_VER > 1800)
#if defined(_MSC_VER) && (_MSC_VER > 1800)
#define tzname _tzname
#define P_tmpdir "C:\\TEMP"
#endif
#if (_MSC_VER > 1310)
#if defined(_MSC_VER) && (_MSC_VER > 1310)
# define HAVE_SETENV
#define setenv(a,b,c) _putenv_s(a,b)
#endif

View File

@ -370,6 +370,7 @@ CHECK_FUNCTION_EXISTS (mallinfo HAVE_MALLINFO)
CHECK_FUNCTION_EXISTS (memcpy HAVE_MEMCPY)
CHECK_FUNCTION_EXISTS (memmove HAVE_MEMMOVE)
CHECK_FUNCTION_EXISTS (mkstemp HAVE_MKSTEMP)
CHECK_FUNCTION_EXISTS (mkostemp HAVE_MKOSTEMP)
CHECK_FUNCTION_EXISTS (mlock HAVE_MLOCK)
CHECK_FUNCTION_EXISTS (mlockall HAVE_MLOCKALL)
CHECK_FUNCTION_EXISTS (mmap HAVE_MMAP)
@ -413,7 +414,6 @@ CHECK_FUNCTION_EXISTS (strtoul HAVE_STRTOUL)
CHECK_FUNCTION_EXISTS (strtoull HAVE_STRTOULL)
CHECK_FUNCTION_EXISTS (strcasecmp HAVE_STRCASECMP)
CHECK_FUNCTION_EXISTS (tell HAVE_TELL)
CHECK_FUNCTION_EXISTS (tempnam HAVE_TEMPNAM)
CHECK_FUNCTION_EXISTS (thr_setconcurrency HAVE_THR_SETCONCURRENCY)
CHECK_FUNCTION_EXISTS (thr_yield HAVE_THR_YIELD)
CHECK_FUNCTION_EXISTS (vasprintf HAVE_VASPRINTF)
@ -477,26 +477,6 @@ CHECK_SYMBOL_EXISTS(TIOCSTAT "sys/ioctl.h" TIOCSTAT_IN_SYS_IOCTL)
CHECK_SYMBOL_EXISTS(FIONREAD "sys/filio.h" FIONREAD_IN_SYS_FILIO)
CHECK_SYMBOL_EXISTS(gettimeofday "sys/time.h" HAVE_GETTIMEOFDAY)
CHECK_SYMBOL_EXISTS(finite "math.h" HAVE_FINITE_IN_MATH_H)
IF(HAVE_FINITE_IN_MATH_H)
SET(HAVE_FINITE TRUE CACHE INTERNAL "")
ELSE()
CHECK_SYMBOL_EXISTS(finite "ieeefp.h" HAVE_FINITE)
ENDIF()
CHECK_SYMBOL_EXISTS(log2 math.h HAVE_LOG2)
CHECK_SYMBOL_EXISTS(isnan math.h HAVE_ISNAN)
CHECK_SYMBOL_EXISTS(rint math.h HAVE_RINT)
# isinf() prototype not found on Solaris
CHECK_CXX_SOURCE_COMPILES(
"#include <math.h>
int main() {
isinf(0.0);
return 0;
}" HAVE_ISINF)
#
# Test for endianness
#

View File

@ -4,6 +4,8 @@
#
# Changes to this file will be preserved when updating the Debian package.
#
# NOTE: This file is read only by the traditional SysV init script, not systemd.
#
source /usr/share/mysql/debian-start.inc.sh

View File

@ -77,7 +77,7 @@ Changelog for innotop:
* remove cxn from $meta->{group_by} if there's only one connection displayed
* fix for issue 19 - cxn column won't become visible when viewing two
connections after having viewed one connection
* suppress errors resulting from the addition of a 'BACKGROUND THREAD'
* supress errors resulting from the addition of a 'BACKGROUND THREAD'
section in the output of 'show innodb status'
* possible fix for issue 22 - Useless use of a constant in void context
* small change to set_to_tbl() around hiding the cxn column if there

View File

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
# Street, Fifth Floor, Boston, MA 02111-1301 USA
# Street, Fifth Floor, Boston, MA 02110-1301 USA
use strict;
use warnings FATAL => 'all';
@ -1438,8 +1438,8 @@ systems, you can issue `man perlgpl' or `man perlartistic' to read these
licenses.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
Street, Fifth Floor, Boston, MA 02111-1301 USA.
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA.
LICENSE
# Configuration information and global setup {{{1
@ -4657,7 +4657,7 @@ my %stmt_maker_for = (
my $sth;
eval { # This can fail if the table doesn't exist, INFORMATION_SCHEMA doesn't exist, etc.
my $cols = $dbh->selectall_arrayref(q{SHOW /*innotop*/ COLUMNS FROM INFORMATION_SCHEMA.PROCESSLIST LIKE 'TIME_MS'});
if ( @$cols ) { # The TIME_MS column exists
if ( @$cols ) { # The TIME_MS colum exists
$sth = $dbh->prepare(q{SELECT /*innotop*/ ID, USER, HOST, DB, COMMAND, CASE WHEN TIME_MS/1000 > 365*86400 THEN TIME ELSE TIME_MS/1000 END AS TIME, STATE, INFO FROM INFORMATION_SCHEMA.PROCESSLIST});
}
};
@ -11653,7 +11653,7 @@ show you something like this:
pages_modified Dirty Pages Pages modified (dirty IB_bp_pages_m
buf_pool_hit_rate Hit Rate Buffer pool hit rate IB_bp_buf_poo
total_mem_alloc Memory Total memory allocate IB_bp_total_m
add_pool_alloc Add'l Pool Additional pool alloca IB_bp_add_poo
add_pool_alloc Add'l Pool Additonal pool alloca IB_bp_add_poo
The first line shows which table you're editing, and reminds you again to press
'?' for a list of key mappings. The rest is a tabular representation of the
@ -12233,8 +12233,8 @@ systems, you can issue `man perlgpl' or `man perlartistic' to read these
licenses.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
Street, Fifth Floor, Boston, MA 02111-1301 USA.
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA.
Execute innotop and press '!' to see this information at any time.

View File

@ -1678,7 +1678,7 @@ show you something like this:
\& pages_modified Dirty Pages Pages modified (dirty IB_bp_pages_m
\& buf_pool_hit_rate Hit Rate Buffer pool hit rate IB_bp_buf_poo
\& total_mem_alloc Memory Total memory allocate IB_bp_total_m
\& add_pool_alloc Add\*(Aql Pool Additional pool alloca IB_bp_add_poo
\& add_pool_alloc Add\*(Aql Pool Additonal pool alloca IB_bp_add_poo
.Ve
.PP
The first line shows which table you're editing, and reminds you again to press
@ -2183,8 +2183,8 @@ systems, you can issue `man perlgpl' or `man perlartistic' to read these
licenses.
.PP
You should have received a copy of the \s-1GNU\s0 General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
Street, Fifth Floor, Boston, \s-1MA\s0 02111\-1301 \s-1USA\s0.
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, \s-1MA 02111\-1307 USA.\s0
.PP
Execute innotop and press '!' to see this information at any time.
.SH "AUTHOR"

View File

@ -186,4 +186,5 @@ key_buffer = 16M
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
!include /etc/mysql/mariadb.cnf
!includedir /etc/mysql/conf.d/

View File

@ -1,4 +1,4 @@
# This file is intensionally empty to disable apparmor by default for newer
# This file is intentionally empty to disable apparmor by default for newer
# versions of MariaDB, while providing seamless upgrade from older versions
# and from mysql, where apparmor is used.
#
@ -11,5 +11,5 @@
# be used.
#
# When upgrading from previous version, users who modified the profile
# will be promptet to keep or discard it, while for default installs
# will be prompted to keep or discard it, while for default installs
# we will automatically disable the profile.

View File

@ -48,7 +48,7 @@ fi
if ! apt-cache madison libcrack2-dev | grep 'libcrack2-dev *| *2\.9' >/dev/null 2>&1
then
sed '/libcrack2-dev/d' -i debian/control
sed '/Package: mariadb-plugin-cracklib/,+9d' -i debian/control
sed '/Package: mariadb-plugin-cracklib/,+11d' -i debian/control
fi
# If libpcre3-dev (>= 2:8.35-3.2~) is not available (before Debian Jessie or Ubuntu Wily)
@ -73,6 +73,15 @@ then
sed '/mariadb-service-convert/d' -i debian/mariadb-server-10.3.install
fi
# If libzstd-dev is not available (before Debian Stretch and Ubuntu Xenial)
# remove the dependency from server and rocksdb so it can build properly
if ! apt-cache madison libzstd-dev | grep 'libzstd-dev' >/dev/null 2>&1
then
sed '/libzstd-dev/d' -i debian/control
sed '/libzstd1/d' -i debian/control
fi
# Convert gcc version to numberical value. Format is Mmmpp where M is Major
# version, mm is minor version and p is patch.
# -dumpfullversion & -dumpversion to make it uniform across old and new (>=7)
@ -128,10 +137,11 @@ UPSTREAM="${MYSQL_VERSION_MAJOR}.${MYSQL_VERSION_MINOR}.${MYSQL_VERSION_PATCH}${
PATCHLEVEL="+maria"
LOGSTRING="MariaDB build"
CODENAME="$(lsb_release -sc)"
EPOCH="1:"
dch -b -D ${CODENAME} -v "1:${UPSTREAM}${PATCHLEVEL}~${CODENAME}" "Automatic build with ${LOGSTRING}."
dch -b -D ${CODENAME} -v "${EPOCH}${UPSTREAM}${PATCHLEVEL}~${CODENAME}" "Automatic build with ${LOGSTRING}."
echo "Creating package version ${UPSTREAM}${PATCHLEVEL}~${CODENAME} ... "
echo "Creating package version ${EPOCH}${UPSTREAM}${PATCHLEVEL}~${CODENAME} ... "
# On Travis CI, use -b to build binary only packages as there is no need to
# waste time on generating the source package.

31
debian/control vendored
View File

@ -8,7 +8,6 @@ Build-Depends: bison,
debhelper (>= 9),
dh-apparmor,
dh-systemd,
dpatch,
gdb,
libaio-dev [linux-any],
libboost-dev,
@ -26,6 +25,7 @@ Build-Depends: bison,
libssl-dev | libssl1.0-dev,
libsystemd-dev,
libxml2-dev,
libzstd-dev,
lsb-release,
perl (>= 5.6.0),
po-debconf,
@ -40,6 +40,7 @@ Vcs-Git: https://github.com/MariaDB/server.git
Package: libmariadb-dev
Architecture: any
Multi-Arch: same
Section: libdevel
Depends: libmariadb3 (= ${binary:Version}),
zlib1g-dev,
@ -91,6 +92,7 @@ Description: MariaDB Connector/C, compatibility symlinks
Package: libmariadb3
Architecture: any
Multi-Arch: same
Section: libs
Depends: mariadb-common,
${misc:Depends},
@ -167,6 +169,7 @@ Description: Virtual package to satisfy external libmysqlclient18 depends
Package: libmariadbd-dev
Architecture: any
Multi-Arch: same
Section: libdevel
Provides: libmysqld-dev
Pre-Depends: ${misc:Pre-Depends}
@ -186,10 +189,10 @@ Description: MariaDB embedded database, development files
Package: libmariadbd19
Architecture: any
Multi-Arch: same
Section: libs
Depends: ${misc:Depends},
${shlibs:Depends}
Multi-Arch: same
Breaks: libmariadbd-dev (<< ${source:Version})
Replaces: libmariadbd-dev (<< ${source:Version})
Description: MariaDB embedded database, shared library
@ -418,10 +421,7 @@ Recommends: libhtml-template-perl
Pre-Depends: adduser (>= 3.40),
debconf,
mariadb-common (>= ${source:Version})
Depends: bsdutils,
coreutils,
findutils,
galera-3 (>=25.3),
Depends: galera-3 (>=25.3),
gawk,
iproute2,
libdbi-perl,
@ -536,6 +536,7 @@ Description: Connect storage engine for MariaDB
Package: mariadb-plugin-rocksdb
Architecture: amd64 arm64 mips64el ppc64el
Depends: mariadb-server-10.3 (= ${binary:Version}),
libzstd1,
${misc:Depends},
${shlibs:Depends}
Breaks: mariadb-rocksdb-engine-10.2,
@ -655,7 +656,10 @@ Replaces: mariadb-gssapi-server-10.1,
mariadb-gssapi-server-10.2,
mariadb-gssapi-server-10.3
Description: GSSAPI authentication plugin for MariaDB server
This package contains the server components.
This plugin includes support for Kerberos on Unix, but can also be used for
Windows authentication with or without domain environment.
.
This package contains the server parts.
Package: mariadb-plugin-gssapi-client
Architecture: any
@ -670,7 +674,10 @@ Replaces: mariadb-gssapi-client-10.1,
mariadb-gssapi-client-10.2,
mariadb-gssapi-client-10.3
Description: GSSAPI authentication plugin for MariaDB client
This package contains the client components.
This plugin includes support for Kerberos on Unix, but can also be used for
Windows authentication with or without domain environment.
.
This package contains the client parts.
Package: mariadb-backup
Architecture: any
@ -683,6 +690,10 @@ Depends: mariadb-client-core-10.3,
${shlibs:Depends}
Description: Backup tool for MariaDB server
This backup tool is guaranteed to be compatible with MariaDB.
Based on Xtrabackup, but improved to work with MariaDB.
.
Plese refer to the MariaDB Knowledge Base on more information on
how to use this tool.
Package: mariadb-plugin-cracklib-password-check
Architecture: any
@ -693,6 +704,9 @@ Depends: libcrack2 (>= 2.9.0),
Description: CrackLib Password Validation Plugin for MariaDB
This password validation plugin uses cracklib to allow only
sufficiently secure (as defined by cracklib) user passwords in MariaDB.
.
Plese refer to the MariaDB Knowledge Base on more information on
how to use this tool.
Package: mariadb-test
Architecture: any
@ -733,6 +747,7 @@ Description: MariaDB database regression test suite
Package: mariadb-test-data
Architecture: all
Multi-Arch: foreign
Depends: ${misc:Depends}
Breaks: mariadb-test-10.0,
mariadb-test-10.1,

View File

@ -41,6 +41,7 @@ usr/bin/wsrep_sst_xtrabackup-v2
usr/lib/mysql/plugin/auth_ed25519.so
usr/lib/mysql/plugin/auth_pam.so
usr/lib/mysql/plugin/auth_socket.so
usr/lib/mysql/plugin/disks.so
usr/lib/mysql/plugin/file_key_management.so
usr/lib/mysql/plugin/ha_archive.so
usr/lib/mysql/plugin/ha_blackhole.so
@ -98,4 +99,5 @@ usr/share/mysql/mysql_performance_tables.sql
usr/share/mysql/mysql_system_tables.sql
usr/share/mysql/mysql_system_tables_data.sql
usr/share/mysql/mysql_test_data_timezone.sql
usr/share/mysql/mysql_test_db.sql
usr/share/mysql/wsrep_notify

View File

@ -1,3 +1,18 @@
#
# NOTE: This file is read only by the traditional SysV init script.
# Debian 9 and Ubuntu 17.04 onwards do not normally read this file as they use
# systemd by default.
#
# For similar behaviour, systemd users should override ExecStart by dropping
# files into /etc/systemd/system/mariadb.service.d/
#
# See also:
# https://wiki.debian.org/Teams/pkg-systemd/Packaging#overriding_options_and_.2Fetc.2Fdefault_handling
# https://mariadb.com/kb/en/mariadb/systemd/
#
# Note also that MariaDB systemd does _not_ utilize mysqld_safe nor debian-start.
# The delay in seconds the init script waits for the server to be up and running after having started "mysqld_safe" to run the "/etc/mysql/debian-start" script.
# If the server is still not responding after the delay, the script won't be executed and an error will be thrown on the syslog.
# Default: 30

View File

@ -91,7 +91,7 @@ case "$1" in
mv "$targetdir" "$mysql_tmp"
cat << EOF > "$mysql_tmp/README"
Ff you're reading this, it's most likely because you had replaced /var/lib/mysql
If you're reading this, it's most likely because you had replaced /var/lib/mysql
with a symlink, then upgraded to a new version of mysql, and then dpkg
removed your symlink (see #182747 and others). The mysql packages noticed
that this happened, and as a workaround have restored it. However, because
@ -141,7 +141,9 @@ EOF
# Debian: beware of the bashisms...
# Debian: can safely run on upgrades with existing databases
set +e
bash /usr/bin/mysql_install_db --rpm --cross-bootstrap --user=mysql --disable-log-bin 2>&1 | $ERR_LOGGER
bash /usr/bin/mysql_install_db --rpm --cross-bootstrap --user=mysql \
--disable-log-bin --skip-test-db 2>&1 | \
$ERR_LOGGER
set -e

View File

@ -1,2 +1 @@
debian/additions/my.cnf etc/mysql
usr/share/mysql-common/internal-use-only

View File

@ -1,5 +0,0 @@
33_scripts__mysql_create_system_tables__no_test.dpatch
38_scripts__mysqld_safe.sh__signals.dpatch
41_scripts__mysql_install_db.sh__no_test.dpatch
50_mysql-test__db_test.dpatch
61_replace_dash_with_bash_mbug675185.dpatch

View File

@ -1,38 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 33_scripts__mysql_create_system_tables__no_test.dpatch by <ch@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: scripts__mysql_create_system_tables__no_test
## DP: A user with no password prevents a normal user from login under certain
## DP: circumstances as it is checked first. See #301741.
## DP: http://bugs.mysql.com/bug.php?id=6901
@DPATCH@
--- a/scripts/mysql_system_tables_data.sql
+++ b/scripts/mysql_system_tables_data.sql
@@ -27,15 +27,6 @@
SELECT LOWER( REPLACE((SELECT REPLACE(@@hostname,'_','\_')),'%','\%') )INTO @current_hostname;
--- Fill "db" table with default grants for anyone to
--- access database 'test' and 'test_%' if "db" table didn't exist
-CREATE TEMPORARY TABLE tmp_db LIKE db;
-INSERT INTO tmp_db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y','Y');
-INSERT INTO tmp_db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y','Y');
-INSERT INTO db SELECT * FROM tmp_db WHERE @had_db_table=0;
-DROP TABLE tmp_db;
-
-
-- Fill "user" table with default users allowing root access
-- from local machine if "user" table didn't exist before
CREATE TEMPORARY TABLE tmp_user_nopasswd LIKE user;
@@ -48,9 +39,6 @@ REPLACE INTO tmp_user_nopasswd VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y'
REPLACE INTO tmp_user_nopasswd VALUES ('::1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','','N','N', '', 0);
-- More secure root account using unix sucket auth.
INSERT INTO tmp_user_socket VALUES ('localhost',IFNULL(@auth_root_socket, 'root'),'','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'unix_socket','','N', 'N','', 0);
--- Anonymous user with no privileges.
-INSERT INTO tmp_user_anonymous (host,user) VALUES ('localhost','');
-INSERT INTO tmp_user_anonymous (host,user) SELECT @current_hostname,'' FROM dual WHERE @current_hostname != 'localhost';
INSERT INTO user SELECT * FROM tmp_user_nopasswd WHERE @had_user_table=0 AND @skip_auth_root_nopasswd IS NULL;
INSERT INTO user SELECT * FROM tmp_user_socket WHERE @had_user_table=0 AND @auth_root_socket IS NOT NULL;

View File

@ -1,43 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 38_scripts__mysqld_safe.sh__signals.dpatch by <ch@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Executes /etc/init.d/mysql on signals
## DP: Reported as http://bugs.mysql.com/bug.php?id=31361
@DPATCH@
--- a/scripts/mysqld_safe.sh 2013-01-11 16:02:41 +0000
+++ b/scripts/mysqld_safe.sh 2013-01-11 16:03:14 +0000
@@ -36,7 +36,6 @@ skip_err_log=0
syslog_tag_mysqld=mysqld
syslog_tag_mysqld_safe=mysqld_safe
-trap '' 1 2 3 15 # we shouldn't let anyone kill us
# MySQL-specific environment variable. First off, it's not really a umask,
# it's the desired mode. Second, it follows umask(2), not umask(3) in that
@@ -181,7 +180,7 @@ eval_log_error () {
# sed buffers output (only GNU sed supports a -u (unbuffered) option)
# which means that messages may not get sent to syslog until the
# mysqld process quits.
- cmd="$cmd 2>&1 | logger -t '$syslog_tag_mysqld' -p daemon.error"
+ cmd="$cmd 2>&1 | logger -t '$syslog_tag_mysqld' -p daemon.error & wait"
;;
*)
echo "Internal program error (non-fatal):" \
@@ -895,6 +894,13 @@ then
fi
#
+# From now on, we catch signals to do a proper shutdown of mysqld
+# when signalled to do so.
+#
+trap '/usr/bin/mysqladmin --defaults-extra-file=/etc/mysql/debian.cnf refresh & wait' 1 # HUP
+trap '/usr/bin/mysqladmin --defaults-extra-file=/etc/mysql/debian.cnf shutdown' 2 3 15 # INT QUIT and TERM
+
+#
# Uncomment the following lines if you want all tables to be automatically
# checked and repaired during startup. You should add sensible key_buffer
# and sort_buffer values to my.cnf to improve check performance or require

View File

@ -1,20 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 41_scripts__mysql_install_db.sh__no_test.dpatch by <ch@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: scripts__mysql_install_db.sh__no_test
## DP: http://bugs.mysql.com/bug.php?id=6901
@DPATCH@
--- mysql-dfsg-5.1-5.1.23rc.orig/scripts/mysql_install_db.sh 2008-01-29 22:41:20.000000000 +0100
+++ mysql-dfsg-5.1-5.1.23rc/scripts/mysql_install_db.sh 2008-02-28 10:08:11.000000000 +0100
@@ -407,7 +407,7 @@ then
fi
# Create database directories
-for dir in "$ldata" "$ldata/mysql" "$ldata/test"
+for dir in "$ldata" "$ldata/mysql"
do
if test ! -d "$dir"
then

View File

@ -1,24 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 50_mysql-test__db_test.dpatch by Christian Hammers <ch@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Patch 33_scripts__mysql_create_system_tables__no_test removes the
## DP: rights for anybody to connect to the test database but the test
## DP: suite depends on them.
@DPATCH@
--- old/mysql-test/mysql-test-run.pl 2009-06-16 14:24:09.000000000 +0200
+++ new/mysql-test/mysql-test-run.pl 2009-07-04 00:03:34.000000000 +0200
@@ -3180,6 +3180,11 @@ sub mysql_install_db {
mtr_appendfile_to_file("$sql_dir/mysql_system_tables_data.sql",
$bootstrap_sql_file);
+ mtr_tofile($bootstrap_sql_file, "-- Debian removed the default privileges on the 'test' database\n");
+ mtr_tofile($bootstrap_sql_file, "INSERT INTO mysql.db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y','Y');\n");
+ mtr_tofile($bootstrap_sql_file, "INSERT INTO mysql.db VALUES ('%','test\\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y','Y');\n");
+
+
# Add test data for timezone - this is just a subset, on a real
# system these tables will be populated either by mysql_tzinfo_to_sql
# or by downloading the timezone table package from our website

View File

@ -1,20 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 61_replace_dash_with_bash_mbug675185.dpatch by <knielsen@knielsen-hq.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: 61_replace_dash_with_bash_mbug675185
## DP: A race in dash causes mysqld_safe to occasionally loop infinitely.
## DP: Fix by using bash instead.
## DP: https://bugs.launchpad.net/ubuntu/+source/mysql-dfsg-5.0/+bug/675185
@DPATCH@
=== modified file 'scripts/mysqld_safe.sh'
--- old/scripts/mysqld_safe.sh 2010-04-09 11:47:18 +0000
+++ new/scripts/mysqld_safe.sh 2010-11-21 09:40:50 +0000
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
# This file is public domain and comes with NO WARRANTY of any kind
#

68
debian/rules vendored
View File

@ -4,25 +4,13 @@ export DH_VERBOSE=1
# enable Debian Hardening
# see: https://wiki.debian.org/Hardening
export DEB_BUILD_MAINT_OPTIONS = hardening=+all,-pie
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
include /usr/share/dpkg/default.mk
ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH)
ARCH_OS := $(shell dpkg-architecture -qDEB_BUILD_ARCH_OS)
BUILDDIR := builddir
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_SYSTEM ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_SYSTEM)
DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
DEBVERSION := $(shell dpkg-parsechangelog | awk '/^Version: / { print $$2 }' | sed 's/^.*-//' )
DEB_SOURCE_PACKAGE ?= $(strip $(shell egrep '^Source: ' debian/control | cut -f 2 -d ':'))
DEB_VERSION ?= $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ')
DEB_NOEPOCH_VERSION ?= $(shell echo $(DEB_VERSION) | cut -d: -f2-)
DEB_UPSTREAM_VERSION ?= $(shell echo $(DEB_NOEPOCH_VERSION) | sed 's/-[^-]*$$//')
DEB_UPSTREAM_VERSION_MAJOR_MINOR := $(shell echo $(DEB_UPSTREAM_VERSION) | sed -r -n 's/^([0-9]+\.[0-9]+).*/\1/p')
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
DISTRIBUTION := $(shell lsb_release -i -s)
RELEASE := $(shell lsb_release -r -s)
DEB_VERSION_REVISION := $(shell echo $(DEB_VERSION) | sed -e 's/^.*-//')
RELEASE := $(shell lsb_release -r -s) # Use changelog based DEB_DISTRIBUTION instead?
TMP:=$(CURDIR)/debian/tmp
CC := $(DEB_HOST_GNU_TYPE)-gcc
@ -39,12 +27,28 @@ else
endif
# Ignore test suite exit code on unstable platforms
ifneq (,$(filter $(ARCH),mips mipsel mips64el alpha powerpc sh4 hurd-i386 sparc64 kfreebsd-i386 kfreebsd-amd64))
ifneq (,$(filter $(DEB_HOST_ARCH),mips mipsel mips64el alpha powerpc sh4 hurd-i386 sparc64 kfreebsd-i386 kfreebsd-amd64))
TESTSUITE_FAIL_CMD:=true
else
TESTSUITE_FAIL_CMD:=exit 1
endif
ifeq (32,$(DEB_HOST_ARCH_BITS))
CMAKEFLAGS += -DWITHOUT_ROCKSDB=true
endif
# Skip TokuDB if arch is not amd64 (also disable for kfreebsd-amd64 as it FTBFS)
# Skipped on the x32 ABI too; untested, but unlikely to work given i386 is not
# supported.
ifneq ($(DEB_HOST_ARCH),amd64)
CMAKEFLAGS += -DWITHOUT_TOKUDB=true
endif
# Disable jemalloc on mips* due to #843926
ifneq (,$(filter $(DEB_HOST_ARCH), mips mipsel mips64 mips64el))
CMAKEFLAGS += -DWITH_JEMALLOC=no
endif
# Add support for verbose builds
MAKEFLAGS += VERBOSE=1
@ -66,7 +70,7 @@ override_dh_auto_configure:
# Versioned symbols are only available on Linux.
# Remove symbols file on kFreeBSD builds so that
# dpkg-gensymbols will not fail the build.
ifneq (,$(filter $(ARCH), kfreebsd-i386 kfreebsd-amd64))
ifneq (,$(filter $(DEB_HOST_ARCH), kfreebsd-i386 kfreebsd-amd64))
rm debian/libmariadb3.symbols
endif
@ -77,19 +81,14 @@ endif
cmake -DCMAKE_INSTALL_PREFIX=/usr \
$(CMAKEFLAGS) \
-DCOMPILATION_COMMENT="mariadb.org binary distribution" \
-DMYSQL_SERVER_SUFFIX="-$(DEBVERSION)" \
-DSYSTEM_TYPE="debian-$(DEB_BUILD_GNU_SYSTEM)" \
$${MYSQL_BUILD_CXX:+-DCMAKE_CXX_COMPILER=$${MYSQL_BUILD_CXX}} \
$${MYSQL_BUILD_CC:+-DCMAKE_C_COMPILER=$${MYSQL_BUILD_CC}} \
$${MYSQL_COMPILER_LAUNCHER:+-DCMAKE_CXX_COMPILER_LAUNCHER=${MYSQL_COMPILER_LAUNCHER}} \
$${MYSQL_COMPILER_LAUNCHER:+-DCMAKE_C_COMPILER_LAUNCHER=${MYSQL_COMPILER_LAUNCHER}} \
-DCMAKE_SYSTEM_PROCESSOR=$(DEB_BUILD_ARCH) \
-DMYSQL_SERVER_SUFFIX="-$(DEB_VERSION_REVISION)" \
-DSYSTEM_TYPE="debian-$(DEB_HOST_GNU_SYSTEM)" \
-DCMAKE_SYSTEM_PROCESSOR=$(DEB_HOST_ARCH) \
-DBUILD_CONFIG=mysql_release \
-DINSTALL_LIBDIR=lib/$(DEB_HOST_MULTIARCH) \
-DINSTALL_PLUGINDIR=lib/mysql/plugin \
-DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test \
-DDEB=$(DISTRIBUTION) ..'
touch $@
-DDEB=$(DEB_VENDOR) ..'
# This is needed, otherwise 'make test' will run before binaries have been built
override_dh_auto_build:
@ -97,13 +96,12 @@ override_dh_auto_build:
# Print build env info to help debug builds on different platforms
dpkg-architecture
cd $(BUILDDIR) && $(MAKE)
touch $@
override_dh_auto_test:
@echo "RULES.$@"
dh_testdir
# Skip unstable tests if such are defined for arch
[ ! -f debian/unstable-tests.$(ARCH) ] || cat debian/unstable-tests.$(ARCH) >> mysql-test/unstable-tests
[ ! -f debian/unstable-tests.$(DEB_HOST_ARCH) ] || cat debian/unstable-tests.$(DEB_HOST_ARCH) >> mysql-test/unstable-tests
# Run testsuite
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
cd $(BUILDDIR)/mysql-test && ./mtr --force --mem --parallel=$(NUMJOBS) --skip-rpl --suite=main --skip-test-list=unstable-tests || $(TESTSUITE_FAIL_CMD) ;
@ -119,9 +117,11 @@ override_dh_auto_install:
# otherwise skip it.
[ -f $(BUILDDIR)/storage/cassandra/ha_cassandra.so ] || sed -i -e "/Package: mariadb-plugin-cassandra/,+20d" debian/control
ifneq (,$(filter linux,$(DEB_HOST_ARCH_OS)))
# Copy systemd files to a location available for dh_installinit
cp $(BUILDDIR)/support-files/mariadb.service debian/mariadb-server-10.3.mariadb.service
cp $(BUILDDIR)/support-files/mariadb@.service debian/mariadb-server-10.3.mariadb@.service
endif
# make install
cd $(BUILDDIR) && $(MAKE) install DESTDIR=$(TMP)
@ -135,13 +135,6 @@ override_dh_auto_install:
# to satisfy Debian reproducible build requirements
nm --defined-only $(BUILDDIR)/sql/mysqld | LC_ALL=C sort | gzip -n -9 > $(TMP)/usr/share/doc/mariadb-server-10.3/mysqld.sym.gz
# For 5.0 -> 10.3 transition
d=$(TMP)/usr/share/mysql-common/internal-use-only/; \
mkdir -p $$d; \
cp debian/mariadb-server-10.3.mysql.init $$d/_etc_init.d_mysql; \
cp debian/mariadb-server-10.3.mysql-server.logrotate $$d/_etc_logrotate.d_mysql-server; \
cp debian/additions/debian-start $$d/_etc_mysql_debian-start;
# rename and install AppArmor profile
install -D -m 644 debian/apparmor-profile $(TMP)/etc/apparmor.d/usr.sbin.mysqld
# install Apport hook
@ -156,7 +149,6 @@ override_dh_auto_install:
ln -s libmariadb.so.3 $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmysqlclient.so.19
ln -s libmariadb.so.3 $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmysqlclient.so.20
touch $@
override_dh_installlogrotate-arch:
dh_installlogrotate --name mysql-server
@ -182,6 +174,6 @@ get-orig-source:
# white list file only starting from Debian Stretch and Ubuntu Xenial.
# To find more, grep build logs for 'but is not installed to anywhere'.
%:
dh $@ --parallel --with dpatch --with systemd --list-missing
dh $@ --parallel --with systemd --list-missing
# vim: ts=8

View File

@ -1,2 +1,9 @@
ENABLE_LANGUAGE(ASM)
ADD_CONVENIENCE_LIBRARY(${CRC32_VPMSUM_LIBRARY} crc32c.S crc32c_wrapper.c crc32ieee.S crc32ieee_wrapper.c)
ADD_CONVENIENCE_LIBRARY(${CRC32_LIBRARY} $<TARGET_OBJECTS:crc32c> $<TARGET_OBJECTS:crc32ieee>)
ADD_LIBRARY(crc32c OBJECT vec_crc32.c)
ADD_LIBRARY(crc32ieee OBJECT vec_crc32.c)
GET_TARGET_PROPERTY(CFLAGS_CRC32_VPMSUM ${CRC32_LIBRARY} COMPILE_FLAGS)
SET_TARGET_PROPERTIES(crc32c crc32ieee PROPERTIES COMPILE_FLAGS "${CFLAGS_CRC32_VPMSUM} -maltivec -mvsx -mpower8-vector -mcrypto -mpower8-vector")
SET_TARGET_PROPERTIES(crc32ieee PROPERTIES COMPILE_DEFINITIONS "CRC32_FUNCTION=crc32ieee_vpmsum;CRC32_CONSTANTS_HEADER=\"crc32ieee_constants.h\"")
SET_TARGET_PROPERTIES(crc32c PROPERTIES COMPILE_DEFINITIONS "CRC32_FUNCTION=crc32c_vpmsum;CRC32_CONSTANTS_HEADER=\"crc32c_constants.h\"")

View File

@ -0,0 +1,82 @@
#ifndef CLANG_WORKAROUNDS_H
#define CLANG_WORKAROUNDS_H
/*
* These stubs fix clang incompatibilities with GCC builtins.
*/
#ifndef __builtin_crypto_vpmsumw
#define __builtin_crypto_vpmsumw __builtin_crypto_vpmsumb
#endif
#ifndef __builtin_crypto_vpmsumd
#define __builtin_crypto_vpmsumd __builtin_crypto_vpmsumb
#endif
static inline
__vector unsigned long long __attribute__((overloadable))
vec_ld(int __a, const __vector unsigned long long* __b)
{
return (__vector unsigned long long)__builtin_altivec_lvx(__a, __b);
}
/*
* GCC __builtin_pack_vector_int128 returns a vector __int128_t but Clang
* does not recognize this type. On GCC this builtin is translated to a
* xxpermdi instruction that only moves the registers __a, __b instead generates
* a load.
*
* Clang has vec_xxpermdi intrinsics. It was implemented in 4.0.0.
*/
static inline
__vector unsigned long long __builtin_pack_vector (unsigned long __a,
unsigned long __b)
{
#if defined(__BIG_ENDIAN__)
__vector unsigned long long __v = {__a, __b};
#else
__vector unsigned long long __v = {__b, __a};
#endif
return __v;
}
#ifndef vec_xxpermdi
static inline
unsigned long __builtin_unpack_vector (__vector unsigned long long __v,
int __o)
{
return __v[__o];
}
#if defined(__BIG_ENDIAN__)
#define __builtin_unpack_vector_0(a) __builtin_unpack_vector ((a), 0)
#define __builtin_unpack_vector_1(a) __builtin_unpack_vector ((a), 1)
#else
#define __builtin_unpack_vector_0(a) __builtin_unpack_vector ((a), 1)
#define __builtin_unpack_vector_1(a) __builtin_unpack_vector ((a), 0)
#endif
#else
static inline
unsigned long __builtin_unpack_vector_0 (__vector unsigned long long __v)
{
#if defined(__BIG_ENDIAN__)
return vec_xxpermdi(__v, __v, 0x0)[1];
#else
return vec_xxpermdi(__v, __v, 0x0)[0];
#endif
}
static inline
unsigned long __builtin_unpack_vector_1 (__vector unsigned long long __v)
{
#if defined(__BIG_ENDIAN__)
return vec_xxpermdi(__v, __v, 0x3)[1];
#else
return vec_xxpermdi(__v, __v, 0x3)[0];
#endif
}
#endif /* vec_xxpermdi */
#endif

View File

@ -1,734 +0,0 @@
/*
* Calculate the checksum of data that is 16 byte aligned and a multiple of
* 16 bytes.
*
* The first step is to reduce it to 1024 bits. We do this in 8 parallel
* chunks in order to mask the latency of the vpmsum instructions. If we
* have more than 32 kB of data to checksum we repeat this step multiple
* times, passing in the previous 1024 bits.
*
* The next step is to reduce the 1024 bits to 64 bits. This step adds
* 32 bits of 0s to the end - this matches what a CRC does. We just
* calculate constants that land the data in this 32 bits.
*
* We then use fixed point Barrett reduction to compute a mod n over GF(2)
* for n = CRC using POWER8 instructions. We use x = 32.
*
* http://en.wikipedia.org/wiki/Barrett_reduction
*
* Copyright (C) 2015 Anton Blanchard <anton@au.ibm.com>, IBM
*
* 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 Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#ifdef __powerpc__
#include <ppc-asm.h>
#include "ppc-opcode.h"
#undef toc
#ifndef r1
#define r1 1
#endif
#ifndef r2
#define r2 2
#endif
.section .rodata
.balign 16
.byteswap_constant:
/* byte reverse permute constant */
.octa 0x0F0E0D0C0B0A09080706050403020100
.text
#define off16 r25
#define off32 r26
#define off48 r27
#define off64 r28
#define off80 r29
#define off96 r30
#define off112 r31
#define const1 v24
#define const2 v25
#define byteswap v26
#define mask_32bit v27
#define mask_64bit v28
#define zeroes v29
#ifdef BYTESWAP_DATA
#define VPERM(A, B, C, D) vperm A, B, C, D
#else
#define VPERM(A, B, C, D)
#endif
/* unsigned int __crc32_vpmsum(unsigned int crc, void *p, unsigned long len) */
FUNC_START(__F)
std r31,-8(r1)
std r30,-16(r1)
std r29,-24(r1)
std r28,-32(r1)
std r27,-40(r1)
std r26,-48(r1)
std r25,-56(r1)
li off16,16
li off32,32
li off48,48
li off64,64
li off80,80
li off96,96
li off112,112
li r0,0
/* Enough room for saving 10 non volatile VMX registers */
subi r6,r1,56+10*16
subi r7,r1,56+2*16
stvx v20,0,r6
stvx v21,off16,r6
stvx v22,off32,r6
stvx v23,off48,r6
stvx v24,off64,r6
stvx v25,off80,r6
stvx v26,off96,r6
stvx v27,off112,r6
stvx v28,0,r7
stvx v29,off16,r7
mr r10,r3
vxor zeroes,zeroes,zeroes
vspltisw v0,-1
vsldoi mask_32bit,zeroes,v0,4
vsldoi mask_64bit,zeroes,v0,8
/* Get the initial value into v8 */
vxor v8,v8,v8
MTVRD(v8, r3)
vsldoi v8,zeroes,v8,8 /* shift into bottom 32 bits */
addis r3,r2,.byteswap_constant@toc@ha
addi r3,r3,.byteswap_constant@toc@l
lvx byteswap,0,r3
addi r3,r3,16
cmpdi r5,256
blt .Lshort
rldicr r6,r5,0,56
/* Checksum in blocks of MAX_SIZE */
1: lis r7,MAX_SIZE@h
ori r7,r7,MAX_SIZE@l
mr r9,r7
cmpd r6,r7
bgt 2f
mr r7,r6
2: subf r6,r7,r6
/* our main loop does 128 bytes at a time */
srdi r7,r7,7
/*
* Work out the offset into the constants table to start at. Each
* constant is 16 bytes, and it is used against 128 bytes of input
* data - 128 / 16 = 8
*/
sldi r8,r7,4
srdi r9,r9,3
subf r8,r8,r9
/* We reduce our final 128 bytes in a separate step */
addi r7,r7,-1
mtctr r7
addis r3,r2,CONSTANTS@toc@ha
addi r3,r3,CONSTANTS@toc@l
/* Find the start of our constants */
add r3,r3,r8
/* zero v0-v7 which will contain our checksums */
vxor v0,v0,v0
vxor v1,v1,v1
vxor v2,v2,v2
vxor v3,v3,v3
vxor v4,v4,v4
vxor v5,v5,v5
vxor v6,v6,v6
vxor v7,v7,v7
lvx const1,0,r3
/*
* If we are looping back to consume more data we use the values
* already in v16-v23.
*/
cmpdi r0,1
beq 2f
/* First warm up pass */
lvx v16,0,r4
lvx v17,off16,r4
VPERM(v16,v16,v16,byteswap)
VPERM(v17,v17,v17,byteswap)
lvx v18,off32,r4
lvx v19,off48,r4
VPERM(v18,v18,v18,byteswap)
VPERM(v19,v19,v19,byteswap)
lvx v20,off64,r4
lvx v21,off80,r4
VPERM(v20,v20,v20,byteswap)
VPERM(v21,v21,v21,byteswap)
lvx v22,off96,r4
lvx v23,off112,r4
VPERM(v22,v22,v22,byteswap)
VPERM(v23,v23,v23,byteswap)
addi r4,r4,8*16
/* xor in initial value */
vxor v16,v16,v8
2: bdz .Lfirst_warm_up_done
addi r3,r3,16
lvx const2,0,r3
/* Second warm up pass */
VPMSUMD(v8,v16,const1)
lvx v16,0,r4
VPERM(v16,v16,v16,byteswap)
ori r2,r2,0
VPMSUMD(v9,v17,const1)
lvx v17,off16,r4
VPERM(v17,v17,v17,byteswap)
ori r2,r2,0
VPMSUMD(v10,v18,const1)
lvx v18,off32,r4
VPERM(v18,v18,v18,byteswap)
ori r2,r2,0
VPMSUMD(v11,v19,const1)
lvx v19,off48,r4
VPERM(v19,v19,v19,byteswap)
ori r2,r2,0
VPMSUMD(v12,v20,const1)
lvx v20,off64,r4
VPERM(v20,v20,v20,byteswap)
ori r2,r2,0
VPMSUMD(v13,v21,const1)
lvx v21,off80,r4
VPERM(v21,v21,v21,byteswap)
ori r2,r2,0
VPMSUMD(v14,v22,const1)
lvx v22,off96,r4
VPERM(v22,v22,v22,byteswap)
ori r2,r2,0
VPMSUMD(v15,v23,const1)
lvx v23,off112,r4
VPERM(v23,v23,v23,byteswap)
addi r4,r4,8*16
bdz .Lfirst_cool_down
/*
* main loop. We modulo schedule it such that it takes three iterations
* to complete - first iteration load, second iteration vpmsum, third
* iteration xor.
*/
.balign 16
4: lvx const1,0,r3
addi r3,r3,16
ori r2,r2,0
vxor v0,v0,v8
VPMSUMD(v8,v16,const2)
lvx v16,0,r4
VPERM(v16,v16,v16,byteswap)
ori r2,r2,0
vxor v1,v1,v9
VPMSUMD(v9,v17,const2)
lvx v17,off16,r4
VPERM(v17,v17,v17,byteswap)
ori r2,r2,0
vxor v2,v2,v10
VPMSUMD(v10,v18,const2)
lvx v18,off32,r4
VPERM(v18,v18,v18,byteswap)
ori r2,r2,0
vxor v3,v3,v11
VPMSUMD(v11,v19,const2)
lvx v19,off48,r4
VPERM(v19,v19,v19,byteswap)
lvx const2,0,r3
ori r2,r2,0
vxor v4,v4,v12
VPMSUMD(v12,v20,const1)
lvx v20,off64,r4
VPERM(v20,v20,v20,byteswap)
ori r2,r2,0
vxor v5,v5,v13
VPMSUMD(v13,v21,const1)
lvx v21,off80,r4
VPERM(v21,v21,v21,byteswap)
ori r2,r2,0
vxor v6,v6,v14
VPMSUMD(v14,v22,const1)
lvx v22,off96,r4
VPERM(v22,v22,v22,byteswap)
ori r2,r2,0
vxor v7,v7,v15
VPMSUMD(v15,v23,const1)
lvx v23,off112,r4
VPERM(v23,v23,v23,byteswap)
addi r4,r4,8*16
bdnz 4b
.Lfirst_cool_down:
/* First cool down pass */
lvx const1,0,r3
addi r3,r3,16
vxor v0,v0,v8
VPMSUMD(v8,v16,const1)
ori r2,r2,0
vxor v1,v1,v9
VPMSUMD(v9,v17,const1)
ori r2,r2,0
vxor v2,v2,v10
VPMSUMD(v10,v18,const1)
ori r2,r2,0
vxor v3,v3,v11
VPMSUMD(v11,v19,const1)
ori r2,r2,0
vxor v4,v4,v12
VPMSUMD(v12,v20,const1)
ori r2,r2,0
vxor v5,v5,v13
VPMSUMD(v13,v21,const1)
ori r2,r2,0
vxor v6,v6,v14
VPMSUMD(v14,v22,const1)
ori r2,r2,0
vxor v7,v7,v15
VPMSUMD(v15,v23,const1)
ori r2,r2,0
.Lsecond_cool_down:
/* Second cool down pass */
vxor v0,v0,v8
vxor v1,v1,v9
vxor v2,v2,v10
vxor v3,v3,v11
vxor v4,v4,v12
vxor v5,v5,v13
vxor v6,v6,v14
vxor v7,v7,v15
/*
* vpmsumd produces a 96 bit result in the least significant bits
* of the register. Since we are bit reflected we have to shift it
* left 32 bits so it occupies the least significant bits in the
* bit reflected domain.
*/
vsldoi v0,v0,zeroes,4
vsldoi v1,v1,zeroes,4
vsldoi v2,v2,zeroes,4
vsldoi v3,v3,zeroes,4
vsldoi v4,v4,zeroes,4
vsldoi v5,v5,zeroes,4
vsldoi v6,v6,zeroes,4
vsldoi v7,v7,zeroes,4
/* xor with last 1024 bits */
lvx v8,0,r4
lvx v9,off16,r4
VPERM(v8,v8,v8,byteswap)
VPERM(v9,v9,v9,byteswap)
lvx v10,off32,r4
lvx v11,off48,r4
VPERM(v10,v10,v10,byteswap)
VPERM(v11,v11,v11,byteswap)
lvx v12,off64,r4
lvx v13,off80,r4
VPERM(v12,v12,v12,byteswap)
VPERM(v13,v13,v13,byteswap)
lvx v14,off96,r4
lvx v15,off112,r4
VPERM(v14,v14,v14,byteswap)
VPERM(v15,v15,v15,byteswap)
addi r4,r4,8*16
vxor v16,v0,v8
vxor v17,v1,v9
vxor v18,v2,v10
vxor v19,v3,v11
vxor v20,v4,v12
vxor v21,v5,v13
vxor v22,v6,v14
vxor v23,v7,v15
li r0,1
cmpdi r6,0
addi r6,r6,128
bne 1b
/* Work out how many bytes we have left */
andi. r5,r5,127
/* Calculate where in the constant table we need to start */
subfic r6,r5,128
add r3,r3,r6
/* How many 16 byte chunks are in the tail */
srdi r7,r5,4
mtctr r7
/*
* Reduce the previously calculated 1024 bits to 64 bits, shifting
* 32 bits to include the trailing 32 bits of zeros
*/
lvx v0,0,r3
lvx v1,off16,r3
lvx v2,off32,r3
lvx v3,off48,r3
lvx v4,off64,r3
lvx v5,off80,r3
lvx v6,off96,r3
lvx v7,off112,r3
addi r3,r3,8*16
VPMSUMW(v0,v16,v0)
VPMSUMW(v1,v17,v1)
VPMSUMW(v2,v18,v2)
VPMSUMW(v3,v19,v3)
VPMSUMW(v4,v20,v4)
VPMSUMW(v5,v21,v5)
VPMSUMW(v6,v22,v6)
VPMSUMW(v7,v23,v7)
/* Now reduce the tail (0 - 112 bytes) */
cmpdi r7,0
beq 1f
lvx v16,0,r4
lvx v17,0,r3
VPERM(v16,v16,v16,byteswap)
VPMSUMW(v16,v16,v17)
vxor v0,v0,v16
bdz 1f
lvx v16,off16,r4
lvx v17,off16,r3
VPERM(v16,v16,v16,byteswap)
VPMSUMW(v16,v16,v17)
vxor v0,v0,v16
bdz 1f
lvx v16,off32,r4
lvx v17,off32,r3
VPERM(v16,v16,v16,byteswap)
VPMSUMW(v16,v16,v17)
vxor v0,v0,v16
bdz 1f
lvx v16,off48,r4
lvx v17,off48,r3
VPERM(v16,v16,v16,byteswap)
VPMSUMW(v16,v16,v17)
vxor v0,v0,v16
bdz 1f
lvx v16,off64,r4
lvx v17,off64,r3
VPERM(v16,v16,v16,byteswap)
VPMSUMW(v16,v16,v17)
vxor v0,v0,v16
bdz 1f
lvx v16,off80,r4
lvx v17,off80,r3
VPERM(v16,v16,v16,byteswap)
VPMSUMW(v16,v16,v17)
vxor v0,v0,v16
bdz 1f
lvx v16,off96,r4
lvx v17,off96,r3
VPERM(v16,v16,v16,byteswap)
VPMSUMW(v16,v16,v17)
vxor v0,v0,v16
/* Now xor all the parallel chunks together */
1: vxor v0,v0,v1
vxor v2,v2,v3
vxor v4,v4,v5
vxor v6,v6,v7
vxor v0,v0,v2
vxor v4,v4,v6
vxor v0,v0,v4
.Lbarrett_reduction:
/* Barrett constants */
addis r3,r2,BARRETT_CONSTANTS@toc@ha
addi r3,r3,BARRETT_CONSTANTS@toc@l
lvx const1,0,r3
lvx const2,off16,r3
vsldoi v1,v0,v0,8
vxor v0,v0,v1 /* xor two 64 bit results together */
/* shift left one bit */
vspltisb v1,1
vsl v0,v0,v1
vand v0,v0,mask_64bit
/*
* The reflected version of Barrett reduction. Instead of bit
* reflecting our data (which is expensive to do), we bit reflect our
* constants and our algorithm, which means the intermediate data in
* our vector registers goes from 0-63 instead of 63-0. We can reflect
* the algorithm because we don't carry in mod 2 arithmetic.
*/
vand v1,v0,mask_32bit /* bottom 32 bits of a */
VPMSUMD(v1,v1,const1) /* ma */
vand v1,v1,mask_32bit /* bottom 32bits of ma */
VPMSUMD(v1,v1,const2) /* qn */
vxor v0,v0,v1 /* a - qn, subtraction is xor in GF(2) */
/*
* Since we are bit reflected, the result (ie the low 32 bits) is in
* the high 32 bits. We just need to shift it left 4 bytes
* V0 [ 0 1 X 3 ]
* V0 [ 0 X 2 3 ]
*/
vsldoi v0,v0,zeroes,4 /* shift result into top 64 bits of */
.Lout:
subi r6,r1,56+10*16
subi r7,r1,56+2*16
lvx v20,0,r6
lvx v21,off16,r6
lvx v22,off32,r6
lvx v23,off48,r6
lvx v24,off64,r6
lvx v25,off80,r6
lvx v26,off96,r6
lvx v27,off112,r6
lvx v28,0,r7
lvx v29,off16,r7
/* Get it into r3 */
MFVRD(r3, v0)
ld r31,-8(r1)
ld r30,-16(r1)
ld r29,-24(r1)
ld r28,-32(r1)
ld r27,-40(r1)
ld r26,-48(r1)
ld r25,-56(r1)
blr
.Lfirst_warm_up_done:
lvx const1,0,r3
addi r3,r3,16
VPMSUMD(v8,v16,const1)
VPMSUMD(v9,v17,const1)
VPMSUMD(v10,v18,const1)
VPMSUMD(v11,v19,const1)
VPMSUMD(v12,v20,const1)
VPMSUMD(v13,v21,const1)
VPMSUMD(v14,v22,const1)
VPMSUMD(v15,v23,const1)
b .Lsecond_cool_down
.Lshort:
cmpdi r5,0
beq .Lzero
addis r3,r2,SHORT_CONSTANTS@toc@ha
addi r3,r3,SHORT_CONSTANTS@toc@l
/* Calculate where in the constant table we need to start */
subfic r6,r5,256
add r3,r3,r6
/* How many 16 byte chunks? */
srdi r7,r5,4
mtctr r7
vxor v19,v19,v19
vxor v20,v20,v20
lvx v0,0,r4
lvx v16,0,r3
VPERM(v0,v0,v16,byteswap)
vxor v0,v0,v8 /* xor in initial value */
VPMSUMW(v0,v0,v16)
bdz .Lv0
lvx v1,off16,r4
lvx v17,off16,r3
VPERM(v1,v1,v17,byteswap)
VPMSUMW(v1,v1,v17)
bdz .Lv1
lvx v2,off32,r4
lvx v16,off32,r3
VPERM(v2,v2,v16,byteswap)
VPMSUMW(v2,v2,v16)
bdz .Lv2
lvx v3,off48,r4
lvx v17,off48,r3
VPERM(v3,v3,v17,byteswap)
VPMSUMW(v3,v3,v17)
bdz .Lv3
lvx v4,off64,r4
lvx v16,off64,r3
VPERM(v4,v4,v16,byteswap)
VPMSUMW(v4,v4,v16)
bdz .Lv4
lvx v5,off80,r4
lvx v17,off80,r3
VPERM(v5,v5,v17,byteswap)
VPMSUMW(v5,v5,v17)
bdz .Lv5
lvx v6,off96,r4
lvx v16,off96,r3
VPERM(v6,v6,v16,byteswap)
VPMSUMW(v6,v6,v16)
bdz .Lv6
lvx v7,off112,r4
lvx v17,off112,r3
VPERM(v7,v7,v17,byteswap)
VPMSUMW(v7,v7,v17)
bdz .Lv7
addi r3,r3,128
addi r4,r4,128
lvx v8,0,r4
lvx v16,0,r3
VPERM(v8,v8,v16,byteswap)
VPMSUMW(v8,v8,v16)
bdz .Lv8
lvx v9,off16,r4
lvx v17,off16,r3
VPERM(v9,v9,v17,byteswap)
VPMSUMW(v9,v9,v17)
bdz .Lv9
lvx v10,off32,r4
lvx v16,off32,r3
VPERM(v10,v10,v16,byteswap)
VPMSUMW(v10,v10,v16)
bdz .Lv10
lvx v11,off48,r4
lvx v17,off48,r3
VPERM(v11,v11,v17,byteswap)
VPMSUMW(v11,v11,v17)
bdz .Lv11
lvx v12,off64,r4
lvx v16,off64,r3
VPERM(v12,v12,v16,byteswap)
VPMSUMW(v12,v12,v16)
bdz .Lv12
lvx v13,off80,r4
lvx v17,off80,r3
VPERM(v13,v13,v17,byteswap)
VPMSUMW(v13,v13,v17)
bdz .Lv13
lvx v14,off96,r4
lvx v16,off96,r3
VPERM(v14,v14,v16,byteswap)
VPMSUMW(v14,v14,v16)
bdz .Lv14
lvx v15,off112,r4
lvx v17,off112,r3
VPERM(v15,v15,v17,byteswap)
VPMSUMW(v15,v15,v17)
.Lv15: vxor v19,v19,v15
.Lv14: vxor v20,v20,v14
.Lv13: vxor v19,v19,v13
.Lv12: vxor v20,v20,v12
.Lv11: vxor v19,v19,v11
.Lv10: vxor v20,v20,v10
.Lv9: vxor v19,v19,v9
.Lv8: vxor v20,v20,v8
.Lv7: vxor v19,v19,v7
.Lv6: vxor v20,v20,v6
.Lv5: vxor v19,v19,v5
.Lv4: vxor v20,v20,v4
.Lv3: vxor v19,v19,v3
.Lv2: vxor v20,v20,v2
.Lv1: vxor v19,v19,v1
.Lv0: vxor v20,v20,v0
vxor v0,v19,v20
b .Lbarrett_reduction
.Lzero:
mr r3,r10
b .Lout
FUNC_END(__F)
#endif /* __powerpc__ */

View File

@ -1,52 +0,0 @@
#ifdef __powerpc__
#define VMX_ALIGN 16
#define VMX_ALIGN_MASK (VMX_ALIGN-1)
static unsigned int crc32_align(unsigned int crc, unsigned char *p,
unsigned long len)
{
while (len--)
crc = crc_table[(crc ^ *p++) & 0xff] ^ (crc >> 8);
return crc;
}
unsigned int __F(unsigned int crc, unsigned char *p,
unsigned long len);
unsigned int F(unsigned int crc, unsigned char *p,
unsigned long len)
{
unsigned int prealign;
unsigned int tail;
crc ^= 0xffffffff;
if (len < VMX_ALIGN + VMX_ALIGN_MASK) {
crc = crc32_align(crc, p, len);
goto out;
}
if ((unsigned long)p & VMX_ALIGN_MASK) {
prealign = VMX_ALIGN - ((unsigned long)p & VMX_ALIGN_MASK);
crc = crc32_align(crc, p, prealign);
len -= prealign;
p += prealign;
}
crc = __F(crc, p, len & ~VMX_ALIGN_MASK);
tail = len & VMX_ALIGN_MASK;
if (tail) {
p += len & ~VMX_ALIGN_MASK;
crc = crc32_align(crc, p, tail);
}
out:
crc ^= 0xffffffff;
return crc;
}
#endif /* __powerpc__ */

View File

@ -1,14 +0,0 @@
#ifdef __powerpc__
#define CONSTANTS .crc32c_constants
#define SHORT_CONSTANTS .crc32c_short_constants
#define BARRETT_CONSTANTS .crc32c_barrett_constants
#include "crc32c_constants.h"
#define __F __crc32c_vpmsum
#include "crc32.iS"
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,78 +0,0 @@
#ifdef __powerpc__
#define F crc32c_vpmsum
#define __F __crc32c_vpmsum
#define CRC 0x1edc6f41
static const unsigned int crc_table[] = {
0x00000000, 0xf26b8303, 0xe13b70f7, 0x1350f3f4,
0xc79a971f, 0x35f1141c, 0x26a1e7e8, 0xd4ca64eb,
0x8ad958cf, 0x78b2dbcc, 0x6be22838, 0x9989ab3b,
0x4d43cfd0, 0xbf284cd3, 0xac78bf27, 0x5e133c24,
0x105ec76f, 0xe235446c, 0xf165b798, 0x030e349b,
0xd7c45070, 0x25afd373, 0x36ff2087, 0xc494a384,
0x9a879fa0, 0x68ec1ca3, 0x7bbcef57, 0x89d76c54,
0x5d1d08bf, 0xaf768bbc, 0xbc267848, 0x4e4dfb4b,
0x20bd8ede, 0xd2d60ddd, 0xc186fe29, 0x33ed7d2a,
0xe72719c1, 0x154c9ac2, 0x061c6936, 0xf477ea35,
0xaa64d611, 0x580f5512, 0x4b5fa6e6, 0xb93425e5,
0x6dfe410e, 0x9f95c20d, 0x8cc531f9, 0x7eaeb2fa,
0x30e349b1, 0xc288cab2, 0xd1d83946, 0x23b3ba45,
0xf779deae, 0x05125dad, 0x1642ae59, 0xe4292d5a,
0xba3a117e, 0x4851927d, 0x5b016189, 0xa96ae28a,
0x7da08661, 0x8fcb0562, 0x9c9bf696, 0x6ef07595,
0x417b1dbc, 0xb3109ebf, 0xa0406d4b, 0x522bee48,
0x86e18aa3, 0x748a09a0, 0x67dafa54, 0x95b17957,
0xcba24573, 0x39c9c670, 0x2a993584, 0xd8f2b687,
0x0c38d26c, 0xfe53516f, 0xed03a29b, 0x1f682198,
0x5125dad3, 0xa34e59d0, 0xb01eaa24, 0x42752927,
0x96bf4dcc, 0x64d4cecf, 0x77843d3b, 0x85efbe38,
0xdbfc821c, 0x2997011f, 0x3ac7f2eb, 0xc8ac71e8,
0x1c661503, 0xee0d9600, 0xfd5d65f4, 0x0f36e6f7,
0x61c69362, 0x93ad1061, 0x80fde395, 0x72966096,
0xa65c047d, 0x5437877e, 0x4767748a, 0xb50cf789,
0xeb1fcbad, 0x197448ae, 0x0a24bb5a, 0xf84f3859,
0x2c855cb2, 0xdeeedfb1, 0xcdbe2c45, 0x3fd5af46,
0x7198540d, 0x83f3d70e, 0x90a324fa, 0x62c8a7f9,
0xb602c312, 0x44694011, 0x5739b3e5, 0xa55230e6,
0xfb410cc2, 0x092a8fc1, 0x1a7a7c35, 0xe811ff36,
0x3cdb9bdd, 0xceb018de, 0xdde0eb2a, 0x2f8b6829,
0x82f63b78, 0x709db87b, 0x63cd4b8f, 0x91a6c88c,
0x456cac67, 0xb7072f64, 0xa457dc90, 0x563c5f93,
0x082f63b7, 0xfa44e0b4, 0xe9141340, 0x1b7f9043,
0xcfb5f4a8, 0x3dde77ab, 0x2e8e845f, 0xdce5075c,
0x92a8fc17, 0x60c37f14, 0x73938ce0, 0x81f80fe3,
0x55326b08, 0xa759e80b, 0xb4091bff, 0x466298fc,
0x1871a4d8, 0xea1a27db, 0xf94ad42f, 0x0b21572c,
0xdfeb33c7, 0x2d80b0c4, 0x3ed04330, 0xccbbc033,
0xa24bb5a6, 0x502036a5, 0x4370c551, 0xb11b4652,
0x65d122b9, 0x97baa1ba, 0x84ea524e, 0x7681d14d,
0x2892ed69, 0xdaf96e6a, 0xc9a99d9e, 0x3bc21e9d,
0xef087a76, 0x1d63f975, 0x0e330a81, 0xfc588982,
0xb21572c9, 0x407ef1ca, 0x532e023e, 0xa145813d,
0x758fe5d6, 0x87e466d5, 0x94b49521, 0x66df1622,
0x38cc2a06, 0xcaa7a905, 0xd9f75af1, 0x2b9cd9f2,
0xff56bd19, 0x0d3d3e1a, 0x1e6dcdee, 0xec064eed,
0xc38d26c4, 0x31e6a5c7, 0x22b65633, 0xd0ddd530,
0x0417b1db, 0xf67c32d8, 0xe52cc12c, 0x1747422f,
0x49547e0b, 0xbb3ffd08, 0xa86f0efc, 0x5a048dff,
0x8ecee914, 0x7ca56a17, 0x6ff599e3, 0x9d9e1ae0,
0xd3d3e1ab, 0x21b862a8, 0x32e8915c, 0xc083125f,
0x144976b4, 0xe622f5b7, 0xf5720643, 0x07198540,
0x590ab964, 0xab613a67, 0xb831c993, 0x4a5a4a90,
0x9e902e7b, 0x6cfbad78, 0x7fab5e8c, 0x8dc0dd8f,
0xe330a81a, 0x115b2b19, 0x020bd8ed, 0xf0605bee,
0x24aa3f05, 0xd6c1bc06, 0xc5914ff2, 0x37faccf1,
0x69e9f0d5, 0x9b8273d6, 0x88d28022, 0x7ab90321,
0xae7367ca, 0x5c18e4c9, 0x4f48173d, 0xbd23943e,
0xf36e6f75, 0x0105ec76, 0x12551f82, 0xe03e9c81,
0x34f4f86a, 0xc69f7b69, 0xd5cf889d, 0x27a40b9e,
0x79b737ba, 0x8bdcb4b9, 0x988c474d, 0x6ae7c44e,
0xbe2da0a5, 0x4c4623a6, 0x5f16d052, 0xad7d5351,};
#include "crc32_wrapper.ic"
#endif

View File

@ -1,14 +0,0 @@
#ifdef __powerpc__
#define CONSTANTS .crc32_constants
#define SHORT_CONSTANTS .crc32_short_constants
#define BARRETT_CONSTANTS .crc32_barrett_constants
#include "crc32ieee_constants.h"
#define __F __crc32ieee_vpmsum
#include "crc32.iS"
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,75 +0,0 @@
#ifdef __powerpc__
#define F crc32ieee_vpmsum
#define __F __crc32ieee_vpmsum
static const unsigned int crc_table[] = {
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba,
0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec,
0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940,
0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116,
0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a,
0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818,
0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c,
0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086,
0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4,
0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe,
0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252,
0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60,
0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04,
0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a,
0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e,
0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0,
0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6,
0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d,};
#include "crc32_wrapper.ic"
#endif

View File

@ -1,23 +0,0 @@
#ifndef __OPCODES_H
#define __OPCODES_H
#define __PPC_RA(a) (((a) & 0x1f) << 16)
#define __PPC_RB(b) (((b) & 0x1f) << 11)
#define __PPC_XA(a) ((((a) & 0x1f) << 16) | (((a) & 0x20) >> 3))
#define __PPC_XB(b) ((((b) & 0x1f) << 11) | (((b) & 0x20) >> 4))
#define __PPC_XS(s) ((((s) & 0x1f) << 21) | (((s) & 0x20) >> 5))
#define __PPC_XT(s) __PPC_XS(s)
#define VSX_XX3(t, a, b) (__PPC_XT(t) | __PPC_XA(a) | __PPC_XB(b))
#define VSX_XX1(s, a, b) (__PPC_XS(s) | __PPC_RA(a) | __PPC_RB(b))
#define PPC_INST_VPMSUMW 0x10000488
#define PPC_INST_VPMSUMD 0x100004c8
#define PPC_INST_MFVSRD 0x7c000066
#define PPC_INST_MTVSRD 0x7c000166
#define VPMSUMW(t, a, b) .long PPC_INST_VPMSUMW | VSX_XX3((t), a, b)
#define VPMSUMD(t, a, b) .long PPC_INST_VPMSUMD | VSX_XX3((t), a, b)
#define MFVRD(a, t) .long PPC_INST_MFVSRD | VSX_XX1((t)+32, a, 0)
#define MTVRD(t, a) .long PPC_INST_MTVSRD | VSX_XX1((t)+32, a, 0)
#endif

View File

@ -0,0 +1,674 @@
/*
* Calculate the checksum of data that is 16 byte aligned and a multiple of
* 16 bytes.
*
* The first step is to reduce it to 1024 bits. We do this in 8 parallel
* chunks in order to mask the latency of the vpmsum instructions. If we
* have more than 32 kB of data to checksum we repeat this step multiple
* times, passing in the previous 1024 bits.
*
* The next step is to reduce the 1024 bits to 64 bits. This step adds
* 32 bits of 0s to the end - this matches what a CRC does. We just
* calculate constants that land the data in this 32 bits.
*
* We then use fixed point Barrett reduction to compute a mod n over GF(2)
* for n = CRC using POWER8 instructions. We use x = 32.
*
* http://en.wikipedia.org/wiki/Barrett_reduction
*
* This code uses gcc vector builtins instead using assembly directly.
*
* Copyright (C) 2017 Rogerio Alves <rogealve@br.ibm.com>, IBM
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of either:
*
* a) the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version, or
* b) the Apache License, Version 2.0
*/
#include <altivec.h>
#define POWER8_INTRINSICS
#define CRC_TABLE
#ifdef CRC32_CONSTANTS_HEADER
#include CRC32_CONSTANTS_HEADER
#else
#include "crc32_constants.h"
#endif
#define VMX_ALIGN 16
#define VMX_ALIGN_MASK (VMX_ALIGN-1)
#ifdef REFLECT
static unsigned int crc32_align(unsigned int crc, const unsigned char *p,
unsigned long len)
{
while (len--)
crc = crc_table[(crc ^ *p++) & 0xff] ^ (crc >> 8);
return crc;
}
#else
static unsigned int crc32_align(unsigned int crc, const unsigned char *p,
unsigned long len)
{
while (len--)
crc = crc_table[((crc >> 24) ^ *p++) & 0xff] ^ (crc << 8);
return crc;
}
#endif
static unsigned int __attribute__ ((aligned (32)))
__crc32_vpmsum(unsigned int crc, const void* p, unsigned long len);
#ifndef CRC32_FUNCTION
#define CRC32_FUNCTION crc32_vpmsum
#endif
unsigned int CRC32_FUNCTION(unsigned int crc, const unsigned char *p,
unsigned long len)
{
unsigned int prealign;
unsigned int tail;
#ifdef CRC_XOR
crc ^= 0xffffffff;
#endif
if (len < VMX_ALIGN + VMX_ALIGN_MASK) {
crc = crc32_align(crc, p, len);
goto out;
}
if ((unsigned long)p & VMX_ALIGN_MASK) {
prealign = VMX_ALIGN - ((unsigned long)p & VMX_ALIGN_MASK);
crc = crc32_align(crc, p, prealign);
len -= prealign;
p += prealign;
}
crc = __crc32_vpmsum(crc, p, len & ~VMX_ALIGN_MASK);
tail = len & VMX_ALIGN_MASK;
if (tail) {
p += len & ~VMX_ALIGN_MASK;
crc = crc32_align(crc, p, tail);
}
out:
#ifdef CRC_XOR
crc ^= 0xffffffff;
#endif
return crc;
}
#if defined (__clang__)
#include "clang_workaround.h"
#else
#define __builtin_pack_vector(a, b) __builtin_pack_vector_int128 ((a), (b))
#define __builtin_unpack_vector_0(a) __builtin_unpack_vector_int128 ((vector __int128_t)(a), 0)
#define __builtin_unpack_vector_1(a) __builtin_unpack_vector_int128 ((vector __int128_t)(a), 1)
#endif
/* When we have a load-store in a single-dispatch group and address overlap
* such that foward is not allowed (load-hit-store) the group must be flushed.
* A group ending NOP prevents the flush.
*/
#define GROUP_ENDING_NOP asm("ori 2,2,0" ::: "memory")
#if defined(__BIG_ENDIAN__) && defined (REFLECT)
#define BYTESWAP_DATA
#elif defined(__LITTLE_ENDIAN__) && !defined(REFLECT)
#define BYTESWAP_DATA
#endif
#ifdef BYTESWAP_DATA
#define VEC_PERM(vr, va, vb, vc) vr = vec_perm(va, vb,\
(__vector unsigned char) vc)
#if defined(__LITTLE_ENDIAN__)
/* Byte reverse permute constant LE. */
static const __vector unsigned long long vperm_const
__attribute__ ((aligned(16))) = { 0x08090A0B0C0D0E0FUL,
0x0001020304050607UL };
#else
static const __vector unsigned long long vperm_const
__attribute__ ((aligned(16))) = { 0x0F0E0D0C0B0A0908UL,
0X0706050403020100UL };
#endif
#else
#define VEC_PERM(vr, va, vb, vc)
#endif
static unsigned int __attribute__ ((aligned (32)))
__crc32_vpmsum(unsigned int crc, const void* p, unsigned long len) {
const __vector unsigned long long vzero = {0,0};
const __vector unsigned long long vones = {0xffffffffffffffffUL,
0xffffffffffffffffUL};
#ifdef REFLECT
const __vector unsigned long long vmask_32bit =
(__vector unsigned long long)vec_sld((__vector unsigned char)vzero,
(__vector unsigned char)vones, 4);
#endif
const __vector unsigned long long vmask_64bit =
(__vector unsigned long long)vec_sld((__vector unsigned char)vzero,
(__vector unsigned char)vones, 8);
__vector unsigned long long vcrc;
__vector unsigned long long vconst1, vconst2;
/* vdata0-vdata7 will contain our data (p). */
__vector unsigned long long vdata0, vdata1, vdata2, vdata3, vdata4,
vdata5, vdata6, vdata7;
/* v0-v7 will contain our checksums */
__vector unsigned long long v0 = {0,0};
__vector unsigned long long v1 = {0,0};
__vector unsigned long long v2 = {0,0};
__vector unsigned long long v3 = {0,0};
__vector unsigned long long v4 = {0,0};
__vector unsigned long long v5 = {0,0};
__vector unsigned long long v6 = {0,0};
__vector unsigned long long v7 = {0,0};
/* Vector auxiliary variables. */
__vector unsigned long long va0, va1, va2, va3, va4, va5, va6, va7;
unsigned int result = 0;
unsigned int offset; /* Constant table offset. */
unsigned long i; /* Counter. */
unsigned long chunks;
unsigned long block_size;
int next_block = 0;
/* Align by 128 bits. The last 128 bit block will be processed at end. */
unsigned long length = len & 0xFFFFFFFFFFFFFF80UL;
#ifdef REFLECT
vcrc = (__vector unsigned long long)__builtin_pack_vector(0UL, crc);
#else
vcrc = (__vector unsigned long long)__builtin_pack_vector(crc, 0UL);
/* Shift into top 32 bits */
vcrc = (__vector unsigned long long)vec_sld((__vector unsigned char)vcrc,
(__vector unsigned char)vzero, 4);
#endif
/* Short version. */
if (len < 256) {
/* Calculate where in the constant table we need to start. */
offset = 256 - len;
vconst1 = vec_ld(offset, vcrc_short_const);
vdata0 = vec_ld(0, (__vector unsigned long long*) p);
VEC_PERM(vdata0, vdata0, vconst1, vperm_const);
/* xor initial value*/
vdata0 = vec_xor(vdata0, vcrc);
vdata0 = (__vector unsigned long long) __builtin_crypto_vpmsumw
((__vector unsigned int)vdata0, (__vector unsigned int)vconst1);
v0 = vec_xor(v0, vdata0);
for (i = 16; i < len; i += 16) {
vconst1 = vec_ld(offset + i, vcrc_short_const);
vdata0 = vec_ld(i, (__vector unsigned long long*) p);
VEC_PERM(vdata0, vdata0, vconst1, vperm_const);
vdata0 = (__vector unsigned long long) __builtin_crypto_vpmsumw
((__vector unsigned int)vdata0, (__vector unsigned int)vconst1);
v0 = vec_xor(v0, vdata0);
}
} else {
/* Load initial values. */
vdata0 = vec_ld(0, (__vector unsigned long long*) p);
vdata1 = vec_ld(16, (__vector unsigned long long*) p);
VEC_PERM(vdata0, vdata0, vdata0, vperm_const);
VEC_PERM(vdata1, vdata1, vdata1, vperm_const);
vdata2 = vec_ld(32, (__vector unsigned long long*) p);
vdata3 = vec_ld(48, (__vector unsigned long long*) p);
VEC_PERM(vdata2, vdata2, vdata2, vperm_const);
VEC_PERM(vdata3, vdata3, vdata3, vperm_const);
vdata4 = vec_ld(64, (__vector unsigned long long*) p);
vdata5 = vec_ld(80, (__vector unsigned long long*) p);
VEC_PERM(vdata4, vdata4, vdata4, vperm_const);
VEC_PERM(vdata5, vdata5, vdata5, vperm_const);
vdata6 = vec_ld(96, (__vector unsigned long long*) p);
vdata7 = vec_ld(112, (__vector unsigned long long*) p);
VEC_PERM(vdata6, vdata6, vdata6, vperm_const);
VEC_PERM(vdata7, vdata7, vdata7, vperm_const);
/* xor in initial value */
vdata0 = vec_xor(vdata0, vcrc);
p = (char *)p + 128;
do {
/* Checksum in blocks of MAX_SIZE. */
block_size = length;
if (block_size > MAX_SIZE) {
block_size = MAX_SIZE;
}
length = length - block_size;
/*
* Work out the offset into the constants table to start at. Each
* constant is 16 bytes, and it is used against 128 bytes of input
* data - 128 / 16 = 8
*/
offset = (MAX_SIZE/8) - (block_size/8);
/* We reduce our final 128 bytes in a separate step */
chunks = (block_size/128)-1;
vconst1 = vec_ld(offset, vcrc_const);
va0 = __builtin_crypto_vpmsumd ((__vector unsigned long long)vdata0,
(__vector unsigned long long)vconst1);
va1 = __builtin_crypto_vpmsumd ((__vector unsigned long long)vdata1,
(__vector unsigned long long)vconst1);
va2 = __builtin_crypto_vpmsumd ((__vector unsigned long long)vdata2,
(__vector unsigned long long)vconst1);
va3 = __builtin_crypto_vpmsumd ((__vector unsigned long long)vdata3,
(__vector unsigned long long)vconst1);
va4 = __builtin_crypto_vpmsumd ((__vector unsigned long long)vdata4,
(__vector unsigned long long)vconst1);
va5 = __builtin_crypto_vpmsumd ((__vector unsigned long long)vdata5,
(__vector unsigned long long)vconst1);
va6 = __builtin_crypto_vpmsumd ((__vector unsigned long long)vdata6,
(__vector unsigned long long)vconst1);
va7 = __builtin_crypto_vpmsumd ((__vector unsigned long long)vdata7,
(__vector unsigned long long)vconst1);
if (chunks > 1) {
offset += 16;
vconst2 = vec_ld(offset, vcrc_const);
GROUP_ENDING_NOP;
vdata0 = vec_ld(0, (__vector unsigned long long*) p);
VEC_PERM(vdata0, vdata0, vdata0, vperm_const);
vdata1 = vec_ld(16, (__vector unsigned long long*) p);
VEC_PERM(vdata1, vdata1, vdata1, vperm_const);
vdata2 = vec_ld(32, (__vector unsigned long long*) p);
VEC_PERM(vdata2, vdata2, vdata2, vperm_const);
vdata3 = vec_ld(48, (__vector unsigned long long*) p);
VEC_PERM(vdata3, vdata3, vdata3, vperm_const);
vdata4 = vec_ld(64, (__vector unsigned long long*) p);
VEC_PERM(vdata4, vdata4, vdata4, vperm_const);
vdata5 = vec_ld(80, (__vector unsigned long long*) p);
VEC_PERM(vdata5, vdata5, vdata5, vperm_const);
vdata6 = vec_ld(96, (__vector unsigned long long*) p);
VEC_PERM(vdata6, vdata6, vdata6, vperm_const);
vdata7 = vec_ld(112, (__vector unsigned long long*) p);
VEC_PERM(vdata7, vdata7, vdata7, vperm_const);
p = (char *)p + 128;
/*
* main loop. We modulo schedule it such that it takes three
* iterations to complete - first iteration load, second
* iteration vpmsum, third iteration xor.
*/
for (i = 0; i < chunks-2; i++) {
vconst1 = vec_ld(offset, vcrc_const);
offset += 16;
GROUP_ENDING_NOP;
v0 = vec_xor(v0, va0);
va0 = __builtin_crypto_vpmsumd ((__vector unsigned long
long)vdata0, (__vector unsigned long long)vconst2);
vdata0 = vec_ld(0, (__vector unsigned long long*) p);
VEC_PERM(vdata0, vdata0, vdata0, vperm_const);
GROUP_ENDING_NOP;
v1 = vec_xor(v1, va1);
va1 = __builtin_crypto_vpmsumd ((__vector unsigned long
long)vdata1, (__vector unsigned long long)vconst2);
vdata1 = vec_ld(16, (__vector unsigned long long*) p);
VEC_PERM(vdata1, vdata1, vdata1, vperm_const);
GROUP_ENDING_NOP;
v2 = vec_xor(v2, va2);
va2 = __builtin_crypto_vpmsumd ((__vector unsigned long
long)vdata2, (__vector unsigned long long)vconst2);
vdata2 = vec_ld(32, (__vector unsigned long long*) p);
VEC_PERM(vdata2, vdata2, vdata2, vperm_const);
GROUP_ENDING_NOP;
v3 = vec_xor(v3, va3);
va3 = __builtin_crypto_vpmsumd ((__vector unsigned long
long)vdata3, (__vector unsigned long long)vconst2);
vdata3 = vec_ld(48, (__vector unsigned long long*) p);
VEC_PERM(vdata3, vdata3, vdata3, vperm_const);
vconst2 = vec_ld(offset, vcrc_const);
GROUP_ENDING_NOP;
v4 = vec_xor(v4, va4);
va4 = __builtin_crypto_vpmsumd ((__vector unsigned long
long)vdata4, (__vector unsigned long long)vconst1);
vdata4 = vec_ld(64, (__vector unsigned long long*) p);
VEC_PERM(vdata4, vdata4, vdata4, vperm_const);
GROUP_ENDING_NOP;
v5 = vec_xor(v5, va5);
va5 = __builtin_crypto_vpmsumd ((__vector unsigned long
long)vdata5, (__vector unsigned long long)vconst1);
vdata5 = vec_ld(80, (__vector unsigned long long*) p);
VEC_PERM(vdata5, vdata5, vdata5, vperm_const);
GROUP_ENDING_NOP;
v6 = vec_xor(v6, va6);
va6 = __builtin_crypto_vpmsumd ((__vector unsigned long
long)vdata6, (__vector unsigned long long)vconst1);
vdata6 = vec_ld(96, (__vector unsigned long long*) p);
VEC_PERM(vdata6, vdata6, vdata6, vperm_const);
GROUP_ENDING_NOP;
v7 = vec_xor(v7, va7);
va7 = __builtin_crypto_vpmsumd ((__vector unsigned long
long)vdata7, (__vector unsigned long long)vconst1);
vdata7 = vec_ld(112, (__vector unsigned long long*) p);
VEC_PERM(vdata7, vdata7, vdata7, vperm_const);
p = (char *)p + 128;
}
/* First cool down*/
vconst1 = vec_ld(offset, vcrc_const);
offset += 16;
v0 = vec_xor(v0, va0);
va0 = __builtin_crypto_vpmsumd ((__vector unsigned long
long)vdata0, (__vector unsigned long long)vconst1);
GROUP_ENDING_NOP;
v1 = vec_xor(v1, va1);
va1 = __builtin_crypto_vpmsumd ((__vector unsigned long
long)vdata1, (__vector unsigned long long)vconst1);
GROUP_ENDING_NOP;
v2 = vec_xor(v2, va2);
va2 = __builtin_crypto_vpmsumd ((__vector unsigned long
long)vdata2, (__vector unsigned long long)vconst1);
GROUP_ENDING_NOP;
v3 = vec_xor(v3, va3);
va3 = __builtin_crypto_vpmsumd ((__vector unsigned long
long)vdata3, (__vector unsigned long long)vconst1);
GROUP_ENDING_NOP;
v4 = vec_xor(v4, va4);
va4 = __builtin_crypto_vpmsumd ((__vector unsigned long
long)vdata4, (__vector unsigned long long)vconst1);
GROUP_ENDING_NOP;
v5 = vec_xor(v5, va5);
va5 = __builtin_crypto_vpmsumd ((__vector unsigned long
long)vdata5, (__vector unsigned long long)vconst1);
GROUP_ENDING_NOP;
v6 = vec_xor(v6, va6);
va6 = __builtin_crypto_vpmsumd ((__vector unsigned long
long)vdata6, (__vector unsigned long long)vconst1);
GROUP_ENDING_NOP;
v7 = vec_xor(v7, va7);
va7 = __builtin_crypto_vpmsumd ((__vector unsigned long
long)vdata7, (__vector unsigned long long)vconst1);
}/* else */
/* Second cool down. */
v0 = vec_xor(v0, va0);
v1 = vec_xor(v1, va1);
v2 = vec_xor(v2, va2);
v3 = vec_xor(v3, va3);
v4 = vec_xor(v4, va4);
v5 = vec_xor(v5, va5);
v6 = vec_xor(v6, va6);
v7 = vec_xor(v7, va7);
#ifdef REFLECT
/*
* vpmsumd produces a 96 bit result in the least significant bits
* of the register. Since we are bit reflected we have to shift it
* left 32 bits so it occupies the least significant bits in the
* bit reflected domain.
*/
v0 = (__vector unsigned long long)vec_sld((__vector unsigned char)v0,
(__vector unsigned char)vzero, 4);
v1 = (__vector unsigned long long)vec_sld((__vector unsigned char)v1,
(__vector unsigned char)vzero, 4);
v2 = (__vector unsigned long long)vec_sld((__vector unsigned char)v2,
(__vector unsigned char)vzero, 4);
v3 = (__vector unsigned long long)vec_sld((__vector unsigned char)v3,
(__vector unsigned char)vzero, 4);
v4 = (__vector unsigned long long)vec_sld((__vector unsigned char)v4,
(__vector unsigned char)vzero, 4);
v5 = (__vector unsigned long long)vec_sld((__vector unsigned char)v5,
(__vector unsigned char)vzero, 4);
v6 = (__vector unsigned long long)vec_sld((__vector unsigned char)v6,
(__vector unsigned char)vzero, 4);
v7 = (__vector unsigned long long)vec_sld((__vector unsigned char)v7,
(__vector unsigned char)vzero, 4);
#endif
/* xor with the last 1024 bits. */
va0 = vec_ld(0, (__vector unsigned long long*) p);
VEC_PERM(va0, va0, va0, vperm_const);
va1 = vec_ld(16, (__vector unsigned long long*) p);
VEC_PERM(va1, va1, va1, vperm_const);
va2 = vec_ld(32, (__vector unsigned long long*) p);
VEC_PERM(va2, va2, va2, vperm_const);
va3 = vec_ld(48, (__vector unsigned long long*) p);
VEC_PERM(va3, va3, va3, vperm_const);
va4 = vec_ld(64, (__vector unsigned long long*) p);
VEC_PERM(va4, va4, va4, vperm_const);
va5 = vec_ld(80, (__vector unsigned long long*) p);
VEC_PERM(va5, va5, va5, vperm_const);
va6 = vec_ld(96, (__vector unsigned long long*) p);
VEC_PERM(va6, va6, va6, vperm_const);
va7 = vec_ld(112, (__vector unsigned long long*) p);
VEC_PERM(va7, va7, va7, vperm_const);
p = (char *)p + 128;
vdata0 = vec_xor(v0, va0);
vdata1 = vec_xor(v1, va1);
vdata2 = vec_xor(v2, va2);
vdata3 = vec_xor(v3, va3);
vdata4 = vec_xor(v4, va4);
vdata5 = vec_xor(v5, va5);
vdata6 = vec_xor(v6, va6);
vdata7 = vec_xor(v7, va7);
/* Check if we have more blocks to process */
next_block = 0;
if (length != 0) {
next_block = 1;
/* zero v0-v7 */
v0 = vec_xor(v0, v0);
v1 = vec_xor(v1, v1);
v2 = vec_xor(v2, v2);
v3 = vec_xor(v3, v3);
v4 = vec_xor(v4, v4);
v5 = vec_xor(v5, v5);
v6 = vec_xor(v6, v6);
v7 = vec_xor(v7, v7);
}
length = length + 128;
} while (next_block);
/* Calculate how many bytes we have left. */
length = (len & 127);
/* Calculate where in (short) constant table we need to start. */
offset = 128 - length;
v0 = vec_ld(offset, vcrc_short_const);
v1 = vec_ld(offset + 16, vcrc_short_const);
v2 = vec_ld(offset + 32, vcrc_short_const);
v3 = vec_ld(offset + 48, vcrc_short_const);
v4 = vec_ld(offset + 64, vcrc_short_const);
v5 = vec_ld(offset + 80, vcrc_short_const);
v6 = vec_ld(offset + 96, vcrc_short_const);
v7 = vec_ld(offset + 112, vcrc_short_const);
offset += 128;
v0 = (__vector unsigned long long)__builtin_crypto_vpmsumw (
(__vector unsigned int)vdata0,(__vector unsigned int)v0);
v1 = (__vector unsigned long long)__builtin_crypto_vpmsumw (
(__vector unsigned int)vdata1,(__vector unsigned int)v1);
v2 = (__vector unsigned long long)__builtin_crypto_vpmsumw (
(__vector unsigned int)vdata2,(__vector unsigned int)v2);
v3 = (__vector unsigned long long)__builtin_crypto_vpmsumw (
(__vector unsigned int)vdata3,(__vector unsigned int)v3);
v4 = (__vector unsigned long long)__builtin_crypto_vpmsumw (
(__vector unsigned int)vdata4,(__vector unsigned int)v4);
v5 = (__vector unsigned long long)__builtin_crypto_vpmsumw (
(__vector unsigned int)vdata5,(__vector unsigned int)v5);
v6 = (__vector unsigned long long)__builtin_crypto_vpmsumw (
(__vector unsigned int)vdata6,(__vector unsigned int)v6);
v7 = (__vector unsigned long long)__builtin_crypto_vpmsumw (
(__vector unsigned int)vdata7,(__vector unsigned int)v7);
/* Now reduce the tail (0-112 bytes). */
for (i = 0; i < length; i+=16) {
vdata0 = vec_ld(i,(__vector unsigned long long*)p);
VEC_PERM(vdata0, vdata0, vdata0, vperm_const);
va0 = vec_ld(offset + i,vcrc_short_const);
va0 = (__vector unsigned long long)__builtin_crypto_vpmsumw (
(__vector unsigned int)vdata0,(__vector unsigned int)va0);
v0 = vec_xor(v0, va0);
}
/* xor all parallel chunks together. */
v0 = vec_xor(v0, v1);
v2 = vec_xor(v2, v3);
v4 = vec_xor(v4, v5);
v6 = vec_xor(v6, v7);
v0 = vec_xor(v0, v2);
v4 = vec_xor(v4, v6);
v0 = vec_xor(v0, v4);
}
/* Barrett Reduction */
vconst1 = vec_ld(0, v_Barrett_const);
vconst2 = vec_ld(16, v_Barrett_const);
v1 = (__vector unsigned long long)vec_sld((__vector unsigned char)v0,
(__vector unsigned char)v0, 8);
v0 = vec_xor(v1,v0);
#ifdef REFLECT
/* shift left one bit */
__vector unsigned char vsht_splat = vec_splat_u8 (1);
v0 = (__vector unsigned long long)vec_sll ((__vector unsigned char)v0,
vsht_splat);
#endif
v0 = vec_and(v0, vmask_64bit);
#ifndef REFLECT
/*
* Now for the actual algorithm. The idea is to calculate q,
* the multiple of our polynomial that we need to subtract. By
* doing the computation 2x bits higher (ie 64 bits) and shifting the
* result back down 2x bits, we round down to the nearest multiple.
*/
/* ma */
v1 = __builtin_crypto_vpmsumd ((__vector unsigned long long)v0,
(__vector unsigned long long)vconst1);
/* q = floor(ma/(2^64)) */
v1 = (__vector unsigned long long)vec_sld ((__vector unsigned char)vzero,
(__vector unsigned char)v1, 8);
/* qn */
v1 = __builtin_crypto_vpmsumd ((__vector unsigned long long)v1,
(__vector unsigned long long)vconst2);
/* a - qn, subtraction is xor in GF(2) */
v0 = vec_xor (v0, v1);
/*
* Get the result into r3. We need to shift it left 8 bytes:
* V0 [ 0 1 2 X ]
* V0 [ 0 X 2 3 ]
*/
result = __builtin_unpack_vector_1 (v0);
#else
/*
* The reflected version of Barrett reduction. Instead of bit
* reflecting our data (which is expensive to do), we bit reflect our
* constants and our algorithm, which means the intermediate data in
* our vector registers goes from 0-63 instead of 63-0. We can reflect
* the algorithm because we don't carry in mod 2 arithmetic.
*/
/* bottom 32 bits of a */
v1 = vec_and(v0, vmask_32bit);
/* ma */
v1 = __builtin_crypto_vpmsumd ((__vector unsigned long long)v1,
(__vector unsigned long long)vconst1);
/* bottom 32bits of ma */
v1 = vec_and(v1, vmask_32bit);
/* qn */
v1 = __builtin_crypto_vpmsumd ((__vector unsigned long long)v1,
(__vector unsigned long long)vconst2);
/* a - qn, subtraction is xor in GF(2) */
v0 = vec_xor (v0, v1);
/*
* Since we are bit reflected, the result (ie the low 32 bits) is in
* the high 32 bits. We just need to shift it left 4 bytes
* V0 [ 0 1 X 3 ]
* V0 [ 0 X 2 3 ]
*/
/* shift result into top 64 bits of */
v0 = (__vector unsigned long long)vec_sld((__vector unsigned char)v0,
(__vector unsigned char)vzero, 4);
result = __builtin_unpack_vector_0 (v0);
#endif
return result;
}

View File

@ -98,6 +98,7 @@ extern ulong srv_checksum_algorithm;
static ulint physical_page_size; /* Page size in bytes on disk. */
static ulint logical_page_size; /* Page size when uncompressed. */
ulong srv_page_size;
ulong srv_page_size_shift;
page_size_t univ_page_size(0, 0, false);
/* Current page number (0 based). */
unsigned long long cur_page_num;
@ -308,16 +309,16 @@ const page_size_t
get_page_size(
byte* buf)
{
const ulint flags = mach_read_from_4(buf + FIL_PAGE_DATA
const unsigned flags = mach_read_from_4(buf + FIL_PAGE_DATA
+ FSP_SPACE_FLAGS);
const ulint ssize = FSP_FLAGS_GET_PAGE_SSIZE(flags);
const ulong ssize = FSP_FLAGS_GET_PAGE_SSIZE(flags);
if (ssize == 0) {
srv_page_size = UNIV_PAGE_SIZE_ORIG;
} else {
srv_page_size = ((UNIV_ZIP_SIZE_MIN >> 1) << ssize);
}
srv_page_size_shift = ssize
? UNIV_ZIP_SIZE_SHIFT_MIN - 1 + ssize
: UNIV_PAGE_SIZE_SHIFT_ORIG;
srv_page_size = 1U << srv_page_size_shift;
univ_page_size.copy_from(
page_size_t(srv_page_size, srv_page_size, false));
@ -1703,7 +1704,6 @@ int main(
ulint zip_size = page_size.is_compressed() ? page_size.logical() : 0;
logical_page_size = page_size.is_compressed() ? zip_size : 0;
physical_page_size = page_size.physical();
srv_page_size = (ulong)page_size.logical();
bool is_compressed = FSP_FLAGS_HAS_PAGE_COMPRESSION(flags);
if (page_size.physical() > UNIV_ZIP_SIZE_MIN) {

View File

@ -55,7 +55,7 @@ ELSE()
SET(NT_SERVICE_SOURCE)
ENDIF()
ADD_DEFINITIONS(-DPCRE_STATIC=1)
ADD_DEFINITIONS(-DPCRE_STATIC=1 -DHAVE_OPENSSL=1)
MYSQL_ADD_EXECUTABLE(mariabackup
xtrabackup.cc

View File

@ -57,8 +57,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#include "backup_copy.h"
#include "backup_mysql.h"
#include <btr0btr.h>
#include "xb0xb.h"
/* list of files to sync for --rsync mode */
static std::set<std::string> rsync_list;
@ -966,6 +964,9 @@ copy_file(ds_ctxt_t *datasink,
ds_file_t *dstfile = NULL;
datafile_cur_t cursor;
xb_fil_cur_result_t res;
const char *dst_path =
(xtrabackup_copy_back || xtrabackup_move_back)?
dst_file_path : trim_dotslash(dst_file_path);
if (!datafile_open(src_file_path, &cursor, thread_n)) {
goto error_close;
@ -973,8 +974,7 @@ copy_file(ds_ctxt_t *datasink,
strncpy(dst_name, cursor.rel_path, sizeof(dst_name));
dstfile = ds_open(datasink, trim_dotslash(dst_file_path),
&cursor.statinfo);
dstfile = ds_open(datasink, dst_path, &cursor.statinfo);
if (dstfile == NULL) {
msg("[%02u] error: "
"cannot open the destination stream for %s\n",

View File

@ -48,6 +48,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#include <limits>
#include "common.h"
#include "xtrabackup.h"
#include "srv0srv.h"
#include "mysql_version.h"
#include "backup_copy.h"
#include "backup_mysql.h"
@ -93,7 +94,7 @@ time_t history_lock_time;
MYSQL *mysql_connection;
my_bool opt_ssl_verify_server_cert;
extern my_bool opt_ssl_verify_server_cert, opt_use_ssl;
MYSQL *
xb_mysql_connect()
@ -480,7 +481,7 @@ get_mysql_vars(MYSQL *connection)
innodb_data_file_path_var, MYF(MY_FAE));
}
if (innodb_data_home_dir_var && *innodb_data_home_dir_var) {
if (innodb_data_home_dir_var) {
innobase_data_home_dir = my_strdup(
innodb_data_home_dir_var, MYF(MY_FAE));
}
@ -897,16 +898,23 @@ DECLARE_THREAD(kill_mdl_waiters_thread(void *))
break;
MYSQL_RES *result = xb_mysql_query(mysql,
"SELECT ID, COMMAND FROM INFORMATION_SCHEMA.PROCESSLIST "
"SELECT ID, COMMAND, INFO FROM INFORMATION_SCHEMA.PROCESSLIST "
" WHERE State='Waiting for table metadata lock'",
true, true);
while (MYSQL_ROW row = mysql_fetch_row(result))
{
char query[64];
msg_ts("Killing MDL waiting query '%s' on connection '%s'\n",
row[1], row[0]);
if (row[1] && !strcmp(row[1], "Killed"))
continue;
msg_ts("Killing MDL waiting %s ('%s') on connection %s\n",
row[1], row[2], row[0]);
snprintf(query, sizeof(query), "KILL QUERY %s", row[0]);
xb_mysql_query(mysql, query, true);
if (mysql_query(mysql, query) && (mysql_errno(mysql) != ER_NO_SUCH_THREAD)) {
msg("Error: failed to execute query %s: %s\n", query,mysql_error(mysql));
exit(EXIT_FAILURE);
}
}
}
@ -1607,6 +1615,44 @@ cleanup:
extern const char *innodb_checksum_algorithm_names[];
#ifdef _WIN32
#include <algorithm>
#endif
static std::string make_local_paths(const char *data_file_path)
{
if (strchr(data_file_path, '/') == 0
#ifdef _WIN32
&& strchr(data_file_path, '\\') == 0
#endif
){
return std::string(data_file_path);
}
std::ostringstream buf;
char *dup = strdup(innobase_data_file_path);
ut_a(dup);
char *p;
char * token = strtok_r(dup, ";", &p);
while (token) {
if (buf.tellp())
buf << ";";
char *fname = strrchr(token, '/');
#ifdef _WIN32
fname = std::max(fname,strrchr(token, '\\'));
#endif
if (fname)
buf << fname + 1;
else
buf << token;
token = strtok_r(NULL, ";", &p);
}
free(dup);
return buf.str();
}
bool write_backup_config_file()
{
int rc= backup_file_printf("backup-my.cnf",
@ -1623,7 +1669,7 @@ bool write_backup_config_file()
"%s%s\n"
"%s\n",
innodb_checksum_algorithm_names[srv_checksum_algorithm],
innobase_data_file_path,
make_local_paths(innobase_data_file_path).c_str(),
srv_n_log_files,
srv_log_file_size,
srv_page_size,

View File

@ -26,6 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#include "common.h"
#include "xtrabackup.h"
#include "srv0srv.h"
/* TODO: copy-pasted shared definitions from the XtraDB bitmap write code.
Remove these on the first opportunity, i.e. single-binary XtraBackup. */

View File

@ -57,7 +57,7 @@ typedef uint8_t byte;
#if __GNUC__ >= 4 && defined(__x86_64__) && defined(HAVE_CLMUL_INSTRUCTION)
#if _GCRY_GCC_VERSION >= 40400 /* 4.4 */
#if defined(_GCRY_GCC_VERSION) && _GCRY_GCC_VERSION >= 40400 /* 4.4 */
/* Prevent compiler from issuing SSE instructions between asm blocks. */
# pragma GCC target("no-sse")
#endif

View File

@ -91,22 +91,8 @@ tmpfile_open(ds_ctxt_t *ctxt, const char *path,
/* Create a temporary file in tmpdir. The file will be automatically
removed on close. Code copied from mysql_tmpfile(). */
fd = create_temp_file(tmp_path,xtrabackup_tmpdir,
"xbtemp",
#ifdef __WIN__
O_BINARY | O_TRUNC | O_SEQUENTIAL |
O_TEMPORARY | O_SHORT_LIVED |
#endif /* __WIN__ */
O_CREAT | O_EXCL | O_RDWR,
MYF(MY_WME));
#ifndef __WIN__
if (fd >= 0) {
/* On Windows, open files cannot be removed, but files can be
created with the O_TEMPORARY flag to the same effect
("delete on close"). */
unlink(tmp_path);
}
#endif /* !__WIN__ */
"xbtemp", O_BINARY | O_SEQUENTIAL,
MYF(MY_WME | MY_TEMPORARY));
if (fd < 0) {
return NULL;

View File

@ -33,7 +33,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#include "common.h"
#include "read_filt.h"
#include "xtrabackup.h"
#include "xb0xb.h"
/* Size of read buffer in pages (640 pages = 10M for 16K sized pages) */
#define XB_FIL_CUR_PAGES 640
@ -218,9 +217,9 @@ xb_fil_cur_open(
/* Allocate read buffer */
cursor->buf_size = XB_FIL_CUR_PAGES * page_size.physical();
cursor->orig_buf = static_cast<byte *>
(malloc(cursor->buf_size + UNIV_PAGE_SIZE));
(malloc(cursor->buf_size + srv_page_size));
cursor->buf = static_cast<byte *>
(ut_align(cursor->orig_buf, UNIV_PAGE_SIZE));
(ut_align(cursor->orig_buf, srv_page_size));
cursor->buf_read = 0;
cursor->buf_npages = 0;
@ -258,7 +257,7 @@ xb_fil_cur_read(
ib_int64_t offset;
ib_int64_t to_read;
const ulint page_size = cursor->page_size.physical();
xb_ad(!cursor->is_system() || page_size == UNIV_PAGE_SIZE);
xb_ad(!cursor->is_system() || page_size == srv_page_size);
cursor->read_filter->get_next_batch(&cursor->read_filter_ctxt,
&offset, &to_read);

View File

@ -28,6 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#include <my_dir.h>
#include "read_filt.h"
#include "srv0start.h"
#include "srv0srv.h"
struct xb_fil_cur_t {
pfs_os_file_t file; /*!< source file handle */

View File

@ -1,27 +0,0 @@
/******************************************************
Copyright (c) 2012 Percona LLC and/or its affiliates.
Declarations of XtraBackup functions called by InnoDB code.
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 Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*******************************************************/
#ifndef xb0xb_h
#define xb0xb_h
extern const char *innodb_checksum_algorithm_names[];
extern TYPELIB innodb_checksum_algorithm_typelib;
#endif

View File

@ -4,7 +4,7 @@ MariaBackup: hot backup tool for InnoDB
Originally Created 3/3/2009 Yasufumi Kinoshita
Written by Alexey Kopytov, Aleksandr Kuzminsky, Stewart Smith, Vadim Tkachenko,
Yasufumi Kinoshita, Ignacio Nin and Baron Schwartz.
(c) 2017, MariaDB Corporation.
(c) 2017, 2018, MariaDB Corporation.
Portions written by Marko Mäkelä.
This program is free software; you can redistribute it and/or modify
@ -97,7 +97,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#include "backup_mysql.h"
#include "backup_copy.h"
#include "backup_mysql.h"
#include "xb0xb.h"
#include "encryption_plugin.h"
#include <sql_plugin.h>
#include <srv0srv.h>
@ -196,6 +195,10 @@ static ulong max_buf_pool_modified_pct;
/* Ignored option (--log) for MySQL option compatibility */
static char* log_ignored_opt;
extern my_bool opt_use_ssl;
my_bool opt_ssl_verify_server_cert;
/* === metadata of backup === */
#define XTRABACKUP_METADATA_FILENAME "xtrabackup_checkpoints"
char metadata_type[30] = ""; /*[full-backuped|log-applied|incremental]*/
@ -223,7 +226,6 @@ long innobase_buffer_pool_awe_mem_mb = 0;
long innobase_file_io_threads = 4;
long innobase_read_io_threads = 4;
long innobase_write_io_threads = 4;
long innobase_log_buffer_size = 1024*1024L;
longlong innobase_page_size = (1LL << 14); /* 16KB */
char* innobase_buffer_pool_filename = NULL;
@ -236,9 +238,6 @@ are determined in innobase_init below: */
static char* innobase_ignored_opt;
char* innobase_data_home_dir;
char* innobase_data_file_path;
/* The following has a misleading name: starting from 4.0.5, this also
affects Windows: */
char* innobase_unix_file_flush_method;
my_bool innobase_use_doublewrite;
my_bool innobase_use_large_pages;
@ -301,6 +300,11 @@ my_bool opt_remove_original;
my_bool opt_lock_ddl_per_table = FALSE;
extern const char *innodb_checksum_algorithm_names[];
extern TYPELIB innodb_checksum_algorithm_typelib;
extern const char *innodb_flush_method_names[];
extern TYPELIB innodb_flush_method_typelib;
static const char *binlog_info_values[] = {"off", "lockless", "on", "auto",
NullS};
static TYPELIB binlog_info_typelib = {array_elements(binlog_info_values)-1, "",
@ -334,9 +338,6 @@ uint opt_safe_slave_backup_timeout = 0;
const char *opt_history = NULL;
#if defined(HAVE_OPENSSL)
my_bool opt_ssl_verify_server_cert = FALSE;
#endif
char mariabackup_exe[FN_REFLEN];
char orig_argv1[FN_REFLEN];
@ -589,6 +590,7 @@ typedef struct {
} data_thread_ctxt_t;
/* ======== for option and variables ======== */
#include <../../client/client_priv.h>
enum options_xtrabackup
{
@ -621,13 +623,10 @@ enum options_xtrabackup
OPT_INNODB_ADAPTIVE_HASH_INDEX,
OPT_INNODB_DOUBLEWRITE,
OPT_INNODB_FILE_PER_TABLE,
OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT,
OPT_INNODB_FLUSH_METHOD,
OPT_INNODB_LOCKS_UNSAFE_FOR_BINLOG,
OPT_INNODB_LOG_GROUP_HOME_DIR,
OPT_INNODB_MAX_DIRTY_PAGES_PCT,
OPT_INNODB_MAX_PURGE_LAG,
OPT_INNODB_ROLLBACK_ON_TIMEOUT,
OPT_INNODB_STATUS_FILE,
OPT_INNODB_AUTOEXTEND_INCREMENT,
OPT_INNODB_BUFFER_POOL_SIZE,
@ -652,8 +651,6 @@ enum options_xtrabackup
OPT_INNODB_LOG_CHECKSUMS,
OPT_XTRA_INCREMENTAL_FORCE_SCAN,
OPT_DEFAULTS_GROUP,
OPT_OPEN_FILES_LIMIT,
OPT_PLUGIN_DIR,
OPT_PLUGIN_LOAD,
OPT_INNODB_ENCRYPT_LOG,
OPT_CLOSE_FILES,
@ -1033,9 +1030,9 @@ struct my_option xb_client_options[] =
{"secure-auth", OPT_XB_SECURE_AUTH, "Refuse client connecting to server if it"
" uses old (pre-4.1.1) protocol.", &opt_secure_auth,
&opt_secure_auth, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
#define MYSQL_CLIENT
#include "sslopt-longopts.h"
#undef MYSQL_CLIENT
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@ -1128,14 +1125,15 @@ struct my_option xb_server_options[] =
FALSE, 0, 0, 0, 0, 0},
{"innodb_flush_method", OPT_INNODB_FLUSH_METHOD,
"With which method to flush data.", (G_PTR*) &innobase_unix_file_flush_method,
(G_PTR*) &innobase_unix_file_flush_method, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
0, 0, 0},
"With which method to flush data.",
&srv_file_flush_method, &srv_file_flush_method,
&innodb_flush_method_typelib, GET_ENUM, REQUIRED_ARG,
IF_WIN(SRV_ALL_O_DIRECT_FSYNC, SRV_FSYNC), 0, 0, 0, 0, 0},
{"innodb_log_buffer_size", OPT_INNODB_LOG_BUFFER_SIZE,
"The size of the buffer which InnoDB uses to write log to the log files on disk.",
(G_PTR*) &innobase_log_buffer_size, (G_PTR*) &innobase_log_buffer_size, 0,
GET_LONG, REQUIRED_ARG, 1024*1024L, 256*1024L, LONG_MAX, 0, 1024, 0},
(G_PTR*) &srv_log_buffer_size, (G_PTR*) &srv_log_buffer_size, 0,
GET_ULONG, REQUIRED_ARG, 1024*1024L, 256*1024L, LONG_MAX, 0, 1024, 0},
{"innodb_log_file_size", OPT_INNODB_LOG_FILE_SIZE,
"Ignored for mysqld option compatibility",
(G_PTR*) &srv_log_file_size, (G_PTR*) &srv_log_file_size, 0,
@ -1480,8 +1478,9 @@ xb_get_one_option(int optid,
break;
case OPT_INNODB_FLUSH_METHOD:
ADD_PRINT_PARAM_OPT(innobase_unix_file_flush_method);
ut_a(srv_file_flush_method
<= IF_WIN(SRV_ALL_O_DIRECT_FSYNC, SRV_O_DIRECT_NO_FSYNC));
ADD_PRINT_PARAM_OPT(innodb_flush_method_names[srv_file_flush_method]);
break;
case OPT_INNODB_PAGE_SIZE:
@ -1571,7 +1570,9 @@ xb_get_one_option(int optid,
}
}
break;
#define MYSQL_CLIENT
#include "sslopt-case.h"
#undef MYSQL_CLIENT
case '?':
usage();
@ -1587,15 +1588,14 @@ xb_get_one_option(int optid,
return 0;
}
static my_bool
innodb_init_param(void)
static bool innodb_init_param()
{
srv_is_being_started = TRUE;
/* === some variables from mysqld === */
memset((G_PTR) &mysql_tmpdir_list, 0, sizeof(mysql_tmpdir_list));
if (init_tmpdir(&mysql_tmpdir_list, opt_mysql_tmpdir))
exit(EXIT_FAILURE);
return true;
xtrabackup_tmpdir = my_tmpdir(&mysql_tmpdir_list);
/* dummy for initialize all_charsets[] */
get_charset_name(0);
@ -1607,21 +1607,21 @@ innodb_init_param(void)
#endif /* BTR_CUR_HASH_ADAPT */
if (innobase_page_size != (1LL << 14)) {
int n_shift = (int)get_bit_shift((ulint) innobase_page_size);
size_t n_shift = get_bit_shift(size_t(innobase_page_size));
if (n_shift >= 12 && n_shift <= UNIV_PAGE_SIZE_SHIFT_MAX) {
srv_page_size_shift = n_shift;
srv_page_size = 1 << n_shift;
srv_page_size_shift = ulong(n_shift);
srv_page_size = 1U << n_shift;
msg("InnoDB: The universal page size of the "
"database is set to %lu.\n", srv_page_size);
} else {
msg("InnoDB: Error: invalid value of "
"innobase_page_size: %lld", innobase_page_size);
exit(EXIT_FAILURE);
goto error;
}
} else {
srv_page_size_shift = 14;
srv_page_size = (1 << srv_page_size_shift);
srv_page_size = 1U << 14;
}
/* Check that values don't overflow on 32-bit systems. */
@ -1684,6 +1684,9 @@ innodb_init_param(void)
goto error;
}
srv_sys_space.normalize_size();
srv_lock_table_size = 5 * (srv_buf_pool_size >> srv_page_size_shift);
/* -------------- Log files ---------------------------*/
/* The default dir for log files is the datadir of MySQL */
@ -1707,16 +1710,13 @@ innodb_init_param(void)
srv_adaptive_flushing = FALSE;
srv_file_flush_method_str = innobase_unix_file_flush_method;
srv_log_buffer_size = (ulint) innobase_log_buffer_size;
/* We set srv_pool_size here in units of 1 kB. InnoDB internally
changes the value so that it becomes the number of database pages. */
srv_buf_pool_size = (ulint) xtrabackup_use_memory;
srv_buf_pool_chunk_unit = (ulong)srv_buf_pool_size;
srv_buf_pool_instances = 1;
srv_n_page_cleaners = 1;
srv_n_file_io_threads = (ulint) innobase_file_io_threads;
srv_n_read_io_threads = (ulint) innobase_read_io_threads;
@ -1732,7 +1732,7 @@ innodb_init_param(void)
srv_locks_unsafe_for_binlog = (ibool) innobase_locks_unsafe_for_binlog;
srv_max_n_open_files = ULINT_UNDEFINED;
srv_max_n_open_files = ULINT_UNDEFINED - 5;
srv_innodb_status = (ibool) innobase_create_status_file;
srv_print_verbose_log = 1;
@ -1743,20 +1743,7 @@ innodb_init_param(void)
/* We cannot treat characterset here for now!! */
data_mysql_default_charset_coll = (ulint)default_charset_info->number;
ut_a(DATA_MYSQL_BINARY_CHARSET_COLL == my_charset_bin.number);
//innobase_commit_concurrency_init_default();
/* Since we in this module access directly the fields of a trx
struct, and due to different headers and flags it might happen that
mutex_t has a different size in this module and in InnoDB
modules, we check at run time that the size is the same in
these compilation modules. */
/* On 5.5+ srv_use_native_aio is TRUE by default. It is later reset
if it is not supported by the platform in
innobase_start_or_create_for_mysql(). As we don't call it in xtrabackup,
we have to duplicate checks from that function here. */
ut_ad(DATA_MYSQL_BINARY_CHARSET_COLL == my_charset_bin.number);
#ifdef _WIN32
srv_use_native_aio = TRUE;
@ -1789,16 +1776,26 @@ innodb_init_param(void)
? log_block_calc_checksum_crc32
: log_block_calc_checksum_none;
return(FALSE);
#ifdef _WIN32
srv_use_native_aio = TRUE;
#endif
return false;
error:
msg("mariabackup: innodb_init_param(): Error occured.\n");
return(TRUE);
return true;
}
static bool innodb_init()
{
dberr_t err = innobase_start_or_create_for_mysql();
bool create_new_db = false;
/* Check if the data files exist or not. */
dberr_t err = srv_sys_space.check_file_spec(&create_new_db, 5U << 20);
if (err == DB_SUCCESS) {
err = srv_start(create_new_db);
}
if (err != DB_SUCCESS) {
msg("mariabackup: innodb_init() returned %d (%s).\n",
err, ut_strerr(err));
@ -2466,7 +2463,7 @@ lsn_t
xtrabackup_copy_log(copy_logfile copy, lsn_t start_lsn, lsn_t end_lsn)
{
lsn_t scanned_lsn = start_lsn;
const byte* log_block = log_sys->buf;
const byte* log_block = log_sys.buf;
bool more_data = false;
for (ulint scanned_checkpoint = 0;
@ -2515,7 +2512,7 @@ xtrabackup_copy_log(copy_logfile copy, lsn_t start_lsn, lsn_t end_lsn)
recv_sys_justify_left_parsing_buf();
log_sys->log.scanned_lsn = scanned_lsn;
log_sys.log.scanned_lsn = scanned_lsn;
end_lsn = copy == COPY_LAST
? ut_uint64_align_up(scanned_lsn, OS_FILE_LOG_BLOCK_SIZE)
@ -2523,10 +2520,10 @@ xtrabackup_copy_log(copy_logfile copy, lsn_t start_lsn, lsn_t end_lsn)
if (ulint write_size = ulint(end_lsn - start_lsn)) {
if (srv_encrypt_log) {
log_crypt(log_sys->buf, start_lsn, write_size);
log_crypt(log_sys.buf, start_lsn, write_size);
}
if (ds_write(dst_log_file, log_sys->buf, write_size)) {
if (ds_write(dst_log_file, log_sys.buf, write_size)) {
msg("mariabackup: Error: "
"write to logfile failed\n");
return(0);
@ -2565,8 +2562,7 @@ xtrabackup_copy_logfile(copy_logfile copy)
lsn_t lsn= start_lsn;
for(int retries= 0; retries < 100; retries++) {
if (log_group_read_log_seg(log_sys->buf, &log_sys->log,
&lsn, end_lsn)){
if (log_sys.log.read_log_seg(&lsn, end_lsn)) {
break;
}
msg("Retrying read of a redo log block");
@ -2586,7 +2582,7 @@ xtrabackup_copy_logfile(copy_logfile copy)
}
} while (start_lsn == end_lsn);
ut_ad(start_lsn == log_sys->log.scanned_lsn);
ut_ad(start_lsn == log_sys.log.scanned_lsn);
msg_ts(">> log scanned up to (" LSN_PF ")\n", start_lsn);
@ -3036,7 +3032,7 @@ static dberr_t xb_assign_undo_space_start()
byte* page;
bool ret;
dberr_t error = DB_SUCCESS;
ulint space, page_no;
ulint space, page_no __attribute__((unused));
if (srv_undo_tablespaces == 0) {
return error;
@ -3050,7 +3046,7 @@ static dberr_t xb_assign_undo_space_start()
name[dirnamelen++] = OS_PATH_SEPARATOR;
}
snprintf(name + dirnamelen, strlen(name) + strlen("ibdata1"),
snprintf(name + dirnamelen, (sizeof name) - dirnamelen,
"%s", "ibdata1");
file = os_file_create(0, name, OS_FILE_OPEN,
@ -3061,12 +3057,13 @@ static dberr_t xb_assign_undo_space_start()
return DB_ERROR;
}
buf = static_cast<byte*>(ut_malloc_nokey(2 * UNIV_PAGE_SIZE));
page = static_cast<byte*>(ut_align(buf, UNIV_PAGE_SIZE));
buf = static_cast<byte*>(ut_malloc_nokey(2U << srv_page_size_shift));
page = static_cast<byte*>(ut_align(buf, srv_page_size));
retry:
if (!os_file_read(IORequestRead, file, page, TRX_SYS_PAGE_NO * UNIV_PAGE_SIZE,
UNIV_PAGE_SIZE)) {
if (!os_file_read(IORequestRead, file, page,
TRX_SYS_PAGE_NO << srv_page_size_shift,
srv_page_size)) {
msg("mariabackup: Reading TRX_SYS page failed.\n");
error = DB_ERROR;
goto func_exit;
@ -3582,19 +3579,6 @@ open_or_create_log_file(
return(DB_SUCCESS);
}
/*********************************************************************//**
Normalizes init parameter values to use units we use inside InnoDB.
@return DB_SUCCESS or error code */
static
void
xb_normalize_init_values(void)
/*==========================*/
{
srv_sys_space.normalize();
srv_log_buffer_size /= UNIV_PAGE_SIZE;
srv_lock_table_size = 5 * (srv_buf_pool_size / UNIV_PAGE_SIZE);
}
/***********************************************************************
Set the open files limit. Based on set_max_open_files().
@ -3689,9 +3673,9 @@ xtrabackup_backup_low()
log_mutex_enter();
if (recv_find_max_checkpoint(&max_cp_field) == DB_SUCCESS
&& log_sys->log.format != 0) {
&& log_sys.log.format != 0) {
metadata_to_lsn = mach_read_from_8(
log_sys->checkpoint_buf + LOG_CHECKPOINT_LSN);
log_sys.checkpoint_buf + LOG_CHECKPOINT_LSN);
msg("mariabackup: The latest check point"
" (for incremental): '" LSN_PF "'\n",
metadata_to_lsn);
@ -3804,42 +3788,6 @@ fail:
return(false);
}
xb_normalize_init_values();
if (srv_file_flush_method_str == NULL) {
/* These are the default options */
srv_file_flush_method = SRV_FSYNC;
} else if (0 == ut_strcmp(srv_file_flush_method_str, "fsync")) {
srv_file_flush_method = SRV_FSYNC;
} else if (0 == ut_strcmp(srv_file_flush_method_str, "O_DSYNC")) {
srv_file_flush_method = SRV_O_DSYNC;
} else if (0 == ut_strcmp(srv_file_flush_method_str, "O_DIRECT")) {
srv_file_flush_method = SRV_O_DIRECT;
msg("mariabackup: using O_DIRECT\n");
} else if (0 == ut_strcmp(srv_file_flush_method_str, "littlesync")) {
srv_file_flush_method = SRV_LITTLESYNC;
} else if (0 == ut_strcmp(srv_file_flush_method_str, "nosync")) {
srv_file_flush_method = SRV_NOSYNC;
} else if (0 == ut_strcmp(srv_file_flush_method_str, "ALL_O_DIRECT")) {
srv_file_flush_method = SRV_ALL_O_DIRECT_FSYNC;
msg("mariabackup: using ALL_O_DIRECT\n");
} else if (0 == ut_strcmp(srv_file_flush_method_str,
"O_DIRECT_NO_FSYNC")) {
srv_file_flush_method = SRV_O_DIRECT_NO_FSYNC;
msg("mariabackup: using O_DIRECT_NO_FSYNC\n");
} else {
msg("mariabackup: Unrecognized value %s for "
"innodb_flush_method\n", srv_file_flush_method_str);
goto fail;
}
#ifdef _WIN32
srv_file_flush_method = SRV_ALL_O_DIRECT_FSYNC;
srv_use_native_aio = TRUE;
#endif
if (srv_buf_pool_size >= 1000 * 1024 * 1024) {
/* Here we still have srv_pool_size counted
in kilobytes (in 4.0 this was in bytes)
@ -3887,8 +3835,8 @@ fail:
os_aio_init(srv_n_read_io_threads, srv_n_write_io_threads,
SRV_MAX_N_PENDING_SYNC_IOS);
log_sys_init();
log_init(srv_n_log_files);
log_sys.create();
log_sys.log.create(srv_n_log_files);
fil_space_t* space = fil_space_create(
"innodb_redo_log", SRV_LOG_SPACE_FIRST_ID, 0,
FIL_TYPE_LOG, NULL);
@ -3963,7 +3911,7 @@ log_fail:
goto fail;
}
if (log_sys->log.format == 0) {
if (log_sys.log.format == 0) {
old_format:
msg("mariabackup: Error: cannot process redo log"
" before MariaDB 10.2.2\n");
@ -3971,14 +3919,14 @@ old_format:
goto log_fail;
}
ut_ad(!((log_sys->log.format ^ LOG_HEADER_FORMAT_CURRENT)
ut_ad(!((log_sys.log.format ^ LOG_HEADER_FORMAT_CURRENT)
& ~LOG_HEADER_FORMAT_ENCRYPTED));
const byte* buf = log_sys->checkpoint_buf;
const byte* buf = log_sys.checkpoint_buf;
reread_log_header:
checkpoint_lsn_start = log_sys->log.lsn;
checkpoint_no_start = log_sys->next_checkpoint_no;
checkpoint_lsn_start = log_sys.log.lsn;
checkpoint_no_start = log_sys.next_checkpoint_no;
err = recv_find_max_checkpoint(&max_cp_field);
@ -3986,14 +3934,14 @@ reread_log_header:
goto log_fail;
}
if (log_sys->log.format == 0) {
if (log_sys.log.format == 0) {
goto old_format;
}
ut_ad(!((log_sys->log.format ^ LOG_HEADER_FORMAT_CURRENT)
ut_ad(!((log_sys.log.format ^ LOG_HEADER_FORMAT_CURRENT)
& ~LOG_HEADER_FORMAT_ENCRYPTED));
log_group_header_read(&log_sys->log, max_cp_field);
log_header_read(max_cp_field);
if (checkpoint_no_start != mach_read_from_8(buf + LOG_CHECKPOINT_NO)) {
goto reread_log_header;
@ -4019,7 +3967,7 @@ reread_log_header:
/* label it */
byte MY_ALIGNED(OS_FILE_LOG_BLOCK_SIZE) log_hdr[OS_FILE_LOG_BLOCK_SIZE];
memset(log_hdr, 0, sizeof log_hdr);
mach_write_to_4(LOG_HEADER_FORMAT + log_hdr, log_sys->log.format);
mach_write_to_4(LOG_HEADER_FORMAT + log_hdr, log_sys.log.format);
mach_write_to_8(LOG_HEADER_START_LSN + log_hdr, checkpoint_lsn_start);
strcpy(reinterpret_cast<char*>(LOG_HEADER_CREATOR + log_hdr),
"Backup " MYSQL_SERVER_VERSION);
@ -4248,7 +4196,8 @@ xb_space_create_file(
}
ret = os_file_set_size(path, *file,
FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE);
FIL_IBD_FILE_INITIAL_SIZE
<< srv_page_size_shift);
if (!ret) {
msg("mariabackup: cannot set size for file %s\n", path);
os_file_close(*file);
@ -4256,11 +4205,11 @@ xb_space_create_file(
return ret;
}
buf = static_cast<byte *>(malloc(3 * UNIV_PAGE_SIZE));
buf = static_cast<byte *>(malloc(3U << srv_page_size_shift));
/* Align the memory for file i/o if we might have O_DIRECT set */
page = static_cast<byte *>(ut_align(buf, UNIV_PAGE_SIZE));
page = static_cast<byte *>(ut_align(buf, srv_page_size));
memset(page, '\0', UNIV_PAGE_SIZE);
memset(page, '\0', srv_page_size);
fsp_header_init_fields(page, space_id, flags);
mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, space_id);
@ -4271,12 +4220,12 @@ xb_space_create_file(
buf_flush_init_for_writing(NULL, page, NULL, 0);
ret = os_file_write(IORequestWrite, path, *file, page, 0,
UNIV_PAGE_SIZE);
srv_page_size);
} else {
page_zip_des_t page_zip;
ulint zip_size = page_size.physical();
page_zip_set_size(&page_zip, zip_size);
page_zip.data = page + UNIV_PAGE_SIZE;
page_zip.data = page + srv_page_size;
fprintf(stderr, "zip_size = " ULINTPF "\n", zip_size);
#ifdef UNIV_DEBUG
@ -4562,8 +4511,6 @@ xtrabackup_apply_delta(
posix_fadvise(src_file, 0, 0, POSIX_FADV_SEQUENTIAL);
os_file_set_nocache(src_file, src_path, "OPEN");
dst_file = xb_delta_open_matching_space(
dbname, space_name, info,
dst_path, sizeof(dst_path), &success);
@ -4574,8 +4521,6 @@ xtrabackup_apply_delta(
posix_fadvise(dst_file, 0, 0, POSIX_FADV_DONTNEED);
os_file_set_nocache(dst_file, dst_path, "OPEN");
/* allocate buffer for incremental backup (4096 pages) */
incremental_buffer_base = static_cast<byte *>
(malloc((page_size / 4 + 1) * page_size));
@ -4658,7 +4603,7 @@ xtrabackup_apply_delta(
n_pages * page_size))
goto error;
} else if (fil_space_t* space
= fil_space_acquire(0)) {
= fil_system.sys_space) {
/* The system tablespace can
consist of multiple files. The
first one has full tablespace
@ -4669,7 +4614,6 @@ xtrabackup_apply_delta(
bool fail = !strcmp(n->name, dst_path)
&& !fil_space_extend(
space, (ulint)n_pages);
fil_space_release(space);
if (fail) goto error;
}
}
@ -4681,6 +4625,13 @@ xtrabackup_apply_delta(
}
}
/* Free file system buffer cache after the batch was written. */
#ifdef __linux__
os_file_flush_func(dst_file);
#endif
posix_fadvise(dst_file, 0, 0, POSIX_FADV_DONTNEED);
incremental_buffers++;
}
@ -4998,12 +4949,11 @@ xtrabackup_prepare_func(char** argv)
goto error_cleanup;
}
xb_normalize_init_values();
sync_check_init();
ut_d(sync_check_enable());
ut_crc32_init();
recv_sys_init();
log_sys_init();
log_sys.create();
recv_recovery_on = true;
#ifdef WITH_INNODB_DISALLOW_WRITES
@ -5037,7 +4987,7 @@ xtrabackup_prepare_func(char** argv)
os_event_destroy(srv_allow_writes_event);
#endif
innodb_free_param();
log_shutdown();
log_sys.close();
sync_check_close();
if (!ok) goto error_cleanup;
}

View File

@ -1072,7 +1072,7 @@ static int convert_file(REPLACE *rep, char * name)
if (!(in= my_fopen(org_name,O_RDONLY,MYF(MY_WME))))
DBUG_RETURN(1);
dirname_part(dir_buff, org_name, &dir_buff_length);
if ((temp_file= create_temp_file(tempname, dir_buff, "PR", O_WRONLY,
if ((temp_file= create_temp_file(tempname, dir_buff, "PR", 0,
MYF(MY_WME))) < 0)
{
my_fclose(in,MYF(0));

View File

@ -72,7 +72,7 @@ my_bool my_hash_init2(HASH *hash, uint growth_size, CHARSET_INFO *charset,
uint flags);
void my_hash_free(HASH *tree);
void my_hash_reset(HASH *hash);
uchar *my_hash_element(HASH *hash, ulong idx);
uchar *my_hash_element(HASH *hash, size_t idx);
uchar *my_hash_search(const HASH *info, const uchar *key, size_t length);
uchar *my_hash_search_using_hash_value(const HASH *info,
my_hash_value_type hash_value,

View File

@ -217,7 +217,7 @@ extern int heap_write(HP_INFO *info,const uchar *buff);
extern int heap_update(HP_INFO *info,const uchar *old,const uchar *newdata);
extern int heap_rrnd(HP_INFO *info,uchar *buf,uchar *pos);
extern int heap_scan_init(HP_INFO *info);
extern int heap_scan(register HP_INFO *info, uchar *record);
extern int heap_scan(HP_INFO *info, uchar *record);
extern int heap_delete(HP_INFO *info,const uchar *buff);
extern int heap_info(HP_INFO *info,HEAPINFO *x,int flag);
extern int heap_create(const char *name,

View File

@ -1093,7 +1093,7 @@ my_well_formed_length(CHARSET_INFO *cs, const char *b, const char *e,
MY_STRCOPY_STATUS status;
(void) cs->cset->well_formed_char_length(cs, b, e, nchars, &status);
*error= status.m_well_formed_error_pos == NULL ? 0 : 1;
return status.m_source_end_pos - b;
return (size_t) (status.m_source_end_pos - b);
}

View File

@ -366,7 +366,7 @@ int maria_sort_index(HA_CHECK *param, MARIA_HA *info, char * name);
int maria_zerofill(HA_CHECK *param, MARIA_HA *info, const char *name);
int maria_repair_by_sort(HA_CHECK *param, MARIA_HA *info,
const char *name, my_bool rep_quick);
int maria_repair_parallel(HA_CHECK *param, register MARIA_HA *info,
int maria_repair_parallel(HA_CHECK *param, MARIA_HA *info,
const char *name, my_bool rep_quick);
int maria_change_to_newfile(const char *filename, const char *old_ext,
const char *new_ext, time_t backup_time,

View File

@ -647,7 +647,7 @@ typedef ulong ha_rows;
#define HA_POS_ERROR (~ (ha_rows) 0)
#define HA_OFFSET_ERROR (~ (my_off_t) 0)
#if SYSTEM_SIZEOF_OFF_T == 4
#if SIZEOF_OFF_T == 4
#define MAX_FILE_SIZE INT_MAX32
#else
#define MAX_FILE_SIZE LONGLONG_MAX

View File

@ -76,7 +76,7 @@ typedef struct my_stat
#else
#if(_MSC_VER)
#if defined(_MSC_VER)
#define MY_STAT struct _stati64 /* 64 bit file size */
#else
#define MY_STAT struct stat /* Original struct has what we need */

View File

@ -189,15 +189,6 @@
#define __builtin_expect(x, expected_value) (x)
#endif
/**
The semantics of builtin_expect() are that
1) its two arguments are long
2) it's likely that they are ==
Those of our likely(x) are that x can be bool/int/longlong/pointer.
*/
#define likely(x) __builtin_expect(((x) != 0),1)
#define unlikely(x) __builtin_expect(((x) != 0),0)
/* Fix problem with S_ISLNK() on Linux */
#if defined(TARGET_OS_LINUX) || defined(__GLIBC__)
#undef _GNU_SOURCE
@ -384,6 +375,36 @@ C_MODE_END
#include <crypt.h>
#endif
/* Add checking if we are using likely/unlikely wrong */
#ifdef CHECK_UNLIKELY
C_MODE_START
extern void init_my_likely(), end_my_likely(FILE *);
extern int my_likely_ok(const char *file_name, uint line);
extern int my_likely_fail(const char *file_name, uint line);
C_MODE_END
#define likely(A) ((A) ? (my_likely_ok(__FILE__, __LINE__),1) : (my_likely_fail(__FILE__, __LINE__), 0))
#define unlikely(A) ((A) ? (my_likely_fail(__FILE__, __LINE__),1) : (my_likely_ok(__FILE__, __LINE__), 0))
/*
These macros should be used when the check fails often when running benchmarks but
we know for sure that the check is correct in a production environment
*/
#define checked_likely(A) (A)
#define checked_unlikely(A) (A)
#else
/**
The semantics of builtin_expect() are that
1) its two arguments are long
2) it's likely that they are ==
Those of our likely(x) are that x can be bool/int/longlong/pointer.
*/
#define likely(x) __builtin_expect(((x) != 0),1)
#define unlikely(x) __builtin_expect(((x) != 0),0)
#define checked_likely(x) likely(x)
#define checked_unlikely(x) unlikely(x)
#endif /* CHECK_UNLIKELY */
/*
A lot of our programs uses asserts, so better to always include it
This also fixes a problem when people uses DBUG_ASSERT without including
@ -579,8 +600,8 @@ typedef SOCKET_SIZE_TYPE size_socket;
#endif
#endif /* O_SHARE */
#ifndef O_TEMPORARY
#define O_TEMPORARY 0
#ifndef O_SEQUENTIAL
#define O_SEQUENTIAL 0
#endif
#ifndef O_SHORT_LIVED
#define O_SHORT_LIVED 0
@ -710,7 +731,7 @@ typedef SOCKET_SIZE_TYPE size_socket;
#define closesocket(A) close(A)
#endif
#if (_MSC_VER)
#if defined(_MSC_VER)
#if !defined(_WIN64)
inline double my_ulonglong2double(unsigned long long value)
{
@ -807,37 +828,6 @@ inline unsigned long long my_double2ulonglong(double d)
#define SIZE_T_MAX (~((size_t) 0))
#endif
#ifndef HAVE_FINITE
#define finite(x) (1.0 / fabs(x) > 0.0)
#endif
#ifndef isfinite
#define isfinite(x) finite(x)
#endif
#ifndef HAVE_ISNAN
#define isnan(x) ((x) != (x))
#endif
#define my_isnan(x) isnan(x)
#ifndef HAVE_ISINF
#define isinf(X) (!isfinite(X) && !isnan(X))
#endif
#define my_isinf(X) isinf(X)
#ifdef __cplusplus
#include <cmath>
#ifndef isfinite
#define isfinite(X) std::isfinite(X)
#endif
#ifndef isnan
#define isnan(X) std::isnan(X)
#endif
#ifndef isinf
#define isinf(X) std::isinf(X)
#endif
#endif
/* Define missing math constants. */
#ifndef M_PI
#define M_PI 3.14159265358979323846
@ -849,17 +839,6 @@ inline unsigned long long my_double2ulonglong(double d)
#define M_LN2 0.69314718055994530942
#endif
#ifndef HAVE_LOG2
/*
This will be slightly slower and perhaps a tiny bit less accurate than
doing it the IEEE754 way but log2() should be available on C99 systems.
*/
static inline double log2(double x)
{
return (log(x) / M_LN2);
}
#endif
/*
Max size that must be added to a so that we know Size to make
addressable obj.
@ -1166,7 +1145,7 @@ typedef struct { const char *dli_fname, dli_fbase; } Dl_info;
/* Provide __func__ macro definition for platforms that miss it. */
#if !defined (__func__)
#if __STDC_VERSION__ < 199901L
#if defined(__STDC_VERSION__) && __STDC_VERSION__ < 199901L
# if __GNUC__ >= 2
# define __func__ __FUNCTION__
# else
@ -1185,41 +1164,6 @@ typedef struct { const char *dli_fname, dli_fbase; } Dl_info;
#endif
#endif /* !defined(__func__) */
#ifndef HAVE_RINT
/**
All integers up to this number can be represented exactly as double precision
values (DBL_MANT_DIG == 53 for IEEE 754 hardware).
*/
#define MAX_EXACT_INTEGER ((1LL << DBL_MANT_DIG) - 1)
/**
rint(3) implementation for platforms that do not have it.
Always rounds to the nearest integer with ties being rounded to the nearest
even integer to mimic glibc's rint() behavior in the "round-to-nearest"
FPU mode. Hardware-specific optimizations are possible (frndint on x86).
Unlike this implementation, hardware will also honor the FPU rounding mode.
*/
static inline double rint(double x)
{
double f, i;
f = modf(x, &i);
/*
All doubles with absolute values > MAX_EXACT_INTEGER are even anyway,
no need to check it.
*/
if (x > 0.0)
i += (double) ((f > 0.5) || (f == 0.5 &&
i <= (double) MAX_EXACT_INTEGER &&
(longlong) i % 2));
else
i -= (double) ((f < -0.5) || (f == -0.5 &&
i >= (double) -MAX_EXACT_INTEGER &&
(longlong) i % 2));
return i;
}
#endif /* HAVE_RINT */
/*
MYSQL_PLUGIN_IMPORT macro is used to export mysqld data
(i.e variables) for usage in storage engine loadable plugins.
@ -1258,7 +1202,7 @@ static inline double rint(double x)
CMake using getconf
*/
#if !defined(CPU_LEVEL1_DCACHE_LINESIZE) || CPU_LEVEL1_DCACHE_LINESIZE == 0
#if CPU_LEVEL1_DCACHE_LINESIZE == 0
#if defined(CPU_LEVEL1_DCACHE_LINESIZE) && CPU_LEVEL1_DCACHE_LINESIZE == 0
#undef CPU_LEVEL1_DCACHE_LINESIZE
#endif
@ -1279,5 +1223,4 @@ static inline double rint(double x)
#else
#define NOT_FIXED_DEC FLOATING_POINT_DECIMALS
#endif
#endif /* my_global_h */

View File

@ -67,6 +67,7 @@ typedef struct my_aio_result {
#define MY_WAIT_IF_FULL 32U /* Wait and try again if disk full error */
#define MY_IGNORE_BADFD 32U /* my_sync(): ignore 'bad descriptor' errors */
#define MY_ENCRYPT 64U /* Encrypt IO_CACHE temporary files */
#define MY_TEMPORARY 64U /* create_temp_file(): delete file at once */
#define MY_NOSYMLINKS 512U /* my_open(): don't follow symlinks */
#define MY_FULL_IO 512U /* my_read(): loop until I/O is complete */
#define MY_DONT_CHECK_FILESIZE 128U /* Option to init_io_cache() */
@ -573,21 +574,21 @@ static inline my_bool my_b_write_byte(IO_CACHE *info, uchar chr)
static inline size_t my_b_fill(IO_CACHE *info)
{
info->read_pos= info->read_end;
return _my_b_read(info,0,0) ? 0 : info->read_end - info->read_pos;
return _my_b_read(info,0,0) ? 0 : (size_t) (info->read_end - info->read_pos);
}
static inline my_off_t my_b_tell(const IO_CACHE *info)
{
if (info->type == WRITE_CACHE) {
return info->pos_in_file + (info->write_pos - info->request_pos);
return info->pos_in_file + (my_off_t)(info->write_pos - info->request_pos);
}
return info->pos_in_file + (info->read_pos - info->request_pos);
return info->pos_in_file + (my_off_t) (info->read_pos - info->request_pos);
}
static inline my_off_t my_b_write_tell(const IO_CACHE *info)
{
return info->pos_in_file + (info->write_pos - info->write_buffer);
return info->pos_in_file + (my_off_t) (info->write_pos - info->write_buffer);
}
static inline uchar* my_b_get_buffer_start(const IO_CACHE *info)
@ -597,7 +598,7 @@ static inline uchar* my_b_get_buffer_start(const IO_CACHE *info)
static inline size_t my_b_get_bytes_in_buffer(const IO_CACHE *info)
{
return info->read_end - info->request_pos;
return (size_t) (info->read_end - info->request_pos);
}
static inline my_off_t my_b_get_pos_in_file(const IO_CACHE *info)
@ -608,9 +609,9 @@ static inline my_off_t my_b_get_pos_in_file(const IO_CACHE *info)
static inline size_t my_b_bytes_in_cache(const IO_CACHE *info)
{
if (info->type == WRITE_CACHE) {
return info->write_end - info->write_pos;
return (size_t) (info->write_end - info->write_pos);
}
return info->read_end - info->read_pos;
return (size_t) (info->read_end - info->read_pos);
}
int my_b_copy_to_file(IO_CACHE *cache, FILE *file);
@ -733,12 +734,6 @@ void my_create_backup_name(char *to, const char *from,
extern int my_copystat(const char *from, const char *to, int MyFlags);
extern char * my_filename(File fd);
#ifdef EXTRA_DEBUG
void my_print_open_files(void);
#else
#define my_print_open_files()
#endif
extern my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist);
extern char *my_tmpdir(MY_TMPDIR *tmpdir);
extern void free_tmpdir(MY_TMPDIR *tmpdir);

View File

@ -104,7 +104,8 @@ typedef struct st_mysql_time_status
static inline void my_time_status_init(MYSQL_TIME_STATUS *status)
{
status->warnings= status->precision= 0;
status->warnings= 0;
status->precision= 0;
}
my_bool check_date(const MYSQL_TIME *ltime, my_bool not_zero_date,

View File

@ -373,7 +373,7 @@ typedef struct st_mi_sort_param
int (*key_read)(struct st_mi_sort_param *,void *);
int (*key_write)(struct st_mi_sort_param *, const void *);
void (*lock_in_memory)(HA_CHECK *);
int (*write_keys)(struct st_mi_sort_param *, register uchar **,
int (*write_keys)(struct st_mi_sort_param *, uchar **,
ulonglong , struct st_buffpek *, IO_CACHE *);
my_off_t (*read_to_buffer)(IO_CACHE *,struct st_buffpek *, uint);
int (*write_key)(struct st_mi_sort_param *, IO_CACHE *,uchar *,
@ -383,16 +383,15 @@ typedef struct st_mi_sort_param
/* functions in mi_check */
void myisamchk_init(HA_CHECK *param);
int chk_status(HA_CHECK *param, MI_INFO *info);
int chk_del(HA_CHECK *param, register MI_INFO *info, ulonglong test_flag);
int chk_del(HA_CHECK *param, MI_INFO *info, ulonglong test_flag);
int chk_size(HA_CHECK *param, MI_INFO *info);
int chk_key(HA_CHECK *param, MI_INFO *info);
int chk_data_link(HA_CHECK *param, MI_INFO *info, my_bool extend);
int mi_repair(HA_CHECK *param, register MI_INFO *info,
char * name, int rep_quick);
int mi_sort_index(HA_CHECK *param, register MI_INFO *info, char * name);
int mi_repair_by_sort(HA_CHECK *param, register MI_INFO *info,
int mi_repair(HA_CHECK *param, MI_INFO *info, char * name, int rep_quick);
int mi_sort_index(HA_CHECK *param, MI_INFO *info, char * name);
int mi_repair_by_sort(HA_CHECK *param, MI_INFO *info,
const char * name, int rep_quick);
int mi_repair_parallel(HA_CHECK *param, register MI_INFO *info,
int mi_repair_parallel(HA_CHECK *param, MI_INFO *info,
const char * name, int rep_quick);
int change_to_newfile(const char * filename, const char * old_ext,
const char * new_ext, time_t backup_time, myf myflags);

Some files were not shown because too many files have changed in this diff Show More