Merge branch '10.5' into 10.6

This commit is contained in:
Vladislav Vaintroub 2020-07-03 21:49:45 +02:00
commit 272828a171
1195 changed files with 48743 additions and 27688 deletions

4
.gitignore vendored
View File

@ -8,6 +8,8 @@
.*.swp
*.ninja
.ninja_*
*.mri
*.mri.tpl
.gdb_history
.vs/
errmsg.sys
@ -88,7 +90,7 @@ mysql-test/lib/My/SafeProcess/my_safe_process
mysql-test/lib/My/SafeProcess/wsrep_check_version
mysql-test/mtr
mysql-test/mysql-test-run
mysql-test/var
mysql-test/var*
mysql-test-gcov.err
mysql-test-gcov.msg
mysys/test_hash

3
.gitmodules vendored
View File

@ -14,3 +14,6 @@
[submodule "storage/maria/libmarias3"]
path = storage/maria/libmarias3
url = https://github.com/mariadb-corporation/libmarias3.git
[submodule "storage/columnstore/columnstore"]
path = storage/columnstore/columnstore
url = https://github.com/mariadb-corporation/mariadb-columnstore-engine.git

View File

@ -24,6 +24,9 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.7)
IF(POLICY CMP0022)
CMAKE_POLICY(SET CMP0022 NEW)
ENDIF()
IF(POLICY CMP0048)
CMAKE_POLICY(SET CMP0048 NEW)
ENDIF()
IF(POLICY CMP0054)
CMAKE_POLICY(SET CMP0054 NEW)
ENDIF()
@ -170,7 +173,6 @@ INCLUDE(systemd)
INCLUDE(mysql_add_executable)
INCLUDE(symlinks)
INCLUDE(compile_flags)
INCLUDE(crc32)
INCLUDE(pmem)
# Handle options
@ -239,6 +241,9 @@ IF (WITH_MSAN)
MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=memory -fsanitize-memory-track-origins -U_FORTIFY_SOURCE" DEBUG RELWITHDEBINFO)
ENDIF()
# Be nice to profilers etc
MY_CHECK_AND_SET_COMPILER_FLAG("-fno-omit-frame-pointer" RELWITHDEBINFO)
# enable security hardening features, like most distributions do
# in our benchmarks that costs about ~1% of performance, depending on the load
OPTION(SECURITY_HARDENED "Use security-enhancing compiler features (stack protector, relro, etc)" ON)
@ -420,7 +425,7 @@ INCLUDE(mariadb_connector_c) # this does ADD_SUBDIRECTORY(libmariadb)
INCLUDE(cpack_rpm)
INCLUDE(cpack_deb)
SET(PYTHON_SHEBANG "/usr/bin/env python" CACHE STRING "python shebang")
SET(PYTHON_SHEBANG "/usr/bin/env python3" CACHE STRING "python shebang")
MARK_AS_ADVANCED(PYTHON_SHEBANG)
# Add storage engines and plugins.

View File

@ -92,6 +92,9 @@ extern "C" {
#include <conio.h>
#else
#include <readline.h>
#if !defined(USE_LIBEDIT_INTERFACE)
#include <history.h>
#endif
#define HAVE_READLINE
#define USE_POPEN
#endif
@ -1043,22 +1046,6 @@ static const char *embedded_server_groups[]=
{ "server", "embedded", "mysql_SERVER", "mariadb_SERVER", 0 };
#ifdef HAVE_READLINE
/*
HIST_ENTRY is defined for libedit, but not for the real readline
Need to redefine it for real readline to find it
*/
#if !defined(HAVE_HIST_ENTRY)
typedef struct _hist_entry {
const char *line;
const char *data;
} HIST_ENTRY;
#endif
extern "C" int add_history(const char *command); /* From readline directory */
extern "C" int read_history(const char *command);
extern "C" int write_history(const char *command);
extern "C" HIST_ENTRY *history_get(int num);
extern "C" int history_length;
static int not_in_history(const char *line);
static void initialize_readline ();
static void fix_history(String *final_command);
@ -1300,8 +1287,8 @@ sig_handler mysql_end(int sig)
{
#ifndef _WIN32
/*
Ingnoring SIGQUIT and SIGINT signals when cleanup process starts.
This will help in resolving the double free issues, which occures in case
Ignoring SIGQUIT and SIGINT signals when cleanup process starts.
This will help in resolving the double free issues, which occurs in case
the signal handler function is started in between the clean up function.
*/
signal(SIGQUIT, SIG_IGN);
@ -4733,7 +4720,7 @@ sql_real_connect(char *host,char *database,char *user,char *password,
/*
CLIENT_PROGRESS_OBSOLETE is set only if we requested it in
mysql_real_connect() and the server also supports it
*/
*/
if (mysql.client_flag & CLIENT_PROGRESS_OBSOLETE)
mysql_options(&mysql, MYSQL_PROGRESS_CALLBACK, (void*) report_progress);
#else
@ -4802,7 +4789,7 @@ com_status(String *buffer __attribute__((unused)),
tee_fprintf(stdout, "\nConnection id:\t\t%lu\n",mysql_thread_id(&mysql));
/*
Don't remove "limit 1",
it is protection againts SQL_SELECT_LIMIT=0
it is protection against SQL_SELECT_LIMIT=0
*/
if (!mysql_store_result_for_lazy(&result))
{
@ -5151,7 +5138,7 @@ static const char *construct_prompt()
time_t lclock = time(NULL); // Get the date struct
struct tm *t = localtime(&lclock);
/* parse thru the settings for the prompt */
/* parse through the settings for the prompt */
for (char *c = current_prompt; *c ; c++)
{
if (*c != PROMPT_CHAR)

View File

@ -1024,7 +1024,7 @@ static int find_plugin(char *tp_path)
/**
Build the boostrap file.
Build the bootstrap file.
Create a new file and populate it with SQL commands to ENABLE or DISABLE
the plugin via REPLACE and DELETE operations on the mysql.plugin table.
@ -1153,7 +1153,7 @@ exit:
Create a command line sequence to launch mysqld in bootstrap mode. This
will allow mysqld to launch a minimal server instance to read and
execute SQL commands from a file piped in (the boostrap file). We use
execute SQL commands from a file piped in (the bootstrap file). We use
the --no-defaults option to skip reading values from the config file.
The bootstrap mode skips loading of plugins and many other subsystems.

View File

@ -753,7 +753,7 @@ static bool shall_skip_database(const char *log_dbname)
/**
Print "use <db>" statement when current db is to be changed.
We have to control emiting USE statements according to rewrite-db options.
We have to control emitting USE statements according to rewrite-db options.
We have to do it here (see process_event() below) and to suppress
producing USE statements by corresponding log event print-functions.
*/
@ -785,7 +785,7 @@ print_use_stmt(PRINT_EVENT_INFO* pinfo, const Query_log_event *ev)
// In case of rewrite rule print USE statement for db_to
my_fprintf(result_file, "use %`s%s\n", db_to, pinfo->delimiter);
// Copy the *original* db to pinfo to suppress emiting
// Copy the *original* db to pinfo to suppress emitting
// of USE stmts by log_event print-functions.
memcpy(pinfo->db, db, db_len + 1);
}

View File

@ -147,7 +147,7 @@ static char * opt_mysql_unix_port=0;
static int first_error=0;
/*
multi_source is 0 if old server or 2 if server that support multi source
This is choosen this was as multi_source has 2 extra columns first in
This is chosen this was as multi_source has 2 extra columns first in
SHOW ALL SLAVES STATUS.
*/
static uint multi_source= 0;
@ -2075,7 +2075,7 @@ static void print_xml_tag(FILE * xml_file, const char* sbeg,
<stag_atr="sval" xsi:nil="true"/>
NOTE
sval MUST be a NULL terminated string.
sval string will be qouted before output.
sval string will be quoted before output.
*/
static void print_xml_null_tag(FILE * xml_file, const char* sbeg,
@ -2147,7 +2147,7 @@ static void print_xml_cdata(FILE *xml_file, const char *str, ulong len)
Print tag with many attribute to the xml_file. Format is:
\t\t<row_name Atr1="Val1" Atr2="Val2"... />
NOTE
All atributes and values will be quoted before output.
All attributes and values will be quoted before output.
*/
static void print_xml_row(FILE *xml_file, const char *row_name,
@ -2632,7 +2632,7 @@ static uint dump_routines_for_db(char *db)
print_comment(sql_file, 1,
"-- does %s have permissions on mysql.proc?\n\n",
fix_for_comment(current_user));
maybe_die(EX_MYSQLERR,"%s has insufficent privileges to %s!",
maybe_die(EX_MYSQLERR,"%s has insufficient privileges to %s!",
current_user, query_buff);
}
else if (strlen(row[2]))
@ -4187,7 +4187,7 @@ static void dump_table(char *table, char *db, const uchar *hash_key, size_t len)
}
}
/* XML - close table tag and supress regular output */
/* XML - close table tag and suppress regular output */
if (opt_xml)
fputs("\t</table_data>\n", md_result_file);
else if (extended_insert && row_break)

View File

@ -581,7 +581,7 @@ static char *field_escape(char *to,const char *from,uint length)
else
{
if (*from == '\'' && !end_backslashes)
*to++= *from; /* We want a dublicate of "'" for MySQL */
*to++= *from; /* We want a duplicate of "'" for MySQL */
end_backslashes=0;
}
}

View File

@ -2283,7 +2283,7 @@ slap_connect(MYSQL *mysql)
opt_mysql_unix_port,
connect_flags))
{
/* Connect suceeded */
/* Connect succeeded */
connect_error= 0;
break;
}

View File

@ -146,7 +146,7 @@ struct property {
my_bool *var; /* Actual variable */
my_bool set; /* Has been set for ONE command */
my_bool old; /* If set, thus is the old value */
my_bool reverse; /* Varible is true if disabled */
my_bool reverse; /* Variable is true if disabled */
const char *env_name; /* Env. variable name */
};
@ -566,7 +566,7 @@ DYNAMIC_ARRAY regex_arr; /* stores a list of st_regex subsitutions */
Temporary storage areas for substitutions. To reduce unnessary copying
and memory freeing/allocation, we pre-allocate two buffers, and alternate
their use, one for input/one for output, the roles changing on the next
st_regex substition. At the end of substitutions buf points to the
st_regex substitution. At the end of substitutions buf points to the
one containing the final result.
*/
char* buf;
@ -587,9 +587,10 @@ ATTRIBUTE_NORETURN
static void cleanup_and_exit(int exit_code);
ATTRIBUTE_NORETURN
void really_die(const char *msg);
static void really_die(const char *msg);
void report_or_die(const char *fmt, ...);
void die(const char *fmt, ...);
ATTRIBUTE_NORETURN
static void die(const char *fmt, ...);
static void make_error_message(char *buf, size_t len, const char *fmt, va_list args);
ATTRIBUTE_NORETURN ATTRIBUTE_FORMAT(printf, 1, 2)
void abort_not_supported_test(const char *fmt, ...);
@ -1461,7 +1462,7 @@ void free_used_memory()
}
static void cleanup_and_exit(int exit_code)
ATTRIBUTE_NORETURN static void cleanup_and_exit(int exit_code)
{
free_used_memory();
@ -1540,7 +1541,7 @@ static void make_error_message(char *buf, size_t len, const char *fmt, va_list a
s+= my_snprintf(s, end -s, "\n");
}
void die(const char *fmt, ...)
static void die(const char *fmt, ...)
{
char buff[DIE_BUFF_SIZE];
va_list args;
@ -1549,7 +1550,7 @@ void die(const char *fmt, ...)
really_die(buff);
}
void really_die(const char *msg)
static void really_die(const char *msg)
{
static int dying= 0;
fflush(stdout);
@ -3094,7 +3095,7 @@ void open_file(const char *name)
strxnmov(buff, sizeof(buff), opt_overlay_dir, suffix, name, NullS);
/*
Overlayed rty/include/thing.inc can contain the line
Overlaid rty/include/thing.inc can contain the line
--source thing.inc
which would mean to include qwe/include/thing.inc.
But it looks like including "itself", so don't try to open the file,
@ -4802,7 +4803,7 @@ int do_save_master_pos()
mysql_errno(mysql), mysql_error(mysql));
if (!(res = mysql_store_result(mysql)))
die("mysql_store_result() retuned NULL for '%s'", query);
die("mysql_store_result() returned NULL for '%s'", query);
if (!(row = mysql_fetch_row(res)))
die("empty result in show master status");
strnmov(master_pos.file, row[0], sizeof(master_pos.file)-1);
@ -5349,7 +5350,7 @@ void do_get_errcodes(struct st_command *command)
p++;
}
/* Convert the sting to int */
/* Convert the string to int */
if (!str2int(start, 10, (long) INT_MIN, (long) INT_MAX, &val))
die("Invalid argument to error: '%s'", command->first_argument);
@ -5741,7 +5742,7 @@ int connect_n_handle_errors(struct st_command *command,
dynstr_append_mem(ds, delimiter, delimiter_length);
dynstr_append_mem(ds, "\n", 1);
}
/* Simlified logging if enabled */
/* Simplified logging if enabled */
if (!disable_connect_log && !disable_query_log)
{
replace_dynstr_append(ds, command->query);
@ -7710,6 +7711,28 @@ void append_info(DYNAMIC_STRING *ds, ulonglong affected_rows,
}
#ifndef EMBEDDED_LIBRARY
static const char *trking_info_desc[SESSION_TRACK_END + 1]=
{
"Tracker : SESSION_TRACK_SYSTEM_VARIABLES\n",
"Tracker : SESSION_TRACK_SCHEMA\n",
"Tracker : SESSION_TRACK_STATE_CHANGE\n",
"Tracker : SESSION_TRACK_GTIDS\n",
"Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS\n",
"Tracker : SESSION_TRACK_TRANSACTION_TYPE\n"
#ifdef USER_VAR_TRACKING
,
"Tracker : SESSION_TRACK_MYSQL_RESERVED1\n",
"Tracker : SESSION_TRACK_MYSQL_RESERVED2\n",
"Tracker : SESSION_TRACK_MYSQL_RESERVED3\n",
"Tracker : SESSION_TRACK_MYSQL_RESERVED4\n",
"Tracker : SESSION_TRACK_MYSQL_RESERVED5\n",
"Tracker : SESSION_TRACK_MYSQL_RESERVED6\n",
"Tracker : SESSION_TRACK_USER_VARIABLES\n"
#endif // USER_VAR_TRACKING
};
#endif // EMBEDDED_LIBRARY
/**
@brief Append state change information (received through Ok packet) to the output.
@ -7730,31 +7753,15 @@ static void append_session_track_info(DYNAMIC_STRING *ds, MYSQL *mysql)
&data, &data_length))
{
dynstr_append(ds, "-- ");
switch (type)
if (type <= SESSION_TRACK_END)
{
case SESSION_TRACK_SYSTEM_VARIABLES:
dynstr_append(ds, "Tracker : SESSION_TRACK_SYSTEM_VARIABLES\n");
break;
case SESSION_TRACK_SCHEMA:
dynstr_append(ds, "Tracker : SESSION_TRACK_SCHEMA\n");
break;
case SESSION_TRACK_STATE_CHANGE:
dynstr_append(ds, "Tracker : SESSION_TRACK_STATE_CHANGE\n");
break;
case SESSION_TRACK_GTIDS:
dynstr_append(ds, "Tracker : SESSION_TRACK_GTIDS\n");
break;
case SESSION_TRACK_TRANSACTION_CHARACTERISTICS:
dynstr_append(ds, "Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS\n");
break;
case SESSION_TRACK_TRANSACTION_TYPE:
dynstr_append(ds, "Tracker : SESSION_TRACK_TRANSACTION_TYPE\n");
break;
default:
DBUG_ASSERT(0);
dynstr_append(ds, "\n");
dynstr_append(ds, trking_info_desc[type]);
}
else
{
DBUG_ASSERT(0);
dynstr_append(ds, "Tracker???\n");
}
dynstr_append(ds, "-- ");
dynstr_append_mem(ds, data, data_length);
@ -7766,7 +7773,13 @@ static void append_session_track_info(DYNAMIC_STRING *ds, MYSQL *mysql)
&data, &data_length))
{
dynstr_append(ds, "\n-- ");
dynstr_append_mem(ds, data, data_length);
if (data == NULL)
{
DBUG_ASSERT(data_length == 0);
dynstr_append_mem(ds, "<NULL>", sizeof("<NULL>") - 1);
}
else
dynstr_append_mem(ds, data, data_length);
}
dynstr_append(ds, "\n\n");
}
@ -8206,7 +8219,7 @@ void handle_no_error(struct st_command *command)
SYNPOSIS
run_query_stmt
mysql - mysql handle
command - currrent command pointer
command - current command pointer
query - query string to execute
query_len - length query string to execute
ds - output buffer where to store result form query
@ -8446,7 +8459,7 @@ end:
/*
Create a util connection if one does not already exists
and use that to run the query
This is done to avoid implict commit when creating/dropping objects such
This is done to avoid implicit commit when creating/dropping objects such
as view, sp etc.
*/
@ -8487,7 +8500,7 @@ int util_query(MYSQL* org_mysql, const char* query){
SYNPOSIS
run_query()
mysql mysql handle
command currrent command pointer
command current command pointer
flags control the phased/stages of query execution to be performed
if QUERY_SEND_FLAG bit is on, the query will be sent. If QUERY_REAP_FLAG
@ -10244,7 +10257,7 @@ int multi_reg_replace(struct st_replace_regex* r,char* val)
if (!reg_replace(&out_buf, buf_len_p, re.pattern, re.replace,
in_buf, re.icase))
{
/* if the buffer has been reallocated, make adjustements */
/* if the buffer has been reallocated, make adjustments */
if (save_out_buf != out_buf)
{
if (save_out_buf == r->even_buf)
@ -10511,7 +10524,7 @@ typedef struct st_rep_set {
uint found_len; /* Best match to date */
int found_offset;
uint table_offset;
uint size_of_bits; /* For convinience */
uint size_of_bits; /* For convenience */
} REP_SET;
typedef struct st_rep_sets {
@ -10614,7 +10627,7 @@ REPLACE *init_replace(char * *from, char * *to,uint count,
DBUG_RETURN(0);
}
(void) make_new_set(&sets); /* Set starting set */
make_sets_invisible(&sets); /* Hide previus sets */
make_sets_invisible(&sets); /* Hide previous sets */
used_sets=-1;
word_states=make_new_set(&sets); /* Start of new word */
start_states=make_new_set(&sets); /* This is first state */

8
cmake/FindBISON.cmake Normal file
View File

@ -0,0 +1,8 @@
IF(DEFINED BISON_EXECUTABLE)
SET(bison_quiet QUIET)
ENDIF()
set(orig_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
unset(CMAKE_MODULE_PATH)
find_package(BISON ${BISON_FIND_VERSION} ${bison_quiet} ${BISON_FIND_REQUIRED})
set(CMAKE_MODULE_PATH ${orig_CMAKE_MODULE_PATH})

View File

@ -1,9 +1,9 @@
find_path(LZ4_INCLUDE_DIR NAMES lz4.h)
find_library(LZ4_LIBRARY NAMES lz4)
find_library(LZ4_LIBRARIES NAMES lz4)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
LZ4 DEFAULT_MSG
LZ4_LIBRARY LZ4_INCLUDE_DIR)
LZ4_LIBRARIES LZ4_INCLUDE_DIR)
mark_as_advanced(LZ4_INCLUDE_DIR LZ4_LIBRARY)
mark_as_advanced(LZ4_INCLUDE_DIR LZ4_LIBRARIES)

View File

@ -5,10 +5,6 @@
# ZSTD_LIBRARIES - List of libraries when using zstd.
# ZSTD_FOUND - True if zstd found.
if (DEFINED ZSTD_LIBRARIES)
return()
endif()
find_path(ZSTD_INCLUDE_DIR
NAMES zstd.h
HINTS ${ZSTD_ROOT_DIR}/include)
@ -18,7 +14,7 @@ find_library(ZSTD_LIBRARIES
HINTS ${ZSTD_ROOT_DIR}/lib)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(zstd DEFAULT_MSG ZSTD_LIBRARIES ZSTD_INCLUDE_DIR)
find_package_handle_standard_args(ZSTD DEFAULT_MSG ZSTD_LIBRARIES ZSTD_INCLUDE_DIR)
mark_as_advanced(
ZSTD_LIBRARIES

View File

@ -108,6 +108,7 @@ ELSEIF(DEB)
SET(WITH_PCRE system CACHE STRING "")
ELSE()
SET(WITH_SSL bundled CACHE STRING "")
SET(WITH_PCRE bundled CACHE STRING "")
SET(WITH_ZLIB bundled CACHE STRING "")
SET(WITH_JEMALLOC static CACHE STRING "")
SET(PLUGIN_AUTH_SOCKET STATIC CACHE STRING "")
@ -145,7 +146,7 @@ IF(UNIX)
RedHat/Fedora/Oracle Linux: yum install libaio-devel
SuSE: zypper install libaio-devel
If you really do not want it, pass -DIGNORE_AIO_CHECK to cmake.
If you really do not want it, pass -DIGNORE_AIO_CHECK=ON to cmake.
")
ENDIF()

View File

@ -1,4 +1,4 @@
#!/usr/bin/perl
#!/usr/bin/env perl
# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
#

View File

@ -6,5 +6,6 @@ IF(DEB)
SET(CPACK_COMPONENT_SERVER_GROUP "server")
SET(CPACK_COMPONENT_README_GROUP "server")
SET(CPACK_COMPONENTS_ALL Server Test SharedLibraries)
SET(PYTHON_SHEBANG "/usr/bin/python3" CACHE STRING "python shebang")
ENDIF(DEB)

View File

@ -249,9 +249,7 @@ ELSEIF(RPM MATCHES "sles")
"mariadb-server = %{version}-%{release}"
)
ENDIF()
IF(RPM MATCHES "fedora31" OR RPM MATCHES "(rhel|centos)8")
SET(PYTHON_SHEBANG "/usr/bin/python3" CACHE STRING "python shebang")
ENDIF()
SET(PYTHON_SHEBANG "/usr/bin/python3" CACHE STRING "python shebang")
# If we want to build build MariaDB-shared-compat,
# extract compat libraries from MariaDB-shared-5.3 rpm

View File

@ -15,6 +15,7 @@
SET(CPACK_SOURCE_IGNORE_FILES
\\\\.git/
\\\\.git$
\\\\.gitignore$
\\\\.gitattributes$
CMakeCache\\\\.txt$

View File

@ -1,36 +0,0 @@
IF(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|AARCH64")
IF(CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1)
include(CheckCXXSourceCompiles)
CHECK_CXX_SOURCE_COMPILES("
#define CRC32CX(crc, value) __asm__(\"crc32cx %w[c], %w[c], %x[v]\":[c]\"+r\"(crc):[v]\"r\"(value))
asm(\".arch_extension crc\");
unsigned int foo(unsigned int ret) {
CRC32CX(ret, 0);
return ret;
}
int main() { foo(0); }" HAVE_ARMV8_CRC)
CHECK_CXX_SOURCE_COMPILES("
asm(\".arch_extension crypto\");
unsigned int foo(unsigned int ret) {
__asm__(\"pmull v2.1q, v2.1d, v1.1d\");
return ret;
}
int main() { foo(0); }" HAVE_ARMV8_CRYPTO)
CHECK_C_COMPILER_FLAG(-march=armv8-a+crc+crypto HAVE_ARMV8_CRC_CRYPTO_INTRINSICS)
IF(HAVE_ARMV8_CRC_CRYPTO_INTRINSICS)
SET(ARMV8_CRC_COMPILE_FLAGS "${ARMV8_CRC_COMPILE_FLAGS} -march=armv8-a+crc+crypto")
ENDIF()
SET(CRC32_LIBRARY crc32_armv8_neon)
ADD_SUBDIRECTORY(extra/crc32_armv8_neon)
ENDIF()
ENDIF()
IF(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64")
SET(HAVE_CRC32_VPMSUM 1)
SET(CRC32_LIBRARY crc32-vpmsum)
ADD_SUBDIRECTORY(extra/crc32-vpmsum)
ENDIF()

View File

@ -43,7 +43,8 @@ MACRO(CHECK_DTRACE)
IF(DTRACE AND NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD"
AND NOT BUGGY_GCC_NO_DTRACE_MODULES
AND NOT BUGGY_LINUX_DTRACE
AND NOT CMAKE_SYSTEM_NAME MATCHES "SunOS")
AND NOT CMAKE_SYSTEM_NAME MATCHES "SunOS"
AND NOT WIN32)
SET(ENABLE_DTRACE ON CACHE BOOL "Enable dtrace")
ENDIF()
# On GNU/Hurd, dtrace is not supported

View File

@ -175,7 +175,7 @@ SET(INSTALL_BINDIR_DEB "bin")
SET(INSTALL_SBINDIR_DEB "sbin")
SET(INSTALL_SCRIPTDIR_DEB "bin")
SET(INSTALL_SYSCONFDIR_DEB "/etc")
SET(INSTALL_SYSCONF2DIR_DEB "/etc/mysql/conf.d")
SET(INSTALL_SYSCONF2DIR_DEB "/etc/mysql/mariadb.conf.d")
#
SET(INSTALL_LIBDIR_DEB "lib/${CMAKE_CXX_LIBRARY_ARCHITECTURE}")
SET(INSTALL_PLUGINDIR_DEB "lib/mysql/plugin")
@ -195,7 +195,7 @@ SET(INSTALL_SUPPORTFILESDIR_DEB "share/mysql")
#
SET(INSTALL_MYSQLDATADIR_DEB "/var/lib/mysql")
SET(INSTALL_UNIX_ADDRDIR_DEB "/var/run/mysqld/mysqld.sock")
SET(INSTALL_UNIX_ADDRDIR_DEB "/run/mysqld/mysqld.sock")
SET(INSTALL_SYSTEMD_UNITDIR_DEB "/lib/systemd/system")
SET(INSTALL_SYSTEMD_SYSUSERSDIR_DEB "/usr/lib/sysusers.d")
SET(INSTALL_SYSTEMD_TMPFILESDIR_DEB "/usr/lib/tmpfiles.d")

View File

@ -127,7 +127,8 @@ ENDMACRO()
# Merge static libraries into a big static lib. The resulting library
# should not not have dependencies on other static libraries.
# We use it in MySQL to merge mysys,dbug,vio etc into mysqlclient
# We use it in MariaDB to merge mysys,dbug,vio etc into the embedded server
# mariadbd.
MACRO(MERGE_STATIC_LIBS TARGET OUTPUT_NAME LIBS_TO_MERGE)
# To produce a library we need at least one source file.
@ -164,8 +165,18 @@ MACRO(MERGE_STATIC_LIBS TARGET OUTPUT_NAME LIBS_TO_MERGE)
ENDIF()
ENDIF()
ENDFOREACH()
# With static libraries the order matter to some linkers.
# REMOVE_DUPLICATES will keep the first entry and because
# the linker requirement we want to keep the last.
IF(STATIC_LIBS)
LIST(REVERSE STATIC_LIBS)
LIST(REMOVE_DUPLICATES STATIC_LIBS)
LIST(REVERSE STATIC_LIBS)
ENDIF()
IF(OSLIBS)
LIST(REVERSE OSLIBS)
LIST(REMOVE_DUPLICATES OSLIBS)
LIST(REVERSE OSLIBS)
TARGET_LINK_LIBRARIES(${TARGET} ${OSLIBS})
ENDIF()
@ -196,18 +207,34 @@ MACRO(MERGE_STATIC_LIBS TARGET OUTPUT_NAME LIBS_TO_MERGE)
)
ELSE()
# Generic Unix, Cygwin or MinGW. In post-build step, call
# script, that extracts objects from archives with "ar x"
# and repacks them with "ar r"
# script, that uses a MRI script to append static archives.
IF(CMAKE_VERSION VERSION_LESS "3.0")
SET(MRI_SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}.mri")
ELSE()
SET(MRI_SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}-$<CONFIG>.mri")
ENDIF()
SET(MRI_SCRIPT_TPL "${MRI_SCRIPT}.tpl")
SET(SCRIPT_CONTENTS "CREATE $<TARGET_FILE:${TARGET}>\n")
FOREACH(LIB ${STATIC_LIBS})
SET(SCRIPT_CONTENTS "${SCRIPT_CONTENTS}ADDLIB ${LIB}\n")
ENDFOREACH()
FILE(WRITE ${MRI_SCRIPT_TPL} "${SCRIPT_CONTENTS}\nSAVE\nEND\n")
FILE(GENERATE OUTPUT ${MRI_SCRIPT} INPUT ${MRI_SCRIPT_TPL})
ADD_CUSTOM_COMMAND(TARGET ${TARGET} POST_BUILD
DEPENDS ${MRI_SCRIPT}
COMMAND ${CMAKE_COMMAND}
-DTARGET_LOCATION="$<TARGET_FILE:${TARGET}>"
-DTARGET="${TARGET}"
-DSTATIC_LIBS="${STATIC_LIBS}"
-DCMAKE_CURRENT_BINARY_DIR="${CMAKE_CURRENT_BINARY_DIR}"
ARGS
-DTARGET_SCRIPT="${MRI_SCRIPT}"
-DTOP_DIR="${CMAKE_BINARY_DIR}"
-DCMAKE_AR="${CMAKE_AR}"
-DCMAKE_RANLIB="${CMAKE_RANLIB}"
-P "${MYSQL_CMAKE_SCRIPT_DIR}/merge_archives_unix.cmake"
COMMAND ${CMAKE_RANLIB}
ARGS $<TARGET_FILE:${TARGET}>
)
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${MRI_SCRIPT_TPL})
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${MRI_SCRIPT}.mri)
ENDIF()
ENDIF()
ENDMACRO()

View File

@ -58,6 +58,14 @@ IF(GIT_EXECUTABLE)
IF(NOT RESULT EQUAL 0)
SET(GIT_EXECUTABLE)
ENDIF()
EXECUTE_PROCESS(
COMMAND "${GIT_EXECUTABLE}" submodule foreach "${GIT_EXECUTABLE} checkout-index --all --prefix=${PACKAGE_DIR}/storage/columnstore/columnstore/$path/"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/storage/columnstore/columnstore
RESULT_VARIABLE RESULT
)
IF(NOT RESULT EQUAL 0)
SET(GIT_EXECUTABLE)
ENDIF()
ENDIF()
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/include/source_revision.h

View File

@ -43,6 +43,8 @@ ADD_SUBDIRECTORY(libmariadb)
IF(UNIX)
INSTALL(CODE "EXECUTE_PROCESS(
COMMAND ${CMAKE_COMMAND} -E make_directory ${INSTALL_BINDIR}
WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX})
EXECUTE_PROCESS(
COMMAND ${CMAKE_COMMAND} -E create_symlink mariadb_config ${INSTALL_BINDIR}/mariadb-config
WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX})"
COMPONENT Development)

View File

@ -1,4 +1,4 @@
# Copyright (c) 2009 Sun Microsystems, Inc.
# Copyright (c) 2020 IBM
# Use is subject to license terms.
#
# This program is free software; you can redistribute it and/or modify
@ -14,43 +14,21 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
FILE(REMOVE "${TARGET_LOCATION}")
SET(TEMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/merge_archives_${TARGET})
MAKE_DIRECTORY(${TEMP_DIR})
# Extract each archive to its own subdirectory(avoid object filename clashes)
SEPARATE_ARGUMENTS(STATIC_LIBS UNIX_COMMAND "${STATIC_LIBS}")
FOREACH(LIB ${STATIC_LIBS})
GET_FILENAME_COMPONENT(NAME_NO_EXT ${LIB} NAME_WE)
SET(TEMP_SUBDIR ${TEMP_DIR}/${NAME_NO_EXT})
MAKE_DIRECTORY(${TEMP_SUBDIR})
EXECUTE_PROCESS(
COMMAND ${CMAKE_AR} -x ${LIB}
WORKING_DIRECTORY ${TEMP_SUBDIR}
)
# MRI scripts have a problem with +. It's a line contination character
# unfortunately there is no escape character. We know we don't have
# "+" in libraries or the MariaDB paths, but Ubuntu CI builds will have
# in their CI path due to the package names that Ubuntu generates.
# So here we replace the fully expanded paths in the TARGET_SCRIPT,
# strip off the TOP_DIR to make it a relative path to the top level directory
# and then execute AR on the top level directory.
FILE(GLOB_RECURSE LIB_OBJECTS "${TEMP_SUBDIR}/*")
SET(OBJECTS ${OBJECTS} ${LIB_OBJECTS})
ENDFOREACH()
FILE(READ ${TARGET_SCRIPT} SCRIPT_CONTENTS)
STRING(REPLACE "${TOP_DIR}/" "" SCRIPT_CONTENTS_TRIMMED "${SCRIPT_CONTENTS}")
FILE(WRITE "${TARGET_SCRIPT}.mri" ${SCRIPT_CONTENTS_TRIMMED})
# Use relative paths, makes command line shorter.
GET_FILENAME_COMPONENT(ABS_TEMP_DIR ${TEMP_DIR} ABSOLUTE)
FOREACH(OBJ ${OBJECTS})
FILE(RELATIVE_PATH OBJ ${ABS_TEMP_DIR} ${OBJ})
FILE(TO_NATIVE_PATH ${OBJ} OBJ)
SET(ALL_OBJECTS ${ALL_OBJECTS} ${OBJ})
ENDFOREACH()
FILE(TO_NATIVE_PATH ${TARGET_LOCATION} ${TARGET_LOCATION})
# Now pack the objects into library with ar.
EXECUTE_PROCESS(
COMMAND ${CMAKE_AR} -r ${TARGET_LOCATION} ${ALL_OBJECTS}
WORKING_DIRECTORY ${TEMP_DIR}
WORKING_DIRECTORY ${TOP_DIR}
COMMAND ${CMAKE_AR} -M
INPUT_FILE ${TARGET_SCRIPT}.mri
)
EXECUTE_PROCESS(
COMMAND ${CMAKE_RANLIB} ${TARGET_LOCATION}
WORKING_DIRECTORY ${TEMP_DIR}
)
# Cleanup
FILE(REMOVE_RECURSE ${TEMP_DIR})

View File

@ -63,9 +63,9 @@ IF(MINGW AND CMAKE_SIZEOF_VOID_P EQUAL 4)
ADD_DEFINITIONS(-march=i486)
ENDIF()
FUNCTION(ENABLE_ASAN)
IF(NOT CLANG_CL)
MESSAGE(FATAL_ERROR "clang-cl is necessary to enable asan")
MACRO(ENABLE_SANITIZERS)
IF(NOT MSVC)
MESSAGE(FATAL_ERROR "clang-cl or MSVC necessary to enable asan/ubsan")
ENDIF()
# currently, asan is broken with static CRT.
IF(NOT(MSVC_CRT_TYPE STREQUAL "/MD"))
@ -74,25 +74,38 @@ FUNCTION(ENABLE_ASAN)
ENDIF()
ENDIF()
IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
MESSAGE(FATAL_ERROR "-DWITH_ASAN on Windows requires 64bit build")
SET(ASAN_ARCH i386)
ELSE()
IF(NOT CLANG_CL)
MESSAGE(FATAL_ERROR "sanitizers do not yet work on MSVC x64, try 32 bit or clang-cl")
ENDIF()
SET(ASAN_ARCH x86_64)
ENDIF()
# After installation, clang lib directory should be added to PATH
# After installation, clang lib directory should be added to PATH
# (e.g C:/Program Files/LLVM/lib/clang/5.0.1/lib/windows)
FIND_LIBRARY(CLANG_RT_ASAN_DYNAMIC clang_rt.asan_dynamic-x86_64.lib)
IF(NOT CLANG_RT_ASAN_DYNAMIC)
MESSAGE(FATAL_ERROR "Can't enable ASAN : missing clang_rt.asan_dynamic-x86_64.lib")
SET(SANITIZER_LIBS)
SET(SANITIZER_LINK_LIBRARIES)
SET(SANITIZER_COMPILE_FLAGS)
IF(WITH_ASAN)
LIST(APPEND SANITIZER_LIBS
clang_rt.asan_dynamic-${ASAN_ARCH}.lib clang_rt.asan_dynamic_runtime_thunk-${ASAN_ARCH}.lib)
STRING(APPEND SANITIZER_COMPILE_FLAGS " -fsanitize=address")
ENDIF()
FIND_LIBRARY(CLANG_RT_ASAN_DYNAMIC_THUNK clang_rt.asan_dynamic_runtime_thunk-x86_64.lib)
IF(NOT CLANG_RT_ASAN_DYNAMIC_THUNK)
MESSAGE(FATAL_ERROR "Can't enable ASAN : missing clang_rt.asan_dynamic_runtime_thunk-x86_64.lib")
IF(WITH_UBSAN)
STRING(APPEND SANITIZER_COMPILE_FLAGS " -fsanitize=undefined -fno-sanitize=alignment")
ENDIF()
FOREACH(lib ${SANITIZER_LIBS})
FIND_LIBRARY(${lib}_fullpath ${lib})
IF(NOT ${lib}_fullpath)
MESSAGE(FATAL_ERROR "Can't enable sanitizer : missing ${lib}")
ENDIF()
LIST(APPEND CMAKE_REQUIRED_LIBRARIES ${${lib}_fullpath})
STRING(APPEND CMAKE_C_STANDARD_LIBRARIES " \"${${lib}_fullpath}\" ")
STRING(APPEND CMAKE_CXX_STANDARD_LIBRARIES " \"${${lib}_fullpath}\" ")
ENDFOREACH()
STRING(APPEND CMAKE_C_FLAGS " -fsanitize=address")
STRING(APPEND CMAKE_CXX_FLAGS " -fsanitize=address")
LINK_LIBRARIES(${CLANG_RT_ASAN_DYNAMIC} ${CLANG_RT_ASAN_DYNAMIC_THUNK})
ENDFUNCTION()
ENDMACRO()
IF(MSVC)
@ -120,12 +133,6 @@ IF(MSVC)
OPTION(DYNAMIC_UCRT_LINK "Link Universal CRT dynamically, if MSVC_CRT_TYPE=/MT" ON)
SET(DYNAMIC_UCRT_LINKER_OPTION " /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib")
IF(WITH_ASAN)
# Workaround something Linux specific
SET(SECURITY_HARDENED 0 CACHE INTERNAL "" FORCE)
ENABLE_ASAN()
ENDIF()
# Enable debug info also in Release build,
# and create PDB to be able to analyze crashes.
FOREACH(type EXE SHARED MODULE)
@ -141,7 +148,9 @@ IF(MSVC)
FOREACH(lang C CXX)
SET(CMAKE_${lang}_FLAGS_RELEASE "${CMAKE_${lang}_FLAGS_RELEASE} /Zi")
ENDFOREACH()
FOREACH(flag
FOREACH(flag
CMAKE_C_FLAGS CMAKE_CXX_FLAGS
CMAKE_C_FLAGS_INIT CMAKE_CXX_FLAGS_INIT
CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT
CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO
@ -155,6 +164,12 @@ IF(MSVC)
ENDIF()
ENDFOREACH()
IF(WITH_ASAN OR WITH_UBSAN)
# Workaround something Linux specific
SET(SECURITY_HARDENED 0 CACHE INTERNAL "" FORCE)
ENABLE_SANITIZERS()
ENDIF()
IF(CLANG_CL)
SET(CLANG_CL_FLAGS
"-Wno-unknown-warning-option -Wno-unused-private-field \
@ -163,17 +178,16 @@ IF(MSVC)
-Wno-deprecated-register -Wno-missing-braces \
-Wno-unused-function -Wno-unused-local-typedef -msse4.2 "
)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CLANG_CL_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CLANG_CL_FLAGS}")
STRING(APPEND CMAKE_C_FLAGS " ${CLANG_CL_FLAGS} ${MSVC_CRT_TYPE}")
STRING(APPEND CMAKE_CXX_FLAGS " ${CLANG_CL_FLAGS} ${MSVC_CRT_TYPE}")
ENDIF()
FOREACH(type EXE SHARED MODULE)
STRING(REGEX REPLACE "/STACK:([^ ]+)" "" CMAKE_${type}_LINKER_FLAGS "${CMAKE_${type}_LINKER_FLAGS}")
STRING(REGEX REPLACE "/INCREMENTAL:([^ ]+)" "/INCREMENTAL:NO" CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO}")
STRING(REGEX REPLACE "/INCREMENTAL$" "/INCREMENTAL:NO" CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO}")
SET(CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO} /OPT:REF")
IF(NOT CLANG_CL)
SET(CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO} /release")
STRING(APPEND CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO " /release /OPT:REF,ICF")
ENDIF()
IF(DYNAMIC_UCRT_LINK AND (MSVC_CRT_TYPE STREQUAL "/MT"))
FOREACH(config RELEASE RELWITHDEBINFO DEBUG MINSIZEREL)
@ -186,25 +200,29 @@ IF(MSVC)
# Mark 32 bit executables large address aware so they can
# use > 2GB address space
IF(CMAKE_SIZEOF_VOID_P MATCHES 4)
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
STRING(APPEND CMAKE_EXE_LINKER_FLAGS " /LARGEADDRESSAWARE")
ENDIF()
# Speed up multiprocessor build
IF (NOT CLANG_CL)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
STRING(APPEND CMAKE_C_FLAGS " /MP")
STRING(APPEND CMAKE_CXX_FLAGS " /MP")
STRING(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO " /Gw")
STRING(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO " /Gw")
ENDIF()
#TODO: update the code and remove the disabled warnings
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /we4700 /we4311 /we4477 /we4302 /we4090")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /we4099 /we4700 /we4311 /we4477 /we4302 /we4090")
STRING(APPEND CMAKE_C_FLAGS " /we4700 /we4311 /we4477 /we4302 /we4090")
STRING(APPEND CMAKE_CXX_FLAGS " /we4099 /we4700 /we4311 /we4477 /we4302 /we4090")
IF(MSVC_VERSION GREATER 1910 AND NOT CLANG_CL)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /permissive-")
STRING(APPEND CMAKE_CXX_FLAGS " /permissive-")
STRING(APPEND CMAKE_C_FLAGS " /diagnostics:caret")
STRING(APPEND CMAKE_CXX_FLAGS " /diagnostics:caret")
ENDIF()
ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_WARNINGS)
IF(MYSQL_MAINTAINER_MODE MATCHES "ERR")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX")
STRING(APPEND CMAKE_C_FLAGS " /WX")
STRING(APPEND CMAKE_CXX_FLAGS " /WX")
FOREACH(type EXE SHARED MODULE)
FOREACH(cfg RELEASE DEBUG RELWITHDEBINFO)
SET(CMAKE_${type}_LINKER_FLAGS_${cfg} "${CMAKE_${type}_LINKER_FLAGS_${cfg}} /WX")
@ -214,9 +232,9 @@ IF(MSVC)
IF(MSVC_VERSION LESS 1910)
# Noisy warning C4800: 'type': forcing value to bool 'true' or 'false' (performance warning),
# removed in VS2017
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800")
STRING(APPEND CMAKE_CXX_FLAGS " /wd4800")
ELSEIF (NOT CLANG_CL)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /d2OptimizeHugeFunctions")
STRING(APPEND CMAKE_CXX_FLAGS " /d2OptimizeHugeFunctions")
ENDIF()
ENDIF()
@ -305,6 +323,6 @@ MACRO(FORCE_STATIC_CRT)
CMAKE_C_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_MINSIZEREL
)
STRING(REGEX REPLACE "/MD[d]?" "/MT" "${flag}" "${${flag}}" )
STRING(REPLACE ${DYNAMIC_UCRT_LINKER_OPTION} "" "${flag}" "${${flag}}")
STRING(REPLACE "${DYNAMIC_UCRT_LINKER_OPTION}" "" "${flag}" "${${flag}}")
ENDFOREACH()
ENDMACRO()

View File

@ -24,11 +24,13 @@ MACRO(BUNDLE_PCRE2)
SET(byproducts ${byproducts} BUILD_BYPRODUCTS ${file} ${file_d})
SET_TARGET_PROPERTIES(${lib} PROPERTIES IMPORTED_LOCATION ${file})
ENDFOREACH()
FOREACH(v "" "_DEBUG" "_RELWITHDEBINFO" "_RELEASE" "_MINZISEREL")
FOREACH(v "" "_DEBUG" "_RELWITHDEBINFO" "_RELEASE" "_MINSIZEREL")
STRING(REPLACE "/WX" "" pcre2_flags${v} "${CMAKE_C_FLAGS${v}}")
IF(MSVC)
# Suppress a warning
STRING(APPEND pcre2_flags${v} " /wd4244 " )
# Need this only for ASAN support
SET(stdlibs "-DCMAKE_C_STANDARD_LIBRARIES=${CMAKE_C_STANDARD_LIBRARIES}")
ENDIF()
ENDFOREACH()
ExternalProject_Add(
@ -48,6 +50,7 @@ MACRO(BUNDLE_PCRE2)
"-DCMAKE_C_FLAGS_RELEASE=${pcre2_flags_RELEASE}"
"-DCMAKE_C_FLAGS_MINSIZEREL=${pcre2_flags_MINSIZEREL}"
"-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}"
${stdlibs}
${byproducts}
)
SET_TARGET_PROPERTIES(pcre2 PROPERTIES EXCLUDE_FROM_ALL TRUE)

View File

@ -252,7 +252,6 @@ MACRO(MYSQL_ADD_PLUGIN)
SET(ARG_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${target}.cnf")
FILE(WRITE ${ARG_CONFIG} "[mariadb]\nplugin-load-add=${ARG_MODULE_OUTPUT_NAME}.so\n")
ENDIF()
INSTALL(FILES ${ARG_CONFIG} COMPONENT ${ARG_COMPONENT} DESTINATION ${INSTALL_SYSCONF2DIR})
SET(CPACK_RPM_${ARG_COMPONENT}_USER_FILELIST ${ignored} "%config(noreplace) ${INSTALL_SYSCONF2DIR}/*" PARENT_SCOPE)
SET(CPACK_RPM_${ARG_COMPONENT}_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/plugin-postin.sh PARENT_SCOPE)
SET(CPACK_RPM_${ARG_COMPONENT}_POST_TRANS_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-posttrans.sh PARENT_SCOPE)
@ -262,6 +261,9 @@ MACRO(MYSQL_ADD_PLUGIN)
SET(ARG_COMPONENT Server)
ENDIF()
MYSQL_INSTALL_TARGETS(${target} DESTINATION ${INSTALL_PLUGINDIR} COMPONENT ${ARG_COMPONENT})
IF(ARG_CONFIG AND INSTALL_SYSCONF2DIR)
INSTALL(FILES ${ARG_CONFIG} COMPONENT ${ARG_COMPONENT} DESTINATION ${INSTALL_SYSCONF2DIR})
ENDIF()
ENDIF()
GET_FILENAME_COMPONENT(subpath ${CMAKE_CURRENT_SOURCE_DIR} NAME)

View File

@ -19,11 +19,11 @@ IF(GIT_EXECUTABLE AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
SET(update_result 0)
ELSEIF (cmake_update_submodules MATCHES force)
MESSAGE(STATUS "Updating submodules (forced)")
EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init --force --recursive
EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init --force --recursive --depth=1
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE update_result)
ELSEIF (cmake_update_submodules MATCHES yes)
EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init --recursive
EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init --recursive --depth=1
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE update_result)
ELSE()

View File

@ -125,7 +125,6 @@
/* Functions we may want to use. */
#cmakedefine HAVE_ACCEPT4 1
#cmakedefine HAVE_ACCESS 1
#cmakedefine HAVE_AIOWAIT 1
#cmakedefine HAVE_ALARM 1
#cmakedefine HAVE_ALLOCA 1
#cmakedefine HAVE_BFILL 1

View File

@ -316,7 +316,6 @@ ENDIF()
#
CHECK_FUNCTION_EXISTS (accept4 HAVE_ACCEPT4)
CHECK_FUNCTION_EXISTS (access HAVE_ACCESS)
#CHECK_FUNCTION_EXISTS (aiowait HAVE_AIOWAIT)
CHECK_FUNCTION_EXISTS (alarm HAVE_ALARM)
SET(HAVE_ALLOCA 1)
CHECK_FUNCTION_EXISTS (backtrace HAVE_BACKTRACE)

View File

@ -490,6 +490,7 @@ static int DbugParse(CODE_STATE *cs, const char *control)
rel= control[0] == '+' || control[0] == '-';
if ((!rel || (!stack->out_file && !stack->next)))
{
LockIfInitSettings(cs);
FreeState(cs, 0);
stack->flags= 0;
stack->delay= 0;
@ -497,10 +498,9 @@ static int DbugParse(CODE_STATE *cs, const char *control)
stack->sub_level= 0;
stack->out_file= sstderr;
stack->functions= NULL;
LockIfInitSettings(cs);
stack->keywords= NULL;
UnlockIfInitSettings(cs);
stack->processes= NULL;
UnlockIfInitSettings(cs);
}
else if (!stack->out_file)
{

View File

@ -1,4 +1,4 @@
#!/usr/bin/perl
#!/usr/bin/env perl
# Copyright (c) 2002 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.

View File

@ -1,4 +1,4 @@
#!/usr/bin/perl
#!/usr/bin/env perl
die <<EEE unless @ARGV;
Usage: $0 func1 [func2 [ ...] ]

View File

@ -1,6 +1,6 @@
#!/bin/bash
#
# This script is executed by "/etc/init.d/mysql" on every (re)start.
# This script is executed by "/etc/init.d/mariadb" on every (re)start.
#
# Changes to this file will be preserved when updating the Debian package.
#
@ -9,10 +9,15 @@
source /usr/share/mysql/debian-start.inc.sh
# Read default/mysql first and then default/mariadb just like the init.d file does
if [ -f /etc/default/mysql ]; then
. /etc/default/mysql
fi
if [ -f /etc/default/mariadb ]; then
. /etc/default/mariadb
fi
MYSQL="/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf"
MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
# Don't run full mysql_upgrade on every server restart, use --version-check to do it only once

View File

@ -1,4 +1,4 @@
#!/usr/bin/perl -w
#!/usr/bin/env perl -w
# mariadb-report v4.0 Oct 23 2015
# renamed to from mysqlreport in 2020

View File

@ -1,19 +1,26 @@
# MariaDB-specific config file.
# Read by /etc/mysql/my.cnf
[client]
# Default is Latin1, if you need UTF-8 set this (also in server section)
#default-character-set = utf8
[mysqld]
# The MariaDB configuration file
#
# * Character sets
#
# Default is Latin1, if you need UTF-8 set all this (also in client section)
# The MariaDB/MySQL tools read configuration files in the following order:
# 1. "/etc/mysql/mariadb.cnf" (this file) to set global defaults,
# 2. "/etc/mysql/conf.d/*.cnf" to set global options.
# 3. "/etc/mysql/mariadb.conf.d/*.cnf" to set MariaDB-only options.
# 4. "~/.my.cnf" to set user-specific options.
#
#character-set-server = utf8
#collation-server = utf8_general_ci
#character_set_server = utf8
#collation_server = utf8_general_ci
# If the same option is defined multiple times, the last one will apply.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# This group is read both by the client and the server
# use it for options that affect everything
#
[client-server]
socket = /run/mysqld/mysqld.sock
#port = 3306
# Import all .cnf files from configuration directory
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mariadb.conf.d/

View File

@ -0,0 +1,22 @@
#
# This group is read by the client library
# Use it for options that affect all clients, but not the server
#
[client]
# Default is Latin1, if you need UTF-8 set this (also in server section)
# default-character-set = utf8mb4
# Example of client certificate usage
# ssl-cert=/etc/mysql/client-cert.pem
# ssl-key=/etc/mysql/client-key.pem
#
# Allow only TLS encrypted connections
# ssl-verify-server-cert=on
# This group is *never* read by mysql client library, though this
# /etc/mysql/mariadb.cnf.d/client.cnf file is not read by Oracle MySQL
# client anyway.
# If you use the same .cnf file for MySQL and MariaDB,
# use it for MariaDB-only client options
[client-mariadb]

View File

@ -0,0 +1,22 @@
#
# These groups are read by MariaDB command-line tools
# Use it for options that affect only one utility
#
[mysql]
[mysql_upgrade]
[mysqladmin]
[mysqlbinlog]
[mysqlcheck]
[mysqldump]
[mysqlimport]
[mysqlshow]
[mysqlslap]

View File

@ -0,0 +1,28 @@
# NOTE: THIS FILE IS READ ONLY BY THE TRADITIONAL SYSV INIT SCRIPT, NOT SYSTEMD.
# MARIADB SYSTEMD DOES _NOT_ UTILIZE MYSQLD_SAFE NOR READ THIS FILE.
#
# For similar behavior, systemd users should create the following file:
# /etc/systemd/system/mariadb.service.d/migrated-from-my.cnf-settings.conf
#
# To achieve the same result as the default 50-mysqld_safe.cnf, please create
# /etc/systemd/system/mariadb.service.d/migrated-from-my.cnf-settings.conf
# with the following contents:
#
# [Service]
# User=mysql
# StandardOutput=syslog
# StandardError=syslog
# SyslogFacility=daemon
# SyslogLevel=err
# SyslogIdentifier=mysqld
#
# For more information, please read https://mariadb.com/kb/en/mariadb/systemd/
[mysqld_safe]
# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# especially if they contain "#" chars...
nice = 0
skip_log_error
syslog

View File

@ -0,0 +1,116 @@
#
# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
# this is read by the standalone daemon and embedded servers
[server]
# this is only for the mysqld standalone daemon
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /run/mysqld/mysqld.pid
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
lc-messages = en_US
skip-external-locking
# Broken reverse DNS slows down connections considerably and name resolve is
# safe to skip if there are no "host by domain name" access grants
#skip-name-resolve
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
#
# * Fine Tuning
#
#key_buffer_size = 128M
#max_allowed_packet = 1G
#thread_stack = 192K
#thread_cache_size = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
#myisam_recover_options = BACKUP
#max_connections = 100
#table_cache = 64
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# Recommend only changing this at runtime for short testing periods if needed!
#general_log_file = /var/log/mysql/mysql.log
#general_log = 1
# When running under systemd, error logging goes via stdout/stderr to journald
# and when running legacy init error logging goes to syslog due to
# /etc/mysql/conf.d/mariadb.conf.d/50-mysqld_safe.cnf
# Enable this if you want to have error logging into a separate file
#log_error = /var/log/mysql/error.log
# Enable the slow query log to see queries with especially long duration
#slow_query_log_file = /var/log/mysql/mariadb-slow.log
#long_query_time = 10
#log_slow_verbosity = query_plan,explain
#log-queries-not-using-indexes
#min_examined_row_limit = 1000
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
# other settings you may need to change.
#server-id = 1
#log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 10
#max_binlog_size = 100M
#
# * SSL/TLS
#
# For documentation, please read
# https://mariadb.com/kb/en/securing-connections-for-client-and-server/
#ssl-ca = /etc/mysql/cacert.pem
#ssl-cert = /etc/mysql/server-cert.pem
#ssl-key = /etc/mysql/server-key.pem
#
# * Character sets
#
# MySQL/MariaDB default is Latin1, but in Debian we rather default to the full
# utf8 4-byte character set. See also client.cnf
character-set-server = utf8mb4
collation-server = utf8mb4_general_ci
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
# Most important is to give InnoDB 80 % of the system RAM for buffer use:
# https://mariadb.com/kb/en/innodb-system-variables/#innodb_buffer_pool_size
#innodb_buffer_pool_size = 8G
# this is only for embedded server
[embedded]
# This group is only read by MariaDB servers, not by MySQL.
# If you use the same .cnf file for MySQL and MariaDB,
# you can put MariaDB-only options here
[mariadb]
# This group is only read by MariaDB-10.5 servers.
# If you use the same .cnf file for MariaDB of different versions,
# use this group for options that older servers don't understand
[mariadb-10.5]

View File

@ -0,0 +1,20 @@
#
# * Galera-related settings
#
# See the examples of server wsrep.cnf files in /usr/share/mysql
[galera]
# Mandatory settings
#wsrep_on=ON
#wsrep_provider=
#wsrep_cluster_address=
#binlog_format=row
#default_storage_engine=InnoDB
#innodb_autoinc_lock_mode=2
# Allow server to accept connections on all interfaces.
#bind-address=0.0.0.0
# Optional settings
#wsrep_slave_threads=1
#innodb_flush_log_at_trx_commit=0

View File

@ -1,188 +0,0 @@
# MariaDB database server configuration file.
#
# You can copy this file to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
# Here is entries for some specific programs
# The following values assume you have at least 32M ram
# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc_messages_dir = /usr/share/mysql
lc_messages = en_US
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
#
# * Fine Tuning
#
max_connections = 100
connect_timeout = 5
wait_timeout = 600
max_allowed_packet = 16M
thread_cache_size = 128
sort_buffer_size = 4M
bulk_insert_buffer_size = 16M
tmp_table_size = 32M
max_heap_table_size = 32M
#
# * MyISAM
#
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched. On error, make copy and try a repair.
myisam_recover_options = BACKUP
key_buffer_size = 128M
#open-files-limit = 2000
table_open_cache = 400
myisam_sort_buffer_size = 512M
concurrent_insert = 2
read_buffer_size = 2M
read_rnd_buffer_size = 1M
#
# * Query Cache Configuration
#
# Cache only tiny result sets, so we can fit more in the query cache.
query_cache_limit = 128K
query_cache_size = 64M
# for more write intensive setups, set to DEMAND or OFF
#query_cache_type = DEMAND
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file = /var/log/mysql/mysql.log
#general_log = 1
#
# Error logging goes to syslog due to /etc/mysql/conf.d/mysqld_safe_syslog.cnf.
#
# we do want to know about network errors and such
log_warnings = 2
#
# Enable the slow query log to see queries with especially long duration
#slow_query_log[={0|1}]
slow_query_log_file = /var/log/mysql/mariadb-slow.log
long_query_time = 10
#log_slow_rate_limit = 1000
log_slow_verbosity = query_plan
#log-queries-not-using-indexes
#log_slow_admin_statements
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
# other settings you may need to change.
#server-id = 1
#report_host = master1
#auto_increment_increment = 2
#auto_increment_offset = 1
log_bin = /var/log/mysql/mariadb-bin
log_bin_index = /var/log/mysql/mariadb-bin.index
# not fab for performance, but safer
#sync_binlog = 1
expire_logs_days = 10
max_binlog_size = 100M
# slaves
#relay_log = /var/log/mysql/relay-bin
#relay_log_index = /var/log/mysql/relay-bin.index
#relay_log_info_file = /var/log/mysql/relay-bin.info
#log_slave_updates
#read_only
#
# If applications support it, this stricter sql_mode prevents some
# mistakes like inserting invalid dates etc.
#sql_mode = NO_ENGINE_SUBSTITUTION,TRADITIONAL
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
default_storage_engine = InnoDB
innodb_buffer_pool_size = 256M
innodb_log_buffer_size = 8M
innodb_file_per_table = 1
innodb_open_files = 400
innodb_io_capacity = 400
innodb_flush_method = O_DIRECT
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem
#
# * Galera-related settings
#
[galera]
# Mandatory settings
#wsrep_on=ON
#wsrep_provider=
#wsrep_cluster_address=
#binlog_format=row
#default_storage_engine=InnoDB
#innodb_autoinc_lock_mode=2
#
# Allow server to accept connections on all interfaces.
#
#bind-address=0.0.0.0
#
# Optional setting
#wsrep_slave_threads=1
#innodb_flush_log_at_trx_commit=0
[mysqldump]
quick
quote-names
max_allowed_packet = 16M
[mysql]
#no-auto-rehash # faster start of mysql but no tab completion
[isamchk]
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,3 +0,0 @@
[mysqld_safe]
skip_log_error
syslog

View File

@ -26,7 +26,7 @@ def add_info(report):
report[key] = ""
for line in read_file('/var/log/daemon.log').split('\n'):
try:
if 'mysqld' in line.split()[4]:
if 'mariadbd' in line.split()[4]:
report[key] += line + '\n'
except IndexError:
continue
@ -35,8 +35,8 @@ def add_info(report):
report[key] = ""
for line in read_file('/var/log/mysql/error.log').split('\n'):
report[key] += line + '\n'
attach_mac_events(report, '/usr/sbin/mysqld')
attach_file(report,'/etc/apparmor.d/usr.sbin.mysqld')
attach_mac_events(report, '/usr/sbin/mariadbd')
attach_file(report,'/etc/apparmor.d/usr.sbin.mariadbd')
_add_my_conf_files(report, '/etc/mysql/mariadb.cnf')
for f in os.listdir('/etc/mysql/conf.d'):
_add_my_conf_files(report, os.path.join('/etc/mysql/conf.d', f))

View File

@ -31,7 +31,7 @@ then
sed 's|DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test|DINSTALL_MYSQLTESTDIR=false|' -i debian/rules
# Also skip building RocksDB, Mroonga etc to save even more time and disk space
sed 's|-DDEB|-DPLUGIN_MROONGA=NO -DPLUGIN_ROCKSDB=NO -DPLUGIN_SPIDER=NO -DPLUGIN_OQGRAPH=NO -DPLUGIN_PERFSCHEMA=NO -DPLUGIN_SPHINX=NO -DDEB|' -i debian/rules
sed 's|-DDEB|-DPLUGIN_MROONGA=NO -DPLUGIN_SPIDER=NO -DPLUGIN_OQGRAPH=NO -DPLUGIN_PERFSCHEMA=NO -DPLUGIN_SPHINX=NO -DDEB|' -i debian/rules
fi
# Convert gcc version to numberical value. Format is Mmmpp where M is Major
@ -75,6 +75,7 @@ fi
if [[ $GCCVERSION -lt 40800 ]] || [[ $(arch) =~ i[346]86 ]] || [[ $TRAVIS ]]
then
sed '/Package: mariadb-plugin-rocksdb/,/^$/d' -i debian/control
sed -i 's|-DPLUGIN_ROCKSDB=YES|-DPLUGIN_ROCKSDB=NO|' debian/rules
fi
# If libpcre2-dev is not available (before Debian Stretch and Ubuntu Xenial)
@ -94,6 +95,13 @@ then
sed -i -e "/Package: libmariadbd-dev/,/^$/d" debian/control
fi
if [[ $TRAVIS ]] || ! [[ $(arch) =~ 86 ]]
then
sed -i -e "/Package: mariadb-plugin-columnstore/,/^$/d" debian/control
sed -i '/flex/d' debian/control
sed -i 's|-DPLUGIN_COLUMNSTORE=YES|-DPLUGIN_COLUMNSTORE=NO|' debian/rules
fi
# Adjust changelog, add new version
echo "Incrementing changelog and starting build scripts"

38
debian/control vendored
View File

@ -9,6 +9,7 @@ Build-Depends: bison,
dh-apparmor,
dh-exec,
dh-systemd,
flex,
gdb,
libaio-dev [linux-any],
libboost-dev,
@ -230,20 +231,19 @@ Description: MariaDB database common files (e.g. /etc/mysql/my.cnf)
Package: mariadb-common
Architecture: all
Depends: mysql-common,
Depends: mysql-common (>= 5.6.25),
${misc:Depends}
Description: MariaDB database common files (e.g. /etc/mysql/conf.d/mariadb.cnf)
Description: MariaDB common configuration files
MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
server. SQL (Structured Query Language) is the most popular database query
language in the world. The main goals of MariaDB are speed, robustness and
ease of use.
.
This package includes files needed by all versions of the client library
(e.g. /etc/mysql/conf.d/mariadb.cnf).
This package includes configuration files common to all MariaDB programs.
Package: mariadb-client-core-10.6
Architecture: any
Depends: libmariadb3,
Depends: libmariadb3 (>= 10.5.4),
mariadb-common (>= ${source:Version}),
${misc:Depends},
${shlibs:Depends}
@ -636,6 +636,15 @@ Description: Connect storage engine for MariaDB
other interesting features.
This package contains the Connect plugin for MariaDB.
Package: mariadb-plugin-s3
Architecture: any
Depends: libcurl4,
mariadb-server-10.6 (= ${binary:Version}),
${misc:Depends},
${shlibs:Depends}
Description: S3 storage engine for MariaDB
Read only table stored in S3.
Package: mariadb-plugin-rocksdb
Architecture: amd64 arm64 mips64el ppc64el
Depends: mariadb-server-10.6 (= ${binary:Version}),
@ -654,6 +663,25 @@ Description: RocksDB storage engine for MariaDB
at maximising storage efficiency while maintaining InnoDB-like performance.
This package contains the RocksDB plugin for MariaDB.
Package: mariadb-plugin-columnstore
Architecture: amd64 i386
Depends: mariadb-server-10.6 (= ${binary:Version}),
net-tools,
binutils,
libsnappy1 | libsnappy1v5,
libjemalloc1 | libjemalloc2,
python3,
${misc:Depends},
${shlibs:Depends}
Breaks: mariadb-columnstore-libs,
mariadb-columnstore-platform
Replaces: mariadb-columnstore-libs,
mariadb-columnstore-platform
Description: MariaDB ColumnStore storage engine
The MariaDB ColumnStore storage engine is a high-performance columnar
analytical engine, aimed at rapid processing of analytical queries on very
large amounts of data.
Package: mariadb-plugin-oqgraph
Architecture: any
Depends: libjudydebian1,

View File

@ -1,5 +1,8 @@
debian/additions/innotop/innotop usr/bin/
debian/additions/mariadb-report usr/bin/
debian/additions/mariadb.conf.d/50-client.cnf etc/mysql/mariadb.conf.d
debian/additions/mariadb.conf.d/50-mysql-clients.cnf etc/mysql/mariadb.conf.d
debian/additions/mariadb.conf.d/60-galera.cnf etc/mysql/mariadb.conf.d
usr/bin/mariadb-access
usr/bin/mariadb-admin
usr/bin/mariadb-conv

View File

@ -1 +1 @@
etc/mysql/mariadb.conf.d/
etc/mysql/mariadb.conf.d

29
debian/mariadb-common.postinst vendored Normal file
View File

@ -0,0 +1,29 @@
#!/bin/sh
set -e
case "$1" in
configure)
# New packaging paradigm for my.cnf handling among MySQL variants
# Used in Ubuntu since Dec-2014 and in Debian since Jul-2015
#
# If the new mysql-common package does not provide
# the update-alternatives facility, notify user about manual fall back
if [ -f /usr/share/mysql-common/configure-symlinks ]
then
/usr/share/mysql-common/configure-symlinks install mariadb "/etc/mysql/mariadb.cnf"
else
# As configure can be called many times, don't re-create the symlink
# if it is there already
if [ ! -L /etc/mysql/my.cnf ]
then
echo "Notice: configure-symlinks trigger could not be called."
echo "Please manually create symlinks by running: "
echo " mv -f /etc/mysql/my.cnf /etc/mysql/my.cnf.old"
echo " ln -sf mariadb.cnf /etc/mysql/my.cnf"
fi
fi
;;
esac
#DEBHELPER#

View File

@ -1,9 +1,16 @@
#!/bin/bash
#!/bin/sh
set -e
if [ "$1" = "purge" ]; then
rmdir /etc/mysql/conf.d 2>/dev/null || true
rmdir /etc/mysql 2>/dev/null || true
fi
case "$1" in
remove|disappear)
# New packaging paradigm for my.cnf handling among MySQL variants
# Used in Ubuntu since Dec-2014 and in Debian since Jul-2015
if [ -f /usr/share/mysql-common/configure-symlinks ]
then
/usr/share/mysql-common/configure-symlinks remove mariadb "/etc/mysql/mariadb.cnf"
fi
;;
esac
#DEBHELPER#

View File

@ -0,0 +1,160 @@
etc/columnstore/AlarmConfig.xml
etc/columnstore/Columnstore.xml
etc/columnstore/ConsoleCmds.xml
etc/columnstore/ErrorMessage.txt
etc/columnstore/MessageFile.txt
etc/columnstore/ProcessConfig.xml
etc/columnstore/storagemanager.cnf
etc/mysql/mariadb.conf.d/columnstore.cnf
usr/bin/DDLProc
usr/bin/DMLProc
usr/bin/ExeMgr
usr/bin/MCSInstanceCmds.sh
usr/bin/MCSVolumeCmds.sh
usr/bin/MCSgetCredentials.sh
usr/bin/PrimProc
usr/bin/ProcMgr
usr/bin/ProcMon
usr/bin/ServerMonitor
usr/bin/StorageManager
usr/bin/WriteEngineServer
usr/bin/dbmsReport.sh
usr/bin/autoConfigure
usr/bin/bulklogReport.sh
usr/bin/clearShm
usr/bin/cleartablelock
usr/bin/columnstore
usr/bin/columnstore-post-install
usr/bin/columnstore-pre-uninstall
usr/bin/columnstoreClusterTester.sh
usr/bin/columnstoreDBWrite
usr/bin/columnstoreSupport
usr/bin/columnstoreSyslogSetup.sh
usr/bin/columnstore_installer
usr/bin/columnstore_module_installer.sh
usr/bin/columnstore_os_check.sh
usr/bin/columnstore_run.sh
usr/bin/colxml
usr/bin/configReport.sh
usr/bin/configxml.sh
usr/bin/controllernode
usr/bin/cpimport
usr/bin/cpimport.bin
usr/bin/cplogger
usr/bin/dbbuilder
usr/bin/dbrmctl
usr/bin/ddlcleanup
usr/bin/disable-rep-columnstore.sh
usr/bin/editem
usr/bin/getMySQLpw
usr/bin/hardwareReport.sh
usr/bin/idbmeminfo
usr/bin/load_brm
usr/bin/logReport.sh
usr/bin/mariadb-command-line.sh
usr/bin/master-rep-columnstore.sh
usr/bin/mcs-stop-controllernode.sh
usr/bin/mcsGetConfig
usr/bin/mcsSetConfig
usr/bin/mcs_module_installer.sh
usr/bin/mycnfUpgrade
usr/bin/os_detect.sh
usr/bin/post-mysql-install
usr/bin/post-mysqld-install
usr/bin/postConfigure
usr/bin/quick_installer_multi_server.sh
usr/bin/quick_installer_single_server.sh
usr/bin/remote_command.sh
usr/bin/remote_command_verify.sh
usr/bin/remote_scp_get.sh
usr/bin/remote_scp_put.sh
usr/bin/remotessh.exp
usr/bin/reset_locks
usr/bin/resourceReport.sh
usr/bin/rollback
usr/bin/rsync.sh
usr/bin/save_brm
usr/bin/slave-rep-columnstore.sh
usr/bin/smcat
usr/bin/smls
usr/bin/smput
usr/bin/smrm
usr/bin/startupTests.sh
usr/bin/viewtablelock
usr/bin/workernode
usr/bin/mcs-start-storagemanager.py
usr/bin/mcs-loadbrm.py
usr/bin/mariadb-columnstore-start.sh
usr/bin/mariadb-columnstore-stop.sh
usr/lib/*/libalarmmanager.so
usr/lib/*/libbatchloader.so
usr/lib/*/libbrm.so
usr/lib/*/libcacheutils.so
usr/lib/*/libcloudio.so
usr/lib/*/libcommon.so
usr/lib/*/libcompress.so
usr/lib/*/libconfigcpp.so
usr/lib/*/libdataconvert.so
usr/lib/*/libddlcleanuputil.so
usr/lib/*/libddlpackage.so
usr/lib/*/libddlpackageproc.so
usr/lib/*/libdmlpackage.so
usr/lib/*/libdmlpackageproc.so
usr/lib/*/libexecplan.so
usr/lib/*/libfuncexp.so
usr/lib/*/libidbdatafile.so
usr/lib/*/libjoblist.so
usr/lib/*/libjoiner.so
usr/lib/*/liblibmysql_client.so
usr/lib/*/libloggingcpp.so
usr/lib/*/libmarias3.so
usr/lib/*/libmessageqcpp.so
usr/lib/*/liboamcpp.so
usr/lib/*/libquerystats.so
usr/lib/*/libquerytele.so
usr/lib/*/libregr.so
usr/lib/*/librowgroup.so
usr/lib/*/librwlock.so
usr/lib/*/libstoragemanager.so
usr/lib/*/libthreadpool.so
usr/lib/*/libthrift.so
usr/lib/*/libudfsdk.so
usr/lib/*/libwindowfunction.so
usr/lib/*/libwriteengine.so
usr/lib/*/libwriteengineclient.so
usr/lib/*/libwriteengineredistribute.so
usr/lib/mysql/plugin/ha_columnstore.so
usr/lib/mysql/plugin/libregr_mysql.so
usr/lib/mysql/plugin/libudf_mysql.so
usr/sbin/install_mcs_mysql.sh
usr/share/columnstore/calremoveuserpriority.sql
usr/share/columnstore/calsetuserpriority.sql
usr/share/columnstore/calshowprocesslist.sql
usr/share/columnstore/columnstoreAlias
usr/share/columnstore/columnstoreLogRotate
usr/share/columnstore/columnstoreSyslog
usr/share/columnstore/columnstoreSyslog-ng
usr/share/columnstore/columnstoreSyslog7
usr/share/columnstore/columnstore_functions
usr/share/columnstore/columnstore_info.sql
usr/share/columnstore/dumpcat_mysql.sql
usr/share/columnstore/gitversionEngine
usr/share/columnstore/mariadb-columnstore.service
usr/share/columnstore/mcs-controllernode.service
usr/share/columnstore/mcs-ddlproc.service
usr/share/columnstore/mcs-dmlproc.service
usr/share/columnstore/mcs-exemgr.service
usr/share/columnstore/mcs-loadbrm.service
usr/share/columnstore/mcs-primproc.service
usr/share/columnstore/mcs-workernode.service
usr/share/columnstore/mcs-writeengineserver.service
usr/share/columnstore/mcs-storagemanager.service
usr/share/columnstore/mcstest-001.sh
usr/share/columnstore/mcstest-002.sh
usr/share/columnstore/mcstest-003.sh
usr/share/columnstore/mcstest-004.sh
usr/share/columnstore/myCnf-exclude-args.text
usr/share/columnstore/myCnf-include-args.text
usr/share/columnstore/releasenum
usr/share/columnstore/syscatalog_mysql.sql
var/lib/columnstore/local/module

View File

@ -0,0 +1,10 @@
#!/bin/bash
set -e
# Install ColumnStore
columnstore-post-install --rpmmode=install
echo "MariaDB ColumnStore install completed"
#DEBHELPER#

View File

@ -0,0 +1,29 @@
#!/bin/bash
set -e
if [ "$1" = "purge" ]; then
rm -rf /var/lib/columnstore
rm -rf /etc/columnstore
rm -f /etc/mysql/mariadb.conf.d/columnstore.cnf.rpmsave
fi
running_systemd() {
if [ "$(ps --no-headers -o comm 1)" = "systemd" ]; then
echo 0
else
echo 1
fi
}
if [ ! -z "$(pgrep -x mysqld)" ];then
systemctl cat mariadb.service > /dev/null 2>&1
if [ $? -eq 0 ] && [ $(running_systemd) -eq 0 ]; then
systemctl restart mariadb.service > /dev/null 2>&1
else
pkill mysqld > /dev/null 2>&1
/usr/bin/mysqld_safe &
fi
fi
#DEBHELPER#

View File

@ -0,0 +1,9 @@
#!/bin/bash
set -e
columnstore-pre-uninstall
exit 0
#DEBHELPER#

View File

@ -1,2 +1,2 @@
etc/mysql/conf.d/connect.cnf etc/mysql/mariadb.conf.d
etc/mysql/mariadb.conf.d/connect.cnf
usr/lib/mysql/plugin/ha_connect.so

View File

@ -1,2 +1,2 @@
etc/mysql/conf.d/cracklib_password_check.cnf etc/mysql/mariadb.conf.d
etc/mysql/mariadb.conf.d/cracklib_password_check.cnf
usr/lib/mysql/plugin/cracklib_password_check.so

View File

@ -1,2 +1,2 @@
etc/mysql/conf.d/auth_gssapi.cnf etc/mysql/mariadb.conf.d
etc/mysql/mariadb.conf.d/auth_gssapi.cnf
usr/lib/mysql/plugin/auth_gssapi.so

View File

@ -1,2 +1,2 @@
etc/mysql/conf.d/oqgraph.cnf etc/mysql/mariadb.conf.d
etc/mysql/mariadb.conf.d/oqgraph.cnf
usr/lib/mysql/plugin/ha_oqgraph.so

View File

@ -1,4 +1,4 @@
etc/mysql/conf.d/rocksdb.cnf etc/mysql/mariadb.conf.d
etc/mysql/mariadb.conf.d/rocksdb.cnf
usr/bin/mariadb-ldb
usr/bin/myrocks_hotbackup
usr/lib/mysql/plugin/ha_rocksdb.so

3
debian/mariadb-plugin-s3.install vendored Normal file
View File

@ -0,0 +1,3 @@
etc/mysql/mariadb.conf.d/s3.cnf
usr/bin/aria_s3_copy
usr/lib/mysql/plugin/ha_s3.so

View File

@ -1,2 +1,2 @@
etc/mysql/mariadb.conf.d/spider.cnf
usr/lib/mysql/plugin/ha_spider.so
usr/share/mysql/install_spider.sql

View File

@ -1,10 +0,0 @@
#!/bin/sh
set -e
# Install Spider
mysql --defaults-file=/etc/mysql/debian.cnf < /usr/share/mysql/install_spider.sql || true
# Always exit with success instead of leaving dpkg in a broken state
#DEBHELPER#

View File

@ -1,7 +1,7 @@
#!/bin/bash
#
### BEGIN INIT INFO
# Provides: mysql
# Provides: mariadb
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: $network $named $time
@ -9,7 +9,7 @@
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start and stop the mysql database server daemon
# Description: Controls the main MariaDB database server daemon "mysqld"
# Description: Controls the main MariaDB database server daemon "mariadbd"
# and its wrapper script "mysqld_safe".
### END INIT INFO
#
@ -17,7 +17,7 @@ set -e
set -u
${DEBIAN_SCRIPT_DEBUG:+ set -v -x}
test -x /usr/sbin/mysqld || exit 0
test -x /usr/sbin/mariadbd || exit 0
. /lib/lsb/init-functions
@ -26,12 +26,19 @@ SELF=$(cd $(dirname $0); pwd -P)/$(basename $0)
MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
# priority can be overridden and "-s" adds output to stderr
ERR_LOGGER="logger -p daemon.err -t /etc/init.d/mysql -i"
ERR_LOGGER="logger -p daemon.err -t /etc/init.d/mariadb -i"
if [ -f /etc/default/mysql ]; then
. /etc/default/mysql
fi
# Also source default/mariadb in case the installation was upgraded from
# packages originally installed from MariaDB.org repositories, which have
# had support for reading /etc/default/mariadb since March 2016.
if [ -f /etc/default/mariadb ]; then
. /etc/default/mariadb
fi
# Safeguard (relative paths, core dumps..)
cd /
umask 077
@ -43,16 +50,16 @@ export HOME=/etc/mysql/
## Fetch a particular option from mysql's invocation.
#
# Usage: void mysqld_get_param option
mysqld_get_param() {
/usr/sbin/mysqld --print-defaults \
# Usage: void mariadbd_get_param option
mariadbd_get_param() {
/usr/sbin/mariadbd --print-defaults \
| tr " " "\n" \
| grep -- "--$1" \
| tail -n 1 \
| cut -d= -f2
}
## Do some sanity checks before even trying to start mysqld.
## Do some sanity checks before even trying to start mariadbd.
sanity_checks() {
# check for config file
if [ ! -r /etc/mysql/my.cnf ]; then
@ -61,7 +68,7 @@ sanity_checks() {
fi
# check for diskspace shortage
datadir=`mysqld_get_param datadir`
datadir=`mariadbd_get_param datadir`
if LC_ALL=C BLOCKSIZE= df --portability $datadir/. | tail -n 1 | awk '{ exit ($4>4096) }'; then
log_failure_msg "$0: ERROR: The partition with $datadir is too full!"
echo "ERROR: The partition with $datadir is too full!" | $ERR_LOGGER
@ -72,14 +79,14 @@ sanity_checks() {
## Checks if there is a server running and if so if it is accessible.
#
# check_alive insists on a pingable server
# check_dead also fails if there is a lost mysqld in the process list
# check_dead also fails if there is a lost mariadbd in the process list
#
# Usage: boolean mysqld_status [check_alive|check_dead] [warn|nowarn]
mysqld_status () {
# Usage: boolean mariadbd_status [check_alive|check_dead] [warn|nowarn]
mariadbd_status () {
ping_output=`$MYADMIN ping 2>&1`; ping_alive=$(( ! $? ))
ps_alive=0
pidfile=`mysqld_get_param pid-file`
pidfile=`mariadbd_get_param pid-file`
if [ -f "$pidfile" ] && ps `cat $pidfile` >/dev/null 2>&1; then ps_alive=1; fi
if [ "$1" = "check_alive" -a $ping_alive = 1 ] ||
@ -102,23 +109,23 @@ case "${1:-''}" in
'start')
sanity_checks;
# Start daemon
log_daemon_msg "Starting MariaDB database server" "mysqld"
if mysqld_status check_alive nowarn; then
log_daemon_msg "Starting MariaDB database server" "mariadbd"
if mariadbd_status check_alive nowarn; then
log_progress_msg "already running"
log_end_msg 0
else
# Could be removed during boot
test -e /var/run/mysqld || install -m 755 -o mysql -g root -d /var/run/mysqld
test -e /run/mysqld || install -m 755 -o mysql -g root -d /run/mysqld
# Start MariaDB!
/usr/bin/mysqld_safe "${@:2}" 2>&1 >/dev/null | $ERR_LOGGER &
for i in $(seq 1 "${MYSQLD_STARTUP_TIMEOUT:-30}"); do
sleep 1
if mysqld_status check_alive nowarn ; then break; fi
if mariadbd_status check_alive nowarn ; then break; fi
log_progress_msg "."
done
if mysqld_status check_alive warn; then
if mariadbd_status check_alive warn; then
log_end_msg 0
# Now start mysqlcheck or whatever the admin wants.
output=$(/etc/mysql/debian-start)
@ -137,26 +144,26 @@ case "${1:-''}" in
# at least for cron, we can rely on it here, too. (although we have
# to specify it explicit as e.g. sudo environments points to the normal
# users home and not /root)
log_daemon_msg "Stopping MariaDB database server" "mysqld"
if ! mysqld_status check_dead nowarn; then
log_daemon_msg "Stopping MariaDB database server" "mariadbd"
if ! mariadbd_status check_dead nowarn; then
set +e
shutdown_out=`$MYADMIN shutdown 2>&1`; r=$?
set -e
if [ "$r" -ne 0 ]; then
log_end_msg 1
[ "$VERBOSE" != "no" ] && log_failure_msg "Error: $shutdown_out"
log_daemon_msg "Killing MariaDB database server by signal" "mysqld"
killall -15 mysqld
log_daemon_msg "Killing MariaDB database server by signal" "mariadbd"
killall -15 mariadbd
server_down=
for i in `seq 1 600`; do
sleep 1
if mysqld_status check_dead nowarn; then server_down=1; break; fi
if mariadbd_status check_dead nowarn; then server_down=1; break; fi
done
if test -z "$server_down"; then killall -9 mysqld; fi
if test -z "$server_down"; then killall -9 mariadbd; fi
fi
fi
if ! mysqld_status check_dead warn; then
if ! mariadbd_status check_dead warn; then
log_end_msg 1
log_failure_msg "Please stop MariaDB manually and read /usr/share/doc/mariadb-server-10.6/README.Debian.gz!"
exit -1
@ -172,13 +179,13 @@ case "${1:-''}" in
;;
'reload'|'force-reload')
log_daemon_msg "Reloading MariaDB database server" "mysqld"
log_daemon_msg "Reloading MariaDB database server" "mariadbd"
$MYADMIN reload
log_end_msg 0
;;
'status')
if mysqld_status check_alive nowarn; then
if mariadbd_status check_alive nowarn; then
log_action_msg "$($MYADMIN version)"
else
log_action_msg "MariaDB is stopped."
@ -186,6 +193,13 @@ case "${1:-''}" in
fi
;;
'bootstrap')
# Bootstrap the cluster, start the first node
# that initiates the cluster
log_daemon_msg "Bootstrapping the cluster" "mariadbd"
$SELF start "${@:2}" --wsrep-new-cluster
;;
*)
echo "Usage: $SELF start|stop|restart|reload|force-reload|status"
exit 1

View File

@ -1,10 +1,10 @@
debian/additions/debian-start etc/mysql
debian/additions/debian-start.inc.sh usr/share/mysql
debian/additions/echo_stderr usr/share/mysql
debian/additions/mysql.init usr/share/mysql
debian/additions/mysqld_safe_syslog.cnf etc/mysql/conf.d
debian/additions/mariadb.conf.d/50-mysqld_safe.cnf etc/mysql/mariadb.conf.d
debian/additions/mariadb.conf.d/50-server.cnf etc/mysql/mariadb.conf.d
debian/additions/source_mariadb-10.6.py usr/share/apport/package-hooks
etc/apparmor.d/usr.sbin.mysqld
etc/apparmor.d/usr.sbin.mariadbd
etc/security/user_map.conf
lib/*/security/pam_user_map.so
lib/systemd/system/mariadb@bootstrap.service.d/use_galera_new_cluster.conf
@ -61,7 +61,7 @@ usr/lib/mysql/plugin/server_audit.so
usr/lib/mysql/plugin/simple_password_check.so
usr/lib/mysql/plugin/sql_errlog.so
usr/lib/mysql/plugin/wsrep_info.so
usr/share/doc/mariadb-server-10.6/mysqld.sym.gz
usr/share/doc/mariadb-server-10.6/mariadbd.sym.gz
usr/share/man/man1/aria_chk.1
usr/share/man/man1/aria_dump_log.1
usr/share/man/man1/aria_ftdump.1
@ -104,4 +104,5 @@ usr/share/man/man1/wsrep_sst_mysqldump.1
usr/share/man/man1/wsrep_sst_rsync.1
usr/share/man/man1/wsrep_sst_rsync_wan.1
usr/share/mysql/errmsg-utf8.txt
usr/share/mysql/wsrep.cnf
usr/share/mysql/wsrep_notify

View File

@ -1,9 +1,9 @@
/etc/init.d/mysql\[[0-9]+\]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists\!$
/etc/init.d/mysql\[[0-9]+\]: '/usr/bin/mysqladmin --defaults-(extra-)?file=/etc/mysql/debian.cnf ping' resulted in$
/etc/init.d/mariadb\[[0-9]+\]: Check that mariadbd is running and that the socket: '/run/mysqld/mysqld.sock' exists\!$
/etc/init.d/mariadb\[[0-9]+\]: '/usr/bin/mysqladmin --defaults-(extra-)?file=/etc/mysql/debian.cnf ping' resulted in$
/etc/mysql/debian-start\[[0-9]+\]: Checking for crashed MySQL tables\.$
mysqld\[[0-9]+\]: $
mysqld\[[0-9]+\]: Version: .* socket: '/var/run/mysqld/mysqld.sock' port: 3306$
mysqld\[[0-9]+\]: Warning: Ignoring user change to 'mysql' because the user was set to 'mysql' earlier on the command line$
mariadbd\[[0-9]+\]: $
mariadbd\[[0-9]+\]: Version: .* socket: '/run/mysqld/mysqld.sock' port: 3306$
mariadbd\[[0-9]+\]: Warning: Ignoring user change to 'mysql' because the user was set to 'mysql' earlier on the command line$
mysqld_safe\[[0-9]+\]: started$
usermod\[[0-9]+\]: change user `mysql' GID from `([0-9]+)' to `\1'$
usermod\[[0-9]+\]: change user `mysql' shell from `/bin/false' to `/bin/false'$

View File

@ -1,18 +1,18 @@
/etc/init.d/mysql\[[0-9]+\]: [0-9]+ processes alive and '/usr/bin/mysqladmin --defaults-(extra-)?file=/etc/mysql/debian.cnf ping' resulted in$
/etc/init.d/mysql\[[0-9]+\]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists\!$
/etc/init.d/mysql\[[0-9]+\]: '/usr/bin/mysqladmin --defaults-(extra-)?file=/etc/mysql/debian.cnf ping' resulted in$
/etc/init.d/mariadb\[[0-9]+\]: [0-9]+ processes alive and '/usr/bin/mysqladmin --defaults-(extra-)?file=/etc/mysql/debian.cnf ping' resulted in$
/etc/init.d/mariadb\[[0-9]+\]: Check that mariadbd is running and that the socket: '/run/mysqld/mysqld.sock' exists\!$
/etc/init.d/mariadb\[[0-9]+\]: '/usr/bin/mysqladmin --defaults-(extra-)?file=/etc/mysql/debian.cnf ping' resulted in$
/etc/mysql/debian-start\[[0-9]+\]: Checking for crashed MySQL tables\.$
mysqld\[[0-9]+\]: ?$
mysqld\[[0-9]+\]: .*InnoDB: Shutdown completed
mysqld\[[0-9]+\]: .*InnoDB: Started;
mysqld\[[0-9]+\]: .*InnoDB: Starting shutdown\.\.\.$
mysqld\[[0-9]+\]: .*\[Note\] /usr/sbin/mysqld: Normal shutdown$
mysqld\[[0-9]+\]: .*\[Note\] /usr/sbin/mysqld: ready for connections\.$
mysqld\[[0-9]+\]: .*\[Note\] /usr/sbin/mysqld: Shutdown complete$
mysqld\[[0-9]+\]: /usr/sbin/mysqld: ready for connections\.$
mysqld\[[0-9]+\]: .*/usr/sbin/mysqld: Shutdown Complete$
mysqld\[[0-9]+\]: Version: .* socket
mysqld\[[0-9]+\]: Warning: Ignoring user change to 'mysql' because the user was set to 'mysql' earlier on the command line$
mariadbd\[[0-9]+\]: ?$
mariadbd\[[0-9]+\]: .*InnoDB: Shutdown completed
mariadbd\[[0-9]+\]: .*InnoDB: Started;
mariadbd\[[0-9]+\]: .*InnoDB: Starting shutdown\.\.\.$
mariadbd\[[0-9]+\]: .*\[Note\] /usr/sbin/mariadbd: Normal shutdown$
mariadbd\[[0-9]+\]: .*\[Note\] /usr/sbin/mariadbd: ready for connections\.$
mariadbd\[[0-9]+\]: .*\[Note\] /usr/sbin/mariadbd: Shutdown complete$
mariadbd\[[0-9]+\]: /usr/sbin/mariadbd: ready for connections\.$
mariadbd\[[0-9]+\]: .*/usr/sbin/mariadbd: Shutdown Complete$
mariadbd\[[0-9]+\]: Version: .* socket
mariadbd\[[0-9]+\]: Warning: Ignoring user change to 'mysql' because the user was set to 'mysql' earlier on the command line$
mysqld_safe\[[0-9]+\]: ?$
mysqld_safe\[[0-9]+\]: able to use the new GRANT command!$
mysqld_safe\[[0-9]+\]: ended$

View File

@ -1,18 +1,18 @@
/etc/init.d/mysql\[[0-9]+\]: [0-9]+ processes alive and '/usr/bin/mysqladmin --defaults-(extra-)?file=/etc/mysql/debian.cnf ping' resulted in$
/etc/init.d/mysql\[[0-9]+\]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists\!$
/etc/init.d/mysql\[[0-9]+\]: '/usr/bin/mysqladmin --defaults-(extra-)?file=/etc/mysql/debian.cnf ping' resulted in$
/etc/init.d/mariadb\[[0-9]+\]: [0-9]+ processes alive and '/usr/bin/mysqladmin --defaults-(extra-)?file=/etc/mysql/debian.cnf ping' resulted in$
/etc/init.d/mariadb\[[0-9]+\]: Check that mariadbd is running and that the socket: '/run/mysqld/mysqld.sock' exists\!$
/etc/init.d/mariadb\[[0-9]+\]: '/usr/bin/mysqladmin --defaults-(extra-)?file=/etc/mysql/debian.cnf ping' resulted in$
/etc/mysql/debian-start\[[0-9]+\]: Checking for crashed MySQL tables\.$
mysqld\[[0-9]+\]: ?$
mysqld\[[0-9]+\]: .*InnoDB: Shutdown completed
mysqld\[[0-9]+\]: .*InnoDB: Started;
mysqld\[[0-9]+\]: .*InnoDB: Starting shutdown\.\.\.$
mysqld\[[0-9]+\]: .*\[Note\] /usr/sbin/mysqld: Normal shutdown$
mysqld\[[0-9]+\]: .*\[Note\] /usr/sbin/mysqld: ready for connections\.$
mysqld\[[0-9]+\]: .*\[Note\] /usr/sbin/mysqld: Shutdown complete$
mysqld\[[0-9]+\]: /usr/sbin/mysqld: ready for connections\.$
mysqld\[[0-9]+\]: .*/usr/sbin/mysqld: Shutdown Complete$
mysqld\[[0-9]+\]: Version: .* socket
mysqld\[[0-9]+\]: Warning: Ignoring user change to 'mysql' because the user was set to 'mysql' earlier on the command line$
mariadbd\[[0-9]+\]: ?$
mariadbd\[[0-9]+\]: .*InnoDB: Shutdown completed
mariadbd\[[0-9]+\]: .*InnoDB: Started;
mariadbd\[[0-9]+\]: .*InnoDB: Starting shutdown\.\.\.$
mariadbd\[[0-9]+\]: .*\[Note\] /usr/sbin/mariadbd: Normal shutdown$
mariadbd\[[0-9]+\]: .*\[Note\] /usr/sbin/mariadbd: ready for connections\.$
mariadbd\[[0-9]+\]: .*\[Note\] /usr/sbin/mariadbd: Shutdown complete$
mariadbd\[[0-9]+\]: /usr/sbin/mariadbd: ready for connections\.$
mariadbd\[[0-9]+\]: .*/usr/sbin/mariadbd: Shutdown Complete$
mariadbd\[[0-9]+\]: Version: .* socket
mariadbd\[[0-9]+\]: Warning: Ignoring user change to 'mysql' because the user was set to 'mysql' earlier on the command line$
mysqld_safe\[[0-9]+\]: ?$
mysqld_safe\[[0-9]+\]: able to use the new GRANT command!$
mysqld_safe\[[0-9]+\]: ended$

View File

@ -11,7 +11,7 @@
sharedscripts
postrotate
test -x /usr/bin/mysqladmin || exit 0
if [ -f `my_print_defaults --mysqld | grep -oP "pid-file=\K[^$]+"` ]; then
if [ -f `my_print_defaults --mariadbd | grep -oP "pid-file=\K[^$]+"` ]; then
# If this fails, check debian.conf!
mysqladmin --defaults-file=/etc/mysql/debian.cnf --local flush-error-log \
flush-engine-log flush-general-log flush-slow-log

View File

@ -18,17 +18,42 @@ ERR_LOGGER="logger -p daemon.err -t mariadb-server-$MAJOR_VER.postinst -i"
# the install, rather than failing silently and leaving a broken install.
set -o pipefail
invoke() {
systemctl $1 mysql
}
case "$1" in
configure)
# This is needed because mysql_install_db removes the pid file in /var/run
# This is needed because mysql_install_db removes the pid file in /run
# and because changed configuration options should take effect immediately.
# In case the server wasn't running at all it should be ok if the stop
# script fails. I can't tell at this point because of the cleaned /var/run.
set +e; invoke stop; set -e
# script fails. I can't tell at this point because of the cleaned /run.
set +e; invoke-rc.d mariadb stop; set -e
# An existing /etc/init.d/mysql might be on the system if there was a
# previous MySQL or MariaDB installation, since /etc/init.d files are
# considered config files and stay around even after the package is removed.
#
# The install step of this package adds a new /etc/init.d/mariadb file. As
# we also want to ensure that there are no old (and potentially outdated)
# versions of /etc/init.d/mysql we simply replace it using a copy of the
# latest 'mariadb' file. This has also the added benefit that anything that
# invokes traditional sysv init with either 'mysql' or 'mariadb' will end up
# controlling this newly installed MariaDB, and thus we maintain better
# backwards compatiblity.
#
# Note that the 'Provides' line is also updated to avoid 'insserv' exiting
# on failure (when it is run by update-rc.d) because of duplicate service
# names.
if [ -f "/etc/init.d/mysql" ] && [ -f "/etc/init.d/mariadb" ]
then
# Copy init file and rename the service name and filename on the fly
sed 's/Provides: mariadb/Provides: mysql/g' /etc/init.d/mariadb > /etc/init.d/mysql
# NOTE: Number of spaces/tabs is important here!
# Confirm if the sed worked
if ! grep --quiet "Provides: mysql" /etc/init.d/mysql
then
# If not, then delete the file to avoid failures later on
rm -f /etc/init.d/mysql
echo "Warning! Failed creating a mysql named copy of mariadb init.d file"
fi
fi
mysql_statedir=/usr/share/mysql
mysql_datadir=/var/lib/mysql
@ -126,7 +151,7 @@ EOF
# initiate databases. Output is not allowed by debconf :-(
# This will fail if we are upgrading an existing database; in this case
# mysql_upgrade, called from the /etc/init.d/mysql start script, will
# mysql_upgrade, called from the /etc/init.d/mariadb start script, will
# handle things.
# Debian: beware of the bashisms...
# Debian: can safely run on upgrades with existing databases
@ -164,21 +189,21 @@ EOF
# This allows upgrade from old versions (that have an apparmor profile
# on by default) to work both to disable a default profile, and to keep
# any profile installed and maintained by users themselves.
profile="/etc/apparmor.d/usr.sbin.mysqld"
profile="/etc/apparmor.d/usr.sbin.mariadbd"
if [ -f "$profile" ] && aa-status --enabled 2>/dev/null; then
if grep -q /usr/sbin/mysqld "$profile" 2>/dev/null ; then
if grep -q /usr/sbin/mariadbd "$profile" 2>/dev/null ; then
apparmor_parser -r "$profile" || true
else
echo "/usr/sbin/mysqld { }" | apparmor_parser --remove 2>/dev/null || true
echo "/usr/sbin/mariadbd { }" | apparmor_parser --remove 2>/dev/null || true
fi
fi
# copy out any mysqld_safe settings
systemd_conf=/etc/systemd/system/mariadb.service.d/migrated-from-my.cnf-settings.conf
if [ -x /usr/bin/mariadb-service-convert -a ! -f "${systemd_conf}" ]; then
mkdir -p /etc/systemd/system/mariadb.service.d
/usr/bin/mariadb-service-convert > "${systemd_conf}"
fi
# @TODO: Remove once buildbot.askmonty.org has been updated not to expect this file
mkdir -p /etc/systemd/system/mariadb.service.d/
# Note that file cannot be empty, otherwise systemd version in Ubuntu Bionic
# will think the service is masked
echo "# empty placeholder" > /etc/systemd/system/mariadb.service.d/migrated-from-my.cnf-settings.conf
;;
abort-upgrade|abort-remove|abort-configure)
@ -187,8 +212,9 @@ EOF
triggered)
if [ -x "$(command -v systemctl)" ]; then
systemctl daemon-reload
else
invoke-rc.d mariadb restart
fi
invoke restart
;;
*)
@ -199,7 +225,7 @@ esac
db_stop # in case invoke failes
# dh_systemd_start doesn't emit anything since we still ship /etc/init.d/mysql.
# dh_systemd_start doesn't emit anything since we still ship /etc/init.d/mariadb.
# Thus MariaDB server is started via init.d script, which in turn redirects to
# systemctl. If we upgrade from MySQL mysql.service may be masked, which also
# means init.d script is disabled. Unmask mysql service explicitly.
@ -209,3 +235,14 @@ if [ -x "$(command -v deb-systemd-helper)" ]; then
fi
#DEBHELPER#
# Modified dh_systemd_start snippet that's not added automatically
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
deb-systemd-invoke start mariadb.service >/dev/null || true
# Modified dh_installinit snippet to only run with sysvinit
elif [ -x "/etc/init.d/mariadb" ]; then
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then
invoke-rc.d mariadb start || exit $?
fi
fi

View File

@ -13,20 +13,28 @@ MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
# Try to stop the server in a sane way. If it does not success let the admin
# do it himself. No database directories should be removed while the server
# is running!
# is running! Another mariadbd in e.g. a different chroot is fine for us.
stop_server() {
set +e
systemctl stop mysql
errno=$?
set -e
# Return immediately if there are no mysql processes running
# as there is no point in trying to shutdown in that case.
if ! pgrep -x mariadbd > /dev/null; then return; fi
if [ "$?" != 0 ]; then
echo "Trying to stop the MySQL server resulted in exitcode $?." 1>&2
echo "Stop it yourself and try again!" 1>&2
exit 1
fi
set +e
invoke-rc.d mariadb stop
errno=$?
set -e
# systemctl could emit exit code 100=no init script (fresh install)
if [ "$errno" != 0 -a "$errno" != 100 ]; then
echo "Attempt to stop MariaDB/MySQL server returned exitcode $errno" 1>&2
echo "There is a MariaDB/MySQL server running, but we failed in our attempts to stop it." 1>&2
echo "Stop it yourself and try again!" 1>&2
db_stop
exit 1
fi
}
case "$1" in
purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
if [ -n "`$MYADMIN ping 2>/dev/null`" ]; then
@ -74,10 +82,15 @@ if [ "$1" = "purge" ] && [ -f "/var/lib/mysql/debian-$MAJOR_VER.flag" ]; then
# /var/lib/mysql is a mount point
rmdir --ignore-fail-on-non-empty /var/lib/mysql || true
fi
rm -rf /var/run/mysqld # this directory is created by the init script, don't leave behind
rm -rf /run/mysqld # this directory is created by the init script, don't leave behind
userdel mysql || true
fi
fi
#DEBHELPER#
# Modified dh_systemd_start snippet that's not added automatically
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
fi

View File

@ -26,21 +26,21 @@ mysql_upgradedir=/var/lib/mysql-upgrade
# Try to stop the server in a sane way. If it does not success let the admin
# do it himself. No database directories should be removed while the server
# is running! Another mysqld in e.g. a different chroot is fine for us.
# is running! Another mariadbd in e.g. a different chroot is fine for us.
stop_server() {
# Return immediately if there are no mysql processes running
# as there is no point in trying to shutdown in that case.
if ! pgrep -x --ns $$ mysqld > /dev/null; then return; fi
if ! pgrep -x --ns $$ mariadbd > /dev/null; then return; fi
set +e
systemctl stop mysql
invoke-rc.d mariadb stop
errno=$?
set -e
# 0=ok, 100=no init script (fresh install)
# systemctl could emit exit code 100=no init script (fresh install)
if [ "$errno" != 0 -a "$errno" != 100 ]; then
echo "'systemctl stop mysql' returned $errno" 1>&2
echo "There is a MySQL server running, but we failed in our attempts to stop it." 1>&2
echo "Attempt to stop MariaDB/MySQL server returned exitcode $errno" 1>&2
echo "There is a MariaDB/MySQL server running, but we failed in our attempts to stop it." 1>&2
echo "Stop it yourself and try again!" 1>&2
db_stop
exit 1

View File

@ -2,3 +2,11 @@
set -e
#DEBHELPER#
# Modified dh_systemd_start snippet that's not added automatically
if [ -d /run/systemd/system ]; then
deb-systemd-invoke stop mariadb.service >/dev/null
# Modified dh_installinit snippet to only run with sysvinit
elif [ -x "/etc/init.d/mariadb" ]; then
invoke-rc.d mariadb stop || exit $?
fi

View File

@ -1 +0,0 @@
debian/additions/my.cnf etc/mysql

1
debian/mysql-common.links vendored Normal file
View File

@ -0,0 +1 @@
etc/mysql/mariadb.cnf etc/mysql/my.cnf

17
debian/rules vendored
View File

@ -39,11 +39,7 @@ else
TESTSUITE_FAIL_CMD:=exit 1
endif
ifeq (32,$(DEB_HOST_ARCH_BITS))
CMAKEFLAGS += -DWITHOUT_ROCKSDB=true
endif
# Add extra flag to avoid WolfSSL code crashing the entire mysqld on s390x. This
# Add extra flag to avoid WolfSSL code crashing the entire mariadbd on s390x. This
# can be removed once upstream has made the code s390x compatible, see
# https://jira.mariadb.org/browse/MDEV-21705 and
# https://github.com/wolfSSL/wolfssl/issues/2828
@ -85,7 +81,10 @@ endif
-DSYSTEM_TYPE="debian-$(DEB_HOST_GNU_SYSTEM)" \
-DCMAKE_SYSTEM_PROCESSOR=$(DEB_HOST_ARCH) \
-DBUILD_CONFIG=mysql_release \
-DWITHOUT_CASSANDRA=true \
-DPLUGIN_TOKUDB=NO \
-DPLUGIN_CASSANDRA=NO \
-DPLUGIN_COLUMNSTORE=YES \
-DPLUGIN_ROCKSDB=YES \
-DPLUGIN_AWS_KEY_MANAGEMENT=NO \
-WITH_EMBEDDED_SERVER=OFF \
-DDEB=$(DEB_VENDOR) ..'
@ -135,10 +134,10 @@ endif
# nm numeric soft is not enough, therefore extra sort in command
# 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.6/mysqld.sym.gz
nm --defined-only $(BUILDDIR)/sql/mariadbd | LC_ALL=C sort | gzip -n -9 > $(TMP)/usr/share/doc/mariadb-server-10.6/mariadbd.sym.gz
# rename and install AppArmor profile
install -D -m 644 debian/apparmor-profile $(TMP)/etc/apparmor.d/usr.sbin.mysqld
install -D -m 644 debian/apparmor-profile $(TMP)/etc/apparmor.d/usr.sbin.mariadbd
# Install libmariadbclient18 compatibility links
ln -s libmariadb.so.3 $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmariadbclient.so
@ -169,7 +168,7 @@ override_dh_systemd_enable:
# Start mysql at sequence number 19 before 20 where apache, proftpd etc gets
# started which might depend on a running database server.
override_dh_installinit-arch:
#dh_installinit --name=mysql -- defaults 19 21
dh_installinit --name=mariadb --no-start -- defaults 19 21
dh_systemd_start --restart-after-upgrade

4
debian/tests/smoke vendored
View File

@ -29,10 +29,10 @@ set -ex
# be started manually.
if ! which systemctl
then
if ! /etc/init.d/mysql status
if ! /etc/init.d/mariadb status
then
echo "Did not find systemctl and deamon was not running, starting it.."
/etc/init.d/mysql start
/etc/init.d/mariadb start
fi
else
# If systemd (and systemctl) is available, but the service did not start, then

View File

@ -788,6 +788,7 @@ static ha_checksum checksum_format_specifier(const char* msg)
case 'x':
case 's':
case 'M':
case 'T':
start= 0; /* Not in format specifier anymore */
break;
}

View File

@ -1,9 +0,0 @@
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_PROPERTY(CFLAGS_CRC32_VPMSUM TARGET ${CRC32_LIBRARY} PROPERTY 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

@ -1,8 +0,0 @@
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/include)
ADD_CONVENIENCE_LIBRARY(${CRC32_LIBRARY} $<TARGET_OBJECTS:common_crc32c_armv8>)
ADD_LIBRARY(common_crc32c_armv8 OBJECT crc32_armv8.c)
SET_TARGET_PROPERTIES(common_crc32c_armv8 PROPERTIES COMPILE_FLAGS "${ARMV8_CRC_COMPILE_FLAGS}")

View File

@ -33,7 +33,6 @@ INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/sql
${CMAKE_CURRENT_SOURCE_DIR}/quicklz
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/crc
)
IF(NOT HAVE_SYSTEM_REGEX)
@ -84,9 +83,8 @@ MYSQL_ADD_EXECUTABLE(mariadb-backup
# Export all symbols on Unix, for better crash callstacks
SET_TARGET_PROPERTIES(mariadb-backup PROPERTIES ENABLE_EXPORTS TRUE)
ADD_SUBDIRECTORY(crc)
TARGET_LINK_LIBRARIES(mariadb-backup sql sql_builtins crc)
TARGET_LINK_LIBRARIES(mariadb-backup sql sql_builtins)
IF(NOT HAVE_SYSTEM_REGEX)
TARGET_LINK_LIBRARIES(mariadb-backup pcre2-posix)
ENDIF()
@ -109,7 +107,6 @@ MYSQL_ADD_EXECUTABLE(mbstream
TARGET_LINK_LIBRARIES(mbstream
mysys
crc
)
ADD_DEPENDENCIES(mbstream GenError)

View File

@ -1,33 +0,0 @@
# Copyright (c) 2017 Percona LLC and/or its affiliates.
#
# 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-1335 USA
PROJECT(crc C)
IF(NOT CMAKE_CROSSCOMPILING AND NOT MSVC)
STRING(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} processor)
IF(processor MATCHES "86" OR processor MATCHES "amd64" OR processor MATCHES "x64")
# Check for PCLMUL instruction
CHECK_C_SOURCE_RUNS("
int main()
{
asm volatile (\"pclmulqdq \\$0x00, %%xmm1, %%xmm0\":::\"cc\");
return 0;
}" HAVE_CLMUL_INSTRUCTION)
ENDIF()
ENDIF()
IF(HAVE_CLMUL_INSTRUCTION)
ADD_DEFINITIONS(-DHAVE_CLMUL_INSTRUCTION)
ENDIF()
ADD_LIBRARY(crc STATIC crc_glue.c crc-intel-pclmul.c)

View File

@ -1,21 +0,0 @@
/******************************************************
Copyright (c) 2017 Percona LLC and/or its affiliates.
Zlib compatible CRC-32 implementation.
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-1335 USA
*******************************************************/
#cmakedefine HAVE_CLMUL_INSTRUCTION 1

View File

@ -1,25 +0,0 @@
/******************************************************
Copyright (c) 2017 Percona LLC and/or its affiliates.
CRC32 using Intel's PCLMUL instruction.
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-1335 USA
*******************************************************/
#include <stdint.h>
#include <stddef.h>
void
crc32_intel_pclmul(uint32_t *pcrc, const uint8_t *inbuf, size_t inlen);

View File

@ -1,72 +0,0 @@
/******************************************************
Copyright (c) 2017 Percona LLC and/or its affiliates.
Zlib compatible CRC-32 implementation.
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-1335 USA
*******************************************************/
#include "my_config.h"
#include "crc_glue.h"
#include "crc-intel-pclmul.h"
#include <stdint.h>
#include <string.h>
#include <zlib.h>
#if defined(__GNUC__) && defined(__x86_64__)
static int pclmul_enabled = 0;
#endif
#if defined(__GNUC__) && defined(__x86_64__)
static
uint32_t
cpuid(uint32_t* ecx, uint32_t* edx)
{
uint32_t level;
asm("cpuid" : "=a" (level) : "a" (0) : "ebx", "ecx", "edx");
if (level < 1) {
return level;
}
asm("cpuid" : "=c" (*ecx), "=d" (*edx)
: "a" (1)
: "ebx");
return level;
}
#endif
void crc_init() {
#if defined(__GNUC__) && defined(__x86_64__)
uint32_t ecx, edx;
if (cpuid(&ecx, &edx) > 0) {
pclmul_enabled = ((ecx >> 19) & 1) && ((ecx >> 1) & 1);
}
#endif
}
unsigned long crc32_iso3309(unsigned long crc, const unsigned char *buf, unsigned int len)
{
#if __GNUC__ >= 4 && defined(__x86_64__) && defined(HAVE_CLMUL_INSTRUCTION)
if (pclmul_enabled) {
uint32_t crc_accum = (uint32_t) ~crc;
crc32_intel_pclmul(&crc_accum, buf, len);
return ~crc_accum;
}
#endif
return crc32(crc, buf, len);
}

View File

@ -1,31 +0,0 @@
/******************************************************
Copyright (c) 2017 Percona LLC and/or its affiliates.
Zlib compatible CRC-32 implementation.
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-1335 USA
*******************************************************/
#ifdef __cplusplus
extern "C" {
#endif
void crc_init();
unsigned long crc32_iso3309(unsigned long crc, const unsigned char *buf, unsigned int len);
#ifdef __cplusplus
}
#endif

View File

@ -112,6 +112,8 @@ bool ibx_partial_backup = false;
char *ibx_position_arg = NULL;
char *ibx_backup_directory = NULL;
extern bool xb_opt_destroy_password;
/* copy of proxied xtrabackup options */
my_bool ibx_xb_close_files;
const char *ibx_xtrabackup_compress_alg;
@ -770,18 +772,7 @@ ibx_get_one_option(const struct my_option *opt,
xtrabackup_compress = TRUE;
break;
case 'p':
if (argument)
{
char *start = argument;
my_free(opt_ibx_password);
opt_ibx_password= my_strdup(PSI_NOT_INSTRUMENTED,
argument, MYF(MY_FAE));
/* Destroy argument */
while (*argument)
*argument++= 'x';
if (*start)
start[1]=0 ;
}
opt_ibx_password= argument;
break;
}
return(0);

View File

@ -26,7 +26,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
#include "common.h"
#include "xbstream.h"
#include "datasink.h"
#include "crc_glue.h"
#define XBSTREAM_VERSION "1.0"
#define XBSTREAM_BUFFER_SIZE (10 * 1024 * 1024UL)
@ -98,7 +97,7 @@ main(int argc, char **argv)
{
MY_INIT(argv[0]);
crc_init();
my_checksum_init();
if (get_options(&argc, &argv)) {
goto err;

View File

@ -23,7 +23,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
#include <zlib.h>
#include "common.h"
#include "xbstream.h"
#include "crc_glue.h"
/* Allocate 1 MB for the payload buffer initially */
#define INIT_BUFFER_LEN (1024 * 1024)
@ -71,8 +70,7 @@ xb_rstream_result_t
xb_stream_validate_checksum(xb_rstream_chunk_t *chunk)
{
ulong checksum;
checksum = crc32_iso3309(0, (unsigned char *)chunk->data, (uint)chunk->length);
checksum = my_checksum(0, chunk->data, chunk->length);
if (checksum != chunk->checksum) {
msg("xb_stream_read_chunk(): invalid checksum at offset "
"0x%llx: expected 0x%lx, read 0x%lx.",

View File

@ -23,7 +23,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
#include <zlib.h>
#include "common.h"
#include "xbstream.h"
#include "crc_glue.h"
/* Group writes smaller than this into a single chunk */
#define XB_STREAM_MIN_CHUNK_SIZE (10 * 1024 * 1024)
@ -216,7 +215,7 @@ xb_stream_write_chunk(xb_wstream_file_t *file, const void *buf, size_t len)
int8store(ptr, len); /* Payload length */
ptr += 8;
checksum = crc32_iso3309(0, (const uchar *)buf, (uint)len); /* checksum */
checksum = my_checksum(0, buf, len);
pthread_mutex_lock(&stream->mutex);

View File

@ -101,7 +101,6 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA
#include "encryption_plugin.h"
#include <sql_plugin.h>
#include <srv0srv.h>
#include <crc_glue.h>
#include <log.h>
#include <derror.h>
#include <thr_timer.h>
@ -119,6 +118,8 @@ my_bool xtrabackup_copy_back;
my_bool xtrabackup_move_back;
my_bool xtrabackup_decrypt_decompress;
my_bool xtrabackup_print_param;
my_bool xtrabackup_mysqld_args;
my_bool xtrabackup_help;
my_bool xtrabackup_export;
@ -157,16 +158,16 @@ typedef std::list<regex_t> regex_list_t;
static regex_list_t regex_include_list;
static regex_list_t regex_exclude_list;
static hash_table_t* tables_include_hash = NULL;
static hash_table_t* tables_exclude_hash = NULL;
static hash_table_t tables_include_hash;
static hash_table_t tables_exclude_hash;
char *xtrabackup_databases = NULL;
char *xtrabackup_databases_file = NULL;
char *xtrabackup_databases_exclude = NULL;
static hash_table_t* databases_include_hash = NULL;
static hash_table_t* databases_exclude_hash = NULL;
static hash_table_t databases_include_hash;
static hash_table_t databases_exclude_hash;
static hash_table_t* inc_dir_tables_hash;
static hash_table_t inc_dir_tables_hash;
struct xb_filter_entry_struct{
char* name;
@ -798,7 +799,8 @@ enum options_xtrabackup
OPT_LOCK_DDL_PER_TABLE,
OPT_ROCKSDB_DATADIR,
OPT_BACKUP_ROCKSDB,
OPT_XTRA_CHECK_PRIVILEGES
OPT_XTRA_CHECK_PRIVILEGES,
OPT_XTRA_MYSQLD_ARGS
};
struct my_option xb_client_options[]= {
@ -1192,7 +1194,6 @@ struct my_option xb_client_options[]= {
#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}};
uint xb_client_options_count = array_elements(xb_client_options);
@ -1408,6 +1409,18 @@ struct my_option xb_server_options[] =
&opt_check_privileges, &opt_check_privileges,
0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 },
{"mysqld-args", OPT_XTRA_MYSQLD_ARGS,
"All arguments that follow this argument are considered as server "
"options, and if some of them are not supported by mariabackup, they "
"will be ignored.",
(G_PTR *) &xtrabackup_mysqld_args, (G_PTR *) &xtrabackup_mysqld_args, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?',
"Display this help and exit.",
(G_PTR *) &xtrabackup_help, (G_PTR *) &xtrabackup_help, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@ -1575,24 +1588,11 @@ end:
return err;
}
static const char *xb_client_default_groups[]= {
"client", "client-server", "client-mariadb", 0, 0, 0};
static const char *xb_client_default_groups[]={
"xtrabackup", "mariabackup",
"client", "client-server",
"client-mariadb",
0, 0, 0
};
static const char *xb_server_default_groups[]={
"xtrabackup", "mariabackup",
"mysqld", "server", MYSQL_BASE_VERSION,
"mariadb", MARIADB_BASE_VERSION,
"client-server",
#ifdef WITH_WSREP
"galera",
#endif
0, 0, 0
};
static const char *backup_default_groups[]= {
"xtrabackup", "mariabackup", "mariadb-backup", 0, 0, 0};
static void print_version(void)
{
@ -1620,7 +1620,7 @@ GNU General Public License for more details.\n\
You can download full text of the license on http://www.gnu.org/licenses/gpl-2.0.txt\n");
printf("Usage: %s [--defaults-file=#] [--backup | --prepare | --copy-back | --move-back] [OPTIONS]\n",my_progname);
print_defaults("my", xb_server_default_groups);
print_defaults("my", load_default_groups);
my_print_help(xb_client_options);
my_print_help(xb_server_options);
my_print_variables(xb_server_options);
@ -1755,15 +1755,7 @@ xb_get_one_option(const struct my_option *opt,
}
break;
case 'p':
if (argument)
{
char *start= argument;
my_free(opt_password);
opt_password= my_strdup(PSI_NOT_INSTRUMENTED, argument, MYF(MY_FAE));
while (*argument) *argument++= 'x'; // Destroy argument
if (*start)
start[1]=0 ;
}
opt_password = argument;
break;
case OPT_PROTOCOL:
if (argument)
@ -2270,7 +2262,7 @@ check_if_table_matches_filters(const char *name,
const regex_list_t& regex_list,
hash_table_t* tables_hash)
{
if (regex_list.empty() && !tables_hash) {
if (regex_list.empty() && !tables_hash->array) {
return(FALSE);
}
@ -2278,11 +2270,8 @@ check_if_table_matches_filters(const char *name,
return(TRUE);
}
if (tables_hash && find_filter_in_hashtable(name, tables_hash, NULL)) {
return(TRUE);
}
return FALSE;
return tables_hash->array &&
find_filter_in_hashtable(name, tables_hash, NULL);
}
enum skip_database_check_result {
@ -2308,8 +2297,8 @@ check_if_skip_database(
/* There are some filters for databases, check them */
xb_filter_entry_t* database = NULL;
if (databases_exclude_hash &&
find_filter_in_hashtable(name, databases_exclude_hash,
if (databases_exclude_hash.array &&
find_filter_in_hashtable(name, &databases_exclude_hash,
&database) &&
!database->has_tables) {
/* Database is found and there are no tables specified,
@ -2317,8 +2306,8 @@ check_if_skip_database(
return DATABASE_SKIP;
}
if (databases_include_hash) {
if (!find_filter_in_hashtable(name, databases_include_hash,
if (databases_include_hash.array) {
if (!find_filter_in_hashtable(name, &databases_include_hash,
&database)) {
/* Database isn't found, skip the database */
return DATABASE_SKIP;
@ -2342,8 +2331,7 @@ check_if_skip_database_by_path(
const char* path /*!< in: path to the db directory. */
)
{
if (databases_include_hash == NULL &&
databases_exclude_hash == NULL) {
if (!databases_include_hash.array && !databases_exclude_hash.array) {
return(FALSE);
}
@ -2387,10 +2375,10 @@ check_if_skip_table(
if (regex_exclude_list.empty() &&
regex_include_list.empty() &&
tables_include_hash == NULL &&
tables_exclude_hash == NULL &&
databases_include_hash == NULL &&
databases_exclude_hash == NULL) {
!tables_include_hash.array &&
!tables_exclude_hash.array &&
!databases_include_hash.array &&
!databases_exclude_hash.array) {
return(FALSE);
}
@ -2422,22 +2410,22 @@ check_if_skip_table(
without truncating the #P#... suffix so we can backup individual
partitions with regexps like '^test[.]t#P#p5' */
if (check_if_table_matches_filters(buf, regex_exclude_list,
tables_exclude_hash)) {
&tables_exclude_hash)) {
return(TRUE);
}
if (check_if_table_matches_filters(buf, regex_include_list,
tables_include_hash)) {
&tables_include_hash)) {
return(FALSE);
}
if ((eptr = strstr(buf, "#P#")) != NULL) {
*eptr = 0;
if (check_if_table_matches_filters(buf, regex_exclude_list,
tables_exclude_hash)) {
&tables_exclude_hash)) {
return (TRUE);
}
if (check_if_table_matches_filters(buf, regex_include_list,
tables_include_hash)) {
&tables_include_hash)) {
return(FALSE);
}
}
@ -2450,7 +2438,7 @@ check_if_skip_table(
if (skip_database == DATABASE_SKIP_SOME_TABLES ||
!regex_include_list.empty() ||
tables_include_hash) {
tables_include_hash.array) {
/* Include lists are present, but qualified name
failed to match any.*/
@ -3475,17 +3463,17 @@ xb_filter_entry_t*
xb_add_filter(
/*========================*/
const char* name, /*!< in: name of table/database */
hash_table_t** hash) /*!< in/out: hash to insert into */
hash_table_t* hash) /*!< in/out: hash to insert into */
{
xb_filter_entry_t* entry;
entry = xb_new_filter_entry(name);
if (UNIV_UNLIKELY(*hash == NULL)) {
*hash = hash_create(1000);
if (UNIV_UNLIKELY(!hash->array)) {
hash->create(1000);
}
HASH_INSERT(xb_filter_entry_t,
name_hash, *hash,
name_hash, hash,
ut_fold_string(entry->name),
entry);
@ -3523,8 +3511,8 @@ void
xb_register_filter_entry(
/*=====================*/
const char* name, /*!< in: name */
hash_table_t** databases_hash,
hash_table_t** tables_hash
hash_table_t* databases_hash,
hash_table_t* tables_hash
)
{
const char* p;
@ -3541,8 +3529,8 @@ xb_register_filter_entry(
strncpy(dbname, name, p - name);
dbname[p - name] = 0;
if (*databases_hash) {
HASH_SEARCH(name_hash, (*databases_hash),
if (databases_hash) {
HASH_SEARCH(name_hash, databases_hash,
ut_fold_string(dbname),
xb_filter_entry_t*,
db_entry, (void) 0,
@ -3741,7 +3729,7 @@ xb_filter_hash_free(hash_table_t* hash)
ulint i;
/* free the hash elements */
for (i = 0; i < hash_get_n_cells(hash); i++) {
for (i = 0; i < hash->n_cells; i++) {
xb_filter_entry_t* table;
table = static_cast<xb_filter_entry_t *>
@ -3759,8 +3747,7 @@ xb_filter_hash_free(hash_table_t* hash)
}
}
/* free hash */
hash_table_free(hash);
hash->free();
}
static void xb_regex_list_free(regex_list_t* list)
@ -3780,20 +3767,20 @@ xb_filters_free()
xb_regex_list_free(&regex_include_list);
xb_regex_list_free(&regex_exclude_list);
if (tables_include_hash) {
xb_filter_hash_free(tables_include_hash);
if (tables_include_hash.array) {
xb_filter_hash_free(&tables_include_hash);
}
if (tables_exclude_hash) {
xb_filter_hash_free(tables_exclude_hash);
if (tables_exclude_hash.array) {
xb_filter_hash_free(&tables_exclude_hash);
}
if (databases_include_hash) {
xb_filter_hash_free(databases_include_hash);
if (databases_include_hash.array) {
xb_filter_hash_free(&databases_include_hash);
}
if (databases_exclude_hash) {
xb_filter_hash_free(databases_exclude_hash);
if (databases_exclude_hash.array) {
xb_filter_hash_free(&databases_exclude_hash);
}
}
@ -4034,7 +4021,7 @@ fail:
trx_pool_init();
ut_crc32_init();
crc_init();
my_checksum_init();
recv_sys.create();
#ifdef WITH_INNODB_DISALLOW_WRITES
@ -4658,7 +4645,7 @@ exit:
table->name = ((char*)table) + sizeof(xb_filter_entry_t);
strcpy(table->name, dest_space_name);
HASH_INSERT(xb_filter_entry_t, name_hash, inc_dir_tables_hash,
HASH_INSERT(xb_filter_entry_t, name_hash, &inc_dir_tables_hash,
ut_fold_string(table->name), table);
mutex_enter(&fil_system.mutex);
@ -5048,7 +5035,7 @@ rm_if_not_found(
/* Truncate ".ibd" */
name[strlen(name) - 4] = '\0';
HASH_SEARCH(name_hash, inc_dir_tables_hash, ut_fold_string(name),
HASH_SEARCH(name_hash, &inc_dir_tables_hash, ut_fold_string(name),
xb_filter_entry_t*,
table, (void) 0,
!strcmp(table->name, name));
@ -5424,7 +5411,7 @@ static bool xtrabackup_prepare_func(char** argv)
goto error_cleanup;
}
inc_dir_tables_hash = hash_create(1000);
inc_dir_tables_hash.create(1000);
ok = xtrabackup_apply_deltas();
@ -5437,7 +5424,7 @@ static bool xtrabackup_prepare_func(char** argv)
xb_process_datadir("./", ".ibd", rm_if_not_found);
}
xb_filter_hash_free(inc_dir_tables_hash);
xb_filter_hash_free(&inc_dir_tables_hash);
fil_system.close();
#ifdef WITH_INNODB_DISALLOW_WRITES
@ -5535,7 +5522,7 @@ static bool xtrabackup_prepare_func(char** argv)
error_cleanup:
xb_filters_free();
return ok;
return ok && !ib::error::was_logged();
}
/**************************************************************************
@ -5802,11 +5789,23 @@ void setup_error_messages()
die("could not initialize error messages");
}
void
handle_options(int argc, char **argv, char ***argv_client, char ***argv_server)
/** Handle mariabackup options. The options are handled with the following
order:
1) Load server groups and process server options, ignore unknown options
2) Load client groups and process client options, ignore unknown options
3) Load backup groups and process client-server options, exit on unknown option
4) Process --mysqld-args options, ignore unknown options
@param[in] argc arguments count
@param[in] argv arguments array
@param[out] argv_server server options including loaded from server groups
@param[out] argv_client client options including loaded from client groups
@param[out] argv_backup backup options including loaded from backup groups */
void handle_options(int argc, char **argv, char ***argv_server,
char ***argv_client, char ***argv_backup)
{
/* Setup some variables for Innodb.*/
srv_operation = SRV_OPERATION_RESTORE;
files_charset_info = &my_charset_utf8mb3_general_ci;
@ -5833,49 +5832,64 @@ handle_options(int argc, char **argv, char ***argv_client, char ***argv_server)
bool prepare = false;
char conf_file[FN_REFLEN];
int argc_client = argc;
int argc_server = argc;
/* scan options for group and config file to load defaults from */
for (i = 1; i < argc; i++) {
// array_elements() will not work for load_defaults, as it is defined
// as external symbol, so let's use dynamic array to have ability to
// add new server default groups
std::vector<const char *> server_default_groups;
char *optend = strcend(argv[i], '=');
for (const char **default_group= load_default_groups; *default_group;
++default_group)
server_default_groups.push_back(*default_group);
if (strncmp(argv[i], "--defaults-group",
optend - argv[i]) == 0) {
defaults_group = optend + 1;
append_defaults_group(defaults_group,
xb_server_default_groups,
array_elements(xb_server_default_groups));
}
std::vector<char *> mysqld_args;
std::vector<char *> mariabackup_args;
mysqld_args.push_back(argv[0]);
mariabackup_args.push_back(argv[0]);
if (strncmp(argv[i], "--login-path",
optend - argv[i]) == 0) {
append_defaults_group(optend + 1,
xb_client_default_groups,
array_elements(xb_client_default_groups));
}
/* scan options for group and config file to load defaults from */
for (i= 1; i < argc; i++)
{
char *optend= strcend(argv[i], '=');
if (mysqld_args.size() > 1 ||
strncmp(argv[i], "--mysqld-args", optend - argv[i]) == 0)
{
mysqld_args.push_back(argv[i]);
continue;
}
else
mariabackup_args.push_back(argv[i]);
if (!strncmp(argv[i], "--prepare",
optend - argv[i])) {
prepare = true;
}
if (!strncmp(argv[i], "--apply-log",
optend - argv[i])) {
prepare = true;
}
if (!strncmp(argv[i], "--target-dir",
optend - argv[i]) && *optend) {
target_dir = optend + 1;
}
if (!*optend && argv[i][0] != '-') {
target_dir = argv[i];
}
}
if (strncmp(argv[i], "--defaults-group", optend - argv[i]) == 0)
{
defaults_group= optend + 1;
server_default_groups.push_back(defaults_group);
}
else if (strncmp(argv[i], "--login-path", optend - argv[i]) == 0)
{
append_defaults_group(optend + 1, xb_client_default_groups,
array_elements(xb_client_default_groups));
}
else if (!strncmp(argv[i], "--prepare", optend - argv[i]))
{
prepare= true;
}
else if (!strncmp(argv[i], "--apply-log", optend - argv[i]))
{
prepare= true;
}
else if (!strncmp(argv[i], "--target-dir", optend - argv[i]) &&
*optend)
{
target_dir= optend + 1;
}
else if (!*optend && argv[i][0] != '-')
{
target_dir= argv[i];
}
}
server_default_groups.push_back(NULL);
snprintf(conf_file, sizeof(conf_file), "my");
if (prepare && target_dir) {
@ -5891,10 +5905,16 @@ handle_options(int argc, char **argv, char ***argv_client, char ***argv_server)
}
}
*argv_client = argv;
*argv_server = argv;
load_defaults_or_exit(conf_file, xb_server_default_groups,
&argc_server, argv_server);
*argv_client= *argv_server= *argv_backup= &mariabackup_args[0];
int argc_backup= static_cast<int>(mariabackup_args.size());
int argc_client= argc_backup;
int argc_server= argc_backup;
/* 1) Load server groups and process server options, ignore unknown
options */
load_defaults_or_exit(conf_file, &server_default_groups[0],
&argc_server, argv_server);
int n;
for (n = 0; (*argv_server)[n]; n++) {};
@ -5914,7 +5934,6 @@ handle_options(int argc, char **argv, char ***argv_client, char ***argv_server)
optp->u_max_value = (G_PTR *) &global_max_value;
}
/* Throw a descriptive error if --defaults-file or --defaults-extra-file
is not the first command line argument */
for (int i = 2 ; i < argc ; i++) {
@ -5936,6 +5955,9 @@ handle_options(int argc, char **argv, char ***argv_client, char ***argv_server)
xb_server_options, xb_get_one_option)))
exit(ho_error);
/* 2) Load client groups and process client options, ignore unknown
options */
load_defaults_or_exit(conf_file, xb_client_default_groups,
&argc_client, argv_client);
@ -5943,8 +5965,6 @@ handle_options(int argc, char **argv, char ***argv_client, char ***argv_server)
argc_client = n;
if (innobackupex_mode && argc_client > 0) {
/* emulate innobackupex script */
innobackupex_mode = true;
if (!ibx_handle_options(&argc_client, argv_client)) {
exit(EXIT_FAILURE);
}
@ -5955,18 +5975,76 @@ handle_options(int argc, char **argv, char ***argv_client, char ***argv_server)
xb_client_options, xb_get_one_option)))
exit(ho_error);
/* 3) Load backup groups and process client-server options, exit on
unknown option */
load_defaults_or_exit(conf_file, backup_default_groups, &argc_backup,
argv_backup);
for (n= 0; (*argv_backup)[n]; n++)
{
};
argc_backup= n;
my_handle_options_init_variables = FALSE;
if (argc_backup > 0 &&
(ho_error= handle_options(&argc_backup, argv_backup,
xb_server_options, xb_get_one_option)))
exit(ho_error);
/* Add back the program name handle_options removes */
++argc_backup;
--(*argv_backup);
if (innobackupex_mode && argc_backup > 0 &&
!ibx_handle_options(&argc_backup, argv_backup))
exit(EXIT_FAILURE);
my_getopt_skip_unknown = FALSE;
if (argc_backup > 0 &&
(ho_error= handle_options(&argc_backup, argv_backup,
xb_client_options, xb_get_one_option)))
exit(ho_error);
if (opt_password)
{
char *argument= opt_password;
char *start= argument;
opt_password= my_strdup(PSI_NOT_INSTRUMENTED, opt_password, MYF(MY_FAE));
while (*argument)
*argument++= 'x'; // Destroy argument
if (*start)
start[1]= 0;
}
/* 4) Process --mysqld-args options, ignore unknown options */
my_getopt_skip_unknown = TRUE;
int argc_mysqld = static_cast<int>(mysqld_args.size());
if (argc_mysqld > 1)
{
char **argv_mysqld= &mysqld_args[0];
if ((ho_error= handle_options(&argc_mysqld, &argv_mysqld,
xb_server_options, xb_get_one_option)))
exit(ho_error);
}
my_handle_options_init_variables = TRUE;
/* Reject command line arguments that don't look like options, i.e. are
not of the form '-X' (single-character options) or '--option' (long
options) */
for (int i = 0 ; i < argc_client ; i++) {
const char * const opt = (*argv_client)[i];
for (int i = 0 ; i < argc_backup ; i++) {
const char * const opt = (*argv_backup)[i];
if (strncmp(opt, "--", 2) &&
!(strlen(opt) == 2 && opt[0] == '-')) {
bool server_option = true;
for (int j = 0; j < argc_server; j++) {
if (opt == (*argv_server)[j]) {
for (int j = 0; j < argc_backup; j++) {
if (opt == (*argv_backup)[j]) {
server_option = false;
break;
}
@ -5987,7 +6065,9 @@ static int get_exepath(char *buf, size_t size, const char *argv0);
/* ================= main =================== */
int main(int argc, char **argv)
{
char **client_defaults, **server_defaults;
char **server_defaults;
char **client_defaults;
char **backup_defaults;
if (get_exepath(mariabackup_exe,FN_REFLEN, argv[0]))
strncpy(mariabackup_exe,argv[0], FN_REFLEN-1);
@ -6038,7 +6118,8 @@ int main(int argc, char **argv)
mysql_mutex_init(key_LOCK_error_log, &LOCK_error_log,
MY_MUTEX_INIT_FAST);
handle_options(argc, argv, &client_defaults, &server_defaults);
handle_options(argc, argv, &server_defaults, &client_defaults,
&backup_defaults);
#ifndef DBUG_OFF
if (dbug_option) {
@ -6058,8 +6139,9 @@ int main(int argc, char **argv)
ibx_cleanup();
}
free_defaults(client_defaults);
free_defaults(server_defaults);
free_defaults(client_defaults);
free_defaults(backup_defaults);
#ifndef DBUG_OFF
if (dbug_option) {

View File

@ -64,7 +64,7 @@ typedef struct st_pointer_array { /* when using array-strings */
#define LAST_CHAR_CODE 259
typedef struct st_replace {
my_bool found;
uint8 found;
struct st_replace *next[256];
} REPLACE;
@ -654,7 +654,13 @@ static REPLACE *init_replace(char * *from, char * *to,uint count,
for (i=1 ; i <= found_sets ; i++)
{
pos=from[found_set[i-1].table_offset];
rep_str[i].found= (my_bool) (!memcmp(pos,"\\^",3) ? 2 : 1);
/*
Test if we are matching start of string (\^)
We can't use bcmp() here as pos may be only 1 character and
that would confuse MSAN.
*/
rep_str[i].found= (uint8) ((pos[0] == '\\' && pos[1] == '^' &&
pos[2] == 0) ? 2 : 1);
rep_str[i].replace_string=to_array[found_set[i-1].table_offset];
rep_str[i].to_offset=found_set[i-1].found_offset-start_at_word(pos);
rep_str[i].from_offset=found_set[i-1].found_offset-replace_len(pos)+

View File

@ -1,6 +1,6 @@
IF(MSVC)
PROJECT(wolfssl C ASM_MASM)
ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64")
PROJECT(wolfssl C ASM)
ELSE()
PROJECT(wolfssl C)
@ -9,7 +9,7 @@ ENDIF()
IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
IF(MSVC)
SET(WOLFSSL_INTELASM ON)
ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64")
IF(CMAKE_C_COMPILER_ID MATCHES GNU AND CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9)
MESSAGE_ONCE(NO_INTEL_ASSEMBLY "Disable Intel assembly for WolfSSL - compiler is too old")
ELSEIF(WITH_MSAN)
@ -119,7 +119,7 @@ IF(WOLFSSL_INTELASM)
SET(HAVE_INTEL_RDSEED 1)
SET(WOLFSSL_X86_64_BUILD 1)
ENDIF()
ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64")
SET(HAVE_INTEL_RDSEED 1)
SET(USE_INTEL_SPEEDUP 1)
LIST(APPEND WOLFCRYPT_SOURCES

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2018 MariaDB corporation
/* Copyright (C) 2018,2020 MariaDB Corporation Ab
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

View File

@ -21,26 +21,28 @@
#include <cstddef>
#include <iterator>
namespace intrusive
{
// Derive your class from this struct to insert to a linked list.
template <class Tag= void> struct list_node
template <class Tag= void> struct ilist_node
{
list_node(list_node *next= NULL, list_node *prev= NULL)
: next(next), prev(prev)
ilist_node()
#ifndef DBUG_OFF
:
next(NULL), prev(NULL)
#endif
{
}
list_node *next;
list_node *prev;
ilist_node(ilist_node *next, ilist_node *prev) : next(next), prev(prev) {}
ilist_node *next;
ilist_node *prev;
};
// Modelled after std::list<T>
template <class T, class Tag= void> class list
template <class T, class Tag= void> class ilist
{
public:
typedef list_node<Tag> ListNode;
typedef ilist_node<Tag> ListNode;
class Iterator;
// All containers in C++ should define these types to implement generic
@ -97,16 +99,22 @@ public:
reference operator*() { return *static_cast<pointer>(node_); }
pointer operator->() { return static_cast<pointer>(node_); }
bool operator==(const Iterator &rhs) { return node_ == rhs.node_; }
bool operator!=(const Iterator &rhs) { return !(*this == rhs); }
friend bool operator==(const Iterator &lhs, const Iterator &rhs)
{
return lhs.node_ == rhs.node_;
}
friend bool operator!=(const Iterator &lhs, const Iterator &rhs)
{
return !(lhs == rhs);
}
private:
ListNode *node_;
friend class list;
friend class ilist;
};
list() : sentinel_(&sentinel_, &sentinel_), size_(0) {}
ilist() : sentinel_(&sentinel_, &sentinel_) {}
reference front() { return *begin(); }
reference back() { return *--end(); }
@ -129,14 +137,18 @@ public:
reverse_iterator rend() { return reverse_iterator(begin()); }
const_reverse_iterator rend() const { return reverse_iterator(begin()); }
bool empty() const { return size_ == 0; }
size_type size() const { return size_; }
bool empty() const { return sentinel_.next == &sentinel_; }
// Not implemented because it's O(N)
// size_type size() const
// {
// return static_cast<size_type>(std::distance(begin(), end()));
// }
void clear()
{
sentinel_.next= &sentinel_;
sentinel_.prev= &sentinel_;
size_= 0;
}
iterator insert(iterator pos, reference value)
@ -150,7 +162,6 @@ public:
static_cast<ListNode &>(value).prev= prev;
static_cast<ListNode &>(value).next= curr;
++size_;
return iterator(&value);
}
@ -162,13 +173,12 @@ public:
prev->next= next;
next->prev= prev;
// This is not required for list functioning. But maybe it'll prevent bugs
// and ease debugging.
#ifndef DBUG_OFF
ListNode *curr= pos.node_;
curr->prev= NULL;
curr->next= NULL;
#endif
--size_;
return next;
}
@ -179,12 +189,63 @@ public:
void pop_front() { erase(begin()); }
// STL version is O(n) but this is O(1) because an element can't be inserted
// several times in the same intrusive list.
// several times in the same ilist.
void remove(reference value) { erase(iterator(&value)); }
private:
ListNode sentinel_;
size_type size_;
};
} // namespace intrusive
// Similar to ilist but also has O(1) size() method.
template <class T, class Tag= void> class sized_ilist : public ilist<T, Tag>
{
typedef ilist<T, Tag> BASE;
public:
// All containers in C++ should define these types to implement generic
// container interface.
typedef T value_type;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
typedef value_type &reference;
typedef const value_type &const_reference;
typedef T *pointer;
typedef const T *const_pointer;
typedef typename BASE::Iterator iterator;
typedef const typename BASE::Iterator const_iterator;
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const iterator> const_reverse_iterator;
sized_ilist() : size_(0) {}
size_type size() const { return size_; }
void clear()
{
BASE::clear();
size_= 0;
}
iterator insert(iterator pos, reference value)
{
++size_;
return BASE::insert(pos, value);
}
iterator erase(iterator pos)
{
--size_;
return BASE::erase(pos);
}
void push_back(reference value) { insert(BASE::end(), value); }
void pop_back() { erase(BASE::end()); }
void push_front(reference value) { insert(BASE::begin(), value); }
void pop_front() { erase(BASE::begin()); }
void remove(reference value) { erase(iterator(&value)); }
private:
size_type size_;
};

View File

@ -29,148 +29,19 @@
extern "C" {
#endif
#define MARIA_CANNOT_ROLLBACK
#define MARIA_UNIQUE_HASH_LENGTH 4
extern my_bool maria_delay_key_write;
uint maria_max_key_length(void);
#define maria_max_key_segments() HA_MAX_KEY_SEG
/*
Limit max keys according to HA_MAX_POSSIBLE_KEY; See myisamchk.h for details
*/
#if MAX_INDEXES > HA_MAX_POSSIBLE_KEY
#define MARIA_MAX_KEY HA_MAX_POSSIBLE_KEY /* Max allowed keys */
#else
#define MARIA_MAX_KEY MAX_INDEXES /* Max allowed keys */
#endif
#define MARIA_NAME_IEXT ".MAI"
#define MARIA_NAME_DEXT ".MAD"
/* Max extra space to use when sorting keys */
#define MARIA_MAX_TEMP_LENGTH (2*1024L*1024L*1024L)
/* Possible values for maria_block_size (must be power of 2) */
#define MARIA_KEY_BLOCK_LENGTH 8192 /* default key block length */
#define MARIA_MIN_KEY_BLOCK_LENGTH 1024 /* Min key block length */
#define MARIA_MAX_KEY_BLOCK_LENGTH 32768
/* Minimal page cache when we only want to be able to scan a table */
#define MARIA_MIN_PAGE_CACHE_SIZE (8192L*16L)
/*
In the following macros '_keyno_' is 0 .. keys-1.
If there can be more keys than bits in the key_map, the highest bit
is for all upper keys. They cannot be switched individually.
This means that clearing of high keys is ignored, setting one high key
sets all high keys.
*/
#define MARIA_KEYMAP_BITS (8 * SIZEOF_LONG_LONG)
#define MARIA_KEYMAP_HIGH_MASK (1ULL << (MARIA_KEYMAP_BITS - 1))
#define maria_get_mask_all_keys_active(_keys_) \
(((_keys_) < MARIA_KEYMAP_BITS) ? \
((1ULL << (_keys_)) - 1ULL) : \
(~ 0ULL))
#if MARIA_MAX_KEY > MARIA_KEYMAP_BITS
#define maria_is_key_active(_keymap_,_keyno_) \
(((_keyno_) < MARIA_KEYMAP_BITS) ? \
MY_TEST((_keymap_) & (1ULL << (_keyno_))) : \
MY_TEST((_keymap_) & MARIA_KEYMAP_HIGH_MASK))
#define maria_set_key_active(_keymap_,_keyno_) \
(_keymap_)|= (((_keyno_) < MARIA_KEYMAP_BITS) ? \
(1ULL << (_keyno_)) : \
MARIA_KEYMAP_HIGH_MASK)
#define maria_clear_key_active(_keymap_,_keyno_) \
(_keymap_)&= (((_keyno_) < MARIA_KEYMAP_BITS) ? \
(~ (1ULL << (_keyno_))) : \
(~ (0ULL)) /*ignore*/ )
#else
#define maria_is_key_active(_keymap_,_keyno_) \
MY_TEST((_keymap_) & (1ULL << (_keyno_)))
#define maria_set_key_active(_keymap_,_keyno_) \
(_keymap_)|= (1ULL << (_keyno_))
#define maria_clear_key_active(_keymap_,_keyno_) \
(_keymap_)&= (~ (1ULL << (_keyno_)))
#endif
#define maria_is_any_key_active(_keymap_) \
MY_TEST((_keymap_))
#define maria_is_all_keys_active(_keymap_,_keys_) \
((_keymap_) == maria_get_mask_all_keys_active(_keys_))
#define maria_set_all_keys_active(_keymap_,_keys_) \
(_keymap_)= maria_get_mask_all_keys_active(_keys_)
#define maria_clear_all_keys_active(_keymap_) \
(_keymap_)= 0
#define maria_intersect_keys_active(_to_,_from_) \
(_to_)&= (_from_)
#define maria_is_any_intersect_keys_active(_keymap1_,_keys_,_keymap2_) \
((_keymap1_) & (_keymap2_) & \
maria_get_mask_all_keys_active(_keys_))
#define maria_copy_keys_active(_to_,_maxkeys_,_from_) \
(_to_)= (maria_get_mask_all_keys_active(_maxkeys_) & \
(_from_))
/* Param to/from maria_info */
typedef ulonglong MARIA_RECORD_POS;
typedef struct st_maria_info
{
ha_rows records; /* Records in database */
ha_rows deleted; /* Deleted records in database */
MARIA_RECORD_POS recpos; /* Pos for last used record */
MARIA_RECORD_POS newrecpos; /* Pos if we write new record */
MARIA_RECORD_POS dup_key_pos; /* Position to record with dup key */
my_off_t data_file_length; /* Length of data file */
my_off_t max_data_file_length, index_file_length;
my_off_t max_index_file_length, delete_length;
ulonglong auto_increment;
ulonglong key_map; /* Which keys are used */
time_t create_time; /* When table was created */
time_t check_time;
time_t update_time;
ulong record_offset;
double *rec_per_key; /* for sql optimizing */
ulong reclength; /* Recordlength */
ulong mean_reclength; /* Mean recordlength (if packed) */
char *data_file_name, *index_file_name;
enum data_file_type data_file_type;
uint keys; /* Number of keys in use */
uint options; /* HA_OPTION_... used */
uint reflength;
int errkey, /* With key was dupplicated on err */
sortkey; /* clustered by this key */
File filenr; /* (uniq) filenr for datafile */
} MARIA_INFO;
typedef struct st_maria_create_info
{
const char *index_file_name, *data_file_name; /* If using symlinks */
ha_rows max_rows;
ha_rows reloc_rows;
ulonglong auto_increment;
ulonglong data_file_length;
ulonglong key_file_length;
ulong s3_block_size;
/* Size of null bitmap at start of row */
uint null_bytes;
uint old_options;
uint compression_algorithm;
enum data_file_type org_data_file_type;
uint16 language;
my_bool with_auto_increment, transactional, encrypted;
} MARIA_CREATE_INFO;
struct st_maria_share;
struct st_maria_handler; /* For referense */
typedef struct st_maria_handler MARIA_HA;
struct st_maria_s_param;
struct st_maria_keydef;
struct st_maria_bit_buff;
struct st_maria_page;
typedef struct st_maria_key /* Internal info about a key */
{
uchar *data; /* Data for key */
struct st_maria_keydef *keyinfo; /* Definition for key */
uint data_length; /* Length of key data */
uint ref_length; /* record ref + transid */
uint32 flag; /* 0 or SEARCH_PART_KEY */
} MARIA_KEY;
struct st_maria_s_param;
struct st_maria_share;
typedef struct st_maria_decode_tree MARIA_DECODE_TREE;
typedef struct st_maria_handler MARIA_HA;
typedef struct st_maria_key MARIA_KEY;
typedef ulonglong MARIA_RECORD_POS;
typedef struct st_maria_keydef /* Key definition with open & info */
{
@ -213,8 +84,6 @@ typedef struct st_maria_keydef /* Key definition with open & info */
} MARIA_KEYDEF;
#define MARIA_UNIQUE_HASH_LENGTH 4
typedef struct st_maria_unique_def /* Segment definition of unique */
{
uint16 keysegs; /* Number of key-segment */
@ -223,17 +92,6 @@ typedef struct st_maria_unique_def /* Segment definition of unique */
HA_KEYSEG *seg, *end;
} MARIA_UNIQUEDEF;
typedef struct st_maria_decode_tree /* Decode huff-table */
{
uint16 *table;
uint quick_table_bits;
uchar *intervalls;
} MARIA_DECODE_TREE;
struct st_maria_bit_buff;
typedef struct s3_info S3_INFO;
/*
Note that null markers should always be first in a row !
When creating a column, one should only specify:
@ -265,157 +123,32 @@ typedef struct st_maria_columndef /* column information */
} MARIA_COLUMNDEF;
extern ulong maria_block_size, maria_checkpoint_frequency;
extern ulong maria_concurrent_insert;
extern my_bool maria_flush, maria_single_user, maria_page_checksums;
extern my_bool maria_delay_key_write;
extern my_off_t maria_max_temp_length;
extern ulong maria_bulk_insert_tree_size, maria_data_pointer_size;
extern MY_TMPDIR *maria_tmpdir;
extern my_bool maria_encrypt_tables;
typedef struct st_maria_create_info
{
const char *index_file_name, *data_file_name; /* If using symlinks */
ha_rows max_rows;
ha_rows reloc_rows;
ulonglong auto_increment;
ulonglong data_file_length;
ulonglong key_file_length;
ulong s3_block_size;
/* Size of null bitmap at start of row */
uint null_bytes;
uint old_options;
uint compression_algorithm;
enum data_file_type org_data_file_type;
uint16 language;
my_bool with_auto_increment, transactional, encrypted;
} MARIA_CREATE_INFO;
/*
This is used to check if a symlink points into the mysql data home,
which is normally forbidden as it can be used to get access to
not privileged data
*/
extern int (*maria_test_invalid_symlink)(const char *filename);
/* Prototypes for maria-functions */
extern int maria_init(void);
extern void maria_end(void);
extern my_bool maria_upgrade(void);
extern int maria_close(MARIA_HA *file);
extern int maria_delete(MARIA_HA *file, const uchar *buff);
extern MARIA_HA *maria_open(const char *name, int mode,
uint wait_if_locked, S3_INFO *s3);
extern int maria_panic(enum ha_panic_function function);
extern int maria_rfirst(MARIA_HA *file, uchar *buf, int inx);
extern int maria_rkey(MARIA_HA *file, uchar *buf, int inx,
const uchar *key, key_part_map keypart_map,
enum ha_rkey_function search_flag);
extern int maria_rlast(MARIA_HA *file, uchar *buf, int inx);
extern int maria_rnext(MARIA_HA *file, uchar *buf, int inx);
extern int maria_rnext_same(MARIA_HA *info, uchar *buf);
extern int maria_rprev(MARIA_HA *file, uchar *buf, int inx);
extern int maria_rrnd(MARIA_HA *file, uchar *buf,
MARIA_RECORD_POS pos);
extern int maria_scan_init(MARIA_HA *file);
extern int maria_scan(MARIA_HA *file, uchar *buf);
extern void maria_scan_end(MARIA_HA *file);
extern int maria_rsame(MARIA_HA *file, uchar *record, int inx);
extern int maria_rsame_with_pos(MARIA_HA *file, uchar *record,
int inx, MARIA_RECORD_POS pos);
extern int maria_update(MARIA_HA *file, const uchar *old,
const uchar *new_record);
extern int maria_write(MARIA_HA *file, const uchar *buff);
extern MARIA_RECORD_POS maria_position(MARIA_HA *file);
extern int maria_status(MARIA_HA *info, MARIA_INFO *x, uint flag);
extern int maria_lock_database(MARIA_HA *file, int lock_type);
extern int maria_create(const char *name, enum data_file_type record_type,
uint keys, MARIA_KEYDEF *keydef,
uint columns, MARIA_COLUMNDEF *columndef,
uint uniques, MARIA_UNIQUEDEF *uniquedef,
MARIA_CREATE_INFO *create_info, uint flags);
extern int maria_delete_table(const char *name);
extern int maria_rename(const char *from, const char *to);
extern int maria_extra(MARIA_HA *file,
enum ha_extra_function function, void *extra_arg);
extern int maria_reset(MARIA_HA *file);
extern ha_rows maria_records_in_range(MARIA_HA *info, int inx,
const key_range *min_key,
const key_range *max_key,
page_range *page);
extern int maria_is_changed(MARIA_HA *info);
extern int maria_delete_all_rows(MARIA_HA *info);
extern uint maria_get_pointer_length(ulonglong file_length, uint def);
extern int maria_commit(MARIA_HA *info);
extern int maria_begin(MARIA_HA *info);
extern void maria_disable_logging(MARIA_HA *info);
extern void maria_enable_logging(MARIA_HA *info);
#define HA_RECOVER_NONE 0 /* No automatic recover */
#define HA_RECOVER_DEFAULT 1 /* Automatic recover active */
#define HA_RECOVER_BACKUP 2 /* Make a backupfile on recover */
#define HA_RECOVER_FORCE 4 /* Recover even if we loose rows */
#define HA_RECOVER_QUICK 8 /* Don't check rows in data file */
#define HA_RECOVER_ANY (HA_RECOVER_DEFAULT | HA_RECOVER_BACKUP | HA_RECOVER_FORCE | HA_RECOVER_QUICK)
/* this is used to pass to mysql_mariachk_table */
#define MARIA_CHK_REPAIR 1 /* equivalent to mariachk -r */
#define MARIA_CHK_VERIFY 2 /* Verify, run repair if failure */
typedef uint maria_bit_type;
typedef struct st_maria_bit_buff
{ /* Used for packing of record */
maria_bit_type current_byte;
uint bits;
uchar *pos, *end, *blob_pos, *blob_end;
uint error;
} MARIA_BIT_BUFF;
/* functions in maria_check */
void maria_chk_init(HA_CHECK *param);
void maria_chk_init_for_check(HA_CHECK *param, MARIA_HA *info);
int maria_chk_status(HA_CHECK *param, MARIA_HA *info);
int maria_chk_del(HA_CHECK *param, MARIA_HA *info, ulonglong test_flag);
int maria_chk_size(HA_CHECK *param, MARIA_HA *info);
int maria_chk_key(HA_CHECK *param, MARIA_HA *info);
int maria_chk_data_link(HA_CHECK *param, MARIA_HA *info, my_bool extend);
int maria_repair(HA_CHECK *param, MARIA_HA *info, char * name, my_bool);
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, 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,
myf myflags);
void maria_lock_memory(HA_CHECK *param);
int maria_update_state_info(HA_CHECK *param, MARIA_HA *info, uint update);
void maria_update_key_parts(MARIA_KEYDEF *keyinfo, double *rec_per_key_part,
ulonglong *unique, ulonglong *notnull,
ulonglong records);
int maria_filecopy(HA_CHECK *param, File to, File from, my_off_t start,
my_off_t length, const char *type);
int maria_movepoint(MARIA_HA *info, uchar *record, my_off_t oldpos,
my_off_t newpos, uint prot_key);
int maria_test_if_almost_full(MARIA_HA *info);
int maria_recreate_table(HA_CHECK *param, MARIA_HA **org_info, char *filename);
int maria_disable_indexes(MARIA_HA *info);
int maria_enable_indexes(MARIA_HA *info);
int maria_indexes_are_disabled(MARIA_HA *info);
void maria_disable_indexes_for_rebuild(MARIA_HA *info, ha_rows rows,
my_bool all_keys);
my_bool maria_test_if_sort_rep(MARIA_HA *info, ha_rows rows, ulonglong key_map,
my_bool force);
int maria_init_bulk_insert(MARIA_HA *info, size_t cache_size, ha_rows rows);
void maria_flush_bulk_insert(MARIA_HA *info, uint inx);
int maria_end_bulk_insert(MARIA_HA *info, my_bool abort);
int maria_preload(MARIA_HA *info, ulonglong key_map, my_bool ignore_leaves);
void maria_versioning(MARIA_HA *info, my_bool versioning);
void maria_ignore_trids(MARIA_HA *info);
uint maria_max_key_length(void);
my_bool maria_too_big_key_for_sort(MARIA_KEYDEF *key, ha_rows rows);
#define maria_max_key_segments() HA_MAX_KEY_SEG
/* fulltext functions */
FT_INFO *maria_ft_init_search(uint,void *, uint, uchar *, size_t,
CHARSET_INFO *, uchar *);
/* 'Almost-internal' Maria functions */
void _ma_update_auto_increment_key(HA_CHECK *param, MARIA_HA *info,
my_bool repair);
uint columns, MARIA_COLUMNDEF *columndef,
uint uniques, MARIA_UNIQUEDEF *uniquedef,
MARIA_CREATE_INFO *create_info, uint flags);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -31,7 +31,7 @@ extern ulong my_time_to_wait_for_lock;
#include <signal.h>
#ifdef HAVE_SIGHANDLER_T
#define sig_return sighandler_t
#elif defined(SOLARIS) || defined(__sun) || defined(__APPLE__)
#elif defined(SOLARIS) || defined(__sun) || defined(__APPLE__) || defined(__FreeBSD__)
typedef void (*sig_return)(int); /* Returns type from signal */
#else
typedef void (*sig_return)(void); /* Returns type from signal */

View File

@ -2,6 +2,7 @@
#define MY_ATOMIC_INCLUDED
/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2018, 2020, MariaDB
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
@ -168,5 +169,4 @@
#define my_atomic_casptr_strong_explicit(P, E, D, S, F) \
my_atomic_casptr((P), (E), (D))
#endif
#endif /* MY_ATOMIC_INCLUDED */

View File

@ -0,0 +1,58 @@
/* Copyright (c) 2020, MariaDB
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-1335 USA */
#ifdef __cplusplus
#include <atomic>
/**
A wrapper for std::atomic, defaulting to std::memory_order_relaxed.
When it comes to atomic loads or stores at std::memory_order_relaxed
on IA-32 or AMD64, this wrapper is only introducing some constraints
to the C++ compiler, to prevent some optimizations of loads or
stores.
On POWER and ARM, atomic loads and stores involve different instructions
from normal loads and stores and will thus incur some overhead.
Because atomic read-modify-write operations will always incur
overhead, we intentionally do not define
operator++(), operator--(), operator+=(), operator-=(), or similar,
to make the overhead stand out in the users of this code.
*/
template <typename Type> class Atomic_relaxed
{
std::atomic<Type> m;
public:
Atomic_relaxed(const Atomic_relaxed<Type> &rhs)
{ m.store(rhs, std::memory_order_relaxed); }
Atomic_relaxed(Type val) : m(val) {}
Atomic_relaxed() {}
operator Type() const { return m.load(std::memory_order_relaxed); }
Type operator=(const Type val)
{ m.store(val, std::memory_order_relaxed); return val; }
Type operator=(const Atomic_relaxed<Type> &rhs) { return *this= Type{rhs}; }
Type fetch_add(const Type i, std::memory_order o= std::memory_order_relaxed)
{ return m.fetch_add(i, o); }
Type fetch_sub(const Type i, std::memory_order o= std::memory_order_relaxed)
{ return m.fetch_sub(i, o); }
bool compare_exchange_strong(Type& i1, const Type i2,
std::memory_order o1= std::memory_order_relaxed,
std::memory_order o2= std::memory_order_relaxed)
{ return m.compare_exchange_strong(i1, i2, o1, o2); }
Type exchange(const Type i, std::memory_order o= std::memory_order_relaxed)
{ return m.exchange(i, o); }
};
#endif /* __cplusplus */

View File

@ -55,6 +55,10 @@
*/
#define HA_OPEN_FOR_ALTER 8192U
/* Open table for FLUSH */
#define HA_OPEN_FOR_FLUSH 8192U
/* The following is parameter to ha_rkey() how to use key */
/*

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