Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Barkov committed Jan 17, 2017
2 parents 59c58f6 + 6a65de6 commit 095ea08
Show file tree
Hide file tree
Showing 319 changed files with 6,519 additions and 10,233 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -3,6 +3,7 @@
*.reject
*.spec
*.bak
*.dgcov
*.rpm
.*.swp
*.ninja
Expand Down Expand Up @@ -80,6 +81,9 @@ mysql-test/lib/My/SafeProcess/my_safe_process
mysql-test/mtr
mysql-test/mysql-test-run
mysql-test/var
mysql-test-gcov.err
mysql-test-gcov.msg
mysys/test_hash
mysys/thr_lock
mysys/thr_timer
packaging/rpm-oel/mysql.spec
Expand Down
4 changes: 2 additions & 2 deletions BUILD/FINISH.sh
Expand Up @@ -32,9 +32,9 @@ then
configure="$configure --verbose"
fi

# git clean -fdX removes all ignored (build) files
commands="\
/bin/rm -rf configure;
/bin/rm -rf CMakeCache.txt CMakeFiles/
git clean -fdX
path=`dirname $0`
. \"$path/autorun.sh\""
Expand Down
11 changes: 5 additions & 6 deletions BUILD/SETUP.sh
Expand Up @@ -42,7 +42,7 @@ Usage: $0 [-h|-n] [configure-options]
Influences the debug flags. Old is default.
--prefix=path Build with prefix 'path'.
Note: this script is intended for internal use by MySQL developers.
Note: this script is intended for internal use by MariaDB developers.
EOF
}

Expand Down Expand Up @@ -120,10 +120,9 @@ path=`dirname $0`
get_make_parallel_flag

# SSL library to use.--with-ssl will select our bundled yaSSL
# implementation of SSL. To use OpenSSL you will need to specify
# the location of OpenSSL headers and libs on your system.
# Ex --with-ssl=/usr
SSL_LIBRARY=--with-ssl
# implementation of SSL. --with-ssl=yes will first try system library
# then the boundled one --with-ssl=system will use the system library.
SSL_LIBRARY=--with-ssl=system

if [ "x$warning_mode" = "xpedantic" ]; then
warnings="-W -Wall -ansi -pedantic -Wno-long-long -Wno-unused -D_POSIX_SOURCE"
Expand Down Expand Up @@ -293,7 +292,7 @@ gcov_compile_flags="$gcov_compile_flags -DMYSQL_SERVER_SUFFIX=-gcov -DHAVE_gcov"
# GCC4 needs -fprofile-arcs -ftest-coverage on the linker command line (as well
# as on the compiler command line), and this requires setting LDFLAGS for BDB.

gcov_link_flags="-fprofile-arcs -ftest-coverage"
gcov_link_flags="-fprofile-arcs -ftest-coverage -lgcov"

gcov_configs="--with-gcov"

Expand Down
2 changes: 1 addition & 1 deletion BUILD/compile-pentium64-gcov
Expand Up @@ -28,6 +28,6 @@ export LDFLAGS="$gcov_link_flags"
extra_flags="$pentium64_cflags $max_cflags $gcov_compile_flags"
c_warnings="$c_warnings $debug_extra_warnings"
cxx_warnings="$cxx_warnings $debug_extra_warnings"
extra_configs="$pentium_configs $debug_configs $gcov_configs $max_configs --with-zlib-dir=bundled"
extra_configs="$pentium_configs $debug_configs $gcov_configs $max_configs"

. "$path/FINISH.sh"
2 changes: 1 addition & 1 deletion CMakeLists.txt
Expand Up @@ -274,7 +274,7 @@ ENDIF()

# Set commonly used variables
IF(WIN32)
SET(DEFAULT_MYSQL_HOME "C:/MariaDB${MYSQL_BASE_VERSION}")
SET(DEFAULT_MYSQL_HOME "C:/Program Files/MariaDB ${MYSQL_BASE_VERSION}")
SET(SHAREDIR share)
ELSE()
SET(DEFAULT_MYSQL_HOME ${CMAKE_INSTALL_PREFIX})
Expand Down
13 changes: 13 additions & 0 deletions client/mysqltest.cc
Expand Up @@ -5156,6 +5156,7 @@ uint get_errcode_from_name(const char *error_name, const char *error_end)
handler_error_names)))
return tmp;
die("Unknown SQL error name '%s'", error_name);
return 0; // Keep compiler happy
}

const char *unknown_error= "<Unknown>";
Expand Down Expand Up @@ -5786,6 +5787,7 @@ void do_connect(struct st_command *command)
my_bool con_shm __attribute__ ((unused))= 0;
int read_timeout= 0;
int write_timeout= 0;
int connect_timeout= 0;
struct st_connection* con_slot;

static DYNAMIC_STRING ds_connection_name;
Expand Down Expand Up @@ -5892,6 +5894,11 @@ void do_connect(struct st_command *command)
{
write_timeout= atoi(con_options + sizeof("write_timeout=")-1);
}
else if (strncasecmp(con_options, "connect_timeout=",
sizeof("connect_timeout=")-1) == 0)
{
connect_timeout= atoi(con_options + sizeof("connect_timeout=")-1);
}
else
die("Illegal option to connect: %.*s",
(int) (end - con_options), con_options);
Expand Down Expand Up @@ -5976,6 +5983,12 @@ void do_connect(struct st_command *command)
(char*)&write_timeout);
}

if (connect_timeout)
{
mysql_options(con_slot->mysql, MYSQL_OPT_CONNECT_TIMEOUT,
(char*)&connect_timeout);
}

#ifdef HAVE_SMEM
if (con_shm)
{
Expand Down
13 changes: 9 additions & 4 deletions cmake/configure.pl
Expand Up @@ -165,21 +165,26 @@ sub check_compiler
$cmakeargs = $cmakeargs." -DWITH_LIBEVENT=bundled";
next;
}
if($option =~ /with-ssl=/)
if($option =~ /with-ssl=yes/)
{
$cmakeargs = $cmakeargs." -DWITH_SSL=yes";
next;
}
if($option =~ /with-debug/)
if($option =~ /with-ssl=system/)
{
$cmakeargs = $cmakeargs." -DCMAKE_BUILD_TYPE=Debug -DSECURITY_HARDENED=OFF";
$cmakeargs = $cmakeargs." -DWITH_SSL=system";
next;
}
if($option =~ /with-ssl/)
if($option =~ /with-ssl$/)
{
$cmakeargs = $cmakeargs." -DWITH_SSL=bundled";
next;
}
if($option =~ /with-debug/)
{
$cmakeargs = $cmakeargs." -DCMAKE_BUILD_TYPE=Debug -DSECURITY_HARDENED=OFF";
next;
}
if($option =~ /prefix=/)
{
$cmake_install_prefix= substr($option, 7);
Expand Down
35 changes: 17 additions & 18 deletions dbug/dbug.c
Expand Up @@ -1213,7 +1213,7 @@ void _db_return_(struct _db_stack_frame_ *_stack_frame_)
*
* SYNOPSIS
*
* VOID _db_pargs_(_line_, keyword)
* int _db_pargs_(_line_, keyword)
* int _line_;
* char *keyword;
*
Expand All @@ -1226,12 +1226,14 @@ void _db_return_(struct _db_stack_frame_ *_stack_frame_)
*
*/

void _db_pargs_(uint _line_, const char *keyword)
int _db_pargs_(uint _line_, const char *keyword)
{
CODE_STATE *cs;
get_code_state_or_return;
get_code_state_or_return 0;
cs->u_line= _line_;
cs->u_keyword= keyword;

return DEBUGGING && _db_keyword_(cs, cs->u_keyword, 0);
}


Expand Down Expand Up @@ -1265,27 +1267,24 @@ void _db_doprnt_(const char *format,...)
{
va_list args;
CODE_STATE *cs;
int save_errno;

get_code_state_or_return;

va_start(args,format);

if (!cs->locked)
pthread_mutex_lock(&THR_LOCK_dbug);
if (_db_keyword_(cs, cs->u_keyword, 0))
{
int save_errno=errno;
DoPrefix(cs, cs->u_line);
if (TRACING)
Indent(cs, cs->level + 1);
else
(void) fprintf(cs->stack->out_file->file, "%s: ", cs->func);
(void) fprintf(cs->stack->out_file->file, "%s: ", cs->u_keyword);
DbugVfprintf(cs->stack->out_file->file, format, args);
DbugFlush(cs);
errno=save_errno;
}
else if (!cs->locked)
pthread_mutex_unlock(&THR_LOCK_dbug);
save_errno=errno;
DoPrefix(cs, cs->u_line);
if (TRACING)
Indent(cs, cs->level + 1);
else
(void) fprintf(cs->stack->out_file->file, "%s: ", cs->func);
(void) fprintf(cs->stack->out_file->file, "%s: ", cs->u_keyword);
DbugVfprintf(cs->stack->out_file->file, format, args);
DbugFlush(cs);
errno=save_errno;

va_end(args);
}
Expand Down
2 changes: 1 addition & 1 deletion debian/mariadb-test.install
Expand Up @@ -17,7 +17,7 @@ usr/lib/mysql/plugin/qa_auth_client.so
usr/lib/mysql/plugin/qa_auth_interface.so
usr/lib/mysql/plugin/qa_auth_server.so
usr/share/mysql/mysql-test/README
usr/share/mysql/mysql-test/README.gcov
usr/share/mysql/mysql-test/README-gcov
usr/share/mysql/mysql-test/README.stress
usr/share/mysql/mysql-test/disabled.def
usr/share/mysql/mysql-test/lib
Expand Down
1 change: 1 addition & 0 deletions extra/CMakeLists.txt
Expand Up @@ -80,6 +80,7 @@ IF(WITH_INNOBASE_STORAGE_ENGINE OR WITH_XTRADB_STORAGE_ENGINE)
../storage/innobase/buf/buf0buf.cc
../storage/innobase/page/page0zip.cc
../storage/innobase/os/os0file.cc
../storage/innobase/fil/fil0crypt.cc
)


Expand Down
42 changes: 38 additions & 4 deletions extra/innochecksum.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2014, 2016, MariaDB Corporation.
Copyright (c) 2014, 2017, MariaDB Corporation.
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
Expand Down Expand Up @@ -70,6 +70,24 @@ The parts not included are excluded by #ifndef UNIV_INNOCHECKSUM. */
#define PRIuMAX "llu"
#endif

/*********************************************************************
Verify checksum for a page (iff it's encrypted)
NOTE: currently this function can only be run in single threaded mode
as it modifies srv_checksum_algorithm (temporarily)
@param[in] src_fame page to verify
@param[in] page_size page_size
@param[in] page_no page number of given read_buf
@param[in] strict_check true if strict-check option is enabled
@return true if page is encrypted AND OK, false otherwise */
UNIV_INTERN
bool
fil_space_verify_crypt_checksum(
/*============================*/
const byte* src_frame, /*!< in: page the verify */
const page_size_t& page_size /*!< in: page size */
,uintmax_t page_no,
bool strict_check);

/* Global variables */
static bool verbose;
static bool just_count;
Expand Down Expand Up @@ -564,9 +582,25 @@ is_page_corrupted(
}
}

is_corrupted = buf_page_is_corrupted(
true, buf, page_size, false, cur_page_num, strict_verify,
is_log_enabled, log_file);
/* If page is encrypted, use different checksum calculation
as innochecksum can't decrypt pages. Note that some old InnoDB
versions did not initialize FIL_PAGE_FILE_FLUSH_LSN field
so if crypt checksum does not match we verify checksum using
normal method.
*/
if (mach_read_from_4(buf+FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION) != 0) {
is_corrupted = fil_space_verify_crypt_checksum(buf, page_size,
cur_page_num, strict_verify);
} else {
is_corrupted = true;
}

if (is_corrupted) {
is_corrupted = buf_page_is_corrupted(
true, buf, page_size, false,
cur_page_num, strict_verify,
is_log_enabled, log_file);
}

return(is_corrupted);
}
Expand Down
2 changes: 1 addition & 1 deletion include/hash.h
Expand Up @@ -42,7 +42,7 @@ extern "C" {
#define HASH_UNIQUE 1 /* hash_insert fails on duplicate key */
#define HASH_THREAD_SPECIFIC 2 /* Mark allocated memory THREAD_SPECIFIC */

typedef uint my_hash_value_type;
typedef uint32 my_hash_value_type;
typedef uchar *(*my_hash_get_key)(const uchar *,size_t*,my_bool);
typedef my_hash_value_type (*my_hash_function)(CHARSET_INFO *,
const uchar *, size_t);
Expand Down
18 changes: 14 additions & 4 deletions include/my_dbug.h
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates.
Copyright (C) 2000-2011 Monty Program Ab
Copyright (C) 2000, 2017, 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
Expand Down Expand Up @@ -50,7 +50,7 @@ extern void _db_set_init_(const char *control);
extern void _db_enter_(const char *_func_, const char *_file_, uint _line_,
struct _db_stack_frame_ *_stack_frame_);
extern void _db_return_(struct _db_stack_frame_ *_stack_frame_);
extern void _db_pargs_(uint _line_,const char *keyword);
extern int _db_pargs_(uint _line_,const char *keyword);
extern void _db_doprnt_(const char *format,...)
ATTRIBUTE_FORMAT(printf, 1, 2);
extern void _db_dump_(uint _line_,const char *keyword,
Expand Down Expand Up @@ -91,7 +91,7 @@ extern const char* _db_get_func_(void);
#define DBUG_EVALUATE_IF(keyword,a1,a2) \
(_db_keyword_(0,(keyword), 1) ? (a1) : (a2))
#define DBUG_PRINT(keyword,arglist) \
do {_db_pargs_(__LINE__,keyword); _db_doprnt_ arglist;} while(0)
do if (_db_pargs_(__LINE__,keyword)) _db_doprnt_ arglist; while(0)
#define DBUG_PUSH(a1) _db_push_ (a1)
#define DBUG_POP() _db_pop_ ()
#define DBUG_SET(a1) _db_set_ (a1)
Expand Down Expand Up @@ -193,8 +193,18 @@ void debug_sync_point(const char* lock_name, uint lock_timeout);
#define DBUG_SYNC_POINT(lock_name,lock_timeout)
#endif /* EXTRA_DEBUG */

#ifdef __cplusplus
#ifdef __cplusplus
}
# ifdef DBUG_OFF
# define DBUG_LOG(keyword, v) do {} while (0)
# else
# include <sstream>
# define DBUG_LOG(keyword, v) do { \
if (_db_pargs_(__LINE__, keyword)) { \
std::ostringstream _db_s; _db_s << v; \
_db_doprnt_("%s", _db_s.str().c_str()); \
}} while (0)
# endif
#endif

#endif /* _my_dbug_h */
8 changes: 8 additions & 0 deletions include/my_sys.h
Expand Up @@ -192,6 +192,14 @@ extern void my_large_free(uchar *ptr);
#define my_large_free(A) my_free_lock((A))
#endif /* HAVE_LARGE_PAGES */

void my_init_atomic_write(void);
#ifdef __linux__
my_bool my_test_if_atomic_write(File handle, int pagesize);
#else
#define my_test_if_atomic_write(A, B) 0
#endif /* __linux__ */
extern my_bool my_may_have_atomic_write;

#if defined(HAVE_ALLOCA) && !defined(HAVE_valgrind)
#if defined(_AIX) && !defined(__GNUC__) && !defined(_AIX43)
#pragma alloca
Expand Down
6 changes: 6 additions & 0 deletions mysql-test/README
Expand Up @@ -76,3 +76,9 @@ then put your .test file and .result file(s) into a tar.gz archive,
add a README that explains the problem, ftp the archive to
ftp://ftp.askmonty.org/private and submit a report to
http://mariadb.org/jira about it.

The latest information about mysql-test-run can be found at:
https://mariadb.com/kb/en/mariadb/mysqltest/

If you want to create .rdiff files, check
https://mariadb.com/kb/en/mariadb/mysql-test-auxiliary-files/
10 changes: 6 additions & 4 deletions mysql-test/README.gcov → mysql-test/README-gcov
Expand Up @@ -2,12 +2,14 @@ To be able to see the level of coverage with the current test suite,
do the following:

- Make sure gcov is installed
- Compile the MySQL distribution with BUILD/compile-pentium-gcov (if your
- Compile the MySQL distribution with BUILD/compile-pentium64-gcov (if your
machine does not have a pentium CPU, hack this script, or just live with
the pentium-specific stuff)
- In the mysql-test directory, run this command: ./mysql-test-run -gcov
- To see the level of coverage for a given source file:
grep source_file_name /tmp/gcov.out
grep -1 source_file_name ../mysql-test-gcov.msg
- To see which lines are not yet covered, look at source_file_name.gcov in
the source tree. Then think hard about a test case that will cover those
lines, and write one!
the source tree. You can find this by doing something like:
find source-directory -name "mysqld.cc.gcov"
Then think hard about a test case that will cover those lines, and write
one!

0 comments on commit 095ea08

Please sign in to comment.