Skip to content

Commit

Permalink
Merge 10.0.14 into 10.1
Browse files Browse the repository at this point in the history
  • Loading branch information
vuvova committed Oct 15, 2014
2 parents f947f73 + f1afc00 commit f62c12b
Show file tree
Hide file tree
Showing 2,115 changed files with 88,123 additions and 80,328 deletions.
45 changes: 35 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ IF(POLICY CMP0022)
CMAKE_POLICY(SET CMP0022 OLD)
ENDIF()

# We use the LOCATION target property (CMP0026)
# and get_target_property() for non-existent targets (CMP0045)
IF(CMAKE_VERSION VERSION_EQUAL "3.0.0" OR
CMAKE_VERSION VERSION_GREATER "3.0.0")
CMAKE_POLICY(SET CMP0026 OLD)
CMAKE_POLICY(SET CMP0045 OLD)
ENDIF()

MESSAGE(STATUS "Running cmake version ${CMAKE_VERSION}")

SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
Expand Down Expand Up @@ -277,16 +285,11 @@ ENDIF()
# safemalloc can be enabled and disabled independently
SET(WITH_SAFEMALLOC "AUTO" CACHE STRING "Use safemalloc memory debugger. Will result in slower execution. Options are: ON OFF AUTO.")

# force -DUSE_MYSYS_NEW unless already done by HAVE_CXX_NEW
IF(HAVE_CXX_NEW)
SET(DUSE_MYSYS_NEW "-DUSE_MYSYS_NEW")
ENDIF()

IF(WITH_SAFEMALLOC MATCHES "ON")
ADD_DEFINITIONS( -DSAFEMALLOC ${DUSE_MYSYS_NEW})
ADD_DEFINITIONS( -DSAFEMALLOC)
ELSEIF(WITH_SAFEMALLOC MATCHES "AUTO" AND NOT WIN32 AND NOT WITH_VALGRIND)
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC ${DUSE_MYSYS_NEW}")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC")
ENDIF()

# Set commonly used variables
Expand All @@ -306,7 +309,7 @@ ELSE()
ENDIF()
SET(DEFAULT_CHARSET_HOME "${DEFAULT_MYSQL_HOME}")
SET(PLUGINDIR "${DEFAULT_MYSQL_HOME}/${INSTALL_PLUGINDIR}")
IF(INSTALL_SYSCONFDIR)
IF(INSTALL_SYSCONFDIR AND NOT DEFAULT_SYSCONFDIR)
SET(DEFAULT_SYSCONFDIR "${INSTALL_SYSCONFDIR}")
ENDIF()

Expand All @@ -324,6 +327,11 @@ ENDIF()
# Run platform tests
INCLUDE(configure.cmake)

# force -DUSE_MYSYS_NEW unless already done by HAVE_CXX_NEW
IF(NOT HAVE_CXX_NEW)
ADD_DEFINITIONS(-DUSE_MYSYS_NEW)
ENDIF()

# Find header files from the bundled libraries
# (jemalloc, yassl, readline, pcre, etc)
# before the ones installed in the system
Expand Down Expand Up @@ -360,6 +368,11 @@ ELSEIF(MYSQL_MAINTAINER_MODE MATCHES "AUTO")
SET(CMAKE_CXX_FLAGS_DEBUG "${MY_MAINTAINER_CXX_WARNINGS} ${CMAKE_CXX_FLAGS_DEBUG}")
ENDIF()

IF(CMAKE_CROSSCOMPILING)
SET(IMPORT_EXECUTABLES "IMPORTFILE-NOTFOUND" CACHE FILEPATH "Path to import_executables.cmake from a native build")
INCLUDE(${IMPORT_EXECUTABLES})
ENDIF()

IF(WITH_UNIT_TESTS)
ENABLE_TESTING()
ADD_SUBDIRECTORY(unittest/mytap)
Expand Down Expand Up @@ -421,10 +434,21 @@ IF(WIN32)
ENDIF()
ADD_SUBDIRECTORY(packaging/solaris)


INCLUDE(for_clients)
ADD_SUBDIRECTORY(scripts)
ADD_SUBDIRECTORY(support-files)

IF(NOT CMAKE_CROSSCOMPILING)
SET(EXPORTED comp_err comp_sql factorial)
IF(NOT WITHOUT_SERVER)
SET(EXPORTED ${EXPORTED} gen_lex_hash gen_pfs_lex_token)
ENDIF()
# minimal target to build only binaries for export
ADD_CUSTOM_TARGET(import_executables DEPENDS ${EXPORTED})
EXPORT(TARGETS ${EXPORTED} FILE ${CMAKE_BINARY_DIR}/import_executables.cmake)
ENDIF()

CONFIGURE_FILE(config.h.cmake ${CMAKE_BINARY_DIR}/include/my_config.h)
CONFIGURE_FILE(config.h.cmake ${CMAKE_BINARY_DIR}/include/config.h)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/mysql_version.h.in
Expand Down Expand Up @@ -458,8 +482,9 @@ ADD_CUSTOM_TARGET(INFO_BIN ALL

INSTALL_DOCUMENTATION(README CREDITS COPYING COPYING.LESSER COPYING.thirdparty
EXCEPTIONS-CLIENT COMPONENT Readme)
INSTALL_DOCUMENTATION(${CMAKE_BINARY_DIR}/Docs/INFO_SRC
${CMAKE_BINARY_DIR}/Docs/INFO_BIN)
# MDEV-6526 these files are not installed anymore
#INSTALL_DOCUMENTATION(${CMAKE_BINARY_DIR}/Docs/INFO_SRC
# ${CMAKE_BINARY_DIR}/Docs/INFO_BIN)

IF(UNIX)
INSTALL_DOCUMENTATION(Docs/INSTALL-BINARY COMPONENT Readme)
Expand Down
4 changes: 0 additions & 4 deletions VERSION
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Version number for MariaDB is maintained here.
# The version string is created from:
# MYSQL_VERSION_MAJOR.MYSQL_VERSION_MINOR.MYSQL_VERSION_PATCH-MYSQL_VERSION_EXTRA
#
MYSQL_VERSION_MAJOR=10
MYSQL_VERSION_MINOR=1
MYSQL_VERSION_PATCH=1
Expand Down
2 changes: 1 addition & 1 deletion client/mysql.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ extern "C" {
#if defined(__WIN__)
#include <conio.h>
#else
#include <readline/readline.h>
#include <readline.h>
#define HAVE_READLINE
#define USE_POPEN
#endif
Expand Down
79 changes: 42 additions & 37 deletions client/mysql_upgrade.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include <welcome_copyright_notice.h> /* ORACLE_WELCOME_COPYRIGHT_NOTICE */

#define VER "1.3a"
#define VER "1.4"

#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
Expand Down Expand Up @@ -140,21 +140,21 @@ static struct my_option my_long_options[]=
#include <sslopt-longopts.h>
{"tmpdir", 't', "Directory for temporary files.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"upgrade-system-tables", 's', "Only upgrade the system tables "
"do not try to upgrade the data.",
{"upgrade-system-tables", 's', "Only upgrade the system tables in the mysql database. Tables in other databases are not checked or touched.",
&opt_systables_only, &opt_systables_only, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"user", 'u', "User for login if not current user.", &opt_user,
&opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"verbose", 'v', "Display more output about the process.",
{"verbose", 'v', "Display more output about the process; Using it twice will print connection argument; Using it 3 times will print out all CHECK, RENAME and ALTER TABLE during the check phase.",
&opt_not_used, &opt_not_used, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version-check", 'k', "Run this program only if its \'server version\' "
"matches the version of the server to which it's connecting, (enabled by "
"default); use --skip-version-check to avoid this check. Note: the \'server "
"version\' of the program is the version of the MySQL server with which it "
"was built/distributed.", &opt_version_check, &opt_version_check, 0,
{"version-check", 'k',
"Run this program only if its \'server version\' "
"matches the version of the server to which it's connecting. "
"Note: the \'server version\' of the program is the version of the MariaDB "
"server with which it was built/distributed.",
&opt_version_check, &opt_version_check, 0,
GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"write-binlog", OPT_WRITE_BINLOG, "All commands including those, "
"issued by mysqlcheck, are written to the binary log.",
Expand Down Expand Up @@ -206,12 +206,12 @@ static void die(const char *fmt, ...)
}


static void verbose(const char *fmt, ...)
static int verbose(const char *fmt, ...)
{
va_list args;

if (opt_silent)
return;
return 0;

/* Print the verbose message */
va_start(args, fmt);
Expand All @@ -222,6 +222,7 @@ static void verbose(const char *fmt, ...)
fflush(stdout);
}
va_end(args);
return 0;
}


Expand Down Expand Up @@ -370,6 +371,9 @@ static int run_command(char* cmd,
FILE *res_file;
int error;

if (opt_verbose >= 4)
puts(cmd);

if (!(res_file= popen(cmd, "r")))
die("popen(\"%s\", \"r\") failed", cmd);

Expand Down Expand Up @@ -750,28 +754,29 @@ static void print_conn_args(const char *tool_name)
in the server using "mysqlcheck --check-upgrade .."
*/

static int run_mysqlcheck_upgrade(void)
static int run_mysqlcheck_upgrade(const char *arg1, const char *arg2)
{
verbose("Phase 2/3: Checking and upgrading tables");
print_conn_args("mysqlcheck");
return run_tool(mysqlcheck_path,
NULL, /* Send output from mysqlcheck directly to screen */
"--no-defaults",
ds_args.str,
"--check-upgrade",
"--all-databases",
"--auto-repair",
!opt_silent || opt_verbose ? "--verbose": "",
!opt_silent || opt_verbose >= 1 ? "--verbose" : "",
opt_verbose >= 2 ? "--verbose" : "",
opt_verbose >= 3 ? "--verbose" : "",
opt_silent ? "--silent": "",
opt_write_binlog ? "--write-binlog" : "--skip-write-binlog",
arg1, arg2,
"2>&1",
NULL);
}


static int run_mysqlcheck_fixnames(void)
{
verbose("Phase 1/3: Fixing table and database names");
verbose("Phase 3/4: Fixing table and database names");
print_conn_args("mysqlcheck");
return run_tool(mysqlcheck_path,
NULL, /* Send output from mysqlcheck directly to screen */
Expand All @@ -780,7 +785,9 @@ static int run_mysqlcheck_fixnames(void)
"--all-databases",
"--fix-db-names",
"--fix-table-names",
opt_verbose ? "--verbose": "",
opt_verbose >= 1 ? "--verbose" : "",
opt_verbose >= 2 ? "--verbose" : "",
opt_verbose >= 3 ? "--verbose" : "",
opt_silent ? "--silent": "",
opt_write_binlog ? "--write-binlog" : "--skip-write-binlog",
"2>&1",
Expand Down Expand Up @@ -857,7 +864,6 @@ static int run_sql_fix_privilege_tables(void)
if (init_dynamic_string(&ds_result, "", 512, 512))
die("Out of memory");

verbose("Phase 3/3: Running 'mysql_fix_privilege_tables'...");
/*
Individual queries can not be executed independently by invoking
a forked mysql client, because the script uses session variables
Expand Down Expand Up @@ -1004,16 +1010,12 @@ int main(int argc, char **argv)
/* Find mysql */
find_tool(mysql_path, IF_WIN("mysql.exe", "mysql"), self_name);

if (!opt_systables_only)
{
/* Find mysqlcheck */
find_tool(mysqlcheck_path, IF_WIN("mysqlcheck.exe", "mysqlcheck"), self_name);
}
else
{
if (!opt_silent)
printf("The --upgrade-system-tables option was used, databases won't be touched.\n");
}
/* Find mysqlcheck */
find_tool(mysqlcheck_path, IF_WIN("mysqlcheck.exe", "mysqlcheck"), self_name);

if (opt_systables_only && !opt_silent)
printf("The --upgrade-system-tables option was used, user tables won't be touched.\n");


/*
Read the mysql_upgrade_info file to check if mysql_upgrade
Expand All @@ -1033,16 +1035,19 @@ int main(int argc, char **argv)
/*
Run "mysqlcheck" and "mysql_fix_privilege_tables.sql"
*/
if ((!opt_systables_only &&
(run_mysqlcheck_fixnames() || run_mysqlcheck_upgrade())) ||
run_sql_fix_privilege_tables())
{
/*
The upgrade failed to complete in some way or another,
significant error message should have been printed to the screen
*/
verbose("Phase 1/4: Checking mysql database");
if (run_mysqlcheck_upgrade("--databases", "mysql"))
die("Upgrade failed" );
}
verbose("Phase 2/4: Running 'mysql_fix_privilege_tables'...");
if (run_sql_fix_privilege_tables())
die("Upgrade failed" );

if (!opt_systables_only &&
(run_mysqlcheck_fixnames() ||
verbose("Phase 4/4: Checking and upgrading tables") ||
run_mysqlcheck_upgrade("--all-databases","--skip-database=mysql")))
die("Upgrade failed" );

verbose("OK");

/* Create a file indicating upgrade has been performed */
Expand Down

0 comments on commit f62c12b

Please sign in to comment.