Commit bb3ac010 authored by Ondrej Sury's avatar Ondrej Sury
Browse files

New upstream version 10.3.0

parent a6063b4a
...@@ -3,16 +3,19 @@ ...@@ -3,16 +3,19 @@
*.reject *.reject
*.spec *.spec
*.bak *.bak
*.dgcov
*.rpm
.*.swp .*.swp
*.ninja *.ninja
.ninja_* .ninja_*
.gdb_history .gdb_history
errmsg.sys errmsg.sys
typescript typescript
_CPack_Packages
CMakeCache.txt CMakeCache.txt
CMakeFiles/ CMakeFiles/
MakeFile MakeFile
install_manifest.txt install_manifest*.txt
CPackConfig.cmake CPackConfig.cmake
CPackSourceConfig.cmake CPackSourceConfig.cmake
CTestTestfile.cmake CTestTestfile.cmake
...@@ -79,6 +82,9 @@ mysql-test/lib/My/SafeProcess/my_safe_process ...@@ -79,6 +82,9 @@ mysql-test/lib/My/SafeProcess/my_safe_process
mysql-test/mtr mysql-test/mtr
mysql-test/mysql-test-run mysql-test/mysql-test-run
mysql-test/var mysql-test/var
mysql-test-gcov.err
mysql-test-gcov.msg
mysys/test_hash
mysys/thr_lock mysys/thr_lock
mysys/thr_timer mysys/thr_timer
packaging/rpm-oel/mysql.spec packaging/rpm-oel/mysql.spec
...@@ -91,6 +97,9 @@ pcre/pcre_chartables.c ...@@ -91,6 +97,9 @@ pcre/pcre_chartables.c
pcre/pcregrep pcre/pcregrep
pcre/pcretest pcre/pcretest
pcre/test*grep pcre/test*grep
plugin/aws_key_management/aws-sdk-cpp
plugin/aws_key_management/aws_sdk_cpp
plugin/aws_key_management/aws_sdk_cpp-prefix
scripts/comp_sql scripts/comp_sql
scripts/make_binary_distribution scripts/make_binary_distribution
scripts/msql2mysql scripts/msql2mysql
...@@ -152,6 +161,8 @@ sql/mysqld ...@@ -152,6 +161,8 @@ sql/mysqld
sql/sql_builtin.cc sql/sql_builtin.cc
sql/sql_yacc.cc sql/sql_yacc.cc
sql/sql_yacc.h sql/sql_yacc.h
sql/sql_yacc_ora.cc
sql/sql_yacc_ora.h
storage/heap/hp_test1 storage/heap/hp_test1
storage/heap/hp_test2 storage/heap/hp_test2
storage/maria/aria_chk storage/maria/aria_chk
...@@ -173,6 +184,9 @@ storage/myisam/myisamlog ...@@ -173,6 +184,9 @@ storage/myisam/myisamlog
storage/myisam/myisampack storage/myisam/myisampack
storage/myisam/rt_test storage/myisam/rt_test
storage/myisam/sp_test storage/myisam/sp_test
storage/rocksdb/ldb
storage/rocksdb/mysql_ldb
storage/rocksdb/sst_dump
storage/tokudb/PerconaFT/buildheader/db.h storage/tokudb/PerconaFT/buildheader/db.h
storage/tokudb/PerconaFT/buildheader/make_tdb storage/tokudb/PerconaFT/buildheader/make_tdb
storage/tokudb/PerconaFT/buildheader/runcat.sh storage/tokudb/PerconaFT/buildheader/runcat.sh
...@@ -199,6 +213,7 @@ storage/tokudb/PerconaFT/tools/tokudb_load ...@@ -199,6 +213,7 @@ storage/tokudb/PerconaFT/tools/tokudb_load
storage/tokudb/PerconaFT/tools/tokuftdump storage/tokudb/PerconaFT/tools/tokuftdump
storage/tokudb/PerconaFT/tools/tokuft_logprint storage/tokudb/PerconaFT/tools/tokuft_logprint
storage/tokudb/PerconaFT/xz/ storage/tokudb/PerconaFT/xz/
strings/conf_to_src
support-files/MySQL-shared-compat.spec support-files/MySQL-shared-compat.spec
support-files/binary-configure support-files/binary-configure
support-files/config.huge.ini support-files/config.huge.ini
......
[submodule "libmariadb"]
path = libmariadb
url = https://github.com/MariaDB/mariadb-connector-c
[submodule "storage/rocksdb/rocksdb"]
path = storage/rocksdb/rocksdb
url = https://github.com/facebook/rocksdb.git
#!/bin/sh
set -v -x
if [[ "${TRAVIS_OS_NAME}" == 'linux' ]]; then
if [[ "${CXX}" == 'clang++' ]]; then
CMAKE_OPT="-DWITHOUT_TOKUDB_STORAGE_ENGINE=ON -DWITHOUT_MROONGA_STORAGE_ENGINE=ON"
#CMAKE_OPT="${CMAKE_OPT} -DWITH_ASAN=ON"
if which ccache ; then
CMAKE_OPT="${CMAKE_OPT} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
fi
case ${GCC_VERSION} in
5) CXX=clang++-3.9 ;;
6) CXX=clang++-4.0 ;;
esac
export CXX CC=${CXX/++/}
elif [[ "${CXX}" == 'g++' ]]; then
CMAKE_OPT=""
export CXX=g++-${GCC_VERSION}
export CC=gcc-${GCC_VERSION}
fi
if [[ ${GCC_VERSION} == 6 ]]; then
wget http://mirrors.kernel.org/ubuntu/pool/universe/p/percona-xtradb-cluster-galera-2.x/percona-xtradb-cluster-galera-2.x_165-0ubuntu1_amd64.deb ;
ar vx percona-xtradb-cluster-galera-2.x_165-0ubuntu1_amd64.deb
tar -xJvf data.tar.xz
export WSREP_PROVIDER=$PWD/usr/lib/libgalera_smm.so
MYSQL_TEST_SUITES="${MYSQL_TEST_SUITES},wsrep"
#elif [[ ${GCC_VERSION} != 5 ]]; then
#CMAKE_OPT="${CMAKE_OPT} -DWITH_ASAN=ON"
fi
else
# osx_image based tests
CMAKE_OPT="-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl"
#CMAKE_OPT="${CMAKE_OPT} -DWITH_ASAN=ON"
if which ccache ; then
CMAKE_OPT="${CMAKE_OPT} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
fi
CMAKE_OPT="${CMAKE_OPT} -DWITHOUT_MROONGA_STORAGE_ENGINE=ON"
if [[ "${TYPE}" == "Debug" ]]; then
CMAKE_OPT="${CMAKE_OPT} -DWITHOUT_TOKUDB_STORAGE_ENGINE=ON"
fi
fi
# main.mysqlhotcopy_myisam consitently failed in travis containers
# https://travis-ci.org/grooverdan/mariadb-server/builds/217661580
echo 'main.mysqlhotcopy_myisam : unstable in containers' >> ${TRAVIS_BUILD_DIR}/mysql-test/unstable-tests
echo 'archive.mysqlhotcopy_archive : unstable in containers' >> ${TRAVIS_BUILD_DIR}/mysql-test/unstable-tests
set +v +x
# vim ft=yaml
# travis-ci.org definition
sudo: false
dist: trusty
git:
depth: 2
language: cpp
os:
- linux
- osx
osx_image: xcode8.3
compiler:
- gcc
- clang
cache:
apt: true
ccache: true
directories:
- /usr/local/Cellar
env:
matrix:
# - GCC_VERSION=4.8 TYPE=Debug MYSQL_TEST_SUITES=rpl
# - GCC_VERSION=5 TYPE=Debug MYSQL_TEST_SUITES=main,archive,optimizer_unfixed_bugs,parts,sys_vars,unit,vcol,innodb,innodb_gis,innodb_zip,innodb_fts
# - GCC_VERSION=6 TYPE=Debug MYSQL_TEST_SUITES=binlog,binlog_encryption,encryption,rocksdb
# - GCC_VERSION=6 TYPE=Debug MYSQL_TEST_SUITES=csv,federated,funcs_1,funcs_2,gcol,handler,heap,json,maria,percona,perfschema,plugins,multi_source,roles
- GCC_VERSION=4.8 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rpl
- GCC_VERSION=5 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main,archive,optimizer_unfixed_bugs,parts,sys_vars,unit,vcol,innodb,innodb_gis,innodb_zip,innodb_fts
- GCC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=binlog,binlog_encryption,encryption,rocksdb
- GCC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=csv,federated,funcs_1,funcs_2,gcol,handler,heap,json,maria,percona,perfschema,plugins,multi_source,roles
matrix:
exclude:
- os: osx
compiler: gcc
include:
- os: linux
compiler: gcc
script:
- ${CC} --version ; ${CXX} --version
# Just for disabling hotcopy tests for now
- source .travis.compiler.sh
# https://github.com/travis-ci/travis-ci/issues/7062 - /run/shm isn't writable or executable
# in trusty containers
- export MTR_MEM=/tmp
- env DEB_BUILD_OPTIONS="parallel=6" debian/autobake-deb.sh;
- ccache --show-stats
# Matrix include for coverity
# - env:
# - GCC_VERSION=6
# addon:
# coverity_scan:
# # ref: https://scan.coverity.com/travis_ci
# # GitHub project metadata
# project:
# - name: MariaDB/server
# - description: MariaDB Server
#
# # Where email notification of build analysis results will be sent
# notification_email: security@mariadb.org
#
# # Commands to prepare for build_command
# build_command_prepend:
# - source .travis.compiler.sh
# - ${MYSQL_BUILD_CC} --version ; ${MYSQL_BUILD_CXX} --version
# - cmake .
# -DCMAKE_BUILD_TYPE=Debug
# -DWITH_SSL=system -DWITH_ZLIB=system
# -DWITHOUT_TOKUDB_STORAGE_ENGINE=ON -DWITHOUT_MROONGA_STORAGE_ENGINE=ON
#
# # The command that will be added as an argument to "cov-build" to compile your project for analysis,
# build_command: make -j 4
#
# # Pattern to match selecting branches that will run analysis.
# # Take care in resource usage, and consider the build frequency allowances per
# # https://scan.coverity.com/faq#frequency - 7 per week is the current limit.
# branch_pattern: .*coverity.*
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty
- llvm-toolchain-trusty-3.9
- llvm-toolchain-trusty-4.0
packages: # make sure these match debian/control contents
- gcc-5
- g++-5
- gcc-6
- g++-6
- clang-3.9
- llvm-3.9-dev
- clang-4.0
- llvm-4.0-dev
- libasan0
- bison
- chrpath
- cmake
- debhelper
- dh-apparmor
- dpatch
- gdb
- libaio-dev
- libboost-dev
- libcurl3-dev
- libjudy-dev
- libncurses5-dev
- libpam0g-dev
- libpcre3-dev
- libreadline-gplv2-dev
- libstemmer-dev
- libssl-dev
- libnuma-dev
- libxml2-dev
- lsb-release
- perl
- po-debconf
- psmisc
- zlib1g-dev
- libcrack2-dev
- libjemalloc-dev
- libsnappy-dev
- liblzma-dev
- libzmq-dev
- libdistro-info-perl
- devscripts # implicit for any build on Ubuntu
# libsystemd-daemon-dev # https://github.com/travis-ci/apt-package-whitelist/issues/3882
before_install:
- if [[ "${TRAVIS_OS_NAME}" == 'osx' ]]; then
brew update;
brew install gnutls lz4 lzo xz snappy ccache jemalloc curl ossp-uuid pcre;
brew link ccache;
fi
script:
- ccache --version
# Clang:
# mroonga just generates too many warnings with clang and travis stops the job
# tokudb has fatal warnings
- source .travis.compiler.sh
- cmake .
-DCMAKE_BUILD_TYPE=${TYPE}
${CMAKE_OPT}
-DWITH_SSL=system -DWITH_ZLIB=system -DPLUGIN_AWS_KEY_MANAGEMENT=DYNAMIC -DAWS_SDK_EXTERNAL_PROJECT=ON
- make -j 6
- cd mysql-test
# With ASAN --thread-stack=400K to account for overhead
# Test timeout needs to be 10(minutes) or less due to travis out timeout
- ./mtr --force --max-test-fail=20 --parallel=6 --testcase-timeout=2
--suite=${MYSQL_TEST_SUITES}
--skip-test-list=unstable-tests
--skip-test=binlog.binlog_unsafe
- ccache --show-stats
notifications:
irc:
channels:
- "chat.freenode.net#maria"
on_success: never # [always|never|change]
on_failure: never
template:
- "%{repository}/%{branch} (%{commit} - %{author}): %{build_url}: %{message}"
...@@ -32,9 +32,9 @@ then ...@@ -32,9 +32,9 @@ then
configure="$configure --verbose" configure="$configure --verbose"
fi fi
# git clean -fdX removes all ignored (build) files
commands="\ commands="\
/bin/rm -rf configure; git clean -fdX
/bin/rm -rf CMakeCache.txt CMakeFiles/
path=`dirname $0` path=`dirname $0`
. \"$path/autorun.sh\"" . \"$path/autorun.sh\""
......
...@@ -42,7 +42,7 @@ Usage: $0 [-h|-n] [configure-options] ...@@ -42,7 +42,7 @@ Usage: $0 [-h|-n] [configure-options]
Influences the debug flags. Old is default. Influences the debug flags. Old is default.
--prefix=path Build with prefix 'path'. --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 EOF
} }
...@@ -120,10 +120,9 @@ path=`dirname $0` ...@@ -120,10 +120,9 @@ path=`dirname $0`
get_make_parallel_flag get_make_parallel_flag
# SSL library to use.--with-ssl will select our bundled yaSSL # SSL library to use.--with-ssl will select our bundled yaSSL
# implementation of SSL. To use OpenSSL you will need to specify # implementation of SSL. --with-ssl=yes will first try system library
# the location of OpenSSL headers and libs on your system. # then the boundled one --with-ssl=system will use the system library.
# Ex --with-ssl=/usr SSL_LIBRARY=--with-ssl=system
SSL_LIBRARY=--with-ssl
if [ "x$warning_mode" = "xpedantic" ]; then if [ "x$warning_mode" = "xpedantic" ]; then
warnings="-W -Wall -ansi -pedantic -Wno-long-long -Wno-unused -D_POSIX_SOURCE" warnings="-W -Wall -ansi -pedantic -Wno-long-long -Wno-unused -D_POSIX_SOURCE"
...@@ -170,7 +169,7 @@ debug_cflags="-DEXTRA_DEBUG -DSAFE_MUTEX -DSAFEMALLOC" ...@@ -170,7 +169,7 @@ debug_cflags="-DEXTRA_DEBUG -DSAFE_MUTEX -DSAFEMALLOC"
error_inject="--with-error-inject " error_inject="--with-error-inject "
# #
# Base C++ flags for all builds # Base C++ flags for all builds
base_cxxflags="-felide-constructors -fno-exceptions -fno-rtti" base_cxxflags="-felide-constructors -fexceptions -fno-rtti"
# #
# Flags for optimizing builds. # Flags for optimizing builds.
# Be as fast as we can be without losing our ability to backtrace. # Be as fast as we can be without losing our ability to backtrace.
...@@ -293,7 +292,7 @@ gcov_compile_flags="$gcov_compile_flags -DMYSQL_SERVER_SUFFIX=-gcov -DHAVE_gcov" ...@@ -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 # 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. # 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" gcov_configs="--with-gcov"
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
# MA 02110-1301, USA # MA 02110-1301, USA
# Ensure cmake and perl are there # Ensure cmake and perl are there
cmake -P cmake/check_minimal_version.cmake >/dev/null 2>&1 || HAVE_CMAKE=no cmake --help >/dev/null 2>&1 || HAVE_CMAKE=no
perl --version >/dev/null 2>&1 || HAVE_PERL=no perl --version >/dev/null 2>&1 || HAVE_PERL=no
scriptdir=`dirname $0` scriptdir=`dirname $0`
if test "$HAVE_CMAKE" = "no" if test "$HAVE_CMAKE" = "no"
......
...@@ -28,6 +28,6 @@ export LDFLAGS="$gcov_link_flags" ...@@ -28,6 +28,6 @@ export LDFLAGS="$gcov_link_flags"
extra_flags="$pentium64_cflags $max_cflags $gcov_compile_flags" extra_flags="$pentium64_cflags $max_cflags $gcov_compile_flags"
c_warnings="$c_warnings $debug_extra_warnings" c_warnings="$c_warnings $debug_extra_warnings"
cxx_warnings="$cxx_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" . "$path/FINISH.sh"
...@@ -14,11 +14,7 @@ ...@@ -14,11 +14,7 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
CMAKE_MINIMUM_REQUIRED(VERSION 2.6) CMAKE_MINIMUM_REQUIRED(VERSION 2.8.3)
# Avoid warnings in higher versions
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.6)
CMAKE_POLICY(VERSION 2.8)
endif()
# explicitly set the policy to OLD # explicitly set the policy to OLD
# (cannot use NEW, not everyone is on cmake-2.8.12 yet) # (cannot use NEW, not everyone is on cmake-2.8.12 yet)
...@@ -35,17 +31,14 @@ IF(CMAKE_VERSION VERSION_EQUAL "3.0.0" OR ...@@ -35,17 +31,14 @@ IF(CMAKE_VERSION VERSION_EQUAL "3.0.0" OR
CMAKE_POLICY(SET CMP0045 OLD) CMAKE_POLICY(SET CMP0045 OLD)
CMAKE_POLICY(SET CMP0042 OLD) CMAKE_POLICY(SET CMP0042 OLD)
ENDIF() ENDIF()
IF(POLICY CMP0054)
CMAKE_POLICY(SET CMP0054 NEW)
ENDIF()
MESSAGE(STATUS "Running cmake version ${CMAKE_VERSION}") MESSAGE(STATUS "Running cmake version ${CMAKE_VERSION}")
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake) SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
# Distinguish between community and non-community builds, with the
# default being a community build. This does not impact the feature
# set that will be compiled in; it's merely provided as a hint to
# custom packaging steps.
OPTION(COMMUNITY_BUILD "Set to true if this is a community build" ON)
# Use a default manufacturer if no manufacturer was identified. # Use a default manufacturer if no manufacturer was identified.
IF(NOT DEFINED MANUFACTURER) IF(NOT DEFINED MANUFACTURER)
SET(MANUFACTURER "Built from Source" CACHE STRING SET(MANUFACTURER "Built from Source" CACHE STRING
...@@ -122,6 +115,11 @@ FOREACH(_base ...@@ -122,6 +115,11 @@ FOREACH(_base
ENDIF() ENDIF()
ENDFOREACH() ENDFOREACH()
FOREACH(tool gtar tar git)
STRING(TOUPPER ${tool} TOOL)
FIND_PROGRAM(${TOOL}_EXECUTABLE ${tool} DOC "path to the executable")
MARK_AS_ADVANCED(${TOOL}_EXECUTABLE)
ENDFOREACH()
# Following autotools tradition, add preprocessor definitions # Following autotools tradition, add preprocessor definitions
# specified in environment variable CPPFLAGS # specified in environment variable CPPFLAGS
...@@ -140,6 +138,7 @@ IF (NOT CPACK_GENERATOR) ...@@ -140,6 +138,7 @@ IF (NOT CPACK_GENERATOR)
ENDIF(WIN32) ENDIF(WIN32)
ENDIF(NOT CPACK_GENERATOR) ENDIF(NOT CPACK_GENERATOR)
INCLUDE(misc)
INCLUDE(mysql_version) INCLUDE(mysql_version)
INCLUDE(cpack_source_ignore_files) INCLUDE(cpack_source_ignore_files)
INCLUDE(install_layout) INCLUDE(install_layout)
...@@ -155,13 +154,13 @@ INCLUDE(ssl) ...@@ -155,13 +154,13 @@ INCLUDE(ssl)
INCLUDE(readline) INCLUDE(readline)
INCLUDE(libutils) INCLUDE(libutils)
INCLUDE(dtrace) INCLUDE(dtrace)
INCLUDE(jemalloc)
INCLUDE(pcre) INCLUDE(pcre)
INCLUDE(ctest) INCLUDE(ctest)
INCLUDE(plugin) INCLUDE(plugin)
INCLUDE(install_macros) INCLUDE(install_macros)
INCLUDE(systemd) INCLUDE(systemd)
INCLUDE(mysql_add_executable) INCLUDE(mysql_add_executable)
INCLUDE(crc32-vpmsum)
# Handle options # Handle options
OPTION(DISABLE_SHARED OPTION(DISABLE_SHARED
...@@ -170,13 +169,11 @@ IF(DISABLE_SHARED) ...@@ -170,13 +169,11 @@ IF(DISABLE_SHARED)
SET(WITHOUT_DYNAMIC_PLUGINS 1) SET(WITHOUT_DYNAMIC_PLUGINS 1)
ENDIF() ENDIF()
OPTION(ENABLED_PROFILING "Enable profiling" ON) OPTION(ENABLED_PROFILING "Enable profiling" ON)
OPTION(CYBOZU "" OFF)
OPTION(WITHOUT_SERVER "Build only the client library and clients" OFF) OPTION(WITHOUT_SERVER "Build only the client library and clients" OFF)
IF(UNIX) IF(UNIX)
OPTION(WITH_VALGRIND "Valgrind instrumentation" OFF) OPTION(WITH_VALGRIND "Valgrind instrumentation" OFF)
ENDIF() ENDIF()
OPTION (WITH_UNIT_TESTS "Compile MySQL with unit tests" ON) OPTION (WITH_UNIT_TESTS "Compile MySQL with unit tests" ON)
MARK_AS_ADVANCED(CYBOZU)
OPTION(NOT_FOR_DISTRIBUTION "Allow linking with GPLv2-incompatible system libraries. Only set it you never plan to distribute the resulting binaries" OFF) OPTION(NOT_FOR_DISTRIBUTION "Allow linking with GPLv2-incompatible system libraries. Only set it you never plan to distribute the resulting binaries" OFF)
...@@ -185,18 +182,18 @@ INCLUDE(check_compiler_flag) ...@@ -185,18 +182,18 @@ INCLUDE(check_compiler_flag)
OPTION(WITH_ASAN "Enable address sanitizer" OFF) OPTION(WITH_ASAN "Enable address sanitizer" OFF)
IF (WITH_ASAN) IF (WITH_ASAN)
# gcc 4.8.1 and new versions of clang # gcc 4.8.1 and new versions of clang
MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=address -O1 -Wno-error -fPIC" MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=address -fPIC"
DEBUG RELWITHDEBINFO) DEBUG RELWITHDEBINFO)
SET(HAVE_C_FSANITIZE ${HAVE_C__fsanitize_address__O1__Wno_error__fPIC}) SET(HAVE_C_FSANITIZE ${have_C__fsanitize_address__fPIC})
SET(HAVE_CXX_FSANITIZE ${HAVE_CXX__fsanitize_address__O1__Wno_error__fPIC}) SET(HAVE_CXX_FSANITIZE ${have_CXX__fsanitize_address__fPIC})
IF(HAVE_C_FSANITIZE AND HAVE_CXX_FSANITIZE) IF(HAVE_C_FSANITIZE AND HAVE_CXX_FSANITIZE)
SET(WITH_ASAN_OK 1) SET(WITH_ASAN_OK 1)
ELSE() ELSE()
# older versions of clang # older versions of clang
MY_CHECK_AND_SET_COMPILER_FLAG("-faddress-sanitizer -O1 -fPIC" MY_CHECK_AND_SET_COMPILER_FLAG("-faddress-sanitizer -fPIC"
DEBUG RELWITHDEBINFO) DEBUG RELWITHDEBINFO)
SET(HAVE_C_FADDRESS ${HAVE_C__faddress_sanitizer__O1__fPIC}) SET(HAVE_C_FADDRESS ${have_C__faddress_sanitizer__fPIC})
SET(HAVE_CXX_FADDRESS ${HAVE_CXX__faddress_sanitizer__O1__fPIC}) SET(HAVE_CXX_FADDRESS ${have_CXX__faddress_sanitizer__fPIC})
IF(HAVE_C_FADDRESS AND HAVE_CXX_FADDRESS) IF(HAVE_C_FADDRESS AND HAVE_CXX_FADDRESS)
SET(WITH_ASAN_OK 1) SET(WITH_ASAN_OK 1)
ENDIF() ENDIF()
...@@ -239,9 +236,6 @@ MY_CHECK_AND_SET_COMPILER_FLAG(-ggdb3 DEBUG) ...@@ -239,9 +236,6 @@ MY_CHECK_AND_SET_COMPILER_FLAG(-ggdb3 DEBUG)
OPTION(ENABLED_LOCAL_INFILE OPTION(ENABLED_LOCAL_INFILE
"If we should should enable LOAD DATA LOCAL by default" ${IF_WIN}) "If we should should enable LOAD DATA LOCAL by default" ${IF_WIN})
OPTION(WITH_FAST_MUTEXES "Compile with fast mutexes" OFF)
MARK_AS_ADVANCED(WITH_FAST_MUTEXES)
OPTION(WITH_INNODB_DISALLOW_WRITES "InnoDB freeze writes patch from Google" ${WITH_WSREP}) OPTION(WITH_INNODB_DISALLOW_WRITES "InnoDB freeze writes patch from Google" ${WITH_WSREP})
IF (WITH_INNODB_DISALLOW_WRITES) IF (WITH_INNODB_DISALLOW_WRITES)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWITH_INNODB_DISALLOW_WRITES") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWITH_INNODB_DISALLOW_WRITES")
...@@ -256,10 +250,6 @@ FOREACH(BUILD_TYPE RELEASE RELWITHDEBINFO MINSIZEREL) ...@@ -256,10 +250,6 @@ FOREACH(BUILD_TYPE RELEASE RELWITHDEBINFO MINSIZEREL)
SET(CMAKE_${LANG}_FLAGS_${BUILD_TYPE} SET(CMAKE_${LANG}_FLAGS_${BUILD_TYPE}
"${CMAKE_${LANG}_FLAGS_${BUILD_TYPE}} -DDBUG_OFF") "${CMAKE_${LANG}_FLAGS_${BUILD_TYPE}} -DDBUG_OFF")
ENDIF() ENDIF()
IF(WITH_FAST_MUTEXES)
SET(CMAKE_${LANG}_FLAGS_${BUILD_TYPE}
"${CMAKE_${LANG}_FLAGS_${BUILD_TYPE}} -DMY_PTHREAD_FASTMUTEX=1")
ENDIF()
ENDFOREACH() ENDFOREACH()
ENDFOREACH() ENDFOREACH()
...@@ -322,7 +312,7 @@ IF(NOT HAVE_CXX_NEW) ...@@ -322,7 +312,7 @@ IF(NOT HAVE_CXX_NEW)
ENDIF() ENDIF()
# Find header files from the bundled libraries # Find header files from the bundled libraries
# (jemalloc, yassl, readline, pcre, etc) # (yassl, readline, pcre, etc)
# before the ones installed in the system # before the ones installed in the system
SET(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON) SET(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
...@@ -341,7 +331,6 @@ MYSQL_CHECK_SSL() ...@@ -341,7 +331,6 @@ MYSQL_CHECK_SSL()
MYSQL_CHECK_READLINE() MYSQL_CHECK_READLINE()
SET(MALLOC_LIBRARY "system") SET(MALLOC_LIBRARY "system")
CHECK_JEMALLOC()
CHECK_PCRE() CHECK_PCRE()
...@@ -368,12 +357,17 @@ IF(WITH_UNIT_TESTS) ...@@ -368,12 +357,17 @@ IF(WITH_UNIT_TESTS)
ADD_SUBDIRECTORY(unittest/examples) ADD_SUBDIRECTORY(unittest/examples)
ADD_SUBDIRECTORY(unittest/mysys) ADD_SUBDIRECTORY(unittest/mysys)
ADD_SUBDIRECTORY(unittest/my_decimal) ADD_SUBDIRECTORY(unittest/my_decimal)
ADD_SUBDIRECTORY(unittest/json_lib)
IF(NOT WITHOUT_SERVER) IF(NOT WITHOUT_SERVER)
ADD_SUBDIRECTORY(unittest/sql) ADD_SUBDIRECTORY(unittest/sql)
ENDIF() ENDIF()
ENDIF() ENDIF()
SET (MYSQLD_STATIC_PLUGIN_LIBS "" CACHE INTERNAL "") SET (MYSQLD_STATIC_PLUGIN_LIBS "" CACHE INTERNAL "")
# mariadb_connector_c fetches submodules which is useful for plugins
INCLUDE(mariadb_connector_c) # this does ADD_SUBDIRECTORY(libmariadb)
# Add storage engines and plugins. # Add storage engines and plugins.
CONFIGURE_PLUGINS() CONFIGURE_PLUGINS()
...@@ -383,7 +377,6 @@ ADD_SUBDIRECTORY(strings) ...@@ -383,7 +377,6 @@ ADD_SUBDIRECTORY(strings)
ADD_SUBDIRECTORY(vio) ADD_SUBDIRECTORY(vio)
ADD_SUBDIRECTORY(mysys) ADD_SUBDIRECTORY(mysys)
ADD_SUBDIRECTORY(mysys_ssl) ADD_SUBDIRECTORY(mysys_ssl)
ADD_SUBDIRECTORY(libmysql)
ADD_SUBDIRECTORY(client) ADD_SUBDIRECTORY(client)
ADD_SUBDIRECTORY(extra) ADD_SUBDIRECTORY(extra)
ADD_SUBDIRECTORY(libservices) ADD_SUBDIRECTORY(libservices)
...@@ -445,12 +438,6 @@ CONFIGURE_FILE( ...@@ -445,12 +438,6 @@ CONFIGURE_FILE(
${CMAKE_SOURCE_DIR}/cmake/info_macros.cmake.in ${CMAKE_SOURCE_DIR}/cmake/info_macros.cmake.in
${CMAKE_BINARY_DIR}/info_macros.cmake @ONLY) ${CMAKE_BINARY_DIR}/info_macros.cmake @ONLY)
IF(DEB)
CONFIGURE_FILE(
${CMAKE_SOURCE_DIR}/debian/mariadb-server-10.1.files.in
${CMAKE_SOURCE_DIR}/debian/mariadb-server-10.1.files)
ENDIF(DEB)
# Handle the "INFO_*" files. # Handle the "INFO_*" files.
INCLUDE(${CMAKE_BINARY_DIR}/info_macros.cmake) INCLUDE(${CMAKE_BINARY_DIR}/info_macros.cmake)
# Source: This can be done during the cmake phase, all information is # Source: This can be done during the cmake phase, all information is
...@@ -467,8 +454,9 @@ ADD_CUSTOM_TARGET(INFO_BIN ALL ...@@ -467,8 +454,9 @@ ADD_CUSTOM_TARGET(INFO_BIN ALL
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
) )
INSTALL_DOCUMENTATION(README CREDITS COPYING COPYING.LESSER COPYING.thirdparty INSTALL_DOCUMENTATION(README.md CREDITS COPYING COPYING.thirdparty
EXCEPTIONS-CLIENT COMPONENT Readme) EXCEPTIONS-CLIENT COMPONENT Readme)
# MDEV-6526 these files are not installed anymore # MDEV-6526 these files are not installed anymore
#INSTALL_DOCUMENTATION(${CMAKE_BINARY_DIR}/Docs/INFO_SRC #INSTALL_DOCUMENTATION(${CMAKE_BINARY_DIR}/Docs/INFO_SRC
# ${CMAKE_BINARY_DIR}/Docs/INFO_BIN) # ${CMAKE_BINARY_DIR}/Docs/INFO_BIN)
......
commit: 68be011cf2ec96a622db857fe9c418380d106d0d commit: 20ae591abd0bfe1bfaee546989ee163f4ef832b1
date: 2017-03-11 20:59:52 +0200 date: 2017-04-13 21:39:05 +0200
build-date: 2017-03-11 20:09:31 +0100 build-date: 2017-04-13 21:45:10 +0200
short: 68be011 short: 20ae591
branch: HEAD branch: HEAD
MariaDB source 10.1.22 MariaDB source 10.3.0
## MariaDB: drop-in replacement for MySQL
MariaDB is designed as a drop-in replacement of MySQL(R) with more MariaDB is designed as a drop-in replacement of MySQL(R) with more
features, new storage engines, fewer bugs, and better performance. features, new storage engines, fewer bugs, and better performance.
...@@ -24,10 +26,17 @@ https://mariadb.com/kb/en/mariadb-versus-mysql-compatibility/ ...@@ -24,10 +26,17 @@ https://mariadb.com/kb/en/mariadb-versus-mysql-compatibility/
As MariaDB is a full replacement of MySQL, the MySQL manual at As MariaDB is a full replacement of MySQL, the MySQL manual at
http://dev.mysql.com/doc is generally applicable. http://dev.mysql.com/doc is generally applicable.
Help:
-----
More help is available from the Maria Discuss mailing list More help is available from the Maria Discuss mailing list
https://launchpad.net/~maria-discuss https://launchpad.net/~maria-discuss
and the #maria IRC channel on Freenode. and the #maria IRC channel on Freenode.
License:
--------
*************************************************************************** ***************************************************************************
NOTE: NOTE:
...@@ -42,7 +51,8 @@ and COPYING.thirdparty files. ...@@ -42,7 +51,8 @@ and COPYING.thirdparty files.
*************************************************************************** ***************************************************************************
IMPORTANT: Bug Reports:
------------
Bug and/or error reports regarding MariaDB should be submitted at Bug and/or error reports regarding MariaDB should be submitted at
http://mariadb.org/jira http://mariadb.org/jira
...@@ -53,3 +63,8 @@ The code for MariaDB, including all revision history, can be found at: ...@@ -53,3 +63,8 @@ The code for MariaDB, including all revision history, can be found at:
https://github.com/MariaDB/server https://github.com/MariaDB/server
*************************************************************************** ***************************************************************************
Code status:
------------
* [![tests status](https://secure.travis-ci.org/MariaDB/server.png?branch=10.2)](https://travis-ci.org/MariaDB/server) travis-ci.org (10.2 branch)
MYSQL_VERSION_MAJOR=10 MYSQL_VERSION_MAJOR=10
MYSQL_VERSION_MINOR=1 MYSQL_VERSION_MINOR=3
MYSQL_VERSION_PATCH=22 MYSQL_VERSION_PATCH=0
...@@ -19,20 +19,25 @@ INCLUDE_DIRECTORIES( ...@@ -19,20 +19,25 @@ INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/mysys_ssl ${CMAKE_SOURCE_DIR}/mysys_ssl
${ZLIB_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR}
${SSL_INCLUDE_DIRS} ${SSL_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/libmysql
${CMAKE_SOURCE_DIR}/sql ${CMAKE_SOURCE_DIR}/sql
${CMAKE_SOURCE_DIR}/strings ${CMAKE_SOURCE_DIR}/strings
${MY_READLINE_INCLUDE_DIR} ${MY_READLINE_INCLUDE_DIR}
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
) )
INCLUDE_DIRECTORIES(BEFORE
${CMAKE_BINARY_DIR}/libmariadb/include
${CMAKE_SOURCE_DIR}/libmariadb/include)
## We will need libeay32.dll and ssleay32.dll when running client executables. ## We will need libeay32.dll and ssleay32.dll when running client executables.
COPY_OPENSSL_DLLS(copy_openssl_client) COPY_OPENSSL_DLLS(copy_openssl_client)
SET(CLIENT_LIB mariadbclient mysys)
ADD_DEFINITIONS(${SSL_DEFINES}) ADD_DEFINITIONS(${SSL_DEFINES})
MYSQL_ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc MYSQL_ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc
${CMAKE_SOURCE_DIR}/sql/sql_string.cc) ${CMAKE_SOURCE_DIR}/sql/sql_string.cc)
TARGET_LINK_LIBRARIES(mysql mysqlclient) TARGET_LINK_LIBRARIES(mysql ${CLIENT_LIB})
IF(UNIX) IF(UNIX)
TARGET_LINK_LIBRARIES(mysql ${MY_READLINE_LIBRARY}) TARGET_LINK_LIBRARIES(mysql ${MY_READLINE_LIBRARY})
SET_TARGET_PROPERTIES(mysql PROPERTIES ENABLE_EXPORTS TRUE) SET_TARGET_PROPERTIES(mysql PROPERTIES ENABLE_EXPORTS TRUE)
...@@ -40,39 +45,40 @@ ENDIF(UNIX) ...@@ -40,39 +45,40 @@ ENDIF(UNIX)
MYSQL_ADD_EXECUTABLE(mysqltest mysqltest.cc COMPONENT Test) MYSQL_ADD_EXECUTABLE(mysqltest mysqltest.cc COMPONENT Test)
SET_SOURCE_FILES_PROPERTIES(mysqltest.cc PROPERTIES COMPILE_FLAGS "-DTHREADS") SET_SOURCE_FILES_PROPERTIES(mysqltest.cc PROPERTIES COMPILE_FLAGS "-DTHREADS")
TARGET_LINK_LIBRARIES(mysqltest mysqlclient pcre pcreposix) TARGET_LINK_LIBRARIES(mysqltest ${CLIENT_LIB} pcre pcreposix)
SET_TARGET_PROPERTIES(mysqltest PROPERTIES ENABLE_EXPORTS TRUE) SET_TARGET_PROPERTIES(mysqltest PROPERTIES ENABLE_EXPORTS TRUE)
MYSQL_ADD_EXECUTABLE(mysqlcheck mysqlcheck.c) MYSQL_ADD_EXECUTABLE(mysqlcheck mysqlcheck.c)
TARGET_LINK_LIBRARIES(mysqlcheck mysqlclient) TARGET_LINK_LIBRARIES(mysqlcheck ${CLIENT_LIB})
MYSQL_ADD_EXECUTABLE(mysqldump mysqldump.c ../sql-common/my_user.c) MYSQL_ADD_EXECUTABLE(mysqldump mysqldump.c ../sql-common/my_user.c)
TARGET_LINK_LIBRARIES(mysqldump mysqlclient) TARGET_LINK_LIBRARIES(mysqldump ${CLIENT_LIB})
MYSQL_ADD_EXECUTABLE(mysqlimport mysqlimport.c) MYSQL_ADD_EXECUTABLE(mysqlimport mysqlimport.c)
SET_SOURCE_FILES_PROPERTIES(mysqlimport.c PROPERTIES COMPILE_FLAGS "-DTHREADS") SET_SOURCE_FILES_PROPERTIES(mysqlimport.c PROPERTIES COMPILE_FLAGS "-DTHREADS")
TARGET_LINK_LIBRARIES(mysqlimport mysqlclient) TARGET_LINK_LIBRARIES(mysqlimport ${CLIENT_LIB})
MYSQL_ADD_EXECUTABLE(mysql_upgrade mysql_upgrade.c COMPONENT Server) MYSQL_ADD_EXECUTABLE(mysql_upgrade mysql_upgrade.c COMPONENT Server)
TARGET_LINK_LIBRARIES(mysql_upgrade mysqlclient) TARGET_LINK_LIBRARIES(mysql_upgrade ${CLIENT_LIB})
ADD_DEPENDENCIES(mysql_upgrade GenFixPrivs) ADD_DEPENDENCIES(mysql_upgrade GenFixPrivs)
MYSQL_ADD_EXECUTABLE(mysqlshow mysqlshow.c) MYSQL_ADD_EXECUTABLE(mysqlshow mysqlshow.c)
TARGET_LINK_LIBRARIES(mysqlshow mysqlclient) TARGET_LINK_LIBRARIES(mysqlshow ${CLIENT_LIB})
MYSQL_ADD_EXECUTABLE(mysql_plugin mysql_plugin.c) MYSQL_ADD_EXECUTABLE(mysql_plugin mysql_plugin.c)
TARGET_LINK_LIBRARIES(mysql_plugin mysqlclient) TARGET_LINK_LIBRARIES(mysql_plugin ${CLIENT_LIB})
MYSQL_ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc) MYSQL_ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc)
TARGET_LINK_LIBRARIES(mysqlbinlog mysqlclient) TARGET_LINK_LIBRARIES(mysqlbinlog ${CLIENT_LIB})
MYSQL_ADD_EXECUTABLE(mysqladmin mysqladmin.cc) MYSQL_ADD_EXECUTABLE(mysqladmin mysqladmin.cc ../sql/password.c)
TARGET_LINK_LIBRARIES(mysqladmin mysqlclient) TARGET_LINK_LIBRARIES(mysqladmin ${CLIENT_LIB})
MYSQL_ADD_EXECUTABLE(mysqlslap mysqlslap.c) MYSQL_ADD_EXECUTABLE(mysqlslap mysqlslap.c)
SET_SOURCE_FILES_PROPERTIES(mysqlslap.c PROPERTIES COMPILE_FLAGS "-DTHREADS") SET_SOURCE_FILES_PROPERTIES(mysqlslap.c PROPERTIES COMPILE_FLAGS "-DTHREADS")
TARGET_LINK_LIBRARIES(mysqlslap mysqlclient) TARGET_LINK_LIBRARIES(mysqlslap ${CLIENT_LIB})
# "WIN32" also covers 64 bit. "echo" is used in some files below "mysql-test/". # "WIN32" also covers 64 bit. "echo" is used in some files below "mysql-test/".
IF(WIN32) IF(WIN32)
...@@ -81,10 +87,16 @@ ENDIF(WIN32) ...@@ -81,10 +87,16 @@ ENDIF(WIN32)
# async_example is just a code example, do not install it. # async_example is just a code example, do not install it.
ADD_EXECUTABLE(async_example async_example.c) ADD_EXECUTABLE(async_example async_example.c)
TARGET_LINK_LIBRARIES(async_example mysqlclient) TARGET_LINK_LIBRARIES(async_example ${CLIENT_LIB})
SET_TARGET_PROPERTIES (mysqlcheck mysqldump mysqlimport mysql_upgrade mysqlshow mysqlslap mysql_plugin async_example SET_TARGET_PROPERTIES (mysqlcheck mysqldump mysqlimport mysql_upgrade mysqlshow mysqlslap mysql_plugin async_example
PROPERTIES HAS_CXX TRUE) PROPERTIES HAS_CXX TRUE)
FOREACH(t mysql mysqltest mysqltest mysqlcheck mysqldump mysqlimport mysql_upgrade mysqlshow mysql_plugin mysqlbinlog
mysqladmin mysqlslap async_example)
ADD_DEPENDENCIES(${t} GenError ${CLIENT_LIB})
ENDFOREACH()
ADD_DEFINITIONS(-DHAVE_DLOPEN) ADD_DEFINITIONS(-DHAVE_DLOPEN)
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <mysql.h> #include <mysql.h>
#include <errmsg.h> #include <errmsg.h>
#include <my_getopt.h> #include <my_getopt.h>
#include <mysql_version.h>
#ifndef WEXITSTATUS #ifndef WEXITSTATUS
# ifdef __WIN__ # ifdef __WIN__
...@@ -65,6 +66,10 @@ enum options_client ...@@ -65,6 +66,10 @@ enum options_client
OPT_MYSQLDUMP_SLAVE_APPLY, OPT_MYSQLDUMP_SLAVE_APPLY,
OPT_MYSQLDUMP_SLAVE_DATA, OPT_MYSQLDUMP_SLAVE_DATA,
OPT_MYSQLDUMP_INCLUDE_MASTER_HOST_PORT, OPT_MYSQLDUMP_INCLUDE_MASTER_HOST_PORT,
#ifdef WHEN_FLASHBACK_REVIEW_READY
OPT_REVIEW,
OPT_REVIEW_DBNAME, OPT_REVIEW_TABLENAME,
#endif
OPT_SLAP_CSV, OPT_SLAP_CREATE_STRING, OPT_SLAP_CSV, OPT_SLAP_CREATE_STRING,
OPT_SLAP_AUTO_GENERATE_SQL_LOAD_TYPE, OPT_SLAP_AUTO_GENERATE_WRITE_NUM, OPT_SLAP_AUTO_GENERATE_SQL_LOAD_TYPE, OPT_SLAP_AUTO_GENERATE_WRITE_NUM,
OPT_SLAP_AUTO_GENERATE_ADD_AUTO, OPT_SLAP_AUTO_GENERATE_ADD_AUTO,
......
...@@ -1144,6 +1144,9 @@ int main(int argc,char *argv[]) ...@@ -1144,6 +1144,9 @@ int main(int argc,char *argv[])
outfile[0]=0; // no (default) outfile outfile[0]=0; // no (default) outfile
strmov(pager, "stdout"); // the default, if --pager wasn't given strmov(pager, "stdout"); // the default, if --pager wasn't given
mysql_init(&mysql);
{ {
char *tmp=getenv("PAGER"); char *tmp=getenv("PAGER");
if (tmp && strlen(tmp)) if (tmp && strlen(tmp))
...@@ -1204,7 +1207,6 @@ int main(int argc,char *argv[]) ...@@ -1204,7 +1207,6 @@ int main(int argc,char *argv[])
glob_buffer.realloc(512); glob_buffer.realloc(512);
completion_hash_init(&ht, 128); completion_hash_init(&ht, 128);
init_alloc_root(&hash_mem_root, 16384, 0, MYF(0)); init_alloc_root(&hash_mem_root, 16384, 0, MYF(0));
bzero((char*) &mysql, sizeof(mysql));
if (sql_connect(current_host,current_db,current_user,opt_password, if (sql_connect(current_host,current_db,current_user,opt_password,
opt_silent)) opt_silent))
{ {
...@@ -1962,7 +1964,7 @@ static int get_options(int argc, char **argv) ...@@ -1962,7 +1964,7 @@ static int get_options(int argc, char **argv)
connect_flag|= CLIENT_IGNORE_SPACE; connect_flag|= CLIENT_IGNORE_SPACE;
if (opt_progress_reports) if (opt_progress_reports)
connect_flag|= CLIENT_PROGRESS; connect_flag|= CLIENT_PROGRESS_OBSOLETE;
return(0); return(0);
} }
...@@ -3493,7 +3495,6 @@ static char *fieldflags2str(uint f) { ...@@ -3493,7 +3495,6 @@ static char *fieldflags2str(uint f) {
ff2s_check_flag(NUM); ff2s_check_flag(NUM);
ff2s_check_flag(PART_KEY); ff2s_check_flag(PART_KEY);
ff2s_check_flag(GROUP); ff2s_check_flag(GROUP);
ff2s_check_flag(UNIQUE);
ff2s_check_flag(BINCMP); ff2s_check_flag(BINCMP);
ff2s_check_flag(ON_UPDATE_NOW); ff2s_check_flag(ON_UPDATE_NOW);
#undef ff2s_check_flag #undef ff2s_check_flag
...@@ -4646,21 +4647,25 @@ sql_real_connect(char *host,char *database,char *user,char *password, ...@@ -4646,21 +4647,25 @@ sql_real_connect(char *host,char *database,char *user,char *password,
} }
return -1; // Retryable return -1; // Retryable
} }
charset_info= mysql.charset; charset_info= get_charset_by_name(mysql.charset->name, MYF(0));
connected=1; connected=1;
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
mysql.reconnect= debug_info_flag; // We want to know if this happens mysql_options(&mysql, MYSQL_OPT_RECONNECT, &debug_info_flag);
/* /*
CLIENT_PROGRESS is set only if we requsted it in mysql_real_connect() CLIENT_PROGRESS_OBSOLETE is set only if we requested it in
and the server also supports it mysql_real_connect() and the server also supports it
*/ */
if (mysql.client_flag & CLIENT_PROGRESS) if (mysql.client_flag & CLIENT_PROGRESS_OBSOLETE)
mysql_options(&mysql, MYSQL_PROGRESS_CALLBACK, (void*) report_progress); mysql_options(&mysql, MYSQL_PROGRESS_CALLBACK, (void*) report_progress);
#else #else
mysql.reconnect= 1; {
my_bool reconnect= 1;
mysql_options(&mysql, MYSQL_OPT_RECONNECT, &reconnect);
}
#endif #endif
#ifdef HAVE_READLINE #ifdef HAVE_READLINE
build_completion_hash(opt_rehash, 1); build_completion_hash(opt_rehash, 1);
...@@ -5124,17 +5129,31 @@ static const char *construct_prompt() ...@@ -5124,17 +5129,31 @@ static const char *construct_prompt()
processed_prompt.append("unknown"); processed_prompt.append("unknown");
break; break;
case 'h': case 'h':
case 'H':
{ {
const char *prompt; const char *prompt;
prompt= connected ? mysql_get_host_info(&mysql) : "not_connected"; prompt= connected ? mysql_get_host_info(&mysql) : "not_connected";
if (strstr(prompt, "Localhost")) if (strstr(prompt, "Localhost") || strstr(prompt, "localhost "))
processed_prompt.append("localhost"); {
else if (*c == 'h')
{ processed_prompt.append("localhost");
const char *end=strcend(prompt,' '); else
processed_prompt.append(prompt, (uint) (end-prompt)); {
} static char hostname[FN_REFLEN];
break; if (hostname[0])
processed_prompt.append(hostname);
else if (gethostname(hostname, sizeof(hostname)) == 0)
processed_prompt.append(hostname);
else
processed_prompt.append("gethostname(2) failed");
}
}
else
{
const char *end=strcend(prompt,' ');
processed_prompt.append(prompt, (uint) (end-prompt));
}
break;
} }
case 'p': case 'p':
{ {
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <mysql.h> #include <mysql.h>
#include <my_getopt.h> #include <my_getopt.h>
#include <my_dir.h> #include <my_dir.h>
#include <mysql_version.h>
#define SHOW_VERSION "1.0.0" #define SHOW_VERSION "1.0.0"
#define PRINT_VERSION do { printf("%s Ver %s Distrib %s\n", \ #define PRINT_VERSION do { printf("%s Ver %s Distrib %s\n", \
......
...@@ -22,9 +22,10 @@ ...@@ -22,9 +22,10 @@
#include <my_pthread.h> /* because of signal() */ #include <my_pthread.h> /* because of signal() */
#include <sys/stat.h> #include <sys/stat.h>
#include <mysql.h> #include <mysql.h>
#include <sql_common.h> #include <mysql_version.h>
#include <welcome_copyright_notice.h> #include <welcome_copyright_notice.h>
#include <my_rnd.h> #include <my_rnd.h>
#include <password.h>
#define ADMIN_VERSION "9.1" #define ADMIN_VERSION "9.1"
#define MAX_MYSQL_VAR 512 #define MAX_MYSQL_VAR 512
...@@ -447,7 +448,7 @@ int main(int argc,char *argv[]) ...@@ -447,7 +448,7 @@ int main(int argc,char *argv[])
didn't signal for us to die. Otherwise, signal failure. didn't signal for us to die. Otherwise, signal failure.
*/ */
if (mysql.net.vio == 0) if (mysql.net.pvio == 0)
{ {
if (option_wait && !interrupted) if (option_wait && !interrupted)
{ {
...@@ -528,7 +529,8 @@ static my_bool sql_connect(MYSQL *mysql, uint wait) ...@@ -528,7 +529,8 @@ static my_bool sql_connect(MYSQL *mysql, uint wait)
if (mysql_real_connect(mysql,host,user,opt_password,NullS,tcp_port, if (mysql_real_connect(mysql,host,user,opt_password,NullS,tcp_port,
unix_port, CLIENT_REMEMBER_OPTIONS)) unix_port, CLIENT_REMEMBER_OPTIONS))
{ {
mysql->reconnect= 1; my_bool reconnect= 1;
mysql_options(mysql, MYSQL_OPT_RECONNECT, &reconnect);
if (info) if (info)
{ {
fputs("\n",stderr); fputs("\n",stderr);
...@@ -1155,9 +1157,9 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -1155,9 +1157,9 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
} }
} }
if (old) if (old)
make_scrambled_password_323(crypted_pw, typed_password); my_make_scrambled_password_323(crypted_pw, typed_password, strlen(typed_password));
else else
make_scrambled_password(crypted_pw, typed_password); my_make_scrambled_password(crypted_pw, typed_password, strlen(typed_password));
} }
else else
crypted_pw[0]=0; /* No password */ crypted_pw[0]=0; /* No password */
...@@ -1265,7 +1267,9 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -1265,7 +1267,9 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
break; break;
} }
case ADMIN_PING: case ADMIN_PING:
mysql->reconnect=0; /* We want to know of reconnects */ {
my_bool reconnect= 0;
mysql_options(mysql, MYSQL_OPT_RECONNECT, &reconnect);
if (!mysql_ping(mysql)) if (!mysql_ping(mysql))
{ {
if (option_silent < 2) if (option_silent < 2)
...@@ -1275,7 +1279,8 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -1275,7 +1279,8 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
{ {
if (mysql_errno(mysql) == CR_SERVER_GONE_ERROR) if (mysql_errno(mysql) == CR_SERVER_GONE_ERROR)
{ {
mysql->reconnect=1; reconnect= 1;
mysql_options(mysql, MYSQL_OPT_RECONNECT, &reconnect);
if (!mysql_ping(mysql)) if (!mysql_ping(mysql))
puts("connection was down, but mysqld is now alive"); puts("connection was down, but mysqld is now alive");
} }
...@@ -1286,8 +1291,10 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -1286,8 +1291,10 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
return -1; return -1;
} }
} }
mysql->reconnect=1; /* Automatic reconnect is default */ reconnect=1; /* Automatic reconnect is default */
mysql_options(mysql, MYSQL_OPT_RECONNECT, &reconnect);
break; break;
}
default: default:
my_printf_error(0, "Unknown command: '%-.60s'", error_flags, argv[0]); my_printf_error(0, "Unknown command: '%-.60s'", error_flags, argv[0]);
return 1; return 1;
......
...@@ -37,13 +37,12 @@ ...@@ -37,13 +37,12 @@
#include <sslopt-vars.h> #include <sslopt-vars.h>
/* That one is necessary for defines of OPTION_NO_FOREIGN_KEY_CHECKS etc */ /* That one is necessary for defines of OPTION_NO_FOREIGN_KEY_CHECKS etc */
#include "sql_priv.h" #include "sql_priv.h"
#include "sql_basic_types.h"
#include "log_event.h" #include "log_event.h"
#include "compat56.h" #include "compat56.h"
#include "sql_common.h" #include "sql_common.h"
#include "my_dir.h" #include "my_dir.h"
#include <welcome_copyright_notice.h> // ORACLE_WELCOME_COPYRIGHT_NOTICE #include <welcome_copyright_notice.h> // ORACLE_WELCOME_COPYRIGHT_NOTICE
#include "sql_string.h" // needed for Rpl_filter #include "sql_string.h" // needed for Rpl_filter
#include "sql_list.h" // needed for Rpl_filter #include "sql_list.h" // needed for Rpl_filter
#include "rpl_filter.h" #include "rpl_filter.h"
...@@ -52,17 +51,25 @@ ...@@ -52,17 +51,25 @@
#include <algorithm> #include <algorithm>
#define my_net_write ma_net_write
#define net_flush ma_net_flush
#define cli_safe_read mysql_net_read_packet
#define my_net_read ma_net_read
extern "C" unsigned char *mysql_net_store_length(unsigned char *packet, size_t length);
#define net_store_length mysql_net_store_length
Rpl_filter *binlog_filter= 0; Rpl_filter *binlog_filter= 0;
#define BIN_LOG_HEADER_SIZE 4 #define BIN_LOG_HEADER_SIZE 4
#define PROBE_HEADER_LEN (EVENT_LEN_OFFSET+4) #define PROBE_HEADER_LEN (EVENT_LEN_OFFSET+4)
#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_LOCAL_FILES)
/* Needed for Rpl_filter */ /* Needed for Rpl_filter */
CHARSET_INFO* system_charset_info= &my_charset_utf8_general_ci; CHARSET_INFO* system_charset_info= &my_charset_utf8_general_ci;
/* Needed for Flashback */
DYNAMIC_ARRAY binlog_events; // Storing the events output string
String stop_event_string; // Storing the STOP_EVENT output string
char server_version[SERVER_VERSION_LENGTH]; char server_version[SERVER_VERSION_LENGTH];
ulong server_id = 0; ulong server_id = 0;
...@@ -86,7 +93,7 @@ static const char *load_groups[]= ...@@ -86,7 +93,7 @@ static const char *load_groups[]=
static void error(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2); static void error(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
static void warning(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2); static void warning(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
static bool one_database=0, to_last_remote_log= 0, disable_log_bin= 0; static bool one_database=0, one_table=0, to_last_remote_log= 0, disable_log_bin= 0;
static bool opt_hexdump= 0, opt_version= 0; static bool opt_hexdump= 0, opt_version= 0;
const char *base64_output_mode_names[]= const char *base64_output_mode_names[]=
{"NEVER", "AUTO", "ALWAYS", "UNSPEC", "DECODE-ROWS", NullS}; {"NEVER", "AUTO", "ALWAYS", "UNSPEC", "DECODE-ROWS", NullS};
...@@ -96,6 +103,7 @@ TYPELIB base64_output_mode_typelib= ...@@ -96,6 +103,7 @@ TYPELIB base64_output_mode_typelib=
static enum_base64_output_mode opt_base64_output_mode= BASE64_OUTPUT_UNSPEC; static enum_base64_output_mode opt_base64_output_mode= BASE64_OUTPUT_UNSPEC;
static char *opt_base64_output_mode_str= NullS; static char *opt_base64_output_mode_str= NullS;
static char* database= 0; static char* database= 0;
static char* table= 0;
static my_bool force_opt= 0, short_form= 0, remote_opt= 0; static my_bool force_opt= 0, short_form= 0, remote_opt= 0;
static my_bool debug_info_flag, debug_check_flag; static my_bool debug_info_flag, debug_check_flag;
static my_bool force_if_open_opt= 1; static my_bool force_if_open_opt= 1;
...@@ -129,6 +137,12 @@ static MYSQL* mysql = NULL; ...@@ -129,6 +137,12 @@ static MYSQL* mysql = NULL;
static const char* dirname_for_local_load= 0; static const char* dirname_for_local_load= 0;
static bool opt_skip_annotate_row_events= 0; static bool opt_skip_annotate_row_events= 0;
static my_bool opt_flashback;
#ifdef WHEN_FLASHBACK_REVIEW_READY
static my_bool opt_flashback_review;
static char *flashback_review_dbname, *flashback_review_tablename;
#endif
/** /**
Pointer to the Format_description_log_event of the currently active binlog. Pointer to the Format_description_log_event of the currently active binlog.
...@@ -787,6 +801,23 @@ print_skip_replication_statement(PRINT_EVENT_INFO *pinfo, const Log_event *ev) ...@@ -787,6 +801,23 @@ print_skip_replication_statement(PRINT_EVENT_INFO *pinfo, const Log_event *ev)
pinfo->skip_replication= cur_val; pinfo->skip_replication= cur_val;
} }
/**
Indicates whether the given table should be filtered out,
according to the --table=X option.
@param log_tblname Name of table.
@return nonzero if the table with the given name should be
filtered out, 0 otherwise.
*/
static bool shall_skip_table(const char *log_tblname)
{
return one_table &&
(log_tblname != NULL) &&
strcmp(log_tblname, table);
}
/** /**
Prints the given event in base64 format. Prints the given event in base64 format.
...@@ -949,6 +980,12 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, ...@@ -949,6 +980,12 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
Exit_status retval= OK_CONTINUE; Exit_status retval= OK_CONTINUE;
IO_CACHE *const head= &print_event_info->head_cache; IO_CACHE *const head= &print_event_info->head_cache;
/* Bypass flashback settings to event */
ev->is_flashback= opt_flashback;
#ifdef WHEN_FLASHBACK_REVIEW_READY
ev->need_flashback_review= opt_flashback_review;
#endif
/* /*
Format events are not concerned by --offset and such, we always need to Format events are not concerned by --offset and such, we always need to
read them to be able to process the wanted events. read them to be able to process the wanted events.
...@@ -985,7 +1022,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, ...@@ -985,7 +1022,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
retval= OK_STOP; retval= OK_STOP;
goto end; goto end;
} }
if (!short_form) if (!short_form && !opt_flashback)
fprintf(result_file, "# at %s\n",llstr(pos,ll_buff)); fprintf(result_file, "# at %s\n",llstr(pos,ll_buff));
if (!opt_hexdump) if (!opt_hexdump)
...@@ -999,6 +1036,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, ...@@ -999,6 +1036,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
switch (ev_type) { switch (ev_type) {
case QUERY_EVENT: case QUERY_EVENT:
case QUERY_COMPRESSED_EVENT:
{ {
Query_log_event *qe= (Query_log_event*)ev; Query_log_event *qe= (Query_log_event*)ev;
if (!qe->is_trans_keyword()) if (!qe->is_trans_keyword())
...@@ -1210,12 +1248,128 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, ...@@ -1210,12 +1248,128 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
case TABLE_MAP_EVENT: case TABLE_MAP_EVENT:
{ {
Table_map_log_event *map= ((Table_map_log_event *)ev); Table_map_log_event *map= ((Table_map_log_event *)ev);
if (shall_skip_database(map->get_db_name())) if (shall_skip_database(map->get_db_name()) ||
shall_skip_table(map->get_table_name()))
{ {
print_event_info->m_table_map_ignored.set_table(map->get_table_id(), map); print_event_info->m_table_map_ignored.set_table(map->get_table_id(), map);
destroy_evt= FALSE; destroy_evt= FALSE;
goto end; goto end;
} }
#ifdef WHEN_FLASHBACK_REVIEW_READY
/* Create review table for Flashback */
if (opt_flashback_review)
{
// Check if the table was already created?
Table_map_log_event *exist_table;
exist_table= print_event_info->m_table_map.get_table(map->get_table_id());
if (!exist_table)
{
MYSQL *conn;
MYSQL_RES *res;
MYSQL_ROW row;
char tmp_sql[8096];
int tmp_sql_offset;
conn = mysql_init(NULL);
if (!mysql_real_connect(conn, host, user, pass,
map->get_db_name(), port, sock, 0))
{
fprintf(stderr, "%s\n", mysql_error(conn));
exit(1);
}
if (mysql_query(conn, "SET group_concat_max_len=10000;"))
{
fprintf(stderr, "%s\n", mysql_error(conn));
exit(1);
}
memset(tmp_sql, 0, sizeof(tmp_sql));
sprintf(tmp_sql, " "
"SELECT Group_concat(cols) "
"FROM (SELECT 'op_type char(1)' cols "
" UNION ALL "
" SELECT Concat('`', column_name, '_old` ', column_type, ' ', "
" IF(character_set_name IS NOT NULL, "
" Concat('character set ', character_set_name, ' '), ' '), "
" IF(collation_name IS NOT NULL, "
" Concat('collate ', collation_name, ' '), ' ')) cols "
" FROM information_schema.columns "
" WHERE table_schema = '%s' "
" AND table_name = '%s' "
" UNION ALL "
" SELECT Concat('`', column_name, '_new` ', column_type, ' ', "
" IF(character_set_name IS NOT NULL, "
" Concat('character set ', character_set_name, ' '), ' '), "
" IF(collation_name IS NOT NULL, "
" Concat('collate ', collation_name, ' '), ' ')) cols "
" FROM information_schema.columns "
" WHERE table_schema = '%s' "
" AND table_name = '%s') tmp;",
map->get_db_name(), map->get_table_name(),
map->get_db_name(), map->get_table_name());
if (mysql_query(conn, tmp_sql))
{
fprintf(stderr, "%s\n", mysql_error(conn));
exit(1);
}
res = mysql_use_result(conn);
if ((row = mysql_fetch_row(res)) != NULL) // only one row
{
if (flashback_review_dbname)
{
ev->set_flashback_review_dbname(flashback_review_dbname);
}
else
{
ev->set_flashback_review_dbname(map->get_db_name());
}
if (flashback_review_tablename)
{
ev->set_flashback_review_tablename(flashback_review_tablename);
}
else
{
memset(tmp_sql, 0, sizeof(tmp_sql));
sprintf(tmp_sql, "__%s", map->get_table_name());
ev->set_flashback_review_tablename(tmp_sql);
}
memset(tmp_sql, 0, sizeof(tmp_sql));
tmp_sql_offset= sprintf(tmp_sql, "CREATE TABLE IF NOT EXISTS");
tmp_sql_offset+= sprintf(tmp_sql + tmp_sql_offset, " `%s`.`%s` (%s) %s",
ev->get_flashback_review_dbname(),
ev->get_flashback_review_tablename(),
row[0],
print_event_info->delimiter);
}
fprintf(result_file, "%s\n", tmp_sql);
mysql_free_result(res);
mysql_close(conn);
}
else
{
char tmp_str[128];
if (flashback_review_dbname)
ev->set_flashback_review_dbname(flashback_review_dbname);
else
ev->set_flashback_review_dbname(map->get_db_name());
if (flashback_review_tablename)
ev->set_flashback_review_tablename(flashback_review_tablename);
else
{
memset(tmp_str, 0, sizeof(tmp_str));
sprintf(tmp_str, "__%s", map->get_table_name());
ev->set_flashback_review_tablename(tmp_str);
}
}
}
#endif
/* /*
The Table map is to be printed, so it's just the time when we may The Table map is to be printed, so it's just the time when we may
print the kept Annotate event (if there is any). print the kept Annotate event (if there is any).
...@@ -1240,6 +1394,12 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, ...@@ -1240,6 +1394,12 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
case WRITE_ROWS_EVENT_V1: case WRITE_ROWS_EVENT_V1:
case UPDATE_ROWS_EVENT_V1: case UPDATE_ROWS_EVENT_V1:
case DELETE_ROWS_EVENT_V1: case DELETE_ROWS_EVENT_V1:
case WRITE_ROWS_COMPRESSED_EVENT:
case DELETE_ROWS_COMPRESSED_EVENT:
case UPDATE_ROWS_COMPRESSED_EVENT:
case WRITE_ROWS_COMPRESSED_EVENT_V1:
case UPDATE_ROWS_COMPRESSED_EVENT_V1:
case DELETE_ROWS_COMPRESSED_EVENT_V1:
{ {
Rows_log_event *e= (Rows_log_event*) ev; Rows_log_event *e= (Rows_log_event*) ev;
if (print_row_event(print_event_info, ev, e->get_table_id(), if (print_row_event(print_event_info, ev, e->get_table_id(),
...@@ -1284,6 +1444,38 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, ...@@ -1284,6 +1444,38 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
*/ */
if (ev) if (ev)
{ {
/* Holding event output if needed */
if (!ev->output_buf.is_empty())
{
LEX_STRING tmp_str;
tmp_str.length= ev->output_buf.length();
tmp_str.str= ev->output_buf.release();
if (opt_flashback)
{
if (ev_type == STOP_EVENT)
stop_event_string.reset(tmp_str.str, tmp_str.length, tmp_str.length,
&my_charset_bin);
else
{
if (push_dynamic(&binlog_events, (uchar *) &tmp_str))
{
error("Out of memory: can't allocate memory to store the flashback events.");
exit(1);
}
}
}
else
{
my_fwrite(result_file, (const uchar *) tmp_str.str, tmp_str.length,
MYF(MY_NABP));
my_free(tmp_str.str);
}
}
if (remote_opt)
ev->temp_buf= 0;
if (destroy_evt) /* destroy it later if not set (ignored table map) */ if (destroy_evt) /* destroy it later if not set (ignored table map) */
delete ev; delete ev;
} }
...@@ -1342,6 +1534,13 @@ static struct my_option my_options[] = ...@@ -1342,6 +1534,13 @@ static struct my_option my_options[] =
"already have. NOTE: you will need a SUPER privilege to use this option.", "already have. NOTE: you will need a SUPER privilege to use this option.",
&disable_log_bin, &disable_log_bin, 0, GET_BOOL, &disable_log_bin, &disable_log_bin, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0}, NO_ARG, 0, 0, 0, 0, 0, 0},
{"flashback", 'B', "Flashback feature can rollback you committed data to a special time point.",
#ifdef WHEN_FLASHBACK_REVIEW_READY
"before Flashback feature writing a row, original row can insert to review-dbname.review-tablename,"
"and mysqlbinlog will login mysql by user(-u) and password(-p) and host(-h).",
#endif
&opt_flashback, &opt_flashback, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"force-if-open", 'F', "Force if binlog was not closed properly.", {"force-if-open", 'F', "Force if binlog was not closed properly.",
&force_if_open_opt, &force_if_open_opt, 0, GET_BOOL, NO_ARG, &force_if_open_opt, &force_if_open_opt, 0, GET_BOOL, NO_ARG,
1, 0, 0, 0, 0, 0}, 1, 0, 0, 0, 0, 0},
...@@ -1385,6 +1584,19 @@ static struct my_option my_options[] = ...@@ -1385,6 +1584,19 @@ static struct my_option my_options[] =
"prefix for the file names.", "prefix for the file names.",
&result_file_name, &result_file_name, 0, GET_STR, REQUIRED_ARG, &result_file_name, &result_file_name, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0}, 0, 0, 0, 0, 0, 0},
#ifdef WHEN_FLASHBACK_REVIEW_READY
{"review", opt_flashback_review, "Print review sql in output file.",
&opt_flashback_review, &opt_flashback_review, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"review-dbname", opt_flashback_flashback_review_dbname,
"Writing flashback original row data into this db",
&flashback_review_dbname, &flashback_review_dbname,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"review-tablename", opt_flashback_flashback_review_tablename,
"Writing flashback original row data into this table",
&flashback_review_tablename, &flashback_review_tablename,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"server-id", 0, {"server-id", 0,
"Extract only binlog entries created by the server having the given id.", "Extract only binlog entries created by the server having the given id.",
&server_id, &server_id, 0, GET_ULONG, &server_id, &server_id, 0, GET_ULONG,
...@@ -1448,6 +1660,9 @@ static struct my_option my_options[] = ...@@ -1448,6 +1660,9 @@ static struct my_option my_options[] =
&stop_position, &stop_position, 0, GET_ULL, &stop_position, &stop_position, 0, GET_ULL,
REQUIRED_ARG, (longlong)(~(my_off_t)0), BIN_LOG_HEADER_SIZE, REQUIRED_ARG, (longlong)(~(my_off_t)0), BIN_LOG_HEADER_SIZE,
(ulonglong)(~(my_off_t)0), 0, 0, 0}, (ulonglong)(~(my_off_t)0), 0, 0, 0},
{"table", 'T', "List entries for just this table (local log only).",
&table, &table, 0, GET_STR_ALLOC, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"to-last-log", 't', "Requires -R. Will not stop at the end of the \ {"to-last-log", 't', "Requires -R. Will not stop at the end of the \
requested binlog but rather continue printing until the end of the last \ requested binlog but rather continue printing until the end of the last \
binlog of the MySQL server. If you send the output to the same MySQL server, \ binlog of the MySQL server. If you send the output to the same MySQL server, \
...@@ -1557,6 +1772,7 @@ static void cleanup() ...@@ -1557,6 +1772,7 @@ static void cleanup()
{ {
my_free(pass); my_free(pass);
my_free(database); my_free(database);
my_free(table);
my_free(host); my_free(host);
my_free(user); my_free(user);
my_free(const_cast<char*>(dirname_for_local_load)); my_free(const_cast<char*>(dirname_for_local_load));
...@@ -1627,6 +1843,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -1627,6 +1843,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break; break;
#endif #endif
#include <sslopt-case.h> #include <sslopt-case.h>
case 'B':
opt_flashback= 1;
break;
case 'd': case 'd':
one_database = 1; one_database = 1;
break; break;
...@@ -1648,10 +1867,18 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -1648,10 +1867,18 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case 'R': case 'R':
remote_opt= 1; remote_opt= 1;
break; break;
case 'T':
one_table= 1;
break;
case OPT_MYSQL_PROTOCOL: case OPT_MYSQL_PROTOCOL:
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib, opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
opt->name); opt->name);
break; break;
#ifdef WHEN_FLASHBACK_REVIEW_READY
case opt_flashback_review:
opt_flashback_review= 1;
break;
#endif
case OPT_START_DATETIME: case OPT_START_DATETIME:
start_datetime= convert_str_to_timestamp(start_datetime_str); start_datetime= convert_str_to_timestamp(start_datetime_str);
break; break;
...@@ -1767,6 +1994,7 @@ static int parse_args(int *argc, char*** argv) ...@@ -1767,6 +1994,7 @@ static int parse_args(int *argc, char*** argv)
*/ */
static Exit_status safe_connect() static Exit_status safe_connect()
{ {
my_bool reconnect= 1;
/* Close any old connections to MySQL */ /* Close any old connections to MySQL */
if (mysql) if (mysql)
mysql_close(mysql); mysql_close(mysql);
...@@ -1812,7 +2040,7 @@ static Exit_status safe_connect() ...@@ -1812,7 +2040,7 @@ static Exit_status safe_connect()
error("Failed on connect: %s", mysql_error(mysql)); error("Failed on connect: %s", mysql_error(mysql));
return ERROR_STOP; return ERROR_STOP;
} }
mysql->reconnect= 1; mysql_options(mysql, MYSQL_OPT_RECONNECT, &reconnect);
return OK_CONTINUE; return OK_CONTINUE;
} }
...@@ -1851,7 +2079,7 @@ static Exit_status dump_log_entries(const char* logname) ...@@ -1851,7 +2079,7 @@ static Exit_status dump_log_entries(const char* logname)
dump_local_log_entries(&print_event_info, logname)); dump_local_log_entries(&print_event_info, logname));
/* Set delimiter back to semicolon */ /* Set delimiter back to semicolon */
if (!opt_raw_mode) if (!opt_raw_mode && !opt_flashback)
fprintf(result_file, "DELIMITER ;\n"); fprintf(result_file, "DELIMITER ;\n");
strmov(print_event_info.delimiter, ";"); strmov(print_event_info.delimiter, ";");
return rc; return rc;
...@@ -2639,8 +2867,6 @@ static Exit_status dump_local_log_entries(PRINT_EVENT_INFO *print_event_info, ...@@ -2639,8 +2867,6 @@ static Exit_status dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
return retval; return retval;
} }
/* Used in sql_alloc(). Inited and freed in main() */
MEM_ROOT s_mem_root;
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
...@@ -2654,7 +2880,6 @@ int main(int argc, char** argv) ...@@ -2654,7 +2880,6 @@ int main(int argc, char** argv)
my_init_time(); // for time functions my_init_time(); // for time functions
tzset(); // set tzname tzset(); // set tzname
init_alloc_root(&s_mem_root, 16384, 0, MYF(0));
if (load_defaults("my", load_groups, &argc, &argv)) if (load_defaults("my", load_groups, &argc, &argv))
exit(1); exit(1);
...@@ -2689,6 +2914,10 @@ int main(int argc, char** argv) ...@@ -2689,6 +2914,10 @@ int main(int argc, char** argv)
my_set_max_open_files(open_files_limit); my_set_max_open_files(open_files_limit);
if (opt_flashback)
my_init_dynamic_array(&binlog_events, sizeof(LEX_STRING), 1024, 1024,
MYF(0));
if (opt_stop_never) if (opt_stop_never)
to_last_remote_log= TRUE; to_last_remote_log= TRUE;
...@@ -2787,6 +3016,29 @@ int main(int argc, char** argv) ...@@ -2787,6 +3016,29 @@ int main(int argc, char** argv)
start_position= BIN_LOG_HEADER_SIZE; start_position= BIN_LOG_HEADER_SIZE;
} }
/*
If enable flashback, need to print the events from the end to the
beginning
*/
if (opt_flashback)
{
for (uint i= binlog_events.elements; i > 0; --i)
{
LEX_STRING *event_str= dynamic_element(&binlog_events, i - 1,
LEX_STRING*);
fprintf(result_file, "%s", event_str->str);
my_free(event_str->str);
}
fprintf(result_file, "COMMIT\n/*!*/;\n");
delete_dynamic(&binlog_events);
}
/* Set delimiter back to semicolon */
if (!stop_event_string.is_empty())
fprintf(result_file, "%s", stop_event_string.ptr());
if (!opt_raw_mode && opt_flashback)
fprintf(result_file, "DELIMITER ;\n");
if (!opt_raw_mode) if (!opt_raw_mode)
{ {
/* /*
...@@ -2814,7 +3066,6 @@ int main(int argc, char** argv) ...@@ -2814,7 +3066,6 @@ int main(int argc, char** argv)
my_fclose(result_file, MYF(0)); my_fclose(result_file, MYF(0));
cleanup(); cleanup();
free_annotate_event(); free_annotate_event();
free_root(&s_mem_root, MYF(0));
free_defaults(defaults_argv); free_defaults(defaults_argv);
my_free_open_file_info(); my_free_open_file_info();
load_processor.destroy(); load_processor.destroy();
...@@ -2835,11 +3086,6 @@ int main(int argc, char** argv) ...@@ -2835,11 +3086,6 @@ int main(int argc, char** argv)
} }
void *sql_alloc(size_t size)
{
return alloc_root(&s_mem_root, size);
}
uint dummy1() { return 1; } uint dummy1() { return 1; }
struct encryption_service_st encryption_handler= struct encryption_service_st encryption_handler=
{ {
...@@ -2862,6 +3108,8 @@ struct encryption_service_st encryption_handler= ...@@ -2862,6 +3108,8 @@ struct encryption_service_st encryption_handler=
#include "my_decimal.h" #include "my_decimal.h"
#include "decimal.c" #include "decimal.c"
#include "my_decimal.cc" #include "my_decimal.cc"
#include "../sql-common/my_time.c"
#include "password.c"
#include "log_event.cc" #include "log_event.cc"
#include "log_event_old.cc" #include "log_event_old.cc"
#include "rpl_utility.cc" #include "rpl_utility.cc"
......
...@@ -1073,6 +1073,7 @@ static void print_result() ...@@ -1073,6 +1073,7 @@ static void print_result()
static int dbConnect(char *host, char *user, char *passwd) static int dbConnect(char *host, char *user, char *passwd)
{ {
my_bool reconnect= 1;
DBUG_ENTER("dbConnect"); DBUG_ENTER("dbConnect");
if (verbose > 1) if (verbose > 1)
{ {
...@@ -1111,7 +1112,7 @@ static int dbConnect(char *host, char *user, char *passwd) ...@@ -1111,7 +1112,7 @@ static int dbConnect(char *host, char *user, char *passwd)
DBerror(&mysql_connection, "when trying to connect"); DBerror(&mysql_connection, "when trying to connect");
DBUG_RETURN(1); DBUG_RETURN(1);
} }
mysql_connection.reconnect= 1; mysql_options(&mysql_connection, MYSQL_OPT_RECONNECT, &reconnect);
DBUG_RETURN(0); DBUG_RETURN(0);
} /* dbConnect */ } /* dbConnect */
......
/* /*
Copyright (c) 2000, 2013, Oracle and/or its affiliates. Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2010, 2016, MariaDB Copyright (c) 2010, 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -199,12 +199,12 @@ const char *compatible_mode_names[]= ...@@ -199,12 +199,12 @@ const char *compatible_mode_names[]=
}; };
#define MASK_ANSI_QUOTES \ #define MASK_ANSI_QUOTES \
(\ (\
(1<<2) | /* POSTGRESQL */\ (1U<<2) | /* POSTGRESQL */\
(1<<3) | /* ORACLE */\ (1U<<3) | /* ORACLE */\
(1<<4) | /* MSSQL */\ (1U<<4) | /* MSSQL */\
(1<<5) | /* DB2 */\ (1U<<5) | /* DB2 */\
(1<<6) | /* MAXDB */\ (1U<<6) | /* MAXDB */\
(1<<10) /* ANSI */\ (1U<<10) /* ANSI */\
) )
TYPELIB compatible_mode_typelib= {array_elements(compatible_mode_names) - 1, TYPELIB compatible_mode_typelib= {array_elements(compatible_mode_names) - 1,
"", compatible_mode_names, NULL}; "", compatible_mode_names, NULL};
...@@ -1666,6 +1666,7 @@ static void maybe_exit(int error) ...@@ -1666,6 +1666,7 @@ static void maybe_exit(int error)
static int connect_to_db(char *host, char *user,char *passwd) static int connect_to_db(char *host, char *user,char *passwd)
{ {
char buff[20+FN_REFLEN]; char buff[20+FN_REFLEN];
my_bool reconnect;
DBUG_ENTER("connect_to_db"); DBUG_ENTER("connect_to_db");
verbose_msg("-- Connecting to %s...\n", host ? host : "localhost"); verbose_msg("-- Connecting to %s...\n", host ? host : "localhost");
...@@ -1720,7 +1721,8 @@ static int connect_to_db(char *host, char *user,char *passwd) ...@@ -1720,7 +1721,8 @@ static int connect_to_db(char *host, char *user,char *passwd)
As we're going to set SQL_MODE, it would be lost on reconnect, so we As we're going to set SQL_MODE, it would be lost on reconnect, so we
cannot reconnect. cannot reconnect.
*/ */
mysql->reconnect= 0; reconnect= 0;
mysql_options(&mysql_connection, MYSQL_OPT_RECONNECT, &reconnect);
my_snprintf(buff, sizeof(buff), "/*!40100 SET @@SQL_MODE='%s' */", my_snprintf(buff, sizeof(buff), "/*!40100 SET @@SQL_MODE='%s' */",
compatible_mode_normal_str); compatible_mode_normal_str);
if (mysql_query_with_error_report(mysql, 0, buff)) if (mysql_query_with_error_report(mysql, 0, buff))
...@@ -5475,7 +5477,7 @@ static ulong find_set(TYPELIB *lib, const char *x, size_t length, ...@@ -5475,7 +5477,7 @@ static ulong find_set(TYPELIB *lib, const char *x, size_t length,
*err_len= var_len; *err_len= var_len;
} }
else else
found|= ((longlong) 1 << (find - 1)); found|= 1UL << (find - 1);
if (pos == end) if (pos == end)
break; break;
start= pos + 1; start= pos + 1;
...@@ -6146,7 +6148,7 @@ int main(int argc, char **argv) ...@@ -6146,7 +6148,7 @@ int main(int argc, char **argv)
goto err; goto err;
/* /*
No reason to explicitely COMMIT the transaction, neither to explicitely No reason to explicitly COMMIT the transaction, neither to explicitly
UNLOCK TABLES: these will be automatically be done by the server when we UNLOCK TABLES: these will be automatically be done by the server when we
disconnect now. Saves some code here, some network trips, adds nothing to disconnect now. Saves some code here, some network trips, adds nothing to
server. server.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment