mirror of
https://github.com/MariaDB/server.git
synced 2025-10-12 12:25:37 +03:00
Merge branch '10.4' into bb-10.4-mdev16188
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -182,6 +182,7 @@ storage/maria/ma_sp_test
|
||||
storage/maria/ma_test1
|
||||
storage/maria/ma_test2
|
||||
storage/maria/ma_test3
|
||||
storage/maria/test_ma_backup
|
||||
storage/myisam/mi_test1
|
||||
storage/myisam/mi_test2
|
||||
storage/myisam/mi_test3
|
||||
@@ -192,7 +193,9 @@ storage/myisam/myisampack
|
||||
storage/myisam/rt_test
|
||||
storage/myisam/sp_test
|
||||
storage/rocksdb/ldb
|
||||
storage/rocksdb/myrocks_hotbackup
|
||||
storage/rocksdb/mysql_ldb
|
||||
storage/rocksdb/myrocks_hotbackup
|
||||
storage/rocksdb/sst_dump
|
||||
storage/rocksdb/rdb_source_revision.h
|
||||
storage/tokudb/PerconaFT/buildheader/db.h
|
||||
|
4
.gitmodules
vendored
4
.gitmodules
vendored
@@ -4,3 +4,7 @@
|
||||
[submodule "storage/rocksdb/rocksdb"]
|
||||
path = storage/rocksdb/rocksdb
|
||||
url = https://github.com/facebook/rocksdb.git
|
||||
[submodule "wsrep-lib"]
|
||||
path = wsrep-lib
|
||||
url = https://github.com/codership/wsrep-lib.git
|
||||
branch = master
|
||||
|
@@ -22,15 +22,22 @@ if [[ "${TRAVIS_OS_NAME}" == 'linux' ]]; then
|
||||
exclude_modules;
|
||||
if which ccache ; then
|
||||
CMAKE_OPT="${CMAKE_OPT} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
|
||||
ccache --max-size=1200M
|
||||
fi
|
||||
if [[ "${CXX}" == 'clang++' ]]; then
|
||||
export CXX CC=${CXX/++/}
|
||||
if [[ "${CC_VERSION}" == '6' ]]; then
|
||||
export CXX=${CXX}-${CC_VERSION}.0
|
||||
else
|
||||
export CXX=${CXX}-${CC_VERSION}
|
||||
fi
|
||||
export CC=${CXX/++/}
|
||||
# excess warnings about unused include path
|
||||
export CFLAGS='-Wno-unused-command-line-argument'
|
||||
export CXXFLAGS='-Wno-unused-command-line-argument'
|
||||
elif [[ "${CXX}" == 'g++' ]]; then
|
||||
export CXX=g++-${CC_VERSION}
|
||||
export CC=gcc-${CC_VERSION}
|
||||
fi
|
||||
if [[ ${CC_VERSION} == 6 ]]; then
|
||||
if [[ ${CC_VERSION} == 7 ]]; 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
|
||||
|
65
.travis.yml
65
.travis.yml
@@ -2,7 +2,7 @@
|
||||
# travis-ci.org definition
|
||||
|
||||
sudo: false
|
||||
dist: trusty
|
||||
dist: xenial
|
||||
|
||||
git:
|
||||
depth: 2
|
||||
@@ -11,13 +11,13 @@ language: cpp
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
osx_image: xcode9.1
|
||||
osx_image: xcode10.1
|
||||
compiler:
|
||||
- gcc
|
||||
- clang
|
||||
|
||||
cache:
|
||||
timeout: 300
|
||||
timeout: 500
|
||||
apt: true
|
||||
ccache: true
|
||||
directories:
|
||||
@@ -25,17 +25,24 @@ cache:
|
||||
|
||||
env:
|
||||
matrix:
|
||||
- CC_VERSION=5 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main
|
||||
- CC_VERSION=5 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=archive,optimizer_unfixed_bugs,parts,sys_vars,unit,vcol,innodb,innodb_gis,innodb_zip,innodb_fts
|
||||
- CC_VERSION=5 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rpl
|
||||
- CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=binlog,binlog_encryption,encryption
|
||||
- CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rocksdb
|
||||
- CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=csv,federated,funcs_1,funcs_2,gcol,handler,heap,json,maria,perfschema,plugins,multi_source,roles
|
||||
- CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main
|
||||
- CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=archive,optimizer_unfixed_bugs,parts,sys_vars,unit,vcol,innodb,innodb_gis,innodb_zip,innodb_fts
|
||||
- CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rpl
|
||||
- CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=binlog,binlog_encryption,encryption
|
||||
- CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rocksdb,versioning
|
||||
- CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=csv,federated,funcs_1,funcs_2,gcol,handler,heap,json,maria,perfschema,plugins,multi_source,roles
|
||||
- CC_VERSION=8 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main
|
||||
|
||||
matrix:
|
||||
exclude:
|
||||
- os: osx
|
||||
compiler: gcc
|
||||
- os: osx
|
||||
compiler: clang
|
||||
env: CC_VERSION=8 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main
|
||||
- os: linux
|
||||
compiler: clang
|
||||
env: CC_VERSION=8 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main
|
||||
include:
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
@@ -79,49 +86,51 @@ matrix:
|
||||
- uuid-dev
|
||||
- devscripts
|
||||
- fakeroot
|
||||
- dh-systemd
|
||||
- libsystemd-dev
|
||||
- libzstd-dev
|
||||
- unixodbc-dev
|
||||
script:
|
||||
- ${CC} --version ; ${CXX} --version
|
||||
# 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=4" debian/autobake-deb.sh;
|
||||
- ccache --show-stats
|
||||
# Until OSX becomes a bit more stable: MDEV-12435 MDEV-16213
|
||||
allow_failures:
|
||||
- os: osx
|
||||
compiler: clang
|
||||
env: CC_VERSION=5 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rpl
|
||||
env: CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rpl
|
||||
- os: osx
|
||||
compiler: clang
|
||||
env: CC_VERSION=5 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main
|
||||
env: CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main
|
||||
- os: osx
|
||||
compiler: clang
|
||||
env: CC_VERSION=5 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=archive,optimizer_unfixed_bugs,parts,sys_vars,unit,vcol,innodb,innodb_gis,innodb_zip,innodb_fts
|
||||
env: CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=archive,optimizer_unfixed_bugs,parts,sys_vars,unit,vcol,innodb,innodb_gis,innodb_zip,innodb_fts
|
||||
- os: osx
|
||||
compiler: clang
|
||||
env: CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=binlog,binlog_encryption,encryption
|
||||
env: CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=binlog,binlog_encryption,encryption
|
||||
- os: osx
|
||||
compiler: clang
|
||||
env: CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rocksdb
|
||||
env: CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rocksdb,versioning
|
||||
- os: osx
|
||||
compiler: clang
|
||||
env: CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=csv,federated,funcs_1,funcs_2,gcol,handler,heap,json,maria,perfschema,plugins,multi_source,roles
|
||||
env: CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=csv,federated,funcs_1,funcs_2,gcol,handler,heap,json,maria,perfschema,plugins,multi_source,roles
|
||||
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-trusty-5.0
|
||||
- llvm-toolchain-trusty-6.0
|
||||
- llvm-toolchain-xenial-6.0
|
||||
- llvm-toolchain-xenial-7
|
||||
packages: # make sure these include all compilers and all build dependencies (see list above)
|
||||
- gcc-5
|
||||
- g++-5
|
||||
- gcc-6
|
||||
- g++-6
|
||||
- clang-5.0
|
||||
- llvm-5.0-dev
|
||||
- gcc-7
|
||||
- g++-7
|
||||
- gcc-8
|
||||
- g++-8
|
||||
- clang-6.0
|
||||
- llvm-6.0-dev
|
||||
- clang-7
|
||||
- llvm-7-dev
|
||||
- bison
|
||||
- chrpath
|
||||
- cmake
|
||||
@@ -156,14 +165,16 @@ addons:
|
||||
before_install:
|
||||
- if [[ "${TRAVIS_OS_NAME}" == 'osx' ]]; then
|
||||
brew update;
|
||||
brew install gnutls lz4 lzo xz snappy ccache jemalloc curl ossp-uuid pcre;
|
||||
brew install gnutls lz4 lzo xz snappy ccache jemalloc curl ossp-uuid pcre zstd;
|
||||
brew link ccache;
|
||||
export PATH="/usr/local/opt/ccache/libexec:$PATH";
|
||||
fi
|
||||
|
||||
before_script:
|
||||
- df -h
|
||||
- ccache --version
|
||||
- ccache --show-stats
|
||||
- ccache --max-size=5G
|
||||
|
||||
script:
|
||||
# following modules are disabled after sourcing .travis.compiler.sh:
|
||||
@@ -181,6 +192,8 @@ script:
|
||||
--suite=${MYSQL_TEST_SUITES}
|
||||
--skip-test-list=unstable-tests
|
||||
--skip-test=binlog.binlog_unsafe
|
||||
|
||||
after_script:
|
||||
- ccache --show-stats
|
||||
- df -h
|
||||
|
||||
|
@@ -122,7 +122,8 @@ get_make_parallel_flag
|
||||
# SSL library to use.--with-ssl will select our bundled yaSSL
|
||||
# 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
|
||||
# We use bundled by default as this is guaranteed to work with Galera
|
||||
SSL_LIBRARY=--with-ssl
|
||||
|
||||
if [ "x$warning_mode" = "xpedantic" ]; then
|
||||
warnings="-W -Wall -ansi -pedantic -Wno-long-long -Wno-unused -D_POSIX_SOURCE"
|
||||
@@ -194,6 +195,8 @@ base_configs="$base_configs --with-extra-charsets=complex "
|
||||
base_configs="$base_configs --enable-thread-safe-client "
|
||||
base_configs="$base_configs --with-big-tables $maintainer_mode"
|
||||
base_configs="$base_configs --with-plugin-aria --with-aria-tmp-tables"
|
||||
# Following is to get tokudb to work
|
||||
base_configs="$base_configs --with-jemalloc=NO"
|
||||
|
||||
if test -d "$path/../cmd-line-utils/readline"
|
||||
then
|
||||
|
@@ -143,6 +143,7 @@ INCLUDE(misc)
|
||||
INCLUDE(mysql_version)
|
||||
INCLUDE(cpack_source_ignore_files)
|
||||
INCLUDE(install_layout)
|
||||
INCLUDE(submodules)
|
||||
INCLUDE(wsrep)
|
||||
INCLUDE(cpack_rpm)
|
||||
INCLUDE(cpack_deb)
|
||||
@@ -342,6 +343,8 @@ MYSQL_CHECK_SSL()
|
||||
MYSQL_CHECK_READLINE()
|
||||
|
||||
SET(MALLOC_LIBRARY "system")
|
||||
SET(PYTHON_SHEBANG "/usr/bin/env python" CACHE STRING "python shebang")
|
||||
MARK_AS_ADVANCED(PYTHON_SHEBANG)
|
||||
|
||||
CHECK_PCRE()
|
||||
|
||||
@@ -376,7 +379,6 @@ ENDIF()
|
||||
|
||||
SET (MYSQLD_STATIC_PLUGIN_LIBS "" CACHE INTERNAL "")
|
||||
|
||||
INCLUDE(submodules)
|
||||
INCLUDE(mariadb_connector_c) # this does ADD_SUBDIRECTORY(libmariadb)
|
||||
|
||||
# Add storage engines and plugins.
|
||||
@@ -404,7 +406,7 @@ IF(NOT WITHOUT_SERVER)
|
||||
ENDIF(WITH_EMBEDDED_SERVER)
|
||||
|
||||
IF(WITH_WSREP)
|
||||
ADD_SUBDIRECTORY(wsrep)
|
||||
ADD_SUBDIRECTORY(wsrep-lib)
|
||||
ENDIF()
|
||||
|
||||
ADD_SUBDIRECTORY(mysql-test)
|
||||
|
47
CONTRIBUTING.md
Normal file
47
CONTRIBUTING.md
Normal file
@@ -0,0 +1,47 @@
|
||||
# How to contribute
|
||||
|
||||
MariaDB Server has a vibrant community contributing in a wide range of areas. There are many valuable ways you can contribute to MariaDB.
|
||||
|
||||
### Engage online with other community members
|
||||
---
|
||||
- [MariaDB on Zulip](https://mariadb.zulipchat.com/)
|
||||
- [maria-developers mailing list](http://launchpad.net/~maria-developers)
|
||||
- [maria-discuss mailing list](http://launchpad.net/~maria-discuss)
|
||||
- [maria-docs mailing list](http://launchpad.net/~maria-docs)
|
||||
- ircs://chat.freenode.net/maria ([see the IRC page on the Knowledge Base](https://mariadb.com/kb/en/meta/irc-chat-servers-and-zulip-instance/) for help with IRC).
|
||||
- The MariaDB Foundation and MariaDB Corporation have a presence on Reddit, Twitter, Facebook and Google Plus. See the [social media page](https://mariadb.com/kb/en/mariadb/social-media/).
|
||||
|
||||
### Help document MariaDB
|
||||
----
|
||||
- Contribute towards [documenting MariaDB Server](https://mariadb.com/kb/en/meta/writing-editing-library-articles/) and its ecosystem by adding new content or improving existing content.
|
||||
- [Translate](https://mariadb.com/kb/en/meta/translating-library-articles/) existing documentation.
|
||||
|
||||
### Help debug and develop MariaDB
|
||||
-----
|
||||
- [Report bugs](https://jira.mariadb.org/)
|
||||
- Test development versions
|
||||
- Write code to fix bugs or develop new features (see [Getting Started for Developers](https://mariadb.org/getting-started-for-developers)).See also [list of beginner friendly tasks](https://jira.mariadb.org/browse/MDEV-15736?jql=resolution%20%3D%20Unresolved%20AND%20labels%20%3D%20beginner-friendly%20ORDER%20BY%20updated%20DESC)
|
||||
- Help with code quality control
|
||||
- Participate in packaging for different Linux distributions
|
||||
|
||||
### Sponsor or donate
|
||||
---
|
||||
You’re very welcome to support MariaDB Server as an individual, or talk your company into joining the Foundation as a sponsoring member. See the [Sponsor page](https://mariadb.org/donate/).
|
||||
|
||||
### Events, meetups and conferences
|
||||
---
|
||||
- Attend an event
|
||||
- [Events and Conferences page](https://mariadb.org/events/)
|
||||
- [mariadb.meetup.com](http://mariadb.meetup.com/)
|
||||
|
||||
### Live QA for beginner contributors
|
||||
----
|
||||
MariaDB has a dedicated time each week when we answer new contributor questions live on Zulip and IRC.
|
||||
From 8:00 to 10:00 UTC on Mondays, and 10:00 to 12:00 UTC on Thursdays, anyone can ask any questions they’d like,
|
||||
and a live developer will be available to assist.
|
||||
New contributors can ask questions any time, but we will provide immediate feedback during that interval.
|
||||
|
||||
### Additional resources
|
||||
----
|
||||
- [MariaDB Foundation ](https://mariadb.org/)
|
||||
- [Knowledge Base](https://mariadb.com/kb/en/)
|
@@ -1,7 +1,9 @@
|
||||
MariaDB and MySQL have identical install methods. In this document we
|
||||
describe how to install MariaDB; However all documentation at www.mysql.com
|
||||
also applies.
|
||||
describe how to install MariaDB.
|
||||
|
||||
The full documentation for installing MariaDB can be found at
|
||||
https://mariadb.com/kb/en/library/binary-packages/
|
||||
However most documentation at www.mysql.com also applies.
|
||||
|
||||
2.2. Installing MariaDB from Generic Binaries on Unix/Linux
|
||||
|
||||
@@ -33,7 +35,8 @@ also applies.
|
||||
If you run into problems and need to file a bug report,
|
||||
please report them to: http://mariadb.org/jira
|
||||
|
||||
See the instructions in Section 1.6, "How to Report Bugs or Problems."
|
||||
See the instructions at
|
||||
https://mariadb.com/kb/en/mariadb-community-bug-reporting
|
||||
|
||||
The basic commands that you must execute to install and use a
|
||||
MariaDB binary distribution are:
|
||||
@@ -79,10 +82,9 @@ shell> useradd -g mysql mysql
|
||||
is protected, you must perform the installation as root.)
|
||||
shell> cd /usr/local
|
||||
|
||||
3. Obtain a distribution file using the instructions in Section
|
||||
2.1.3, "How to Get MariaDB." For a given release, binary
|
||||
distributions for all platforms are built from the same MariaDB
|
||||
source distribution.
|
||||
3. Obtain a distribution file using the instructions at
|
||||
https://mariadb.com/kb/en/library/where-to-download-mariadb/
|
||||
The description below describes how to install a MariaDB tar file.
|
||||
|
||||
4. Unpack the distribution, which creates the installation
|
||||
directory. Then create a symbolic link to that directory:
|
||||
@@ -149,8 +151,8 @@ shell> chown -R mysql data
|
||||
machine, you can copy support-files/mysql.server to the
|
||||
location where your system has its startup files. More
|
||||
information can be found in the support-files/mysql.server
|
||||
script itself and in Section 2.13.1.2, "Starting and Stopping
|
||||
MariaDB Automatically."
|
||||
script itself and at
|
||||
https://mariadb.com/kb/en/starting-and-stopping-mariadb-automatically.
|
||||
10. You can set up new accounts using the bin/mysql_setpermission
|
||||
script if you install the DBI and DBD::mysql Perl modules. See
|
||||
Section 4.6.14, "mysql_setpermission --- Interactively Set
|
||||
@@ -181,8 +183,8 @@ shell> bin/mysqld_safe --user=mysql &
|
||||
find some information in the host_name.err file in the data
|
||||
directory.
|
||||
|
||||
More information about mysqld_safe is given in Section 4.3.2,
|
||||
"mysqld_safe --- MySQL Server Startup Script."
|
||||
More information about mysqld_safe can be found at
|
||||
https://mariadb.com/kb/en/mysqld_safe
|
||||
|
||||
Note
|
||||
|
||||
|
@@ -60,7 +60,7 @@ CONTENTS:
|
||||
Wsrep API developed by Codership Oy is a modern generic (database-agnostic)
|
||||
replication API for transactional databases with a goal to make database
|
||||
replication/logging subsystem completely modular and pluggable. It is developed
|
||||
with flexibility and completeness in mind to satisfy broad range of modern
|
||||
with flexibility and completeness in mind to satisfy a broad range of modern
|
||||
replication scenarios. It is equally suitable for synchronous and asynchronous,
|
||||
master-slave and multi-master replication.
|
||||
|
||||
@@ -87,7 +87,7 @@ Upgrade from mysql-server-5.0 to mysql-wsrep is not supported yet, please
|
||||
upgrade to mysql-server-5.1 first.
|
||||
|
||||
If you're installing over an existing mysql installation, mysql-server-wsrep
|
||||
will conflict with mysql-server-5.1 package, so remove it first:
|
||||
will conflict with the mysql-server-5.1 package, so remove it first:
|
||||
|
||||
$ sudo apt-get remove mysql-server-5.1 mysql-server-core-5.1
|
||||
|
||||
@@ -105,7 +105,7 @@ For example, installation of required packages on Debian Lenny:
|
||||
$ sudo apt-get install psmisc
|
||||
$ sudo apt-get -t lenny-backports install mysql-client-5.1
|
||||
|
||||
Now you should be able to install mysql-wsrep package:
|
||||
Now you should be able to install the mysql-wsrep package:
|
||||
|
||||
$ sudo dpkg -i <mysql-server-wsrep DEB>
|
||||
|
||||
@@ -137,7 +137,7 @@ Additional packages to consider (if not yet installed):
|
||||
* galera (multi-master replication provider, https://launchpad.net/galera)
|
||||
* MySQL-client-community (for connecting to server and mysqldump-based SST)
|
||||
* rsync (for rsync-based SST)
|
||||
* xtrabackup and nc (for xtrabackup-based SST)
|
||||
* mariabackup and nc (for mariabackup-based SST)
|
||||
|
||||
2.2 Upgrade system tables.
|
||||
|
||||
@@ -150,7 +150,7 @@ and can be ignored unless specific functionality is needed.
|
||||
3. FIRST TIME SETUP
|
||||
|
||||
Unless you're upgrading an already installed mysql-wsrep package, you will need
|
||||
to set up a few things to prepare server for operation.
|
||||
to set up a few things to prepare the server for operation.
|
||||
|
||||
3.1 CONFIGURATION FILES
|
||||
|
||||
@@ -162,7 +162,7 @@ to set up a few things to prepare server for operation.
|
||||
* Make sure system-wide my.cnf contains "!includedir /etc/mysql/conf.d/" line.
|
||||
|
||||
* Edit /etc/mysql/conf.d/wsrep.cnf and set wsrep_provider option by specifying
|
||||
a path to provider library. If you don't have a provider, leave it as it is.
|
||||
a path to the provider library. If you don't have a provider, leave it as it is.
|
||||
|
||||
* When a new node joins the cluster it'll have to receive a state snapshot from
|
||||
one of the peers. This requires a privileged MySQL account with access from
|
||||
@@ -267,7 +267,7 @@ innodb_autoinc_lock_mode=2
|
||||
This is a required parameter. Without it INSERTs into tables with
|
||||
AUTO_INCREMENT column may fail.
|
||||
autoinc lock modes 0 and 1 can cause unresolved deadlock, and make
|
||||
system unresponsive.
|
||||
the system unresponsive.
|
||||
|
||||
innodb_locks_unsafe_for_binlog=1
|
||||
This option is required for parallel applying.
|
||||
@@ -299,14 +299,14 @@ wsrep_node_address=
|
||||
results (multiple network interfaces, NAT, etc.)
|
||||
If not explicitly overridden by wsrep_sst_receive_address, the <address> part
|
||||
will be used to listen for SST (see below). And the whole <address>[:port]
|
||||
will be passed to wsrep provider to be used as a base address in its
|
||||
will be passed to the wsrep provider to be used as a base address in its
|
||||
communications.
|
||||
|
||||
wsrep_node_name=
|
||||
Human readable node name (for easier log reading only). Defaults to hostname.
|
||||
|
||||
wsrep_slave_threads=1
|
||||
Number of threads dedicated to processing of writesets from other nodes.
|
||||
The number of threads dedicated to the processing of writesets from other nodes.
|
||||
For best performance should be few per CPU core.
|
||||
|
||||
wsrep_dbug_option
|
||||
@@ -326,7 +326,7 @@ wsrep_convert_LOCK_to_trx=0
|
||||
wsrep_retry_autocommit=1
|
||||
Retry autocommit queries and single statement transactions should they fail
|
||||
certification test. This is analogous to rescheduling an autocommit query
|
||||
should it go into deadlock with other transactions in the database lock
|
||||
should it go into a deadlock with other transactions in the database lock
|
||||
manager.
|
||||
|
||||
wsrep_auto_increment_control=1
|
||||
@@ -357,7 +357,7 @@ wsrep_OSU_method=TOI
|
||||
is not replicating and may be unable to process replication events (due to
|
||||
table lock). Once DDL operation is complete, the node will catch up and sync
|
||||
with the cluster to become fully operational again. The DDL statement or
|
||||
its effects are not replicated, so it is user's responsibility to manually
|
||||
its effects are not replicated, so it is the user's responsibility to manually
|
||||
perform this operation on each of the nodes.
|
||||
|
||||
wsrep_forced_binlog_format=none
|
||||
@@ -380,14 +380,14 @@ to join or start a cluster.
|
||||
wsrep_sst_method=rsync
|
||||
What method to use to copy database state to a newly joined node. Supported
|
||||
methods:
|
||||
- mysqldump: slow (except for small datasets) but allows for upgrade
|
||||
between major MySQL versions or InnoDB features.
|
||||
- rsync: much faster on large datasets (default).
|
||||
- rsync_wan: same as rsync but with deltaxfer to minimize network traffic.
|
||||
- xtrabackup: very fast and practically non-blocking SST method based on
|
||||
Percona's xtrabackup tool.
|
||||
- mysqldump: slow (except for small datasets) but allows for upgrade
|
||||
between major MySQL versions or InnoDB features.
|
||||
- rsync: much faster on large datasets (default).
|
||||
- rsync_wan: same as rsync but with deltaxfer to minimize network traffic.
|
||||
- mariabackup: very fast and practically non-blocking SST method based on
|
||||
mariabackup tool (enhanced version of Percona's xtrabackup).
|
||||
|
||||
(for xtrabackup to work the following settings must be present in my.cnf
|
||||
(for mariabackup to work the following settings must be present in my.cnf
|
||||
on all nodes:
|
||||
[mysqld]
|
||||
wsrep_sst_auth=root:<root password>
|
||||
@@ -412,8 +412,8 @@ wsrep_sst_auth=
|
||||
|
||||
wsrep_sst_donor=
|
||||
A name of the node which should serve as state snapshot donor. This allows
|
||||
to control which node will serve state snapshot request. By default the
|
||||
most suitable node is chosen by wsrep provider. This is the same as given in
|
||||
controlling which node will serve the state snapshot request. By default the
|
||||
most suitable node is chosen by the wsrep provider. This is the same as given in
|
||||
wsrep_node_name.
|
||||
|
||||
|
||||
@@ -423,7 +423,7 @@ wsrep_sst_donor=
|
||||
for the database. They change the database structure and are non-
|
||||
transactional.
|
||||
|
||||
Release 22.3 brings a new method for performing schema upgrades. User can
|
||||
Release 22.3 brings a new method for performing schema upgrades. A user can
|
||||
now choose whether to use the traditional total order isolation or new
|
||||
rolling schema upgrade method. The OSU method choice is done by global
|
||||
parameter: 'wsrep_OSU_method'.
|
||||
@@ -439,7 +439,7 @@ wsrep_sst_donor=
|
||||
|
||||
6.2 Rolling Schema Upgrade (RSU)
|
||||
|
||||
Rolling schema upgrade is new DDL processing method, where DDL will be
|
||||
Rolling schema upgrade is a new DDL processing method, where DDL will be
|
||||
processed locally for the node. The node is disconnected of the replication
|
||||
for the duration of the DDL processing, so that there is only DDL statement
|
||||
processing in the node and it does not block the rest of the cluster. When
|
||||
@@ -468,7 +468,7 @@ wsrep_sst_donor=
|
||||
* LOCK/UNLOCK TABLES cannot be supported in multi-master setups.
|
||||
* lock functions (GET_LOCK(), RELEASE_LOCK()... )
|
||||
|
||||
4) Query log cannot be directed to table. If you enable query logging,
|
||||
4) Query log cannot be directed to a table. If you enable query logging,
|
||||
you must forward the log to a file:
|
||||
log_output = FILE
|
||||
Use general_log and general_log_file to choose query logging and the
|
||||
@@ -480,7 +480,7 @@ wsrep_sst_donor=
|
||||
6) Due to cluster level optimistic concurrency control, transaction issuing
|
||||
COMMIT may still be aborted at that stage. There can be two transactions.
|
||||
writing to same rows and committing in separate cluster nodes, and only one
|
||||
of the them can successfully commit. The failing one will be aborted.
|
||||
of them can successfully commit. The failing one will be aborted.
|
||||
For cluster level aborts, MySQL/galera cluster gives back deadlock error.
|
||||
code (Error: 1213 SQLSTATE: 40001 (ER_LOCK_DEADLOCK)).
|
||||
|
||||
|
@@ -1,137 +0,0 @@
|
||||
diff -r -c --exclude='*.info*' glibc-2.2.5.org/linuxthreads/internals.h glibc-2.2.5/linuxthreads/internals.h
|
||||
*** glibc-2.2.5.org/linuxthreads/internals.h Thu Nov 29 08:44:16 2001
|
||||
--- glibc-2.2.5/linuxthreads/internals.h Tue May 21 10:51:53 2002
|
||||
***************
|
||||
*** 343,349 ****
|
||||
THREAD_SELF implementation is used, this must be a power of two and
|
||||
a multiple of PAGE_SIZE. */
|
||||
#ifndef STACK_SIZE
|
||||
! #define STACK_SIZE (2 * 1024 * 1024)
|
||||
#endif
|
||||
|
||||
/* The initial size of the thread stack. Must be a multiple of PAGE_SIZE. */
|
||||
--- 343,349 ----
|
||||
THREAD_SELF implementation is used, this must be a power of two and
|
||||
a multiple of PAGE_SIZE. */
|
||||
#ifndef STACK_SIZE
|
||||
! #define STACK_SIZE (128 * 1024)
|
||||
#endif
|
||||
|
||||
/* The initial size of the thread stack. Must be a multiple of PAGE_SIZE. */
|
||||
diff -r -c --exclude='*.info*' glibc-2.2.5.org/linuxthreads/sysdeps/unix/sysv/linux/bits/local_lim.h glibc-2.2.5/linuxthreads/sysdeps/unix/sysv/linux/bits/local_lim.h
|
||||
*** glibc-2.2.5.org/linuxthreads/sysdeps/unix/sysv/linux/bits/local_lim.h Thu Jun 8 21:49:49 2000
|
||||
--- glibc-2.2.5/linuxthreads/sysdeps/unix/sysv/linux/bits/local_lim.h Tue May 21 10:52:58 2002
|
||||
***************
|
||||
*** 64,70 ****
|
||||
/* The number of threads per process. */
|
||||
#define _POSIX_THREAD_THREADS_MAX 64
|
||||
/* This is the value this implementation supports. */
|
||||
! #define PTHREAD_THREADS_MAX 1024
|
||||
|
||||
/* Maximum amount by which a process can descrease its asynchronous I/O
|
||||
priority level. */
|
||||
--- 64,70 ----
|
||||
/* The number of threads per process. */
|
||||
#define _POSIX_THREAD_THREADS_MAX 64
|
||||
/* This is the value this implementation supports. */
|
||||
! #define PTHREAD_THREADS_MAX 4096
|
||||
|
||||
/* Maximum amount by which a process can descrease its asynchronous I/O
|
||||
priority level. */
|
||||
diff -r -c --exclude='*.info*' glibc-2.2.5.org/nss/nsswitch.c glibc-2.2.5/nss/nsswitch.c
|
||||
*** glibc-2.2.5.org/nss/nsswitch.c Tue Jul 17 10:21:36 2001
|
||||
--- glibc-2.2.5/nss/nsswitch.c Tue May 21 10:59:55 2002
|
||||
***************
|
||||
*** 496,501 ****
|
||||
--- 496,502 ----
|
||||
{
|
||||
service_user *new_service;
|
||||
const char *name;
|
||||
+ int name_alloc_len;
|
||||
|
||||
while (isspace (line[0]))
|
||||
++line;
|
||||
***************
|
||||
*** 510,522 ****
|
||||
if (name == line)
|
||||
return result;
|
||||
|
||||
|
||||
new_service = (service_user *) malloc (sizeof (service_user)
|
||||
! + (line - name + 1));
|
||||
if (new_service == NULL)
|
||||
return result;
|
||||
|
||||
! *((char *) __mempcpy (new_service->name, name, line - name)) = '\0';
|
||||
|
||||
/* Set default actions. */
|
||||
new_service->actions[2 + NSS_STATUS_TRYAGAIN] = NSS_ACTION_CONTINUE;
|
||||
--- 511,534 ----
|
||||
if (name == line)
|
||||
return result;
|
||||
|
||||
+ name_alloc_len = line - name + 1;
|
||||
+
|
||||
+ #ifdef DO_STATIC_NSS
|
||||
+ if (!((name_alloc_len == 6 && strncmp(name,"files",5) == 0) ||
|
||||
+ (name_alloc_len == 4 && strncmp(name,"dns",3) == 0)))
|
||||
+ {
|
||||
+ name = (char*) "files";
|
||||
+ name_alloc_len = 6;
|
||||
+ }
|
||||
+ #endif
|
||||
|
||||
new_service = (service_user *) malloc (sizeof (service_user)
|
||||
! + name_alloc_len);
|
||||
if (new_service == NULL)
|
||||
return result;
|
||||
|
||||
! *((char *) __mempcpy (new_service->name, name, name_alloc_len-1)) = '\0';
|
||||
!
|
||||
|
||||
/* Set default actions. */
|
||||
new_service->actions[2 + NSS_STATUS_TRYAGAIN] = NSS_ACTION_CONTINUE;
|
||||
diff -r -c --exclude='*.info*' glibc-2.2.5.org/time/Makefile glibc-2.2.5/time/Makefile
|
||||
*** glibc-2.2.5.org/time/Makefile Fri Aug 10 01:59:41 2001
|
||||
--- glibc-2.2.5/time/Makefile Tue May 21 11:01:11 2002
|
||||
***************
|
||||
*** 37,44 ****
|
||||
|
||||
include ../Rules
|
||||
|
||||
! tz-cflags = -DTZDIR='"$(zonedir)"' \
|
||||
! -DTZDEFAULT='"$(localtime-file)"' \
|
||||
-DTZDEFRULES='"$(posixrules-file)"'
|
||||
|
||||
CFLAGS-tzfile.c = $(tz-cflags)
|
||||
--- 37,44 ----
|
||||
|
||||
include ../Rules
|
||||
|
||||
! tz-cflags = -DTZDIR='"/usr/share/zoneinfo/"' \
|
||||
! -DTZDEFAULT='"/etc/localtime"' \
|
||||
-DTZDEFRULES='"$(posixrules-file)"'
|
||||
|
||||
CFLAGS-tzfile.c = $(tz-cflags)
|
||||
diff -r -c --exclude='*.info*' glibc-2.2.5.org/timezone/Makefile glibc-2.2.5/timezone/Makefile
|
||||
*** glibc-2.2.5.org/timezone/Makefile Thu Aug 30 00:45:25 2001
|
||||
--- glibc-2.2.5/timezone/Makefile Tue May 21 11:01:57 2002
|
||||
***************
|
||||
*** 159,166 ****
|
||||
|
||||
$(objpfx)zic: $(objpfx)scheck.o $(objpfx)ialloc.o
|
||||
|
||||
! tz-cflags = -DTZDIR='"$(zonedir)"' \
|
||||
! -DTZDEFAULT='"$(localtime-file)"' \
|
||||
-DTZDEFRULES='"$(posixrules-file)"' \
|
||||
-DTM_GMTOFF=tm_gmtoff -DTM_ZONE=tm_zone
|
||||
|
||||
--- 159,166 ----
|
||||
|
||||
$(objpfx)zic: $(objpfx)scheck.o $(objpfx)ialloc.o
|
||||
|
||||
! tz-cflags = -DTZDIR='"/usr/share/zoneinfo/"' \
|
||||
! -DTZDEFAULT='"/etc/localtime"' \
|
||||
-DTZDEFRULES='"$(posixrules-file)"' \
|
||||
-DTM_GMTOFF=tm_gmtoff -DTM_ZONE=tm_zone
|
||||
|
@@ -1,19 +0,0 @@
|
||||
[Note this information is obsolete]
|
||||
|
||||
Notes on compiling glibc for the standard MySQL binary:
|
||||
|
||||
- make sure you have gcc 2.95 and gmake 3.79 or newer
|
||||
- wget ftp://ftp.gnu.org/pub/gnu/glibc/glibc-2.2.5.tar.gz
|
||||
- wget ftp://ftp.gnu.org/pub/gnu/glibc/glibc-linuxthreads-2.2.5.tar.gz
|
||||
- tar zxvf glibc-2.2.5.tar.gz ; cd glibc-2.2.5 ;
|
||||
tar zxvf ../glibc-linuxthreads-2.2.5.tar.gz
|
||||
- patch -p1 < ~/bk/mysql/Docs/glibc-2.2.5.patch
|
||||
- ./configure --prefix=/usr/local/mysql-glibc --enable-static-nss \
|
||||
--disable-shared --enable-add-ons=linuxthreads --target=i386 \
|
||||
--host=i386-pc-linux-gnu
|
||||
- make
|
||||
- possible problems - if compiler is not properly installed, one can get
|
||||
"cpp: too many input" files error - easiest way to solve - SUSE RPM for gcc
|
||||
2.95
|
||||
- surun make install
|
||||
- To build the binaries, run Build-tools/Do-linux-build
|
1100
Docs/sp-imp-spec.txt
1100
Docs/sp-imp-spec.txt
File diff suppressed because it is too large
Load Diff
@@ -1,35 +1,15 @@
|
||||
This file should contain all known fatal bugs in Mariadb and the Aria
|
||||
storage engine for the last source or binary release. Minor bugs,
|
||||
extensions and feature requests, and bugs found since this release can
|
||||
be found in the MariaDB bugs database at: http://mariadb.org/jira and
|
||||
in the MySQL bugs databases at: http://bugs.mysql.com/ (category
|
||||
"Maria storage engine").
|
||||
This file should contain all known fatal bugs in MariaDB for the last
|
||||
source or binary release. Minor bugs, extensions and feature requests,
|
||||
and bugs found since this release can be found in the MariaDB bugs
|
||||
database at: https://jira.mariadb.org
|
||||
|
||||
There should not normally be any bugs which affect normal operations
|
||||
in any MariaDB release. Still, there are always exceptions and edge
|
||||
cases and that is what this file is for.
|
||||
|
||||
If you have found a bug that is not listed here, please add it to
|
||||
http://mariadb.org/jira so we can either fix it for next release or in
|
||||
the worst case add it here for others to know!
|
||||
If you have find bug please add it to https://jira.mariadb.org so
|
||||
that we are can try to fix it for the next release. You can also add
|
||||
feature request to the JIRA.
|
||||
|
||||
|
||||
IMPORTANT:
|
||||
|
||||
If you have been using the Maria (now Aria) storage engine with the
|
||||
MySQL-5.1-Maria-alpha build and are upgrading to a newer MariaDB you
|
||||
MUST run [m]aria_chk --recover on all your Aria tables. This is because
|
||||
we made an incompatible change with how the transaction id is stored
|
||||
and old transaction id's must be reset!
|
||||
|
||||
cd mysql-data-directory
|
||||
aria_chk --recover */*.MAI
|
||||
|
||||
Going forward, we will do our best to not introduce any incompatible
|
||||
changes in the data format for Aria tables. If this would be ever be
|
||||
needed, we will, if possible, support both the old and the new version
|
||||
to make upgrades as easy as possible.
|
||||
|
||||
Note that for the MariaDB 5.1 release the Aria storage engine is
|
||||
classified as 'beta'; It should work, but use it with caution. Please
|
||||
report all bugs to http://mariadb.org/jira so we can fix them!
|
||||
The latest documentation for the MariaDB server can be found at:
|
||||
https://mariadb.com/kb
|
||||
|
30
README.md
30
README.md
@@ -1,20 +1,21 @@
|
||||
Code status:
|
||||
------------
|
||||
|
||||
* [](https://travis-ci.org/MariaDB/server) travis-ci.org (10.4 branch)
|
||||
* [](https://travis-ci.org/MariaDB/server) travis-ci.org (10.4 branch)
|
||||
* [](https://ci.appveyor.com/project/rasmushoj/server) ci.appveyor.com
|
||||
|
||||
## MariaDB: drop-in replacement for MySQL
|
||||
|
||||
MariaDB is designed as a drop-in replacement of MySQL(R) with more
|
||||
features, new storage engines, fewer bugs, and better performance.
|
||||
|
||||
MariaDB is brought to you by the MariaDB Foundation.
|
||||
MariaDB is brought to you by the MariaDB Foundation and the MariaDB corporation.
|
||||
Please read the CREDITS file for details about the MariaDB Foundation,
|
||||
and who is developing MariaDB.
|
||||
|
||||
MariaDB is developed by many of the original developers of MySQL who
|
||||
now work for the MariaDB Foundation and the MariaDB Corporation,
|
||||
and by many people in the community.
|
||||
now work for the MariaDB Corporation, the MariaDB Foundation and by
|
||||
many people in the community.
|
||||
|
||||
MySQL, which is the base of MariaDB, is a product and trademark of Oracle
|
||||
Corporation, Inc. For a list of developers and other contributors,
|
||||
@@ -23,28 +24,35 @@ list of active contributors.
|
||||
|
||||
A description of the MariaDB project and a manual can be found at:
|
||||
|
||||
https://mariadb.org/
|
||||
|
||||
https://mariadb.com/kb/en/
|
||||
|
||||
https://mariadb.com/kb/en/mariadb-vs-mysql-features/
|
||||
|
||||
https://mariadb.com/kb/en/mariadb-versus-mysql-features/
|
||||
|
||||
https://mariadb.com/kb/en/mariadb-versus-mysql-compatibility/
|
||||
|
||||
https://mariadb.com/kb/en/library/new-and-old-releases/
|
||||
|
||||
https://mariadb.org/
|
||||
|
||||
As MariaDB is a full replacement of MySQL, the MySQL manual at
|
||||
http://dev.mysql.com/doc is generally applicable.
|
||||
|
||||
Help:
|
||||
Help
|
||||
-----
|
||||
|
||||
More help is available from the Maria Discuss mailing list
|
||||
https://launchpad.net/~maria-discuss
|
||||
and the #maria IRC channel on Freenode.
|
||||
|
||||
Live QA for beginner contributors
|
||||
----
|
||||
MariaDB has a dedicated time each week when we answer new contributor questions live on Zulip and IRC.
|
||||
From 8:00 to 10:00 UTC on Mondays, and 10:00 to 12:00 UTC on Thursdays,
|
||||
anyone can ask any questions they’d like, and a live developer will be available to assist.
|
||||
|
||||
License:
|
||||
New contributors can ask questions any time, but we will provide immediate feedback during that interval.
|
||||
|
||||
License
|
||||
--------
|
||||
|
||||
***************************************************************************
|
||||
@@ -61,7 +69,7 @@ and COPYING.thirdparty files.
|
||||
|
||||
***************************************************************************
|
||||
|
||||
Bug Reports:
|
||||
Bug Reports
|
||||
------------
|
||||
|
||||
Bug and/or error reports regarding MariaDB should be submitted at:
|
||||
|
4
VERSION
4
VERSION
@@ -1,4 +1,4 @@
|
||||
MYSQL_VERSION_MAJOR=10
|
||||
MYSQL_VERSION_MINOR=4
|
||||
MYSQL_VERSION_PATCH=1
|
||||
SERVER_MATURITY=alpha
|
||||
MYSQL_VERSION_PATCH=3
|
||||
SERVER_MATURITY=beta
|
||||
|
@@ -3,7 +3,7 @@ version: build-{build}~branch-{branch}
|
||||
before_build:
|
||||
- md %APPVEYOR_BUILD_FOLDER%\win_build
|
||||
- cd %APPVEYOR_BUILD_FOLDER%\win_build
|
||||
- cmake .. -G "Visual Studio 15 2017 Win64" -DWITH_UNIT_TESTS=0
|
||||
- cmake .. -G "Visual Studio 15 2017 Win64" -DWITH_UNIT_TESTS=0 -DWITH_MARIABACKUP=0 -DMYSQL_MAINTAINER_MODE=ERR -DPLUGIN_ROCKSDB=NO -DPLUGIN_CONNECT=NO -DBISON_EXECUTABLE=C:\cygwin64\bin\bison
|
||||
|
||||
build:
|
||||
project: win_build\MySQL.sln
|
||||
@@ -16,6 +16,6 @@ platform: x64
|
||||
test_script:
|
||||
- set PATH=%PATH%;C:\Program Files (x86)\Windows Kits\10\Debuggers\x64
|
||||
- cd %APPVEYOR_BUILD_FOLDER%\win_build\mysql-test
|
||||
- perl mysql-test-run.pl --force --max-test-fail=10 --parallel=auto --testcase-timeout=10 --skip-test-list=unstable-tests --suite=main,innodb,plugins,mariabackup
|
||||
- perl mysql-test-run.pl --force --max-test-fail=10 --parallel=4 --testcase-timeout=10 --skip-test-list=unstable-tests --suite=main
|
||||
|
||||
image: Visual Studio 2017
|
||||
|
@@ -46,7 +46,7 @@ ENDIF(UNIX)
|
||||
|
||||
MYSQL_ADD_EXECUTABLE(mysqltest mysqltest.cc COMPONENT Test)
|
||||
SET_SOURCE_FILES_PROPERTIES(mysqltest.cc PROPERTIES COMPILE_FLAGS "-DTHREADS")
|
||||
TARGET_LINK_LIBRARIES(mysqltest ${CLIENT_LIB} pcre pcreposix)
|
||||
TARGET_LINK_LIBRARIES(mysqltest ${CLIENT_LIB} pcreposix pcre)
|
||||
SET_TARGET_PROPERTIES(mysqltest PROPERTIES ENABLE_EXPORTS TRUE)
|
||||
|
||||
|
||||
|
@@ -278,9 +278,9 @@ static COMMANDS commands[] = {
|
||||
{ "edit", 'e', com_edit, 0, "Edit command with $EDITOR."},
|
||||
#endif
|
||||
{ "ego", 'G', com_ego, 0,
|
||||
"Send command to mysql server, display result vertically."},
|
||||
"Send command to MariaDB server, display result vertically."},
|
||||
{ "exit", 'q', com_quit, 0, "Exit mysql. Same as quit."},
|
||||
{ "go", 'g', com_go, 0, "Send command to mysql server." },
|
||||
{ "go", 'g', com_go, 0, "Send command to MariaDB server." },
|
||||
{ "help", 'h', com_help, 1, "Display this help." },
|
||||
#ifdef USE_POPEN
|
||||
{ "nopager",'n', com_nopager,0, "Disable pager, print to stdout." },
|
||||
@@ -1537,7 +1537,7 @@ static struct my_option my_long_options[] =
|
||||
&ignore_spaces, &ignore_spaces, 0, GET_BOOL, NO_ARG, 0, 0,
|
||||
0, 0, 0, 0},
|
||||
{"init-command", OPT_INIT_COMMAND,
|
||||
"SQL Command to execute when connecting to MySQL server. Will "
|
||||
"SQL Command to execute when connecting to MariaDB server. Will "
|
||||
"automatically be re-executed when reconnecting.",
|
||||
&opt_init_command, &opt_init_command, 0,
|
||||
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
@@ -1599,7 +1599,7 @@ static struct my_option my_long_options[] =
|
||||
"Get progress reports for long running commands (like ALTER TABLE)",
|
||||
&opt_progress_reports, &opt_progress_reports, 0, GET_BOOL, NO_ARG, 1, 0,
|
||||
0, 0, 0, 0},
|
||||
{"prompt", OPT_PROMPT, "Set the mysql prompt to this value.",
|
||||
{"prompt", OPT_PROMPT, "Set the command line prompt to this value.",
|
||||
¤t_prompt, ¤t_prompt, 0, GET_STR_ALLOC,
|
||||
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol to use for connection (tcp, socket, pipe).",
|
||||
@@ -3127,7 +3127,7 @@ com_help(String *buffer __attribute__((unused)),
|
||||
|
||||
put_info("\nGeneral information about MariaDB can be found at\n"
|
||||
"http://mariadb.org\n", INFO_INFO);
|
||||
put_info("List of all MySQL commands:", INFO_INFO);
|
||||
put_info("List of all client commands:", INFO_INFO);
|
||||
if (!named_cmds)
|
||||
put_info("Note that all text commands must be first on line and end with ';'",INFO_INFO);
|
||||
for (i = 0; commands[i].name; i++)
|
||||
|
@@ -111,7 +111,7 @@ static struct my_option my_long_options[]=
|
||||
&opt_default_auth, &opt_default_auth, 0,
|
||||
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"force", 'f', "Force execution of mysqlcheck even if mysql_upgrade "
|
||||
"has already been executed for the current version of MySQL.",
|
||||
"has already been executed for the current version of MariaDB.",
|
||||
&opt_force, &opt_force, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"host", 'h', "Connect to host.", 0,
|
||||
0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
@@ -808,7 +808,7 @@ static my_bool is_mysql()
|
||||
strstr(ds_events_struct.str, "IGNORE_BAD_TABLE_OPTIONS") != NULL)
|
||||
ret= FALSE;
|
||||
else
|
||||
verbose("MySQL upgrade detected");
|
||||
verbose("MariaDB upgrade detected");
|
||||
|
||||
dynstr_free(&ds_events_struct);
|
||||
return(ret);
|
||||
@@ -878,10 +878,14 @@ static int run_mysqlcheck_fixnames(void)
|
||||
|
||||
static const char *expected_errors[]=
|
||||
{
|
||||
"ERROR 1051", /* Unknown table */
|
||||
"ERROR 1060", /* Duplicate column name */
|
||||
"ERROR 1061", /* Duplicate key name */
|
||||
"ERROR 1054", /* Unknown column */
|
||||
"ERROR 1146", /* Table does not exist */
|
||||
"ERROR 1290", /* RR_OPTION_PREVENTS_STATEMENT */
|
||||
"ERROR 1347", /* 'mysql.user' is not of type 'BASE TABLE' */
|
||||
"ERROR 1348", /* Column 'Show_db_priv' is not updatable */
|
||||
0
|
||||
};
|
||||
|
||||
@@ -1192,7 +1196,7 @@ int main(int argc, char **argv)
|
||||
*/
|
||||
if (!opt_force && upgrade_already_done(0))
|
||||
{
|
||||
printf("This installation of MySQL is already upgraded to %s, "
|
||||
printf("This installation of MariaDB is already upgraded to %s, "
|
||||
"use --force if you still need to run mysql_upgrade\n",
|
||||
MYSQL_SERVER_VERSION);
|
||||
goto end;
|
||||
|
@@ -573,7 +573,7 @@ static my_bool sql_connect(MYSQL *mysql, uint wait)
|
||||
if (!info)
|
||||
{
|
||||
info=1;
|
||||
fputs("Waiting for MySQL server to answer",stderr);
|
||||
fputs("Waiting for MariaDB server to answer",stderr);
|
||||
(void) fflush(stderr);
|
||||
}
|
||||
else
|
||||
|
@@ -1598,7 +1598,7 @@ static struct my_option my_options[] =
|
||||
&opt_default_auth, &opt_default_auth, 0,
|
||||
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"disable-log-bin", 'D', "Disable binary log. This is useful, if you "
|
||||
"enabled --to-last-log and are sending the output to the same MySQL server. "
|
||||
"enabled --to-last-log and are sending the output to the same MariaDB server. "
|
||||
"This way you could avoid an endless loop. You would also like to use it "
|
||||
"when restoring after a crash to avoid duplication of the statements you "
|
||||
"already have. NOTE: you will need a SUPER privilege to use this option.",
|
||||
@@ -1643,7 +1643,7 @@ static struct my_option my_options[] =
|
||||
{"protocol", OPT_MYSQL_PROTOCOL,
|
||||
"The protocol to use for connection (tcp, socket, pipe).",
|
||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"read-from-remote-server", 'R', "Read binary logs from a MySQL server.",
|
||||
{"read-from-remote-server", 'R', "Read binary logs from a MariaDB server.",
|
||||
&remote_opt, &remote_opt, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
|
||||
0, 0},
|
||||
{"raw", 0, "Requires -R. Output raw binlog data instead of SQL "
|
||||
@@ -1696,7 +1696,7 @@ static struct my_option my_options[] =
|
||||
{"start-datetime", OPT_START_DATETIME,
|
||||
"Start reading the binlog at first event having a datetime equal or "
|
||||
"posterior to the argument; the argument must be a date and time "
|
||||
"in the local time zone, in any format accepted by the MySQL server "
|
||||
"in the local time zone, in any format accepted by the MariaDB server "
|
||||
"for DATETIME and TIMESTAMP types, for example: 2004-12-25 11:25:56 "
|
||||
"(you should probably use quotes for your shell to set it properly).",
|
||||
&start_datetime_str, &start_datetime_str,
|
||||
@@ -1714,7 +1714,7 @@ static struct my_option my_options[] =
|
||||
{"stop-datetime", OPT_STOP_DATETIME,
|
||||
"Stop reading the binlog at first event having a datetime equal or "
|
||||
"posterior to the argument; the argument must be a date and time "
|
||||
"in the local time zone, in any format accepted by the MySQL server "
|
||||
"in the local time zone, in any format accepted by the MariaDB server "
|
||||
"for DATETIME and TIMESTAMP types, for example: 2004-12-25 11:25:56 "
|
||||
"(you should probably use quotes for your shell to set it properly).",
|
||||
&stop_datetime_str, &stop_datetime_str,
|
||||
@@ -1738,7 +1738,7 @@ static struct my_option my_options[] =
|
||||
0, 0, 0, 0, 0, 0},
|
||||
{"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 \
|
||||
binlog of the MySQL server. If you send the output to the same MySQL server, \
|
||||
binlog of the MariaDB server. If you send the output to the same MariaDB server, \
|
||||
that may lead to an endless loop.",
|
||||
&to_last_remote_log, &to_last_remote_log, 0, GET_BOOL,
|
||||
NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
@@ -1875,7 +1875,7 @@ static void usage()
|
||||
print_version();
|
||||
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
|
||||
printf("\
|
||||
Dumps a MySQL binary log in a format usable for viewing or for piping to\n\
|
||||
Dumps a MariaDB binary log in a format usable for viewing or for piping to\n\
|
||||
the mysql command line client.\n\n");
|
||||
printf("Usage: %s [options] log-files\n", my_progname);
|
||||
print_defaults("my",load_groups);
|
||||
@@ -1893,7 +1893,7 @@ static my_time_t convert_str_to_timestamp(const char* str)
|
||||
uint dummy_in_dst_time_gap;
|
||||
|
||||
/* We require a total specification (date AND time) */
|
||||
if (str_to_datetime(str, (uint) strlen(str), &l_time, 0, &status) ||
|
||||
if (str_to_datetime_or_date(str, (uint) strlen(str), &l_time, 0, &status) ||
|
||||
l_time.time_type != MYSQL_TIMESTAMP_DATETIME || status.warnings)
|
||||
{
|
||||
error("Incorrect date and time argument: %s", str);
|
||||
@@ -2281,7 +2281,7 @@ static Exit_status check_master_version()
|
||||
break;
|
||||
default:
|
||||
error("Could not find server version: "
|
||||
"Master reported unrecognized MySQL version '%s'.", row[0]);
|
||||
"Master reported unrecognized MariaDB version '%s'.", row[0]);
|
||||
goto err;
|
||||
}
|
||||
if (!glob_description_event || !glob_description_event->is_valid())
|
||||
|
@@ -254,10 +254,10 @@ static struct my_option my_long_options[] =
|
||||
1, 0, 0, 0, 0, 0},
|
||||
{"compatible", OPT_COMPATIBLE,
|
||||
"Change the dump to be compatible with a given mode. By default tables "
|
||||
"are dumped in a format optimized for MySQL. Legal modes are: ansi, "
|
||||
"are dumped in a format optimized for MariaDB. Legal modes are: ansi, "
|
||||
"mysql323, mysql40, postgresql, oracle, mssql, db2, maxdb, no_key_options, "
|
||||
"no_table_options, no_field_options. One can use several modes separated "
|
||||
"by commas. Note: Requires MySQL server version 4.1.0 or higher. "
|
||||
"by commas. Note: Requires MariaDB server version 4.1.0 or higher. "
|
||||
"This option is ignored with earlier server versions.",
|
||||
&opt_compatible_mode_str, &opt_compatible_mode_str, 0,
|
||||
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
@@ -274,7 +274,7 @@ static struct my_option my_long_options[] =
|
||||
&opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
|
||||
0, 0, 0},
|
||||
{"create-options", 'a',
|
||||
"Include all MySQL specific create options.",
|
||||
"Include all MariaDB specific create options.",
|
||||
&create_options, &create_options, 0, GET_BOOL, NO_ARG, 1,
|
||||
0, 0, 0, 0, 0},
|
||||
{"databases", 'B',
|
||||
@@ -642,7 +642,7 @@ static void usage(void)
|
||||
{
|
||||
print_version();
|
||||
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
|
||||
puts("Dumping structure and contents of MySQL databases and tables.");
|
||||
puts("Dumping structure and contents of MariaDB databases and tables.");
|
||||
short_usage_sub(stdout);
|
||||
print_defaults("my",load_default_groups);
|
||||
puts("");
|
||||
@@ -700,7 +700,7 @@ static void write_header(FILE *sql_file, char *db_name)
|
||||
else if (!opt_compact)
|
||||
{
|
||||
print_comment(sql_file, 0,
|
||||
"-- MySQL dump %s Distrib %s, for %s (%s)\n--\n",
|
||||
"-- MariaDB dump %s Distrib %s, for %s (%s)\n--\n",
|
||||
DUMP_VERSION, MYSQL_SERVER_VERSION, SYSTEM_TYPE,
|
||||
MACHINE_TYPE);
|
||||
print_comment(sql_file, 0, "-- Host: %s ",
|
||||
@@ -5515,7 +5515,7 @@ static int start_transaction(MYSQL *mysql_con)
|
||||
if ((mysql_get_server_version(mysql_con) < 40100) && opt_master_data)
|
||||
{
|
||||
fprintf(stderr, "-- %s: the combination of --single-transaction and "
|
||||
"--master-data requires a MySQL server version of at least 4.1 "
|
||||
"--master-data requires a MariaDB server version of at least 4.1 "
|
||||
"(current server's version is %s). %s\n",
|
||||
ignore_errors ? "Warning" : "Error",
|
||||
mysql_con->server_version ? mysql_con->server_version : "unknown",
|
||||
|
@@ -195,13 +195,14 @@ static void usage(void)
|
||||
{
|
||||
puts("Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.");
|
||||
puts("Copyright 2008-2011 Oracle and Monty Program Ab.");
|
||||
puts("Copyright 2012-2019 MariaDB Corporation Ab.");
|
||||
print_version();
|
||||
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
|
||||
printf("\
|
||||
Loads tables from text files in various formats. The base name of the\n\
|
||||
text file must be the name of the table that should be used.\n\
|
||||
If one uses sockets to connect to the MySQL server, the server will open and\n\
|
||||
read the text file directly. In other cases the client will open the text\n\
|
||||
If one uses sockets to connect to the MariaDB server, the server will open\n\
|
||||
and read the text file directly. In other cases the client will open the text\n\
|
||||
file. The SQL command 'LOAD DATA INFILE' is used to import the rows.\n");
|
||||
|
||||
printf("\nUsage: %s [OPTIONS] database textfile...\n",my_progname);
|
||||
|
@@ -268,7 +268,7 @@ static void usage(void)
|
||||
{
|
||||
print_version();
|
||||
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
|
||||
puts("Shows the structure of a MySQL database (databases, tables, and columns).\n");
|
||||
puts("Shows the structure of a MariaDB database (databases, tables, and columns).\n");
|
||||
printf("Usage: %s [OPTIONS] [database [table [column]]]\n",my_progname);
|
||||
puts("\n\
|
||||
If last argument contains a shell or SQL wildcard (*,?,% or _) then only\n\
|
||||
@@ -658,7 +658,7 @@ list_table_status(MYSQL *mysql,const char *db,const char *wild)
|
||||
fprintf(stderr,"%s: Cannot get status for db: %s, table: %s: %s\n",
|
||||
my_progname,db,wild ? wild : "",mysql_error(mysql));
|
||||
if (mysql_errno(mysql) == ER_PARSE_ERROR)
|
||||
fprintf(stderr,"This error probably means that your MySQL server doesn't support the\n\'show table status' command.\n");
|
||||
fprintf(stderr,"This error probably means that your MariaDB server doesn't support the\n\'show table status' command.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@@ -623,7 +623,7 @@ static struct my_option my_long_options[] =
|
||||
{"host", 'h', "Connect to host.", &host, &host, 0, GET_STR,
|
||||
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"init-command", OPT_INIT_COMMAND,
|
||||
"SQL Command to execute when connecting to MySQL server. Will "
|
||||
"SQL Command to execute when connecting to MariaDB server. Will "
|
||||
"automatically be re-executed when reconnecting.",
|
||||
&opt_init_command, &opt_init_command, 0,
|
||||
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
|
@@ -6581,8 +6581,6 @@ static inline bool is_escape_char(char c, char in_string)
|
||||
|
||||
SYNOPSIS
|
||||
read_line
|
||||
buf buffer for the read line
|
||||
size size of the buffer i.e max size to read
|
||||
|
||||
DESCRIPTION
|
||||
This function actually reads several lines and adds them to the
|
||||
@@ -6600,10 +6598,15 @@ static inline bool is_escape_char(char c, char in_string)
|
||||
|
||||
*/
|
||||
|
||||
int read_line(char *buf, int size)
|
||||
static char *read_command_buf= NULL;
|
||||
static size_t read_command_buflen= 0;
|
||||
static const size_t max_multibyte_length= 6;
|
||||
|
||||
int read_line()
|
||||
{
|
||||
char c, last_quote=0, last_char= 0;
|
||||
char *p= buf, *buf_end= buf + size - 1;
|
||||
char *p= read_command_buf;
|
||||
char *buf_end= read_command_buf + read_command_buflen - max_multibyte_length;
|
||||
int skip_char= 0;
|
||||
my_bool have_slash= FALSE;
|
||||
|
||||
@@ -6611,10 +6614,21 @@ int read_line(char *buf, int size)
|
||||
R_COMMENT, R_LINE_START} state= R_LINE_START;
|
||||
DBUG_ENTER("read_line");
|
||||
|
||||
*p= 0;
|
||||
start_lineno= cur_file->lineno;
|
||||
DBUG_PRINT("info", ("Starting to read at lineno: %d", start_lineno));
|
||||
for (; p < buf_end ;)
|
||||
while (1)
|
||||
{
|
||||
if (p >= buf_end)
|
||||
{
|
||||
my_ptrdiff_t off= p - read_command_buf;
|
||||
read_command_buf= (char*)my_realloc(read_command_buf,
|
||||
read_command_buflen*2, MYF(MY_FAE));
|
||||
p= read_command_buf + off;
|
||||
read_command_buflen*= 2;
|
||||
buf_end= read_command_buf + read_command_buflen - max_multibyte_length;
|
||||
}
|
||||
|
||||
skip_char= 0;
|
||||
c= my_getc(cur_file->file);
|
||||
if (feof(cur_file->file))
|
||||
@@ -6650,7 +6664,7 @@ int read_line(char *buf, int size)
|
||||
cur_file->lineno++;
|
||||
|
||||
/* Convert cr/lf to lf */
|
||||
if (p != buf && *(p-1) == '\r')
|
||||
if (p != read_command_buf && *(p-1) == '\r')
|
||||
p--;
|
||||
}
|
||||
|
||||
@@ -6665,9 +6679,9 @@ int read_line(char *buf, int size)
|
||||
}
|
||||
else if ((c == '{' &&
|
||||
(!my_strnncoll_simple(charset_info, (const uchar*) "while", 5,
|
||||
(uchar*) buf, MY_MIN(5, p - buf), 0) ||
|
||||
(uchar*) read_command_buf, MY_MIN(5, p - read_command_buf), 0) ||
|
||||
!my_strnncoll_simple(charset_info, (const uchar*) "if", 2,
|
||||
(uchar*) buf, MY_MIN(2, p - buf), 0))))
|
||||
(uchar*) read_command_buf, MY_MIN(2, p - read_command_buf), 0))))
|
||||
{
|
||||
/* Only if and while commands can be terminated by { */
|
||||
*p++= c;
|
||||
@@ -6799,8 +6813,6 @@ int read_line(char *buf, int size)
|
||||
}
|
||||
}
|
||||
}
|
||||
die("The input buffer is too small for this query.\n"
|
||||
"check your query or increase MAX_QUERY and recompile");
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
@@ -6945,12 +6957,8 @@ bool is_delimiter(const char* p)
|
||||
terminated by new line '\n' regardless how many "delimiter" it contain.
|
||||
*/
|
||||
|
||||
#define MAX_QUERY (256*1024*2) /* 256K -- a test in sp-big is >128K */
|
||||
static char read_command_buf[MAX_QUERY];
|
||||
|
||||
int read_command(struct st_command** command_ptr)
|
||||
{
|
||||
char *p= read_command_buf;
|
||||
struct st_command* command;
|
||||
DBUG_ENTER("read_command");
|
||||
|
||||
@@ -6967,8 +6975,7 @@ int read_command(struct st_command** command_ptr)
|
||||
die("Out of memory");
|
||||
command->type= Q_UNKNOWN;
|
||||
|
||||
read_command_buf[0]= 0;
|
||||
if (read_line(read_command_buf, sizeof(read_command_buf)))
|
||||
if (read_line())
|
||||
{
|
||||
check_eol_junk(read_command_buf);
|
||||
DBUG_RETURN(1);
|
||||
@@ -6977,6 +6984,7 @@ int read_command(struct st_command** command_ptr)
|
||||
if (opt_result_format_version == 1)
|
||||
convert_to_format_v1(read_command_buf);
|
||||
|
||||
char *p= read_command_buf;
|
||||
DBUG_PRINT("info", ("query: '%s'", read_command_buf));
|
||||
if (*p == '#')
|
||||
{
|
||||
@@ -7170,7 +7178,7 @@ void usage()
|
||||
{
|
||||
print_version();
|
||||
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
|
||||
printf("Runs a test against the mysql server and compares output with a results file.\n\n");
|
||||
printf("Runs a test against the MariaDB server and compares output with a results file.\n\n");
|
||||
printf("Usage: %s [OPTIONS] [database] < test_file\n", my_progname);
|
||||
print_defaults("my",load_default_groups);
|
||||
puts("");
|
||||
@@ -7928,7 +7936,7 @@ int append_warnings(DYNAMIC_STRING *ds, MYSQL* mysql)
|
||||
static void handle_no_active_connection(struct st_command *command,
|
||||
struct st_connection *cn, DYNAMIC_STRING *ds)
|
||||
{
|
||||
handle_error(command, 2006, "MySQL server has gone away", "000000", ds);
|
||||
handle_error(command, 2006, "MariaDB server has gone away", "000000", ds);
|
||||
cn->pending= FALSE;
|
||||
var_set_errno(2006);
|
||||
}
|
||||
@@ -9204,6 +9212,8 @@ int main(int argc, char **argv)
|
||||
init_win_path_patterns();
|
||||
#endif
|
||||
|
||||
read_command_buf= (char*)my_malloc(read_command_buflen= 65536, MYF(MY_FAE));
|
||||
|
||||
init_dynamic_string(&ds_res, "", 2048, 2048);
|
||||
init_alloc_root(&require_file_root, "require_file", 1024, 1024, MYF(0));
|
||||
|
||||
@@ -9245,7 +9255,7 @@ int main(int argc, char **argv)
|
||||
if (mysql_server_init(embedded_server_arg_count,
|
||||
embedded_server_args,
|
||||
(char**) embedded_server_groups))
|
||||
die("Can't initialize MySQL server");
|
||||
die("Can't initialize MariaDB server");
|
||||
server_initialized= 1;
|
||||
if (cur_file == file_stack && cur_file->file == 0)
|
||||
{
|
||||
@@ -9972,7 +9982,7 @@ void do_get_replace(struct st_command *command)
|
||||
char *buff, *start;
|
||||
char word_end_chars[256], *pos;
|
||||
POINTER_ARRAY to_array, from_array;
|
||||
DBUG_ENTER("get_replace");
|
||||
DBUG_ENTER("do_get_replace");
|
||||
|
||||
free_replace();
|
||||
|
||||
|
@@ -145,6 +145,11 @@ foreach my $option (@ARGV)
|
||||
$cmakeargs = $cmakeargs." -DPLUGIN_".uc($1)."=".uc($2);
|
||||
next;
|
||||
}
|
||||
if($option =~ /without-wsrep/)
|
||||
{
|
||||
$cmakeargs = $cmakeargs." -DWITH_WSREP=OFF";
|
||||
next;
|
||||
}
|
||||
if($option =~ /with-zlib-dir=bundled/)
|
||||
{
|
||||
$cmakeargs = $cmakeargs." -DWITH_ZLIB=bundled";
|
||||
@@ -185,6 +190,16 @@ foreach my $option (@ARGV)
|
||||
$cmakeargs = $cmakeargs." -DCMAKE_BUILD_TYPE=Debug -DSECURITY_HARDENED=OFF";
|
||||
next;
|
||||
}
|
||||
if($option =~ /with-(.*)=(.*)/)
|
||||
{
|
||||
$cmakeargs = $cmakeargs. " -DWITH_" . uc($1) . "=" . uc($2);
|
||||
next;
|
||||
}
|
||||
if($option =~ /without-(.*)=(.*)/)
|
||||
{
|
||||
$cmakeargs = $cmakeargs. " -DWITHOUT_" . uc($1) . "=" . uc($2);
|
||||
next;
|
||||
}
|
||||
if($option =~ /prefix=/)
|
||||
{
|
||||
$cmake_install_prefix= substr($option, 7);
|
||||
|
@@ -171,7 +171,7 @@ SETA(CPACK_RPM_server_PACKAGE_REQUIRES
|
||||
|
||||
IF(WITH_WSREP)
|
||||
SETA(CPACK_RPM_server_PACKAGE_REQUIRES
|
||||
"galera" "rsync" "lsof" "grep" "gawk" "iproute"
|
||||
"galera-4" "rsync" "lsof" "grep" "gawk" "iproute"
|
||||
"coreutils" "findutils" "tar")
|
||||
ENDIF()
|
||||
|
||||
@@ -214,6 +214,8 @@ ELSEIF(RPM MATCHES "fedora" OR RPM MATCHES "(rhel|centos)7")
|
||||
ALTERNATIVE_NAME("server" "mariadb-server")
|
||||
ALTERNATIVE_NAME("server" "mysql-compat-server")
|
||||
ALTERNATIVE_NAME("test" "mariadb-test")
|
||||
ELSEIF(RPM MATCHES "(rhel|centos)8")
|
||||
SET(PYTHON_SHEBANG "/usr/bin/python3")
|
||||
ENDIF()
|
||||
|
||||
# workaround for lots of perl dependencies added by rpmbuild
|
||||
|
@@ -50,6 +50,14 @@ IF(GIT_EXECUTABLE)
|
||||
IF(NOT RESULT EQUAL 0)
|
||||
SET(GIT_EXECUTABLE)
|
||||
ENDIF()
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND "${GIT_EXECUTABLE}" submodule foreach "${GIT_EXECUTABLE} checkout-index --all --prefix=${PACKAGE_DIR}/wsrep-lib/$path/"
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/wsrep-lib
|
||||
RESULT_VARIABLE RESULT
|
||||
)
|
||||
IF(NOT RESULT EQUAL 0)
|
||||
SET(GIT_EXECUTABLE)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/include/source_revision.h
|
||||
|
@@ -6,10 +6,7 @@ ENDIF()
|
||||
|
||||
SET(CONC_WITH_SIGNCODE ${SIGNCODE})
|
||||
SET(SIGN_OPTIONS ${SIGNTOOL_PARAMETERS})
|
||||
|
||||
IF(NOT TARGET zlib)
|
||||
SET(CONC_WITH_EXTERNAL_ZLIB ON)
|
||||
ENDIF()
|
||||
SET(CONC_WITH_EXTERNAL_ZLIB ON)
|
||||
|
||||
IF(SSL_DEFINES MATCHES "YASSL")
|
||||
IF(WIN32)
|
||||
|
@@ -153,6 +153,7 @@ SET(HAVE_SIGSET CACHE INTERNAL "")
|
||||
SET(HAVE_SIGTERM 1 CACHE INTERNAL "")
|
||||
SET(HAVE_SIGTHREADMASK CACHE INTERNAL "")
|
||||
SET(HAVE_SIGWAIT CACHE INTERNAL "")
|
||||
SET(HAVE_SIGWAITINFO CACHE INTERNAL "")
|
||||
SET(HAVE_SIZEOF_CHARP TRUE CACHE INTERNAL "")
|
||||
SET(SIZEOF_CHARP ${CMAKE_SIZEOF_VOID_P} CACHE INTERNAL "")
|
||||
SET(HAVE_SIZEOF_IN6_ADDR TRUE CACHE INTERNAL "")
|
||||
|
@@ -14,16 +14,16 @@ IF(GIT_EXECUTABLE AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
|
||||
SET(update_result 0)
|
||||
ELSEIF (cmake_update_submodules MATCHES force)
|
||||
MESSAGE(STATUS "Updating submodules (forced)")
|
||||
EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init --force
|
||||
EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init --force --recursive
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
RESULT_VARIABLE update_result)
|
||||
ELSEIF (cmake_update_submodules MATCHES yes)
|
||||
EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init
|
||||
EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init --recursive
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
RESULT_VARIABLE update_result)
|
||||
ELSE()
|
||||
MESSAGE(STATUS "Updating submodules")
|
||||
EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init
|
||||
EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init --recursive
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
RESULT_VARIABLE update_result)
|
||||
ENDIF()
|
||||
|
@@ -24,12 +24,15 @@ ELSE()
|
||||
ENDIF()
|
||||
|
||||
OPTION(WITH_WSREP "WSREP replication API (to use, e.g. Galera Replication library)" ${with_wsrep_default})
|
||||
OPTION(WITH_WSREP_ALL
|
||||
"Build all components of WSREP (unit tests, sample programs)"
|
||||
OFF)
|
||||
|
||||
# Set the patch version
|
||||
SET(WSREP_PATCH_VERSION "23")
|
||||
SET(WSREP_PATCH_VERSION "22")
|
||||
|
||||
# Obtain wsrep API version
|
||||
FILE(STRINGS "${MySQL_SOURCE_DIR}/wsrep/wsrep_api.h" WSREP_API_VERSION
|
||||
FILE(STRINGS "${CMAKE_SOURCE_DIR}/wsrep-lib/wsrep-API/v26/wsrep_api.h" WSREP_API_VERSION
|
||||
LIMIT_COUNT 1 REGEX "WSREP_INTERFACE_VERSION")
|
||||
STRING(REGEX MATCH "([0-9]+)" WSREP_API_VERSION "${WSREP_API_VERSION}")
|
||||
|
||||
@@ -40,4 +43,12 @@ SET(WSREP_PROC_INFO ${WITH_WSREP})
|
||||
|
||||
IF(WITH_WSREP)
|
||||
SET(WSREP_PATCH_VERSION "wsrep_${WSREP_VERSION}")
|
||||
if (NOT WITH_WSREP_ALL)
|
||||
SET(WSREP_LIB_WITH_UNIT_TESTS OFF CACHE BOOL
|
||||
"Disable unit tests for wsrep-lib")
|
||||
SET(WSREP_LIB_WITH_DBSIM OFF CACHE BOOL
|
||||
"Disable building dbsim for wsrep-lib")
|
||||
endif()
|
||||
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/wsrep-lib/include)
|
||||
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/wsrep-lib/wsrep-API/v26)
|
||||
ENDIF()
|
||||
|
@@ -34,11 +34,6 @@ ENDMACRO()
|
||||
|
||||
MACRO (MYSQL_CHECK_ZLIB_WITH_COMPRESS)
|
||||
|
||||
# For NDBCLUSTER: Use bundled zlib by default
|
||||
IF (NOT WITH_ZLIB)
|
||||
SET(WITH_ZLIB "bundled" CACHE STRING "By default use bundled zlib on this platform")
|
||||
ENDIF()
|
||||
|
||||
IF(WITH_ZLIB STREQUAL "bundled")
|
||||
MYSQL_USE_BUNDLED_ZLIB()
|
||||
ELSE()
|
||||
|
@@ -219,6 +219,7 @@
|
||||
#cmakedefine HAVE_SIGACTION 1
|
||||
#cmakedefine HAVE_SIGTHREADMASK 1
|
||||
#cmakedefine HAVE_SIGWAIT 1
|
||||
#cmakedefine HAVE_SIGWAITINFO 1
|
||||
#cmakedefine HAVE_SLEEP 1
|
||||
#cmakedefine HAVE_SNPRINTF 1
|
||||
#cmakedefine HAVE_STPCPY 1
|
||||
|
@@ -400,6 +400,7 @@ CHECK_FUNCTION_EXISTS (setlocale HAVE_SETLOCALE)
|
||||
CHECK_FUNCTION_EXISTS (sigaction HAVE_SIGACTION)
|
||||
CHECK_FUNCTION_EXISTS (sigthreadmask HAVE_SIGTHREADMASK)
|
||||
CHECK_FUNCTION_EXISTS (sigwait HAVE_SIGWAIT)
|
||||
CHECK_FUNCTION_EXISTS (sigwaitinfo HAVE_SIGWAITINFO)
|
||||
CHECK_FUNCTION_EXISTS (sigset HAVE_SIGSET)
|
||||
CHECK_FUNCTION_EXISTS (sleep HAVE_SLEEP)
|
||||
CHECK_FUNCTION_EXISTS (snprintf HAVE_SNPRINTF)
|
||||
|
2
debian/additions/debian-start
vendored
2
debian/additions/debian-start
vendored
@@ -15,7 +15,7 @@ fi
|
||||
|
||||
MYSQL="/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf"
|
||||
MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
|
||||
MYUPGRADE="/usr/bin/mysql_upgrade --defaults-extra-file=/etc/mysql/debian.cnf"
|
||||
MYUPGRADE="/usr/bin/mysql_upgrade --defaults-extra-file=/etc/mysql/debian.cnf --version-check"
|
||||
MYCHECK="/usr/bin/mysqlcheck --defaults-file=/etc/mysql/debian.cnf"
|
||||
MYCHECK_SUBJECT="WARNING: mysqlcheck has found corrupt tables"
|
||||
MYCHECK_PARAMS="--all-databases --fast --silent"
|
||||
|
2
debian/additions/debian-start.inc.sh
vendored
2
debian/additions/debian-start.inc.sh
vendored
@@ -60,7 +60,7 @@ function upgrade_system_tables_if_necessary() {
|
||||
# errors as the script is designed to be idempotent.
|
||||
LC_ALL=C $MYUPGRADE \
|
||||
2>&1 \
|
||||
| egrep -v '^(1|@had|ERROR (1054|1060|1061))' \
|
||||
| egrep -v '^(1|@had|ERROR (1051|1054|1060|1061|1146|1347|1348))' \
|
||||
| logger -p daemon.warn -i -t$0
|
||||
}
|
||||
|
||||
|
8
debian/autobake-deb.sh
vendored
8
debian/autobake-deb.sh
vendored
@@ -102,7 +102,7 @@ fi
|
||||
# AWS SDK also requires the build machine to have network access and git, so
|
||||
# it cannot be part of the base version included in Linux distros, but a pure
|
||||
# custom built plugin.
|
||||
if [[ $GCCVERSION -gt 40800 ]] && [[ ! $TRAVIS ]] && wget --timeout 15 --tries 1 --quiet --output-document /dev/null https://github.com/
|
||||
if [[ $GCCVERSION -gt 40800 ]] && [[ ! $TRAVIS ]] && [[ -x "$(command -v git)" ]] && timeout 3s bash -c 'sed -n q </dev/tcp/github.com/22'
|
||||
then
|
||||
cat <<EOF >> debian/control
|
||||
|
||||
@@ -124,6 +124,12 @@ EOF
|
||||
sed -i -e "/-DPLUGIN_AWS_KEY_MANAGEMENT=NO/d" debian/rules
|
||||
fi
|
||||
|
||||
# Don't build cassandra package if thrift is not installed
|
||||
if [[ ! -f /usr/local/include/thrift/Thrift.h && ! -f /usr/include/thrift/Thrift.h ]]
|
||||
then
|
||||
sed '/Package: mariadb-plugin-cassandra/,/^$/d' -i debian/control
|
||||
fi
|
||||
|
||||
# Mroonga, TokuDB never built on Travis CI anyway, see build flags above
|
||||
if [[ $TRAVIS ]]
|
||||
then
|
||||
|
6
debian/control
vendored
6
debian/control
vendored
@@ -53,6 +53,8 @@ Conflicts: libmariadbclient18 (<< 10.2.0),
|
||||
mariadb-server-5.2,
|
||||
mariadb-server-5.3,
|
||||
mariadb-server-5.5 (<< 5.5.33)
|
||||
Breaks: libmariadbclient18 (<< ${source:Version})
|
||||
Replaces: libmariadbclient18 (<< ${source:Version})
|
||||
Description: MariaDB database client library
|
||||
MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
|
||||
server. SQL (Structured Query Language) is the most popular database query
|
||||
@@ -430,7 +432,7 @@ Recommends: libhtml-template-perl
|
||||
Pre-Depends: adduser (>= 3.40),
|
||||
debconf,
|
||||
mariadb-common (>= ${source:Version})
|
||||
Depends: galera-3 (>=25.3),
|
||||
Depends: galera-4 (>=26.4),
|
||||
gawk,
|
||||
iproute | iproute2,
|
||||
libdbi-perl,
|
||||
@@ -594,7 +596,7 @@ Description: OQGraph storage engine for MariaDB
|
||||
|
||||
Package: mariadb-plugin-tokudb
|
||||
Architecture: amd64
|
||||
Depends: libjemalloc1 (>= 3.0.0~),
|
||||
Depends: libjemalloc1 (>= 3.0.0~) | libjemalloc2,
|
||||
mariadb-server-10.4 (= ${binary:Version}),
|
||||
${misc:Depends},
|
||||
${shlibs:Depends}
|
||||
|
5
debian/mariadb-server-10.4.install
vendored
5
debian/mariadb-server-10.4.install
vendored
@@ -36,8 +36,6 @@ usr/bin/wsrep_sst_common
|
||||
usr/bin/wsrep_sst_mariabackup
|
||||
usr/bin/wsrep_sst_mysqldump
|
||||
usr/bin/wsrep_sst_rsync
|
||||
usr/bin/wsrep_sst_xtrabackup
|
||||
usr/bin/wsrep_sst_xtrabackup-v2
|
||||
usr/lib/mysql/plugin/auth_ed25519.so
|
||||
usr/lib/mysql/plugin/auth_pam.so
|
||||
usr/lib/mysql/plugin/auth_pam_tool_dir/auth_pam_tool
|
||||
@@ -92,8 +90,7 @@ usr/share/man/man1/resolveip.1
|
||||
usr/share/man/man1/wsrep_sst_common.1
|
||||
usr/share/man/man1/wsrep_sst_mysqldump.1
|
||||
usr/share/man/man1/wsrep_sst_rsync.1
|
||||
usr/share/man/man1/wsrep_sst_xtrabackup-v2.1
|
||||
usr/share/man/man1/wsrep_sst_xtrabackup.1
|
||||
usr/share/man/man1/wsrep_sst_mariabackup.1
|
||||
usr/share/mysql/errmsg-utf8.txt
|
||||
usr/share/mysql/fill_help_tables.sql
|
||||
usr/share/mysql/maria_add_gis_sp_bootstrap.sql
|
||||
|
60
debian/mariadb-server-10.4.postinst
vendored
60
debian/mariadb-server-10.4.postinst
vendored
@@ -2,13 +2,16 @@
|
||||
|
||||
. /usr/share/debconf/confmodule
|
||||
|
||||
# assume the filename is /path/to/mariadb-server-##.#.postinst
|
||||
VER=${0: -13:4}
|
||||
|
||||
if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi
|
||||
${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }
|
||||
|
||||
export PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin
|
||||
|
||||
# This command can be used as pipe to syslog. With "-s" it also logs to stderr.
|
||||
ERR_LOGGER="logger -p daemon.err -t mysqld_safe -i"
|
||||
ERR_LOGGER="logger -p daemon.err -t mariadb-server-$VER.postinst -i"
|
||||
# This will make an error in a logged command immediately apparent by aborting
|
||||
# the install, rather than failing silently and leaving a broken install.
|
||||
set -o pipefail
|
||||
@@ -23,6 +26,8 @@ invoke() {
|
||||
|
||||
MYSQL_BOOTSTRAP="/usr/sbin/mysqld --bootstrap --user=mysql --disable-log-bin --skip-grant-tables --default-storage-engine=myisam"
|
||||
|
||||
have_global_priv_table=
|
||||
|
||||
set_mysql_rootpw() {
|
||||
# forget we ever saw the password. don't use reset to keep the seen status
|
||||
db_set mysql-server/root_password ""
|
||||
@@ -33,13 +38,23 @@ set_mysql_rootpw() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
# this avoids us having to call "test" or "[" on $rootpw
|
||||
cat << EOF > $tfile
|
||||
USE mysql;
|
||||
SET sql_log_bin=0;
|
||||
EOF
|
||||
if test -n "$have_global_priv_table"; then
|
||||
cat << EOF >> $tfile
|
||||
UPDATE global_priv SET priv=json_set(priv, '$.plugin', 'mysql_native_password', '$.authentication_string', PASSWORD("$rootpw")) WHERE user='root';
|
||||
EOF
|
||||
else
|
||||
cat << EOF >> $tfile
|
||||
UPDATE user SET password=PASSWORD("$rootpw") WHERE user='root';
|
||||
EOF
|
||||
fi
|
||||
cat << EOF >> $tfile
|
||||
FLUSH PRIVILEGES;
|
||||
EOF
|
||||
# this avoids us having to call "test" or "[" on $rootpw
|
||||
if grep -q 'PASSWORD("")' $tfile; then
|
||||
retval=0
|
||||
else
|
||||
@@ -146,6 +161,12 @@ EOF
|
||||
$ERR_LOGGER
|
||||
set -e
|
||||
|
||||
if test -f $mysql_datadir/mysql/global_priv.frm; then
|
||||
have_global_priv_table=yes
|
||||
fi
|
||||
|
||||
# To avoid downgrades.
|
||||
touch $mysql_statedir/debian-$VER.flag
|
||||
|
||||
## On every reconfiguration the maintenance user is recreated.
|
||||
#
|
||||
@@ -191,20 +212,29 @@ EOF
|
||||
chown 0:0 $dc
|
||||
chmod 0600 $dc
|
||||
|
||||
replace_query=`/bin/echo -e \
|
||||
if test -n "$have_global_priv_table"; then
|
||||
replace_query=`/bin/echo -e \
|
||||
"USE mysql;\n" \
|
||||
"SET sql_mode='';\n" \
|
||||
"REPLACE INTO user SET " \
|
||||
" host='localhost', user='debian-sys-maint', password=password('$pass'), " \
|
||||
" Select_priv='Y', Insert_priv='Y', Update_priv='Y', Delete_priv='Y', " \
|
||||
" Create_priv='Y', Drop_priv='Y', Reload_priv='Y', Shutdown_priv='Y', " \
|
||||
" Process_priv='Y', File_priv='Y', Grant_priv='Y', References_priv='Y', " \
|
||||
" Index_priv='Y', Alter_priv='Y', Super_priv='Y', Show_db_priv='Y', "\
|
||||
" Create_tmp_table_priv='Y', Lock_tables_priv='Y', Execute_priv='Y', "\
|
||||
" Repl_slave_priv='Y', Repl_client_priv='Y', Create_view_priv='Y', "\
|
||||
" Show_view_priv='Y', Create_routine_priv='Y', Alter_routine_priv='Y', "\
|
||||
" Create_user_priv='Y', Event_priv='Y', Trigger_priv='Y',"\
|
||||
" ssl_cipher='', x509_issuer='', x509_subject='';"`;
|
||||
"SELECT json_object('access',cast(-1 as unsigned), " \
|
||||
"'plugin', 'mysql_native_password', " \
|
||||
"'authentication_string', password('$pass')) INTO @all_privileges;\n"\
|
||||
"REPLACE global_priv VALUES ('localhost', 'debian-sys-maint', @all_privileges);"`
|
||||
else
|
||||
replace_query=`/bin/echo -e \
|
||||
"USE mysql;\n" \
|
||||
"SET sql_mode='';\n" \
|
||||
"REPLACE INTO user SET " \
|
||||
" host='localhost', user='debian-sys-maint', password=password('$pass'), " \
|
||||
" Select_priv='Y', Insert_priv='Y', Update_priv='Y', Delete_priv='Y', " \
|
||||
" Create_priv='Y', Drop_priv='Y', Reload_priv='Y', Shutdown_priv='Y', " \
|
||||
" Process_priv='Y', File_priv='Y', Grant_priv='Y', References_priv='Y', " \
|
||||
" Index_priv='Y', Alter_priv='Y', Super_priv='Y', Show_db_priv='Y', "\
|
||||
" Create_tmp_table_priv='Y', Lock_tables_priv='Y', Execute_priv='Y', "\
|
||||
" Repl_slave_priv='Y', Repl_client_priv='Y', Create_view_priv='Y', "\
|
||||
" Show_view_priv='Y', Create_routine_priv='Y', Alter_routine_priv='Y', "\
|
||||
" Create_user_priv='Y', Event_priv='Y', Trigger_priv='Y',"\
|
||||
" ssl_cipher='', x509_issuer='', x509_subject='';"`;
|
||||
fi
|
||||
|
||||
db_get mysql-server/root_password && rootpw="$RET"
|
||||
if ! set_mysql_rootpw; then
|
||||
|
5
debian/rules
vendored
5
debian/rules
vendored
@@ -114,11 +114,6 @@ override_dh_auto_install:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
|
||||
# If libthrift-dev was available (manually installed, as it is
|
||||
# not in Debian) and ha_cassandra.so was thus built, create package,
|
||||
# otherwise skip it.
|
||||
[ -f $(BUILDDIR)/storage/cassandra/ha_cassandra.so ] || sed -i -e "/Package: mariadb-plugin-cassandra/,+20d" debian/control
|
||||
|
||||
ifneq (,$(filter linux,$(DEB_HOST_ARCH_OS)))
|
||||
# Copy systemd files to a location available for dh_installinit
|
||||
cp $(BUILDDIR)/support-files/mariadb.service debian/mariadb-server-10.4.mariadb.service
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 2014, 2017, MariaDB Corporation.
|
||||
Copyright (c) 2014, 2018, 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
|
||||
@@ -42,43 +42,18 @@
|
||||
/* Only parts of these files are included from the InnoDB codebase.
|
||||
The parts not included are excluded by #ifndef UNIV_INNOCHECKSUM. */
|
||||
|
||||
typedef void fil_space_t;
|
||||
|
||||
#include "univ.i" /* include all of this */
|
||||
#include "page0size.h"
|
||||
|
||||
#define FLST_BASE_NODE_SIZE (4 + 2 * FIL_ADDR_SIZE)
|
||||
#define FLST_NODE_SIZE (2 * FIL_ADDR_SIZE)
|
||||
#define FSEG_PAGE_DATA FIL_PAGE_DATA
|
||||
#define FSEG_HEADER_SIZE 10
|
||||
#define UT_BITS_IN_BYTES(b) (((b) + 7) / 8)
|
||||
|
||||
#include "ut0ut.h"
|
||||
#include "ut0byte.h"
|
||||
#include "mtr0types.h"
|
||||
#include "mach0data.h"
|
||||
#include "fsp0types.h"
|
||||
#include "rem0rec.h"
|
||||
#include "page0page.h"
|
||||
#include "buf0checksum.h" /* buf_calc_page_*() */
|
||||
#include "buf0buf.h" /* buf_page_is_corrupted */
|
||||
#include "fil0fil.h" /* FIL_* */
|
||||
#include "page0page.h" /* PAGE_* */
|
||||
#include "page0zip.h" /* page_zip_*() */
|
||||
#include "trx0undo.h" /* TRX_* */
|
||||
#include "fsp0fsp.h" /* fsp_flags_get_page_size() &
|
||||
fsp_flags_get_zip_size() */
|
||||
#include "ut0crc32.h" /* ut_crc32_init() */
|
||||
#include "fsp0pagecompress.h" /* fil_get_compression_alg_name */
|
||||
#include "fil0crypt.h" /* fil_space_verify_crypt_checksum */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#ifdef UNIV_NONINL
|
||||
# include "fsp0fsp.ic"
|
||||
# include "mach0data.ic"
|
||||
# include "ut0rnd.ic"
|
||||
#endif
|
||||
|
||||
#ifndef PRIuMAX
|
||||
#define PRIuMAX "llu"
|
||||
#endif
|
||||
@@ -525,7 +500,16 @@ is_page_corrupted(
|
||||
normal method. */
|
||||
if (is_encrypted && key_version != 0) {
|
||||
is_corrupted = !fil_space_verify_crypt_checksum(buf,
|
||||
page_size, space_id, (ulint)cur_page_num);
|
||||
page_size);
|
||||
if (is_corrupted && log_file) {
|
||||
fprintf(log_file,
|
||||
"Page " ULINTPF ":%llu may be corrupted;"
|
||||
" key_version=%u\n",
|
||||
space_id, cur_page_num,
|
||||
mach_read_from_4(
|
||||
FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION
|
||||
+ buf));
|
||||
}
|
||||
} else {
|
||||
is_corrupted = true;
|
||||
}
|
||||
|
@@ -40,9 +40,6 @@ IF(NOT HAVE_SYSTEM_REGEX)
|
||||
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/pcre)
|
||||
ENDIF()
|
||||
|
||||
IF(WITH_WSREP)
|
||||
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/wsrep)
|
||||
ENDIF()
|
||||
|
||||
ADD_DEFINITIONS(-UMYSQL_SERVER)
|
||||
########################################################################
|
||||
@@ -61,19 +58,19 @@ MYSQL_ADD_EXECUTABLE(mariabackup
|
||||
xtrabackup.cc
|
||||
innobackupex.cc
|
||||
changed_page_bitmap.cc
|
||||
datasink.c
|
||||
ds_buffer.c
|
||||
ds_compress.c
|
||||
datasink.cc
|
||||
ds_buffer.cc
|
||||
ds_compress.cc
|
||||
ds_local.cc
|
||||
ds_stdout.c
|
||||
ds_tmpfile.c
|
||||
ds_xbstream.c
|
||||
ds_stdout.cc
|
||||
ds_tmpfile.cc
|
||||
ds_xbstream.cc
|
||||
fil_cur.cc
|
||||
quicklz/quicklz.c
|
||||
read_filt.cc
|
||||
write_filt.cc
|
||||
wsrep.cc
|
||||
xbstream_write.c
|
||||
xbstream_write.cc
|
||||
backup_mysql.cc
|
||||
backup_copy.cc
|
||||
encryption_plugin.cc
|
||||
@@ -100,13 +97,13 @@ ENDIF()
|
||||
# xbstream binary
|
||||
########################################################################
|
||||
MYSQL_ADD_EXECUTABLE(mbstream
|
||||
ds_buffer.c
|
||||
ds_buffer.cc
|
||||
ds_local.cc
|
||||
ds_stdout.c
|
||||
datasink.c
|
||||
xbstream.c
|
||||
xbstream_read.c
|
||||
xbstream_write.c
|
||||
ds_stdout.cc
|
||||
datasink.cc
|
||||
xbstream.cc
|
||||
xbstream_read.cc
|
||||
xbstream_write.cc
|
||||
COMPONENT backup
|
||||
)
|
||||
|
||||
|
@@ -236,7 +236,7 @@ datadir_iter_next_database(datadir_iter_t *it)
|
||||
if (os_file_closedir(it->dbdir) != 0) {
|
||||
|
||||
msg("Warning: could not"
|
||||
" close database directory %s\n", it->dbpath);
|
||||
" close database directory %s", it->dbpath);
|
||||
|
||||
it->err = DB_ERROR;
|
||||
|
||||
@@ -277,7 +277,7 @@ datadir_iter_next_database(datadir_iter_t *it)
|
||||
}
|
||||
|
||||
if (check_if_skip_database_by_path(it->dbpath)) {
|
||||
msg("Skipping db: %s\n", it->dbpath);
|
||||
msg("Skipping db: %s", it->dbpath);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -521,19 +521,15 @@ datafile_open(const char *file, datafile_cur_t *cursor, uint thread_n)
|
||||
/* The following call prints an error message */
|
||||
os_file_get_last_error(TRUE);
|
||||
|
||||
msg("[%02u] error: cannot open "
|
||||
"file %s\n",
|
||||
thread_n, cursor->abs_path);
|
||||
msg(thread_n,"error: cannot open "
|
||||
"file %s", cursor->abs_path);
|
||||
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (!my_stat(cursor->abs_path, &cursor->statinfo, 0)) {
|
||||
msg("[%02u] error: cannot stat %s\n",
|
||||
thread_n, cursor->abs_path);
|
||||
|
||||
msg(thread_n, "error: cannot stat %s", cursor->abs_path);
|
||||
datafile_close(cursor);
|
||||
|
||||
return(false);
|
||||
}
|
||||
|
||||
@@ -724,9 +720,8 @@ directory_exists(const char *dir, bool create)
|
||||
|
||||
if (mkdirp(dir, 0777, MYF(0)) < 0) {
|
||||
my_strerror(errbuf, sizeof(errbuf), my_errno);
|
||||
msg("Can not create directory %s: %s\n", dir, errbuf);
|
||||
msg("Can not create directory %s: %s", dir, errbuf);
|
||||
return(false);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -735,7 +730,7 @@ directory_exists(const char *dir, bool create)
|
||||
|
||||
if (os_dir == NULL) {
|
||||
my_strerror(errbuf, sizeof(errbuf), my_errno);
|
||||
msg("Can not open directory %s: %s\n", dir,
|
||||
msg("Can not open directory %s: %s", dir,
|
||||
errbuf);
|
||||
|
||||
return(false);
|
||||
@@ -764,7 +759,7 @@ directory_exists_and_empty(const char *dir, const char *comment)
|
||||
os_dir = os_file_opendir(dir, FALSE);
|
||||
|
||||
if (os_dir == NULL) {
|
||||
msg("%s can not open directory %s\n", comment, dir);
|
||||
msg("%s can not open directory %s", comment, dir);
|
||||
return(false);
|
||||
}
|
||||
|
||||
@@ -773,7 +768,7 @@ directory_exists_and_empty(const char *dir, const char *comment)
|
||||
os_file_closedir(os_dir);
|
||||
|
||||
if (!empty) {
|
||||
msg("%s directory %s is not empty!\n", comment, dir);
|
||||
msg("%s directory %s is not empty!", comment, dir);
|
||||
}
|
||||
|
||||
return(empty);
|
||||
@@ -822,7 +817,7 @@ datafile_copy_backup(const char *filepath, uint thread_n)
|
||||
of the filters value. */
|
||||
|
||||
if (check_if_skip_table(filepath)) {
|
||||
msg_ts("[%02u] Skipping %s.\n", thread_n, filepath);
|
||||
msg(thread_n,"Skipping %s.", filepath);
|
||||
return(true);
|
||||
}
|
||||
|
||||
@@ -888,14 +883,13 @@ backup_file_vprintf(const char *filename, const char *fmt, va_list ap)
|
||||
|
||||
dstfile = ds_open(ds_data, filename, &stat);
|
||||
if (dstfile == NULL) {
|
||||
msg("[%02u] error: "
|
||||
"cannot open the destination stream for %s\n",
|
||||
0, filename);
|
||||
msg("error: Can't open the destination stream for %s",
|
||||
filename);
|
||||
goto error;
|
||||
}
|
||||
|
||||
action = xb_get_copy_action("Writing");
|
||||
msg_ts("[%02u] %s %s\n", 0, action, filename);
|
||||
msg("%s %s", action, filename);
|
||||
|
||||
if (buf_len == -1) {
|
||||
goto error;
|
||||
@@ -906,7 +900,7 @@ backup_file_vprintf(const char *filename, const char *fmt, va_list ap)
|
||||
}
|
||||
|
||||
/* close */
|
||||
msg_ts("[%02u] ...done\n", 0);
|
||||
msg(" ...done");
|
||||
free(buf);
|
||||
|
||||
if (ds_close(dstfile)) {
|
||||
@@ -922,7 +916,7 @@ error:
|
||||
}
|
||||
|
||||
error_close:
|
||||
msg("[%02u] Error: backup file failed.\n", 0);
|
||||
msg("Error: backup file failed.");
|
||||
return(false); /*ERROR*/
|
||||
}
|
||||
|
||||
@@ -982,7 +976,7 @@ run_data_threads(datadir_iter_t *it, os_thread_func_t func, uint n)
|
||||
for (i = 0; i < n; i++) {
|
||||
ret = data_threads[i].ret && ret;
|
||||
if (!data_threads[i].ret) {
|
||||
msg("Error: thread %u failed.\n", i);
|
||||
msg("Error: thread %u failed.", i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1017,14 +1011,12 @@ copy_file(ds_ctxt_t *datasink,
|
||||
|
||||
dstfile = ds_open(datasink, dst_path, &cursor.statinfo);
|
||||
if (dstfile == NULL) {
|
||||
msg("[%02u] error: "
|
||||
"cannot open the destination stream for %s\n",
|
||||
thread_n, dst_name);
|
||||
msg(thread_n,"error: "
|
||||
"cannot open the destination stream for %s", dst_name);
|
||||
goto error;
|
||||
}
|
||||
|
||||
msg_ts("[%02u] %s %s to %s\n",
|
||||
thread_n, xb_get_copy_action(), src_file_path, dstfile->path);
|
||||
msg(thread_n, "%s %s to %s", xb_get_copy_action(), src_file_path, dstfile->path);
|
||||
|
||||
/* The main copy loop */
|
||||
while ((res = datafile_read(&cursor)) == XB_FIL_CUR_SUCCESS) {
|
||||
@@ -1039,7 +1031,7 @@ copy_file(ds_ctxt_t *datasink,
|
||||
}
|
||||
|
||||
/* close */
|
||||
msg_ts("[%02u] ...done\n", thread_n);
|
||||
msg(thread_n," ...done");
|
||||
datafile_close(&cursor);
|
||||
if (ds_close(dstfile)) {
|
||||
goto error_close;
|
||||
@@ -1053,7 +1045,7 @@ error:
|
||||
}
|
||||
|
||||
error_close:
|
||||
msg("[%02u] Error: copy_file() failed.\n", thread_n);
|
||||
msg(thread_n,"Error: copy_file() failed.");
|
||||
return(false); /*ERROR*/
|
||||
}
|
||||
|
||||
@@ -1085,36 +1077,34 @@ move_file(ds_ctxt_t *datasink,
|
||||
|
||||
if (file_exists(dst_file_path_abs)) {
|
||||
msg("Error: Move file %s to %s failed: Destination "
|
||||
"file exists\n",
|
||||
src_file_path, dst_file_path_abs);
|
||||
"file exists", src_file_path, dst_file_path_abs);
|
||||
return(false);
|
||||
}
|
||||
|
||||
msg_ts("[%02u] Moving %s to %s\n",
|
||||
thread_n, src_file_path, dst_file_path_abs);
|
||||
msg(thread_n,"Moving %s to %s", src_file_path, dst_file_path_abs);
|
||||
|
||||
if (my_rename(src_file_path, dst_file_path_abs, MYF(0)) != 0) {
|
||||
if (my_errno == EXDEV) {
|
||||
bool ret;
|
||||
ret = copy_file(datasink, src_file_path,
|
||||
dst_file_path, thread_n);
|
||||
msg_ts("[%02u] Removing %s\n", thread_n, src_file_path);
|
||||
msg(thread_n,"Removing %s", src_file_path);
|
||||
if (unlink(src_file_path) != 0) {
|
||||
my_strerror(errbuf, sizeof(errbuf), errno);
|
||||
msg("Error: unlink %s failed: %s\n",
|
||||
msg("Error: unlink %s failed: %s",
|
||||
src_file_path,
|
||||
errbuf);
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
my_strerror(errbuf, sizeof(errbuf), my_errno);
|
||||
msg("Can not move file %s to %s: %s\n",
|
||||
msg("Can not move file %s to %s: %s",
|
||||
src_file_path, dst_file_path_abs,
|
||||
errbuf);
|
||||
return(false);
|
||||
}
|
||||
|
||||
msg_ts("[%02u] ...done\n", thread_n);
|
||||
msg(thread_n," ...done");
|
||||
|
||||
return(true);
|
||||
}
|
||||
@@ -1266,13 +1256,13 @@ backup_files(const char *from, bool prep_mode)
|
||||
prep_mode ? 1 : 2);
|
||||
rsync_tmpfile = fopen(rsync_tmpfile_name, "w");
|
||||
if (rsync_tmpfile == NULL) {
|
||||
msg("Error: can't create file %s\n",
|
||||
msg("Error: can't create file %s",
|
||||
rsync_tmpfile_name);
|
||||
return(false);
|
||||
}
|
||||
}
|
||||
|
||||
msg_ts("Starting %s non-InnoDB tables and files\n",
|
||||
msg("Starting %s non-InnoDB tables and files",
|
||||
prep_mode ? "prep copy of" : "to backup");
|
||||
|
||||
datadir_node_init(&node);
|
||||
@@ -1288,7 +1278,7 @@ backup_files(const char *from, bool prep_mode)
|
||||
ret = datafile_copy_backup(node.filepath, 1);
|
||||
}
|
||||
if (!ret) {
|
||||
msg("Failed to copy file %s\n", node.filepath);
|
||||
msg("Failed to copy file %s", node.filepath);
|
||||
goto out;
|
||||
}
|
||||
} else if (!prep_mode) {
|
||||
@@ -1298,7 +1288,7 @@ backup_files(const char *from, bool prep_mode)
|
||||
"%s/db.opt", node.filepath);
|
||||
if (!(ret = backup_file_printf(
|
||||
trim_dotslash(path), "%s", ""))) {
|
||||
msg("Failed to create file %s\n", path);
|
||||
msg("Failed to create file %s", path);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
@@ -1323,13 +1313,13 @@ backup_files(const char *from, bool prep_mode)
|
||||
cmd << "rsync -t . --files-from=" << rsync_tmpfile_name
|
||||
<< " " << xtrabackup_target_dir;
|
||||
|
||||
msg_ts("Starting rsync as: %s\n", cmd.str().c_str());
|
||||
msg("Starting rsync as: %s", cmd.str().c_str());
|
||||
if ((err = system(cmd.str().c_str()) && !prep_mode) != 0) {
|
||||
msg_ts("Error: rsync failed with error code %d\n", err);
|
||||
msg("Error: rsync failed with error code %d", err);
|
||||
ret = false;
|
||||
goto out;
|
||||
}
|
||||
msg_ts("rsync finished successfully.\n");
|
||||
msg("rsync finished successfully.");
|
||||
|
||||
if (!prep_mode && !opt_no_lock) {
|
||||
char path[FN_REFLEN];
|
||||
@@ -1345,7 +1335,7 @@ backup_files(const char *from, bool prep_mode)
|
||||
|
||||
rsync_tmpfile = fopen(rsync_tmpfile_name, "r");
|
||||
if (rsync_tmpfile == NULL) {
|
||||
msg("Error: can't open file %s\n",
|
||||
msg("Error: can't open file %s",
|
||||
rsync_tmpfile_name);
|
||||
ret = false;
|
||||
goto out;
|
||||
@@ -1361,7 +1351,7 @@ backup_files(const char *from, bool prep_mode)
|
||||
snprintf(dst_path, sizeof(dst_path),
|
||||
"%s/%s", xtrabackup_target_dir,
|
||||
path);
|
||||
msg_ts("Removing %s\n", dst_path);
|
||||
msg("Removing %s", dst_path);
|
||||
unlink(dst_path);
|
||||
}
|
||||
}
|
||||
@@ -1371,7 +1361,7 @@ backup_files(const char *from, bool prep_mode)
|
||||
}
|
||||
}
|
||||
|
||||
msg_ts("Finished %s non-InnoDB tables and files\n",
|
||||
msg("Finished %s non-InnoDB tables and files",
|
||||
prep_mode ? "a prep copy of" : "backing up");
|
||||
|
||||
out:
|
||||
@@ -1395,7 +1385,9 @@ static lsn_t get_current_lsn(MYSQL *connection)
|
||||
"SHOW ENGINE INNODB STATUS",
|
||||
true, false)) {
|
||||
if (MYSQL_ROW row = mysql_fetch_row(res)) {
|
||||
if (const char *p = strstr(row[2], lsn_prefix)) {
|
||||
const char *p= strstr(row[2], lsn_prefix);
|
||||
DBUG_ASSERT(p);
|
||||
if (p) {
|
||||
p += sizeof lsn_prefix - 1;
|
||||
lsn = lsn_t(strtoll(p, NULL, 10));
|
||||
}
|
||||
@@ -1441,7 +1433,7 @@ bool backup_start()
|
||||
rocksdb_create_checkpoint();
|
||||
}
|
||||
|
||||
msg_ts("Waiting for log copy thread to read lsn %llu\n", (ulonglong)server_lsn_after_lock);
|
||||
msg("Waiting for log copy thread to read lsn %llu", (ulonglong)server_lsn_after_lock);
|
||||
backup_wait_for_lsn(server_lsn_after_lock);
|
||||
backup_fix_ddl();
|
||||
|
||||
@@ -1483,8 +1475,8 @@ bool backup_start()
|
||||
write_binlog_info(mysql_connection);
|
||||
}
|
||||
|
||||
if (have_flush_engine_logs) {
|
||||
msg_ts("Executing FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS...\n");
|
||||
if (have_flush_engine_logs && !opt_no_lock) {
|
||||
msg("Executing FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS...");
|
||||
xb_mysql_query(mysql_connection,
|
||||
"FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS", false);
|
||||
}
|
||||
@@ -1508,7 +1500,7 @@ void backup_release()
|
||||
}
|
||||
|
||||
if (opt_safe_slave_backup && sql_thread_started) {
|
||||
msg("Starting slave SQL thread\n");
|
||||
msg("Starting slave SQL thread");
|
||||
xb_mysql_query(mysql_connection,
|
||||
"START SLAVE SQL_THREAD", false);
|
||||
}
|
||||
@@ -1534,12 +1526,12 @@ bool backup_finish()
|
||||
rocksdb_backup_checkpoint();
|
||||
}
|
||||
|
||||
msg_ts("Backup created in directory '%s'\n", xtrabackup_target_dir);
|
||||
msg("Backup created in directory '%s'", xtrabackup_target_dir);
|
||||
if (mysql_binlog_position != NULL) {
|
||||
msg("MySQL binlog position: %s\n", mysql_binlog_position);
|
||||
msg("MySQL binlog position: %s", mysql_binlog_position);
|
||||
}
|
||||
if (mysql_slave_position && opt_slave_info) {
|
||||
msg("MySQL slave binlog position: %s\n",
|
||||
msg("MySQL slave binlog position: %s",
|
||||
mysql_slave_position);
|
||||
}
|
||||
|
||||
@@ -1599,7 +1591,7 @@ ibx_copy_incremental_over_full()
|
||||
|
||||
if (!(ret = copy_file(ds_data, node.filepath,
|
||||
node.filepath_rel, 1))) {
|
||||
msg("Failed to copy file %s\n",
|
||||
msg("Failed to copy file %s",
|
||||
node.filepath);
|
||||
goto cleanup;
|
||||
}
|
||||
@@ -1739,7 +1731,7 @@ copy_back()
|
||||
/* cd to backup directory */
|
||||
if (my_setwd(xtrabackup_target_dir, MYF(MY_WME)))
|
||||
{
|
||||
msg("cannot my_setwd %s\n", xtrabackup_target_dir);
|
||||
msg("Can't my_setwd %s", xtrabackup_target_dir);
|
||||
return(false);
|
||||
}
|
||||
|
||||
@@ -1752,7 +1744,7 @@ copy_back()
|
||||
srv_sys_space.set_path(".");
|
||||
|
||||
if (!srv_sys_space.parse_params(innobase_data_file_path, true)) {
|
||||
msg("syntax error in innodb_data_file_path\n");
|
||||
msg("syntax error in innodb_data_file_path");
|
||||
return(false);
|
||||
}
|
||||
|
||||
@@ -1866,12 +1858,12 @@ copy_back()
|
||||
snprintf(path, sizeof(path), "%s/%s",
|
||||
mysql_data_home, node.filepath_rel);
|
||||
|
||||
msg_ts("[%02u] Creating directory %s\n", 1, path);
|
||||
msg("Creating directory %s", path);
|
||||
|
||||
if (mkdirp(path, 0777, MYF(0)) < 0) {
|
||||
char errbuf[MYSYS_STRERROR_SIZE];
|
||||
my_strerror(errbuf, sizeof(errbuf), my_errno);
|
||||
msg("Can not create directory %s: %s\n",
|
||||
msg("Can not create directory %s: %s",
|
||||
path, errbuf);
|
||||
ret = false;
|
||||
|
||||
@@ -1879,7 +1871,7 @@ copy_back()
|
||||
|
||||
}
|
||||
|
||||
msg_ts("[%02u] ...done.", 1);
|
||||
msg(" ...done.");
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -1989,14 +1981,14 @@ decrypt_decompress_file(const char *filepath, uint thread_n)
|
||||
|
||||
if (needs_action) {
|
||||
|
||||
msg_ts("[%02u] %s\n", thread_n, message.str().c_str());
|
||||
msg(thread_n,"%s\n", message.str().c_str());
|
||||
|
||||
if (system(cmd.str().c_str()) != 0) {
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (opt_remove_original) {
|
||||
msg_ts("[%02u] removing %s\n", thread_n, filepath);
|
||||
msg(thread_n, "Removing %s", filepath);
|
||||
if (my_delete(filepath, MYF(MY_WME)) != 0) {
|
||||
return(false);
|
||||
}
|
||||
@@ -2059,7 +2051,7 @@ decrypt_decompress()
|
||||
/* cd to backup directory */
|
||||
if (my_setwd(xtrabackup_target_dir, MYF(MY_WME)))
|
||||
{
|
||||
msg("cannot my_setwd %s\n", xtrabackup_target_dir);
|
||||
msg("Can't my_setwd %s", xtrabackup_target_dir);
|
||||
return(false);
|
||||
}
|
||||
|
||||
@@ -2209,8 +2201,7 @@ static void copy_or_move_dir(const char *from, const char *to, bool do_copy, boo
|
||||
rc = make_hardlink(from_path, to_path);
|
||||
if (rc)
|
||||
{
|
||||
msg_ts("[%02u] Creating hardlink from %s to %s\n",
|
||||
1, from_path, to_path);
|
||||
msg("Creating hardlink from %s to %s",from_path, to_path);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2226,7 +2217,7 @@ static void copy_or_move_dir(const char *from, const char *to, bool do_copy, boo
|
||||
to, 1));
|
||||
}
|
||||
if (!rc)
|
||||
exit(EXIT_FAILURE);
|
||||
die("copy or move file failed");
|
||||
}
|
||||
datadir_iter_free(it);
|
||||
datadir_node_free(&node);
|
||||
@@ -2244,14 +2235,14 @@ static void copy_or_move_dir(const char *from, const char *to, bool do_copy, boo
|
||||
*/
|
||||
static void rocksdb_lock_checkpoint()
|
||||
{
|
||||
msg_ts("Obtaining rocksdb checkpoint lock.\n");
|
||||
msg("Obtaining rocksdb checkpoint lock.");
|
||||
MYSQL_RES *res =
|
||||
xb_mysql_query(mysql_connection, "SELECT GET_LOCK('mariabackup_rocksdb_checkpoint',3600)", true, true);
|
||||
|
||||
MYSQL_ROW r = mysql_fetch_row(res);
|
||||
if (r && r[0] && strcmp(r[0], "1"))
|
||||
{
|
||||
msg_ts("Could not obtain rocksdb checkpont lock\n");
|
||||
msg("Could not obtain rocksdb checkpont lock.");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
mysql_free_result(res);
|
||||
@@ -2305,7 +2296,7 @@ static void rocksdb_create_checkpoint()
|
||||
|
||||
if (!access(rocksdb_checkpoint_dir, 0))
|
||||
{
|
||||
msg_ts("Removing rocksdb checkpoint from previous backup attempt.\n");
|
||||
msg("Removing rocksdb checkpoint from previous backup attempt.");
|
||||
rocksdb_remove_checkpoint_directory();
|
||||
}
|
||||
|
||||
@@ -2321,15 +2312,14 @@ static void rocksdb_create_checkpoint()
|
||||
*/
|
||||
static void rocksdb_backup_checkpoint()
|
||||
{
|
||||
msg_ts("Backing up rocksdb files.\n");
|
||||
msg("Backing up rocksdb files.");
|
||||
char rocksdb_backup_dir[FN_REFLEN];
|
||||
snprintf(rocksdb_backup_dir, sizeof(rocksdb_backup_dir), "%s/" ROCKSDB_BACKUP_DIR , xtrabackup_target_dir);
|
||||
bool backup_to_directory = xtrabackup_backup && xtrabackup_stream_fmt == XB_STREAM_FMT_NONE;
|
||||
if (backup_to_directory)
|
||||
{
|
||||
if (my_mkdir(rocksdb_backup_dir, 0777, MYF(0))){
|
||||
msg_ts("Can't create rocksdb backup directory %s\n", rocksdb_backup_dir);
|
||||
exit(EXIT_FAILURE);
|
||||
die("Can't create rocksdb backup directory %s", rocksdb_backup_dir);
|
||||
}
|
||||
}
|
||||
copy_or_move_dir(rocksdb_checkpoint_dir, ROCKSDB_BACKUP_DIR, true, backup_to_directory);
|
||||
|
@@ -105,7 +105,7 @@ xb_mysql_connect()
|
||||
sprintf(mysql_port_str, "%d", opt_port);
|
||||
|
||||
if (connection == NULL) {
|
||||
msg("Failed to init MySQL struct: %s.\n",
|
||||
msg("Failed to init MySQL struct: %s.",
|
||||
mysql_error(connection));
|
||||
return(NULL);
|
||||
}
|
||||
@@ -121,8 +121,8 @@ xb_mysql_connect()
|
||||
mysql_options(connection, MYSQL_OPT_PROTOCOL, &opt_protocol);
|
||||
mysql_options(connection,MYSQL_SET_CHARSET_NAME, "utf8");
|
||||
|
||||
msg_ts("Connecting to MySQL server host: %s, user: %s, password: %s, "
|
||||
"port: %s, socket: %s\n", opt_host ? opt_host : "localhost",
|
||||
msg("Connecting to MySQL server host: %s, user: %s, password: %s, "
|
||||
"port: %s, socket: %s", opt_host ? opt_host : "localhost",
|
||||
opt_user ? opt_user : "not set",
|
||||
opt_password ? "set" : "not set",
|
||||
opt_port != 0 ? mysql_port_str : "not set",
|
||||
@@ -148,8 +148,7 @@ xb_mysql_connect()
|
||||
opt_password,
|
||||
"" /*database*/, opt_port,
|
||||
opt_socket, 0)) {
|
||||
msg("Failed to connect to MySQL server: %s.\n",
|
||||
mysql_error(connection));
|
||||
msg("Failed to connect to MySQL server: %s.", mysql_error(connection));
|
||||
mysql_close(connection);
|
||||
return(NULL);
|
||||
}
|
||||
@@ -169,10 +168,10 @@ xb_mysql_query(MYSQL *connection, const char *query, bool use_result,
|
||||
MYSQL_RES *mysql_result = NULL;
|
||||
|
||||
if (mysql_query(connection, query)) {
|
||||
msg("Error: failed to execute query %s: %s\n", query,
|
||||
mysql_error(connection));
|
||||
if (die_on_error) {
|
||||
exit(EXIT_FAILURE);
|
||||
die("failed to execute query %s: %s", query, mysql_error(connection));
|
||||
} else {
|
||||
msg("Error: failed to execute query %s: %s", query, mysql_error(connection));
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
@@ -180,9 +179,8 @@ xb_mysql_query(MYSQL *connection, const char *query, bool use_result,
|
||||
/* store result set on client if there is a result */
|
||||
if (mysql_field_count(connection) > 0) {
|
||||
if ((mysql_result = mysql_store_result(connection)) == NULL) {
|
||||
msg("Error: failed to fetch query result %s: %s\n",
|
||||
die("failed to fetch query result %s: %s",
|
||||
query, mysql_error(connection));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (!use_result) {
|
||||
@@ -317,11 +315,11 @@ check_server_version(unsigned long version_number,
|
||||
msg("Error: Built-in InnoDB in MySQL 5.1 is not "
|
||||
"supported in this release. You can either use "
|
||||
"Percona XtraBackup 2.0, or upgrade to InnoDB "
|
||||
"plugin.\n");
|
||||
"plugin.");
|
||||
} else if (!version_supported) {
|
||||
msg("Error: Unsupported server version: '%s'. Please "
|
||||
"report a bug at "
|
||||
"https://bugs.launchpad.net/percona-xtrabackup\n",
|
||||
"https://bugs.launchpad.net/percona-xtrabackup",
|
||||
version_string);
|
||||
}
|
||||
|
||||
@@ -408,7 +406,7 @@ get_mysql_vars(MYSQL *connection)
|
||||
opt_binlog_info == BINLOG_INFO_LOCKLESS) {
|
||||
|
||||
msg("Error: --binlog-info=LOCKLESS is not supported by the "
|
||||
"server\n");
|
||||
"server");
|
||||
return(false);
|
||||
}
|
||||
|
||||
@@ -446,7 +444,7 @@ get_mysql_vars(MYSQL *connection)
|
||||
have_gtid_slave = true;
|
||||
}
|
||||
|
||||
msg("Using server version %s\n", version_var);
|
||||
msg("Using server version %s", version_var);
|
||||
|
||||
if (!(ret = detect_mysql_capabilities_for_backup())) {
|
||||
goto out;
|
||||
@@ -456,17 +454,17 @@ get_mysql_vars(MYSQL *connection)
|
||||
if (check_if_param_set("datadir")) {
|
||||
if (!directory_exists(mysql_data_home, false)) {
|
||||
msg("Warning: option 'datadir' points to "
|
||||
"nonexistent directory '%s'\n", mysql_data_home);
|
||||
"nonexistent directory '%s'", mysql_data_home);
|
||||
}
|
||||
if (!directory_exists(datadir_var, false)) {
|
||||
msg("Warning: MySQL variable 'datadir' points to "
|
||||
"nonexistent directory '%s'\n", datadir_var);
|
||||
"nonexistent directory '%s'", datadir_var);
|
||||
}
|
||||
if (!equal_paths(mysql_data_home, datadir_var)) {
|
||||
msg("Warning: option 'datadir' has different "
|
||||
"values:\n"
|
||||
" '%s' in defaults file\n"
|
||||
" '%s' in SHOW VARIABLES\n",
|
||||
" '%s' in SHOW VARIABLES",
|
||||
mysql_data_home, datadir_var);
|
||||
}
|
||||
}
|
||||
@@ -565,14 +563,14 @@ detect_mysql_capabilities_for_backup()
|
||||
if (opt_galera_info && !have_galera_enabled) {
|
||||
msg("--galera-info is specified on the command "
|
||||
"line, but the server does not support Galera "
|
||||
"replication. Ignoring the option.\n");
|
||||
"replication. Ignoring the option.");
|
||||
opt_galera_info = false;
|
||||
}
|
||||
|
||||
if (opt_slave_info && have_multi_threaded_slave &&
|
||||
!have_gtid_slave) {
|
||||
msg("The --slave-info option requires GTID enabled for a "
|
||||
"multi-threaded slave.\n");
|
||||
"multi-threaded slave.");
|
||||
return(false);
|
||||
}
|
||||
|
||||
@@ -619,7 +617,7 @@ select_incremental_lsn_from_history(lsn_t *incremental_lsn)
|
||||
const MYSQL_ROW row = mysql_fetch_row(mysql_result);
|
||||
if (row) {
|
||||
*incremental_lsn = strtoull(row[0], NULL, 10);
|
||||
msg("Found and using lsn: " LSN_PF " for %s %s\n",
|
||||
msg("Found and using lsn: " LSN_PF " for %s %s",
|
||||
*incremental_lsn,
|
||||
opt_incremental_history_uuid ? "uuid" : "name",
|
||||
opt_incremental_history_uuid ?
|
||||
@@ -627,7 +625,7 @@ select_incremental_lsn_from_history(lsn_t *incremental_lsn)
|
||||
opt_incremental_history_name);
|
||||
} else {
|
||||
msg("Error while attempting to find history record "
|
||||
"for %s %s\n",
|
||||
"for %s %s",
|
||||
opt_incremental_history_uuid ? "uuid" : "name",
|
||||
opt_incremental_history_uuid ?
|
||||
opt_incremental_history_uuid :
|
||||
@@ -737,7 +735,7 @@ have_queries_to_wait_for(MYSQL *connection, uint threshold)
|
||||
&& duration >= (int)threshold
|
||||
&& ((all_queries && is_query(info))
|
||||
|| is_update_query(info))) {
|
||||
msg_ts("Waiting for query %s (duration %d sec): %s",
|
||||
msg("Waiting for query %s (duration %d sec): %s",
|
||||
id, duration, info);
|
||||
have_to_wait = true;
|
||||
break;
|
||||
@@ -766,7 +764,7 @@ kill_long_queries(MYSQL *connection, time_t timeout)
|
||||
(time_t)duration >= timeout &&
|
||||
((all_queries && is_query(info)) ||
|
||||
is_select_query(info))) {
|
||||
msg_ts("Killing query %s (duration %d sec): %s\n",
|
||||
msg("Killing query %s (duration %d sec): %s",
|
||||
id, (int)duration, info);
|
||||
snprintf(kill_stmt, sizeof(kill_stmt),
|
||||
"KILL %s", id);
|
||||
@@ -785,8 +783,8 @@ wait_for_no_updates(MYSQL *connection, uint timeout, uint threshold)
|
||||
|
||||
start_time = time(NULL);
|
||||
|
||||
msg_ts("Waiting %u seconds for queries running longer than %u seconds "
|
||||
"to finish\n", timeout, threshold);
|
||||
msg("Waiting %u seconds for queries running longer than %u seconds "
|
||||
"to finish", timeout, threshold);
|
||||
|
||||
while (time(NULL) <= (time_t)(start_time + timeout)) {
|
||||
if (!have_queries_to_wait_for(connection, threshold)) {
|
||||
@@ -795,7 +793,7 @@ wait_for_no_updates(MYSQL *connection, uint timeout, uint threshold)
|
||||
os_thread_sleep(1000000);
|
||||
}
|
||||
|
||||
msg_ts("Unable to obtain lock. Please try again later.");
|
||||
msg("Unable to obtain lock. Please try again later.");
|
||||
|
||||
return(false);
|
||||
}
|
||||
@@ -813,7 +811,7 @@ DECLARE_THREAD(kill_query_thread)(
|
||||
|
||||
os_event_set(kill_query_thread_started);
|
||||
|
||||
msg_ts("Kill query timeout %d seconds.\n",
|
||||
msg("Kill query timeout %d seconds.",
|
||||
opt_kill_long_queries_timeout);
|
||||
|
||||
while (time(NULL) - start_time <
|
||||
@@ -825,7 +823,7 @@ DECLARE_THREAD(kill_query_thread)(
|
||||
}
|
||||
|
||||
if ((mysql = xb_mysql_connect()) == NULL) {
|
||||
msg("Error: kill query thread failed\n");
|
||||
msg("Error: kill query thread failed");
|
||||
goto stop_thread;
|
||||
}
|
||||
|
||||
@@ -840,7 +838,7 @@ DECLARE_THREAD(kill_query_thread)(
|
||||
mysql_close(mysql);
|
||||
|
||||
stop_thread:
|
||||
msg_ts("Kill query thread stopped\n");
|
||||
msg("Kill query thread stopped");
|
||||
|
||||
os_event_set(kill_query_thread_stopped);
|
||||
|
||||
@@ -871,83 +869,6 @@ stop_query_killer()
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Killing connections that wait for MDL lock.
|
||||
If lock-ddl-per-table is used, there can be some DDL statements
|
||||
|
||||
FLUSH TABLES would hang infinitely, if DDL statements are waiting for
|
||||
MDL lock, which mariabackup currently holds. Therefore we start killing
|
||||
those statements from a dedicated thread, until FLUSH TABLES WITH READ LOCK
|
||||
succeeds.
|
||||
*/
|
||||
|
||||
static os_event_t mdl_killer_stop_event;
|
||||
static os_event_t mdl_killer_finished_event;
|
||||
|
||||
static
|
||||
os_thread_ret_t
|
||||
DECLARE_THREAD(kill_mdl_waiters_thread(void *))
|
||||
{
|
||||
MYSQL *mysql;
|
||||
if ((mysql = xb_mysql_connect()) == NULL) {
|
||||
msg("Error: kill mdl waiters thread failed to connect\n");
|
||||
goto stop_thread;
|
||||
}
|
||||
|
||||
for(;;){
|
||||
if (os_event_wait_time(mdl_killer_stop_event, 1000) == 0)
|
||||
break;
|
||||
|
||||
MYSQL_RES *result = xb_mysql_query(mysql,
|
||||
"SELECT ID, COMMAND, INFO FROM INFORMATION_SCHEMA.PROCESSLIST "
|
||||
" WHERE State='Waiting for table metadata lock'",
|
||||
true, true);
|
||||
while (MYSQL_ROW row = mysql_fetch_row(result))
|
||||
{
|
||||
char query[64];
|
||||
|
||||
if (row[1] && !strcmp(row[1], "Killed"))
|
||||
continue;
|
||||
|
||||
msg_ts("Killing MDL waiting %s ('%s') on connection %s\n",
|
||||
row[1], row[2], row[0]);
|
||||
snprintf(query, sizeof(query), "KILL QUERY %s", row[0]);
|
||||
if (mysql_query(mysql, query) && (mysql_errno(mysql) != ER_NO_SUCH_THREAD)) {
|
||||
msg("Error: failed to execute query %s: %s\n", query,mysql_error(mysql));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
mysql_free_result(result);
|
||||
}
|
||||
|
||||
mysql_close(mysql);
|
||||
|
||||
stop_thread:
|
||||
msg_ts("Kill mdl waiters thread stopped\n");
|
||||
os_event_set(mdl_killer_finished_event);
|
||||
os_thread_exit();
|
||||
return os_thread_ret_t(0);
|
||||
}
|
||||
|
||||
|
||||
static void start_mdl_waiters_killer()
|
||||
{
|
||||
mdl_killer_stop_event = os_event_create(0);
|
||||
mdl_killer_finished_event = os_event_create(0);
|
||||
os_thread_create(kill_mdl_waiters_thread, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
/* Tell MDL killer to stop and finish for its completion*/
|
||||
static void stop_mdl_waiters_killer()
|
||||
{
|
||||
os_event_set(mdl_killer_stop_event);
|
||||
os_event_wait(mdl_killer_finished_event);
|
||||
|
||||
os_event_destroy(mdl_killer_stop_event);
|
||||
os_event_destroy(mdl_killer_finished_event);
|
||||
}
|
||||
|
||||
/*********************************************************************//**
|
||||
Function acquires either a backup tables lock, if supported
|
||||
by the server, or a global read lock (FLUSH TABLES WITH READ LOCK)
|
||||
@@ -965,35 +886,11 @@ lock_tables(MYSQL *connection)
|
||||
}
|
||||
|
||||
if (have_backup_locks) {
|
||||
msg_ts("Executing LOCK TABLES FOR BACKUP...\n");
|
||||
msg("Executing LOCK TABLES FOR BACKUP...");
|
||||
xb_mysql_query(connection, "LOCK TABLES FOR BACKUP", false);
|
||||
return(true);
|
||||
}
|
||||
|
||||
if (opt_lock_ddl_per_table) {
|
||||
start_mdl_waiters_killer();
|
||||
}
|
||||
|
||||
if (!opt_lock_wait_timeout && !opt_kill_long_queries_timeout) {
|
||||
|
||||
/* We do first a FLUSH TABLES. If a long update is running, the
|
||||
FLUSH TABLES will wait but will not stall the whole mysqld, and
|
||||
when the long update is done the FLUSH TABLES WITH READ LOCK
|
||||
will start and succeed quickly. So, FLUSH TABLES is to lower
|
||||
the probability of a stage where both mysqldump and most client
|
||||
connections are stalled. Of course, if a second long update
|
||||
starts between the two FLUSHes, we have that bad stall.
|
||||
|
||||
Option lock_wait_timeout serve the same purpose and is not
|
||||
compatible with this trick.
|
||||
*/
|
||||
|
||||
msg_ts("Executing FLUSH NO_WRITE_TO_BINLOG TABLES...\n");
|
||||
|
||||
xb_mysql_query(connection,
|
||||
"FLUSH NO_WRITE_TO_BINLOG TABLES", false);
|
||||
}
|
||||
|
||||
if (opt_lock_wait_timeout) {
|
||||
if (!wait_for_no_updates(connection, opt_lock_wait_timeout,
|
||||
opt_lock_wait_threshold)) {
|
||||
@@ -1001,7 +898,7 @@ lock_tables(MYSQL *connection)
|
||||
}
|
||||
}
|
||||
|
||||
msg_ts("Executing FLUSH TABLES WITH READ LOCK...\n");
|
||||
msg("Acquiring BACKUP LOCKS...");
|
||||
|
||||
if (opt_kill_long_queries_timeout) {
|
||||
start_query_killer();
|
||||
@@ -1012,11 +909,10 @@ lock_tables(MYSQL *connection)
|
||||
"SET SESSION wsrep_causal_reads=0", false);
|
||||
}
|
||||
|
||||
xb_mysql_query(connection, "FLUSH TABLES WITH READ LOCK", false);
|
||||
|
||||
if (opt_lock_ddl_per_table) {
|
||||
stop_mdl_waiters_killer();
|
||||
}
|
||||
xb_mysql_query(connection, "BACKUP STAGE START", true);
|
||||
//xb_mysql_query(connection, "BACKUP STAGE FLUSH", true);
|
||||
//xb_mysql_query(connection, "BACKUP STAGE BLOCK_DDL", true);
|
||||
xb_mysql_query(connection, "BACKUP STAGE BLOCK_COMMIT", true);
|
||||
|
||||
if (opt_kill_long_queries_timeout) {
|
||||
stop_query_killer();
|
||||
@@ -1034,7 +930,7 @@ bool
|
||||
lock_binlog_maybe(MYSQL *connection)
|
||||
{
|
||||
if (have_backup_locks && !opt_no_lock && !binlog_locked) {
|
||||
msg_ts("Executing LOCK BINLOG FOR BACKUP...\n");
|
||||
msg("Executing LOCK BINLOG FOR BACKUP...");
|
||||
xb_mysql_query(connection, "LOCK BINLOG FOR BACKUP", false);
|
||||
binlog_locked = true;
|
||||
|
||||
@@ -1053,20 +949,15 @@ void
|
||||
unlock_all(MYSQL *connection)
|
||||
{
|
||||
if (opt_debug_sleep_before_unlock) {
|
||||
msg_ts("Debug sleep for %u seconds\n",
|
||||
msg("Debug sleep for %u seconds",
|
||||
opt_debug_sleep_before_unlock);
|
||||
os_thread_sleep(opt_debug_sleep_before_unlock * 1000);
|
||||
}
|
||||
|
||||
if (binlog_locked) {
|
||||
msg_ts("Executing UNLOCK BINLOG\n");
|
||||
xb_mysql_query(connection, "UNLOCK BINLOG", false);
|
||||
}
|
||||
msg("Executing BACKUP STAGE END");
|
||||
xb_mysql_query(connection, "BACKUP STAGE END", false);
|
||||
|
||||
msg_ts("Executing UNLOCK TABLES\n");
|
||||
xb_mysql_query(connection, "UNLOCK TABLES", false);
|
||||
|
||||
msg_ts("All tables unlocked\n");
|
||||
msg("All tables unlocked");
|
||||
}
|
||||
|
||||
|
||||
@@ -1117,7 +1008,7 @@ wait_for_safe_slave(MYSQL *connection)
|
||||
|
||||
if (!(read_master_log_pos && slave_sql_running)) {
|
||||
msg("Not checking slave open temp tables for "
|
||||
"--safe-slave-backup because host is not a slave\n");
|
||||
"--safe-slave-backup because host is not a slave");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -1131,36 +1022,36 @@ wait_for_safe_slave(MYSQL *connection)
|
||||
}
|
||||
|
||||
open_temp_tables = get_open_temp_tables(connection);
|
||||
msg_ts("Slave open temp tables: %d\n", open_temp_tables);
|
||||
msg("Slave open temp tables: %d", open_temp_tables);
|
||||
|
||||
while (open_temp_tables && n_attempts--) {
|
||||
msg_ts("Starting slave SQL thread, waiting %d seconds, then "
|
||||
msg("Starting slave SQL thread, waiting %d seconds, then "
|
||||
"checking Slave_open_temp_tables again (%d attempts "
|
||||
"remaining)...\n", sleep_time, n_attempts);
|
||||
"remaining)...", sleep_time, n_attempts);
|
||||
|
||||
xb_mysql_query(connection, "START SLAVE SQL_THREAD", false);
|
||||
os_thread_sleep(sleep_time * 1000000);
|
||||
xb_mysql_query(connection, "STOP SLAVE SQL_THREAD", false);
|
||||
|
||||
open_temp_tables = get_open_temp_tables(connection);
|
||||
msg_ts("Slave open temp tables: %d\n", open_temp_tables);
|
||||
msg("Slave open temp tables: %d", open_temp_tables);
|
||||
}
|
||||
|
||||
/* Restart the slave if it was running at start */
|
||||
if (open_temp_tables == 0) {
|
||||
msg_ts("Slave is safe to backup\n");
|
||||
msg("Slave is safe to backup");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
result = false;
|
||||
|
||||
if (sql_thread_started) {
|
||||
msg_ts("Restarting slave SQL thread.\n");
|
||||
msg("Restarting slave SQL thread.");
|
||||
xb_mysql_query(connection, "START SLAVE SQL_THREAD", false);
|
||||
}
|
||||
|
||||
msg_ts("Slave_open_temp_tables did not become zero after "
|
||||
"%d seconds\n", opt_safe_slave_backup_timeout);
|
||||
msg("Slave_open_temp_tables did not become zero after "
|
||||
"%d seconds", opt_safe_slave_backup_timeout);
|
||||
|
||||
cleanup:
|
||||
free_mysql_variables(status);
|
||||
@@ -1202,10 +1093,8 @@ write_slave_info(MYSQL *connection)
|
||||
|
||||
if (master == NULL || filename == NULL || position == NULL) {
|
||||
msg("Failed to get master binlog coordinates "
|
||||
"from SHOW SLAVE STATUS\n");
|
||||
msg("This means that the server is not a "
|
||||
"replication slave. Ignoring the --slave-info "
|
||||
"option\n");
|
||||
"from SHOW SLAVE STATUS.This means that the server is not a "
|
||||
"replication slave. Ignoring the --slave-info option");
|
||||
/* we still want to continue the backup */
|
||||
result = true;
|
||||
goto cleanup;
|
||||
@@ -1288,7 +1177,7 @@ write_galera_info(MYSQL *connection)
|
||||
|
||||
if ((state_uuid == NULL && state_uuid55 == NULL)
|
||||
|| (last_committed == NULL && last_committed55 == NULL)) {
|
||||
msg("Failed to get master wsrep state from SHOW STATUS.\n");
|
||||
msg("Failed to get master wsrep state from SHOW STATUS.");
|
||||
result = false;
|
||||
goto cleanup;
|
||||
}
|
||||
@@ -1801,9 +1690,9 @@ mdl_lock_table(ulint space_id)
|
||||
|
||||
std::ostringstream lock_query;
|
||||
lock_query << "SELECT 1 FROM " << full_table_name << " LIMIT 0";
|
||||
msg_ts("Locking MDL for %s\n", full_table_name.c_str());
|
||||
msg("Locking MDL for %s", full_table_name.c_str());
|
||||
if (mysql_query(mdl_con, lock_query.str().c_str())) {
|
||||
msg_ts("Warning : locking MDL failed for space id %zu, name %s\n", space_id, full_table_name.c_str());
|
||||
msg("Warning : locking MDL failed for space id %zu, name %s", space_id, full_table_name.c_str());
|
||||
} else {
|
||||
MYSQL_RES *r = mysql_store_result(mdl_con);
|
||||
mysql_free_result(r);
|
||||
@@ -1813,7 +1702,7 @@ mdl_lock_table(ulint space_id)
|
||||
void
|
||||
mdl_unlock_all()
|
||||
{
|
||||
msg_ts("Unlocking MDL for all tables\n");
|
||||
msg("Unlocking MDL for all tables");
|
||||
xb_mysql_query(mdl_con, "COMMIT", false, true);
|
||||
mysql_close(mdl_con);
|
||||
spaceid_to_tablename.clear();
|
||||
|
@@ -203,7 +203,7 @@ log_online_read_bitmap_page(
|
||||
/* The following call prints an error message */
|
||||
os_file_get_last_error(TRUE);
|
||||
msg("InnoDB: Warning: failed reading changed page bitmap "
|
||||
"file \'%s\'\n", bitmap_file->name);
|
||||
"file \'%s\'", bitmap_file->name);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -282,7 +282,7 @@ log_online_setup_bitmap_file_range(
|
||||
bitmap_dir = os_file_opendir(srv_data_home, FALSE);
|
||||
if (UNIV_UNLIKELY(!bitmap_dir)) {
|
||||
|
||||
msg("InnoDB: Error: failed to open bitmap directory \'%s\'\n",
|
||||
msg("InnoDB: Error: failed to open bitmap directory \'%s\'",
|
||||
srv_data_home);
|
||||
return FALSE;
|
||||
}
|
||||
@@ -332,7 +332,7 @@ log_online_setup_bitmap_file_range(
|
||||
if (UNIV_UNLIKELY(os_file_closedir(bitmap_dir))) {
|
||||
|
||||
os_file_get_last_error(TRUE);
|
||||
msg("InnoDB: Error: cannot close \'%s\'\n",srv_data_home);
|
||||
msg("InnoDB: Error: cannot close \'%s\'",srv_data_home);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -349,7 +349,7 @@ log_online_setup_bitmap_file_range(
|
||||
bitmap_dir = os_file_opendir(srv_data_home, FALSE);
|
||||
if (UNIV_UNLIKELY(!bitmap_dir)) {
|
||||
|
||||
msg("InnoDB: Error: failed to open bitmap directory \'%s\'\n",
|
||||
msg("InnoDB: Error: failed to open bitmap directory \'%s\'",
|
||||
srv_data_home);
|
||||
return FALSE;
|
||||
}
|
||||
@@ -380,7 +380,7 @@ log_online_setup_bitmap_file_range(
|
||||
if (UNIV_UNLIKELY(array_pos >= bitmap_files->count)) {
|
||||
|
||||
msg("InnoDB: Error: inconsistent bitmap file "
|
||||
"directory\n");
|
||||
"directory");
|
||||
free(bitmap_files->files);
|
||||
return FALSE;
|
||||
}
|
||||
@@ -400,7 +400,7 @@ log_online_setup_bitmap_file_range(
|
||||
if (UNIV_UNLIKELY(os_file_closedir(bitmap_dir))) {
|
||||
|
||||
os_file_get_last_error(TRUE);
|
||||
msg("InnoDB: Error: cannot close \'%s\'\n", srv_data_home);
|
||||
msg("InnoDB: Error: cannot close \'%s\'", srv_data_home);
|
||||
free(bitmap_files->files);
|
||||
return FALSE;
|
||||
}
|
||||
@@ -451,7 +451,7 @@ log_online_open_bitmap_file_read_only(
|
||||
/* Here and below assume that bitmap file names do not
|
||||
contain apostrophes, thus no need for ut_print_filename(). */
|
||||
msg("InnoDB: Warning: error opening the changed page "
|
||||
"bitmap \'%s\'\n", bitmap_file->name);
|
||||
"bitmap \'%s\'", bitmap_file->name);
|
||||
return success;
|
||||
}
|
||||
|
||||
@@ -495,7 +495,7 @@ log_online_diagnose_bitmap_eof(
|
||||
itself. */
|
||||
|
||||
msg("InnoDB: Warning: junk at the end of changed "
|
||||
"page bitmap file \'%s\'.\n", bitmap_file->name);
|
||||
"page bitmap file \'%s\'.", bitmap_file->name);
|
||||
}
|
||||
|
||||
if (UNIV_UNLIKELY(!last_page_in_run)) {
|
||||
@@ -506,7 +506,7 @@ log_online_diagnose_bitmap_eof(
|
||||
for the whole server */
|
||||
msg("InnoDB: Warning: changed page bitmap "
|
||||
"file \'%s\' does not contain a complete run "
|
||||
"at the end.\n", bitmap_file->name);
|
||||
"at the end.", bitmap_file->name);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@@ -537,7 +537,7 @@ xb_msg_missing_lsn_data(
|
||||
lsn_t missing_interval_end) /*!<in: interval end */
|
||||
{
|
||||
msg("mariabackup: warning: changed page data missing for LSNs between "
|
||||
LSN_PF " and " LSN_PF "\n", missing_interval_start,
|
||||
LSN_PF " and " LSN_PF, missing_interval_start,
|
||||
missing_interval_end);
|
||||
}
|
||||
|
||||
@@ -615,7 +615,7 @@ xb_page_bitmap_init(void)
|
||||
|
||||
msg("mariabackup: incremental backup LSN " LSN_PF
|
||||
" is larger than than the last checkpoint LSN " LSN_PF
|
||||
"\n", bmp_start_lsn, bmp_end_lsn);
|
||||
, bmp_start_lsn, bmp_end_lsn);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -699,7 +699,7 @@ xb_page_bitmap_init(void)
|
||||
bmp_start_lsn))) {
|
||||
|
||||
msg("mariabackup: Warning: changed page bitmap file "
|
||||
"\'%s\' corrupted\n", bitmap_file.name);
|
||||
"\'%s\' corrupted", bitmap_file.name);
|
||||
rbt_free(result);
|
||||
free(bitmap_files.files);
|
||||
os_file_close(bitmap_file.file);
|
||||
@@ -804,7 +804,7 @@ xb_page_bitmap_init(void)
|
||||
if (UNIV_UNLIKELY(!last_page_ok)) {
|
||||
|
||||
msg("mariabackup: warning: changed page bitmap file "
|
||||
"\'%s\' corrupted.\n", bitmap_file.name);
|
||||
"\'%s\' corrupted.", bitmap_file.name);
|
||||
rbt_free(result);
|
||||
free(bitmap_files.files);
|
||||
os_file_close(bitmap_file.file);
|
||||
|
@@ -72,7 +72,7 @@ static inline int asprintf(char **strp, const char *fmt,...)
|
||||
#define xb_a(expr) \
|
||||
do { \
|
||||
if (!(expr)) { \
|
||||
msg("Assertion \"%s\" failed at %s:%lu\n", \
|
||||
fprintf(stderr,"Assertion \"%s\" failed at %s:%lu\n", \
|
||||
#expr, __FILE__, (ulong) __LINE__); \
|
||||
abort(); \
|
||||
} \
|
||||
@@ -86,42 +86,55 @@ static inline int asprintf(char **strp, const char *fmt,...)
|
||||
|
||||
#define XB_DELTA_INFO_SUFFIX ".meta"
|
||||
|
||||
static inline int msg(const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
|
||||
static inline int msg(const char *fmt, ...)
|
||||
static inline int msg1(uint thread_num, const char *prefix, const char *fmt, va_list args)
|
||||
{
|
||||
int result;
|
||||
va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
result = vfprintf(stderr, fmt, args);
|
||||
va_end(args);
|
||||
|
||||
return result;
|
||||
int result;
|
||||
time_t t = time(NULL);
|
||||
char date[100];
|
||||
char *line;
|
||||
strftime(date, sizeof(date), "%Y-%m-%d %H:%M:%S", localtime(&t));
|
||||
result = vasprintf(&line, fmt, args);
|
||||
if (result != -1) {
|
||||
if (fmt && fmt[strlen(fmt)] != '\n')
|
||||
result = fprintf(stderr, "[%02u] %s%s %s\n", thread_num, prefix, date, line);
|
||||
else
|
||||
result = fprintf(stderr, "[%02u] %s%s %s", thread_num, prefix, date, line);
|
||||
free(line);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static inline int msg_ts(const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
|
||||
static inline int msg_ts(const char *fmt, ...)
|
||||
static inline ATTRIBUTE_FORMAT(printf, 2, 3) int msg(unsigned int thread_num, const char *fmt, ...)
|
||||
{
|
||||
int result;
|
||||
time_t t = time(NULL);
|
||||
char date[100];
|
||||
char *line;
|
||||
va_list args;
|
||||
|
||||
strftime(date, sizeof(date), "%y%m%d %H:%M:%S", localtime(&t));
|
||||
|
||||
va_start(args, fmt);
|
||||
result = vasprintf(&line, fmt, args);
|
||||
va_end(args);
|
||||
|
||||
if (result != -1) {
|
||||
result = fprintf(stderr, "%s %s", date, line);
|
||||
free(line);
|
||||
}
|
||||
|
||||
return result;
|
||||
int result;
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
result = msg1(thread_num,"", fmt, args);
|
||||
va_end(args);
|
||||
return result;
|
||||
}
|
||||
|
||||
static inline ATTRIBUTE_FORMAT(printf, 1, 2) int msg(const char *fmt, ...)
|
||||
{
|
||||
int result;
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
result = msg1(0, "", fmt, args);
|
||||
va_end(args);
|
||||
return result;
|
||||
}
|
||||
|
||||
static inline ATTRIBUTE_FORMAT(printf, 1,2) ATTRIBUTE_NORETURN void die(const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
msg1(0, "FATAL ERROR: ", fmt, args);
|
||||
va_end(args);
|
||||
fflush(stderr);
|
||||
_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
/* Use POSIX_FADV_NORMAL when available */
|
||||
|
||||
#ifdef POSIX_FADV_NORMAL
|
||||
|
@@ -49,8 +49,7 @@ ds_create(const char *root, ds_type_t type)
|
||||
#ifdef HAVE_LIBARCHIVE
|
||||
ds = &datasink_archive;
|
||||
#else
|
||||
msg("Error : mariabackup was built without libarchive support");
|
||||
exit(EXIT_FAILURE);
|
||||
die("mariabackup was built without libarchive support");
|
||||
#endif
|
||||
break;
|
||||
case DS_TYPE_XBSTREAM:
|
||||
@@ -61,8 +60,7 @@ ds_create(const char *root, ds_type_t type)
|
||||
break;
|
||||
case DS_TYPE_ENCRYPT:
|
||||
case DS_TYPE_DECRYPT:
|
||||
msg("Error : mariabackup does not support encrypted backups.");
|
||||
exit(EXIT_FAILURE);
|
||||
die("mariabackup does not support encrypted backups.");
|
||||
break;
|
||||
|
||||
case DS_TYPE_TMPFILE:
|
||||
@@ -72,7 +70,7 @@ ds_create(const char *root, ds_type_t type)
|
||||
ds = &datasink_buffer;
|
||||
break;
|
||||
default:
|
||||
msg("Unknown datasink type: %d\n", type);
|
||||
msg("Unknown datasink type: %d", type);
|
||||
xb_ad(0);
|
||||
return NULL;
|
||||
}
|
||||
@@ -81,8 +79,7 @@ ds_create(const char *root, ds_type_t type)
|
||||
if (ctxt != NULL) {
|
||||
ctxt->datasink = ds;
|
||||
} else {
|
||||
msg("Error: failed to initialize datasink.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
die("failed to initialize datasink.");
|
||||
}
|
||||
|
||||
return ctxt;
|
@@ -71,7 +71,7 @@ buffer_init(const char *root)
|
||||
ds_ctxt_t *ctxt;
|
||||
ds_buffer_ctxt_t *buffer_ctxt;
|
||||
|
||||
ctxt = my_malloc(sizeof(ds_ctxt_t) + sizeof(ds_buffer_ctxt_t),
|
||||
ctxt = (ds_ctxt_t *)my_malloc(sizeof(ds_ctxt_t) + sizeof(ds_buffer_ctxt_t),
|
||||
MYF(MY_FAE));
|
||||
buffer_ctxt = (ds_buffer_ctxt_t *) (ctxt + 1);
|
||||
buffer_ctxt->buffer_size = DS_DEFAULT_BUFFER_SIZE;
|
||||
@@ -96,7 +96,7 @@ buffer_open(ds_ctxt_t *ctxt, const char *path, MY_STAT *mystat)
|
||||
|
||||
dst_file = ds_open(pipe_ctxt, path, mystat);
|
||||
if (dst_file == NULL) {
|
||||
exit(EXIT_FAILURE);
|
||||
die("ds_open(%s) failed", path);
|
||||
}
|
||||
|
||||
buffer_ctxt = (ds_buffer_ctxt_t *) ctxt->ptr;
|
@@ -96,7 +96,7 @@ compress_init(const char *root)
|
||||
/* Create and initialize the worker threads */
|
||||
threads = create_worker_threads(xtrabackup_compress_threads);
|
||||
if (threads == NULL) {
|
||||
msg("compress: failed to create worker threads.\n");
|
||||
msg("compress: failed to create worker threads.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ compress_write(ds_file_t *file, const uchar *buf, size_t len)
|
||||
write_uint64_le(dest_file,
|
||||
comp_file->bytes_processed)) {
|
||||
msg("compress: write to the destination stream "
|
||||
"failed.\n");
|
||||
"failed.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ compress_write(ds_file_t *file, const uchar *buf, size_t len)
|
||||
ds_write(dest_file, threads[i].to,
|
||||
threads[i].to_len)) {
|
||||
msg("compress: write to the destination stream "
|
||||
"failed.\n");
|
||||
"failed.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -368,7 +368,7 @@ create_worker_threads(uint n)
|
||||
if (pthread_create(&thd->id, NULL, compress_worker_thread_func,
|
||||
thd)) {
|
||||
msg("compress: pthread_create() failed: "
|
||||
"errno = %d\n", errno);
|
||||
"errno = %d", errno);
|
||||
goto err;
|
||||
}
|
||||
}
|
@@ -23,7 +23,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
#include <mysys_err.h>
|
||||
#include "common.h"
|
||||
#include "datasink.h"
|
||||
#include "univ.i"
|
||||
#include "fsp0fsp.h"
|
||||
#ifdef _WIN32
|
||||
#include <winioctl.h>
|
||||
|
@@ -49,7 +49,7 @@ stdout_init(const char *root)
|
||||
{
|
||||
ds_ctxt_t *ctxt;
|
||||
|
||||
ctxt = my_malloc(sizeof(ds_ctxt_t), MYF(MY_FAE));
|
||||
ctxt = (ds_ctxt_t *)my_malloc(sizeof(ds_ctxt_t), MYF(MY_FAE));
|
||||
|
||||
ctxt->root = my_strdup(root, MYF(MY_FAE));
|
||||
|
@@ -61,7 +61,7 @@ tmpfile_init(const char *root)
|
||||
ds_ctxt_t *ctxt;
|
||||
ds_tmpfile_ctxt_t *tmpfile_ctxt;
|
||||
|
||||
ctxt = my_malloc(sizeof(ds_ctxt_t) + sizeof(ds_tmpfile_ctxt_t),
|
||||
ctxt = (ds_ctxt_t *)my_malloc(sizeof(ds_ctxt_t) + sizeof(ds_tmpfile_ctxt_t),
|
||||
MYF(MY_FAE));
|
||||
tmpfile_ctxt = (ds_tmpfile_ctxt_t *) (ctxt + 1);
|
||||
tmpfile_ctxt->file_list = NULL;
|
||||
@@ -178,12 +178,11 @@ tmpfile_deinit(ds_ctxt_t *ctxt)
|
||||
/* Walk the files in the order they have been added */
|
||||
list = list_reverse(list);
|
||||
while (list != NULL) {
|
||||
tmp_file = list->data;
|
||||
tmp_file = (ds_tmp_file_t *)list->data;
|
||||
/* Stat the file to replace size and mtime on the original
|
||||
* mystat struct */
|
||||
if (my_fstat(tmp_file->fd, &mystat, MYF(0))) {
|
||||
msg("error: my_fstat() failed.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
die("my_fstat() failed.");
|
||||
}
|
||||
tmp_file->mystat.st_size = mystat.st_size;
|
||||
tmp_file->mystat.st_mtime = mystat.st_mtime;
|
||||
@@ -191,32 +190,29 @@ tmpfile_deinit(ds_ctxt_t *ctxt)
|
||||
dst_file = ds_open(pipe_ctxt, tmp_file->orig_path,
|
||||
&tmp_file->mystat);
|
||||
if (dst_file == NULL) {
|
||||
msg("error: could not stream a temporary file to "
|
||||
"'%s'\n", tmp_file->orig_path);
|
||||
exit(EXIT_FAILURE);
|
||||
die("could not stream a temporary file to "
|
||||
"'%s'", tmp_file->orig_path);
|
||||
}
|
||||
|
||||
/* copy to the destination datasink */
|
||||
posix_fadvise(tmp_file->fd, 0, 0, POSIX_FADV_SEQUENTIAL);
|
||||
if (my_seek(tmp_file->fd, 0, SEEK_SET, MYF(0)) ==
|
||||
MY_FILEPOS_ERROR) {
|
||||
msg("error: my_seek() failed for '%s', errno = %d.\n",
|
||||
die("my_seek() failed for '%s', errno = %d.",
|
||||
tmp_file->file->path, my_errno);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
offset = 0;
|
||||
while ((bytes = my_read(tmp_file->fd, buf, buf_size,
|
||||
while ((bytes = my_read(tmp_file->fd, (unsigned char *)buf, buf_size,
|
||||
MYF(MY_WME))) > 0) {
|
||||
posix_fadvise(tmp_file->fd, offset, buf_size, POSIX_FADV_DONTNEED);
|
||||
offset += buf_size;
|
||||
if (ds_write(dst_file, buf, bytes)) {
|
||||
msg("error: cannot write to stream for '%s'.\n",
|
||||
die("cannot write to stream for '%s'.",
|
||||
tmp_file->orig_path);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
if (bytes == (size_t) -1) {
|
||||
exit(EXIT_FAILURE);
|
||||
die("my_read failed for %s", tmp_file->orig_path);
|
||||
}
|
||||
|
||||
my_close(tmp_file->fd, MYF(MY_WME));
|
@@ -79,18 +79,18 @@ xbstream_init(const char *root __attribute__((unused)))
|
||||
ds_stream_ctxt_t *stream_ctxt;
|
||||
xb_wstream_t *xbstream;
|
||||
|
||||
ctxt = my_malloc(sizeof(ds_ctxt_t) + sizeof(ds_stream_ctxt_t),
|
||||
ctxt = (ds_ctxt_t *)my_malloc(sizeof(ds_ctxt_t) + sizeof(ds_stream_ctxt_t),
|
||||
MYF(MY_FAE));
|
||||
stream_ctxt = (ds_stream_ctxt_t *)(ctxt + 1);
|
||||
|
||||
if (pthread_mutex_init(&stream_ctxt->mutex, NULL)) {
|
||||
msg("xbstream_init: pthread_mutex_init() failed.\n");
|
||||
msg("xbstream_init: pthread_mutex_init() failed.");
|
||||
goto err;
|
||||
}
|
||||
|
||||
xbstream = xb_stream_write_new();
|
||||
if (xbstream == NULL) {
|
||||
msg("xb_stream_write_new() failed.\n");
|
||||
msg("xb_stream_write_new() failed.");
|
||||
goto err;
|
||||
}
|
||||
stream_ctxt->xbstream = xbstream;
|
||||
@@ -143,7 +143,7 @@ xbstream_open(ds_ctxt_t *ctxt, const char *path, MY_STAT *mystat)
|
||||
my_xbstream_write_callback);
|
||||
|
||||
if (xbstream_file == NULL) {
|
||||
msg("xb_stream_write_open() failed.\n");
|
||||
msg("xb_stream_write_open() failed.");
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ xbstream_write(ds_file_t *file, const uchar *buf, size_t len)
|
||||
xbstream_file = stream_file->xbstream_file;
|
||||
|
||||
if (xb_stream_write_data(xbstream_file, buf, len)) {
|
||||
msg("xb_stream_write_data() failed.\n");
|
||||
msg("xb_stream_write_data() failed.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ xbstream_deinit(ds_ctxt_t *ctxt)
|
||||
stream_ctxt = (ds_stream_ctxt_t *) ctxt->ptr;
|
||||
|
||||
if (xb_stream_write_done(stream_ctxt->xbstream)) {
|
||||
msg("xb_stream_done() failed.\n");
|
||||
msg("xb_stream_done() failed.");
|
||||
}
|
||||
|
||||
if (stream_ctxt->dest_file) {
|
@@ -61,8 +61,7 @@ static std::string get_encryption_plugin_from_cnf()
|
||||
FILE *f = fopen("backup-my.cnf", "r");
|
||||
if (!f)
|
||||
{
|
||||
msg("cannot open backup-my.cnf for reading\n");
|
||||
exit(EXIT_FAILURE);
|
||||
die("Can't open backup-my.cnf for reading");
|
||||
}
|
||||
char line[512];
|
||||
std::string plugin_load;
|
||||
@@ -183,7 +182,7 @@ void encryption_plugin_prepare_init(int argc, char **argv)
|
||||
std::string plugin_load= get_encryption_plugin_from_cnf();
|
||||
if (plugin_load.size())
|
||||
{
|
||||
msg("Loading encryption plugin from %s\n", plugin_load.c_str());
|
||||
msg("Loading encryption plugin from %s", plugin_load.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -210,9 +209,9 @@ static void encryption_plugin_init(int argc, char **argv)
|
||||
/* Patch optional and mandatory plugins, we only need to load the one in xb_plugin_load. */
|
||||
mysql_optional_plugins[0] = mysql_mandatory_plugins[0] = 0;
|
||||
plugin_maturity = MariaDB_PLUGIN_MATURITY_UNKNOWN; /* mariabackup accepts all plugins */
|
||||
msg("Loading encryption plugin\n");
|
||||
msg("Loading encryption plugin");
|
||||
for (int i= 1; i < argc; i++)
|
||||
msg("\t Encryption plugin parameter : '%s'\n", argv[i]);
|
||||
msg("\t Encryption plugin parameter : '%s'", argv[i]);
|
||||
plugin_init(&argc, argv, PLUGIN_INIT_SKIP_PLUGIN_TABLE);
|
||||
}
|
||||
|
||||
|
@@ -30,6 +30,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
#include <trx0sys.h>
|
||||
|
||||
#include "fil_cur.h"
|
||||
#include "fil0crypt.h"
|
||||
#include "fil0pagecompress.h"
|
||||
#include "common.h"
|
||||
#include "read_filt.h"
|
||||
#include "xtrabackup.h"
|
||||
@@ -109,7 +111,6 @@ xb_fil_node_close_file(
|
||||
|
||||
ut_a(fil_system.n_open > 0);
|
||||
fil_system.n_open--;
|
||||
fil_n_file_opened--;
|
||||
|
||||
if (node->space->purpose == FIL_TYPE_TABLESPACE &&
|
||||
fil_is_user_tablespace_id(node->space->id)) {
|
||||
@@ -159,8 +160,11 @@ xb_fil_cur_open(
|
||||
/* In the backup mode we should already have a tablespace handle created
|
||||
by fil_ibd_load() unless it is a system
|
||||
tablespace. Otherwise we open the file here. */
|
||||
if (cursor->is_system() || srv_operation == SRV_OPERATION_RESTORE_DELTA
|
||||
|| xb_close_files) {
|
||||
if (!node->is_open()) {
|
||||
ut_ad(cursor->is_system()
|
||||
|| srv_operation == SRV_OPERATION_RESTORE_DELTA
|
||||
|| xb_close_files);
|
||||
|
||||
node->handle = os_file_create_simple_no_error_handling(
|
||||
0, node->name,
|
||||
OS_FILE_OPEN,
|
||||
@@ -169,16 +173,14 @@ xb_fil_cur_open(
|
||||
/* The following call prints an error message */
|
||||
os_file_get_last_error(TRUE);
|
||||
|
||||
msg("[%02u] mariabackup: error: cannot open "
|
||||
"tablespace %s\n",
|
||||
thread_n, cursor->abs_path);
|
||||
msg(thread_n, "mariabackup: error: cannot open "
|
||||
"tablespace %s", cursor->abs_path);
|
||||
|
||||
return(XB_FIL_CUR_SKIP);
|
||||
}
|
||||
mutex_enter(&fil_system.mutex);
|
||||
|
||||
fil_system.n_open++;
|
||||
fil_n_file_opened++;
|
||||
|
||||
if (node->space->purpose == FIL_TYPE_TABLESPACE &&
|
||||
fil_is_user_tablespace_id(node->space->id)) {
|
||||
@@ -213,8 +215,8 @@ xb_fil_cur_open(
|
||||
cursor->statinfo.st_size = (ulonglong)max_file_size;
|
||||
}
|
||||
if (err) {
|
||||
msg("[%02u] mariabackup: error: cannot fstat %s\n",
|
||||
thread_n, cursor->abs_path);
|
||||
msg(thread_n, "mariabackup: error: cannot fstat %s",
|
||||
cursor->abs_path);
|
||||
|
||||
xb_fil_cur_close(cursor);
|
||||
|
||||
@@ -229,7 +231,7 @@ xb_fil_cur_open(
|
||||
|
||||
posix_fadvise(cursor->file, 0, 0, POSIX_FADV_SEQUENTIAL);
|
||||
|
||||
const page_size_t page_size(cursor->node->space->flags);
|
||||
const page_size_t page_size(node->space->flags);
|
||||
cursor->page_size = page_size;
|
||||
|
||||
/* Allocate read buffer */
|
||||
@@ -245,6 +247,19 @@ xb_fil_cur_open(
|
||||
cursor->buf_page_no = 0;
|
||||
cursor->thread_n = thread_n;
|
||||
|
||||
if (!node->space->crypt_data
|
||||
&& os_file_read(IORequestRead,
|
||||
node->handle, cursor->buf, 0,
|
||||
page_size.physical())) {
|
||||
mutex_enter(&fil_system.mutex);
|
||||
if (!node->space->crypt_data) {
|
||||
node->space->crypt_data
|
||||
= fil_space_read_crypt_data(page_size,
|
||||
cursor->buf);
|
||||
}
|
||||
mutex_exit(&fil_system.mutex);
|
||||
}
|
||||
|
||||
cursor->space_size = (ulint)(cursor->statinfo.st_size
|
||||
/ page_size.physical());
|
||||
|
||||
@@ -255,6 +270,107 @@ xb_fil_cur_open(
|
||||
return(XB_FIL_CUR_SUCCESS);
|
||||
}
|
||||
|
||||
static bool page_is_corrupted(const byte *page, ulint page_no,
|
||||
const xb_fil_cur_t *cursor,
|
||||
const fil_space_t *space)
|
||||
{
|
||||
byte tmp_frame[UNIV_PAGE_SIZE_MAX];
|
||||
byte tmp_page[UNIV_PAGE_SIZE_MAX];
|
||||
const ulint page_size = cursor->page_size.physical();
|
||||
ulint page_type = mach_read_from_2(page + FIL_PAGE_TYPE);
|
||||
|
||||
/* We ignore the doublewrite buffer pages.*/
|
||||
if (cursor->space_id == TRX_SYS_SPACE
|
||||
&& page_no >= FSP_EXTENT_SIZE
|
||||
&& page_no < FSP_EXTENT_SIZE * 3) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Validate page number. */
|
||||
if (mach_read_from_4(page + FIL_PAGE_OFFSET) != page_no
|
||||
&& cursor->space_id != TRX_SYS_SPACE) {
|
||||
/* On pages that are not all zero, the
|
||||
page number must match.
|
||||
|
||||
There may be a mismatch on tablespace ID,
|
||||
because files may be renamed during backup.
|
||||
We disable the page number check
|
||||
on the system tablespace, because it may consist
|
||||
of multiple files, and here we count the pages
|
||||
from the start of each file.)
|
||||
|
||||
The first 38 and last 8 bytes are never encrypted. */
|
||||
const ulint* p = reinterpret_cast<const ulint*>(page);
|
||||
const ulint* const end = reinterpret_cast<const ulint*>(
|
||||
page + page_size);
|
||||
do {
|
||||
if (*p++) {
|
||||
return true;
|
||||
}
|
||||
} while (p != end);
|
||||
|
||||
/* Whole zero page is valid. */
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Validate encrypted pages. The first page is never encrypted.
|
||||
In the system tablespace, the first page would be written with
|
||||
FIL_PAGE_FILE_FLUSH_LSN at shutdown, and if the LSN exceeds
|
||||
4,294,967,295, the mach_read_from_4() below would wrongly
|
||||
interpret the page as encrypted. We prevent that by checking
|
||||
page_no first. */
|
||||
if (page_no
|
||||
&& mach_read_from_4(page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION)
|
||||
&& (opt_encrypted_backup
|
||||
|| (space->crypt_data
|
||||
&& space->crypt_data->type != CRYPT_SCHEME_UNENCRYPTED))) {
|
||||
|
||||
if (!fil_space_verify_crypt_checksum(page, cursor->page_size))
|
||||
return true;
|
||||
|
||||
/* Compressed encrypted need to be decrypted
|
||||
and decompressed for verification. */
|
||||
if (page_type != FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED
|
||||
&& !opt_extended_validation)
|
||||
return false;
|
||||
|
||||
memcpy(tmp_page, page, page_size);
|
||||
|
||||
bool decrypted = false;
|
||||
if (!space->crypt_data
|
||||
|| space->crypt_data->type == CRYPT_SCHEME_UNENCRYPTED
|
||||
|| !fil_space_decrypt(space, tmp_frame, tmp_page,
|
||||
&decrypted)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (page_type != FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) {
|
||||
return buf_page_is_corrupted(true, tmp_page,
|
||||
cursor->page_size, space);
|
||||
}
|
||||
}
|
||||
|
||||
if (page_type == FIL_PAGE_PAGE_COMPRESSED) {
|
||||
memcpy(tmp_page, page, page_size);
|
||||
}
|
||||
|
||||
if (page_type == FIL_PAGE_PAGE_COMPRESSED
|
||||
|| page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) {
|
||||
ulint decomp = fil_page_decompress(tmp_frame, tmp_page);
|
||||
page_type = mach_read_from_2(tmp_page + FIL_PAGE_TYPE);
|
||||
|
||||
return (!decomp
|
||||
|| (decomp != srv_page_size
|
||||
&& cursor->page_size.is_compressed())
|
||||
|| page_type == FIL_PAGE_PAGE_COMPRESSED
|
||||
|| page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED
|
||||
|| buf_page_is_corrupted(true, tmp_page,
|
||||
cursor->page_size, space));
|
||||
}
|
||||
|
||||
return buf_page_is_corrupted(true, page, cursor->page_size, space);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
Reads and verifies the next block of pages from the source
|
||||
file. Positions the cursor after the last read non-corrupted page.
|
||||
@@ -266,7 +382,6 @@ xb_fil_cur_read(
|
||||
/*============*/
|
||||
xb_fil_cur_t* cursor) /*!< in/out: source file cursor */
|
||||
{
|
||||
ibool success;
|
||||
byte* page;
|
||||
ulint i;
|
||||
ulint npages;
|
||||
@@ -294,14 +409,8 @@ xb_fil_cur_read(
|
||||
&& offset + to_read == cursor->statinfo.st_size) {
|
||||
|
||||
if (to_read < (ib_int64_t) page_size) {
|
||||
msg("[%02u] mariabackup: Warning: junk at the end of "
|
||||
"%s:\n", cursor->thread_n, cursor->abs_path);
|
||||
msg("[%02u] mariabackup: Warning: offset = %llu, "
|
||||
"to_read = %llu\n",
|
||||
cursor->thread_n,
|
||||
(unsigned long long) offset,
|
||||
(unsigned long long) to_read);
|
||||
|
||||
msg(cursor->thread_n, "Warning: junk at the end of "
|
||||
"%s, offset = %llu, to_read = %llu",cursor->abs_path, (ulonglong) offset, (ulonglong) to_read);
|
||||
return(XB_FIL_CUR_EOF);
|
||||
}
|
||||
|
||||
@@ -311,75 +420,61 @@ xb_fil_cur_read(
|
||||
|
||||
xb_a((to_read & (page_size - 1)) == 0);
|
||||
|
||||
npages = (ulint) (to_read / cursor->page_size.physical());
|
||||
npages = (ulint) (to_read / page_size);
|
||||
|
||||
retry_count = 10;
|
||||
ret = XB_FIL_CUR_SUCCESS;
|
||||
|
||||
fil_space_t *space = fil_space_acquire_for_io(cursor->space_id);
|
||||
|
||||
if (!space) {
|
||||
return XB_FIL_CUR_ERROR;
|
||||
}
|
||||
|
||||
read_retry:
|
||||
xtrabackup_io_throttling();
|
||||
|
||||
cursor->buf_read = 0;
|
||||
cursor->buf_npages = 0;
|
||||
cursor->buf_offset = offset;
|
||||
cursor->buf_page_no = (ulint)(offset / cursor->page_size.physical());
|
||||
cursor->buf_page_no = (ulint)(offset / page_size);
|
||||
|
||||
fil_space_t* space = fil_space_get(cursor->space_id);
|
||||
|
||||
if (!space) {
|
||||
return(XB_FIL_CUR_ERROR);
|
||||
if (!os_file_read(IORequestRead, cursor->file, cursor->buf, offset,
|
||||
(ulint) to_read)) {
|
||||
ret = XB_FIL_CUR_ERROR;
|
||||
goto func_exit;
|
||||
}
|
||||
|
||||
success = os_file_read(IORequestRead,
|
||||
cursor->file, cursor->buf, offset,
|
||||
(ulint) to_read);
|
||||
if (!success) {
|
||||
return(XB_FIL_CUR_ERROR);
|
||||
}
|
||||
|
||||
/* check pages for corruption and re-read if necessary. i.e. in case of
|
||||
partially written pages */
|
||||
for (page = cursor->buf, i = 0; i < npages;
|
||||
page += page_size, i++) {
|
||||
ulint page_no = cursor->buf_page_no + i;
|
||||
|
||||
if (cursor->space_id == TRX_SYS_SPACE &&
|
||||
page_no >= FSP_EXTENT_SIZE &&
|
||||
page_no < FSP_EXTENT_SIZE * 3) {
|
||||
/* We ignore the doublewrite buffer pages */
|
||||
} else if (!fil_space_verify_crypt_checksum(
|
||||
page, cursor->page_size, space->id, page_no)
|
||||
&& buf_page_is_corrupted(true, page,
|
||||
cursor->page_size,
|
||||
space)) {
|
||||
retry_count--;
|
||||
if (retry_count == 0) {
|
||||
msg("[%02u] mariabackup: "
|
||||
"Error: failed to read page after "
|
||||
"10 retries. File %s seems to be "
|
||||
"corrupted.\n", cursor->thread_n,
|
||||
cursor->abs_path);
|
||||
ret = XB_FIL_CUR_ERROR;
|
||||
break;
|
||||
}
|
||||
if (page_is_corrupted(page, page_no, cursor, space)){
|
||||
retry_count--;
|
||||
|
||||
if (retry_count == 9) {
|
||||
msg("[%02u] mariabackup: "
|
||||
"Database page corruption detected at page "
|
||||
ULINTPF ", retrying...\n",
|
||||
cursor->thread_n, page_no);
|
||||
}
|
||||
|
||||
os_thread_sleep(100000);
|
||||
|
||||
goto read_retry;
|
||||
}
|
||||
cursor->buf_read += page_size;
|
||||
cursor->buf_npages++;
|
||||
if (retry_count == 0) {
|
||||
msg(cursor->thread_n,
|
||||
"Error: failed to read page after "
|
||||
"10 retries. File %s seems to be "
|
||||
"corrupted.", cursor->abs_path);
|
||||
ret = XB_FIL_CUR_ERROR;
|
||||
buf_page_print(page, cursor->page_size);
|
||||
break;
|
||||
}
|
||||
msg(cursor->thread_n, "Database page corruption detected at page "
|
||||
ULINTPF ", retrying...",
|
||||
page_no);
|
||||
os_thread_sleep(100000);
|
||||
goto read_retry;
|
||||
}
|
||||
cursor->buf_read += page_size;
|
||||
cursor->buf_npages++;
|
||||
}
|
||||
|
||||
posix_fadvise(cursor->file, offset, to_read, POSIX_FADV_DONTNEED);
|
||||
|
||||
func_exit:
|
||||
space->release_for_io();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
@@ -738,7 +738,7 @@ ibx_get_one_option(int optid,
|
||||
exit(0);
|
||||
break;
|
||||
case 'v':
|
||||
msg("innobackupex version %s %s (%s)\n",
|
||||
printf("innobackupex version %s %s (%s)",
|
||||
MYSQL_SERVER_VERSION,
|
||||
SYSTEM_TYPE, MACHINE_TYPE);
|
||||
exit(0);
|
||||
|
@@ -80,9 +80,8 @@ wf_incremental_init(xb_write_filt_ctxt_t *ctxt, char *dst_name,
|
||||
cp->delta_buf = (unsigned char *)os_mem_alloc_large(&cp->delta_buf_size);
|
||||
|
||||
if (!cp->delta_buf) {
|
||||
msg("[%02u] mariabackup: Error: "
|
||||
"cannot allocate %zu bytes\n",
|
||||
cursor->thread_n, (size_t) cp->delta_buf_size);
|
||||
msg(cursor->thread_n,"Can't allocate %zu bytes",
|
||||
(size_t) cp->delta_buf_size);
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
@@ -91,9 +90,9 @@ wf_incremental_init(xb_write_filt_ctxt_t *ctxt, char *dst_name,
|
||||
XB_DELTA_INFO_SUFFIX);
|
||||
const xb_delta_info_t info(cursor->page_size, cursor->space_id);
|
||||
if (!xb_write_delta_metadata(meta_name, &info)) {
|
||||
msg("[%02u] mariabackup: Error: "
|
||||
"failed to write meta info for %s\n",
|
||||
cursor->thread_n, cursor->rel_path);
|
||||
msg(cursor->thread_n,"Error: "
|
||||
"failed to write meta info for %s",
|
||||
cursor->rel_path);
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
@@ -92,7 +92,7 @@ xb_write_galera_info(bool incremental_prepare)
|
||||
fp = fopen(XB_GALERA_INFO_FILENAME, "w");
|
||||
if (fp == NULL) {
|
||||
|
||||
msg("mariabackup: error: "
|
||||
die(
|
||||
"could not create " XB_GALERA_INFO_FILENAME
|
||||
", errno = %d\n",
|
||||
errno);
|
||||
@@ -106,11 +106,10 @@ xb_write_galera_info(bool incremental_prepare)
|
||||
|
||||
if (fprintf(fp, "%s:%lld", uuid_str, (long long) seqno) < 0) {
|
||||
|
||||
msg("mariabackup: error: "
|
||||
die(
|
||||
"could not write to " XB_GALERA_INFO_FILENAME
|
||||
", errno = %d\n",
|
||||
errno);
|
||||
exit(EXIT_FAILURE);
|
||||
errno);;
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
|
@@ -45,7 +45,6 @@ datasink_t datasink_archive;
|
||||
datasink_t datasink_xbstream;
|
||||
datasink_t datasink_compress;
|
||||
datasink_t datasink_tmpfile;
|
||||
datasink_t datasink_buffer;
|
||||
|
||||
static run_mode_t opt_mode;
|
||||
static char * opt_directory = NULL;
|
||||
@@ -106,7 +105,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (opt_mode == RUN_MODE_NONE) {
|
||||
msg("%s: either -c or -x must be specified.\n", my_progname);
|
||||
msg("%s: either -c or -x must be specified.", my_progname);
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -184,7 +183,7 @@ int
|
||||
set_run_mode(run_mode_t mode)
|
||||
{
|
||||
if (opt_mode != RUN_MODE_NONE) {
|
||||
msg("%s: can't set specify both -c and -x.\n", my_progname);
|
||||
msg("%s: can't set specify both -c and -x.", my_progname);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -233,7 +232,7 @@ stream_one_file(File file, xb_wstream_file_t *xbfile)
|
||||
while ((bytes = (ssize_t)my_read(file, buf, XBSTREAM_BUFFER_SIZE,
|
||||
MYF(MY_WME))) > 0) {
|
||||
if (xb_stream_write_data(xbfile, buf, bytes)) {
|
||||
msg("%s: xb_stream_write_data() failed.\n",
|
||||
msg("%s: xb_stream_write_data() failed.",
|
||||
my_progname);
|
||||
my_free(buf);
|
||||
return 1;
|
||||
@@ -262,13 +261,13 @@ mode_create(int argc, char **argv)
|
||||
xb_wstream_t *stream;
|
||||
|
||||
if (argc < 1) {
|
||||
msg("%s: no files are specified.\n", my_progname);
|
||||
msg("%s: no files are specified.", my_progname);
|
||||
return 1;
|
||||
}
|
||||
|
||||
stream = xb_stream_write_new();
|
||||
if (stream == NULL) {
|
||||
msg("%s: xb_stream_write_new() failed.\n", my_progname);
|
||||
msg("%s: xb_stream_write_new() failed.", my_progname);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -281,13 +280,13 @@ mode_create(int argc, char **argv)
|
||||
goto err;
|
||||
}
|
||||
if (!MY_S_ISREG(mystat.st_mode)) {
|
||||
msg("%s: %s is not a regular file, exiting.\n",
|
||||
msg("%s: %s is not a regular file, exiting.",
|
||||
my_progname, filepath);
|
||||
goto err;
|
||||
}
|
||||
|
||||
if ((src_file = my_open(filepath, O_RDONLY, MYF(MY_WME))) < 0) {
|
||||
msg("%s: failed to open %s.\n", my_progname, filepath);
|
||||
msg("%s: failed to open %s.", my_progname, filepath);
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -297,7 +296,7 @@ mode_create(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (opt_verbose) {
|
||||
msg("%s\n", filepath);
|
||||
msg("%s", filepath);
|
||||
}
|
||||
|
||||
if (stream_one_file(src_file, file) ||
|
||||
@@ -338,12 +337,12 @@ file_entry_new(extract_ctxt_t *ctxt, const char *path, uint pathlen)
|
||||
file = ds_open(ctxt->ds_ctxt, path, NULL);
|
||||
|
||||
if (file == NULL) {
|
||||
msg("%s: failed to create file.\n", my_progname);
|
||||
msg("%s: failed to create file.", my_progname);
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (opt_verbose) {
|
||||
msg("%s\n", entry->path);
|
||||
msg("%s", entry->path);
|
||||
}
|
||||
|
||||
entry->file = file;
|
||||
@@ -425,7 +424,7 @@ extract_worker_thread_func(void *arg)
|
||||
break;
|
||||
}
|
||||
if (my_hash_insert(ctxt->filehash, (uchar *) entry)) {
|
||||
msg("%s: my_hash_insert() failed.\n",
|
||||
msg("%s: my_hash_insert() failed.",
|
||||
my_progname);
|
||||
pthread_mutex_unlock(ctxt->mutex);
|
||||
break;
|
||||
@@ -454,7 +453,7 @@ extract_worker_thread_func(void *arg)
|
||||
|
||||
if (entry->offset != chunk.offset) {
|
||||
msg("%s: out-of-order chunk: real offset = 0x%llx, "
|
||||
"expected offset = 0x%llx\n", my_progname,
|
||||
"expected offset = 0x%llx", my_progname,
|
||||
chunk.offset, entry->offset);
|
||||
pthread_mutex_unlock(&entry->mutex);
|
||||
res = XB_STREAM_READ_ERROR;
|
||||
@@ -462,7 +461,7 @@ extract_worker_thread_func(void *arg)
|
||||
}
|
||||
|
||||
if (ds_write(entry->file, chunk.data, chunk.length)) {
|
||||
msg("%s: my_write() failed.\n", my_progname);
|
||||
msg("%s: my_write() failed.", my_progname);
|
||||
pthread_mutex_unlock(&entry->mutex);
|
||||
res = XB_STREAM_READ_ERROR;
|
||||
break;
|
||||
@@ -500,12 +499,12 @@ mode_extract(int n_threads, int argc __attribute__((unused)),
|
||||
if (my_hash_init(&filehash, &my_charset_bin, START_FILE_HASH_SIZE,
|
||||
0, 0, (my_hash_get_key) get_file_entry_key,
|
||||
(my_hash_free_key) file_entry_free, MYF(0))) {
|
||||
msg("%s: failed to initialize file hash.\n", my_progname);
|
||||
msg("%s: failed to initialize file hash.", my_progname);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (pthread_mutex_init(&mutex, NULL)) {
|
||||
msg("%s: failed to initialize mutex.\n", my_progname);
|
||||
msg("%s: failed to initialize mutex.", my_progname);
|
||||
my_hash_free(&filehash);
|
||||
return 1;
|
||||
}
|
||||
@@ -520,7 +519,7 @@ mode_extract(int n_threads, int argc __attribute__((unused)),
|
||||
|
||||
stream = xb_stream_read_new();
|
||||
if (stream == NULL) {
|
||||
msg("%s: xb_stream_read_new() failed.\n", my_progname);
|
||||
msg("%s: xb_stream_read_new() failed.", my_progname);
|
||||
pthread_mutex_destroy(&mutex);
|
||||
ret = 1;
|
||||
goto exit;
|
||||
@@ -531,8 +530,8 @@ mode_extract(int n_threads, int argc __attribute__((unused)),
|
||||
ctxt.ds_ctxt = ds_ctxt;
|
||||
ctxt.mutex = &mutex;
|
||||
|
||||
tids = calloc(n_threads, sizeof(pthread_t));
|
||||
retvals = calloc(n_threads, sizeof(void*));
|
||||
tids = (pthread_t *)calloc(n_threads, sizeof(pthread_t));
|
||||
retvals = (void **)calloc(n_threads, sizeof(void*));
|
||||
|
||||
for (i = 0; i < n_threads; i++)
|
||||
pthread_create(tids + i, NULL, extract_worker_thread_func,
|
@@ -101,6 +101,6 @@ xb_rstream_result_t xb_stream_read_chunk(xb_rstream_t *stream,
|
||||
|
||||
int xb_stream_read_done(xb_rstream_t *stream);
|
||||
|
||||
int xb_stream_validate_checksum(xb_rstream_chunk_t *chunk);
|
||||
xb_rstream_result_t xb_stream_validate_checksum(xb_rstream_chunk_t *chunk);
|
||||
|
||||
#endif
|
||||
|
@@ -67,15 +67,15 @@ validate_chunk_type(uchar code)
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
xb_rstream_result_t
|
||||
xb_stream_validate_checksum(xb_rstream_chunk_t *chunk)
|
||||
{
|
||||
ulong checksum;
|
||||
|
||||
checksum = crc32_iso3309(0, chunk->data, (uint)chunk->length);
|
||||
checksum = crc32_iso3309(0, (unsigned char *)chunk->data, (uint)chunk->length);
|
||||
if (checksum != chunk->checksum) {
|
||||
msg("xb_stream_read_chunk(): invalid checksum at offset "
|
||||
"0x%llx: expected 0x%lx, read 0x%lx.\n",
|
||||
"0x%llx: expected 0x%lx, read 0x%lx.",
|
||||
(ulonglong) chunk->checksum_offset, chunk->checksum,
|
||||
checksum);
|
||||
return XB_STREAM_READ_ERROR;
|
||||
@@ -86,8 +86,8 @@ xb_stream_validate_checksum(xb_rstream_chunk_t *chunk)
|
||||
|
||||
#define F_READ(buf,len) \
|
||||
do { \
|
||||
if (xb_read_full(fd, buf, len) < len) { \
|
||||
msg("xb_stream_read_chunk(): my_read() failed.\n"); \
|
||||
if (xb_read_full(fd, (uchar *)buf, len) < len) { \
|
||||
msg("xb_stream_read_chunk(): my_read() failed."); \
|
||||
goto err; \
|
||||
} \
|
||||
} while (0)
|
||||
@@ -111,7 +111,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk)
|
||||
return XB_STREAM_READ_EOF;
|
||||
} else if (tbytes < CHUNK_HEADER_CONSTANT_LEN) {
|
||||
msg("xb_stream_read_chunk(): unexpected end of stream at "
|
||||
"offset 0x%llx.\n", stream->offset);
|
||||
"offset 0x%llx.", stream->offset);
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk)
|
||||
/* Chunk magic value */
|
||||
if (memcmp(tmpbuf, XB_STREAM_CHUNK_MAGIC, 8)) {
|
||||
msg("xb_stream_read_chunk(): wrong chunk magic at offset "
|
||||
"0x%llx.\n", (ulonglong) stream->offset);
|
||||
"0x%llx.", (ulonglong) stream->offset);
|
||||
goto err;
|
||||
}
|
||||
ptr += 8;
|
||||
@@ -135,7 +135,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk)
|
||||
if (chunk->type == XB_CHUNK_TYPE_UNKNOWN &&
|
||||
!(chunk->flags & XB_STREAM_FLAG_IGNORABLE)) {
|
||||
msg("xb_stream_read_chunk(): unknown chunk type 0x%lu at "
|
||||
"offset 0x%llx.\n", (ulong) *ptr,
|
||||
"offset 0x%llx.", (ulong) *ptr,
|
||||
(ulonglong) stream->offset);
|
||||
goto err;
|
||||
}
|
||||
@@ -146,7 +146,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk)
|
||||
pathlen = uint4korr(ptr);
|
||||
if (pathlen >= FN_REFLEN) {
|
||||
msg("xb_stream_read_chunk(): path length (%lu) is too large at "
|
||||
"offset 0x%llx.\n", (ulong) pathlen, stream->offset);
|
||||
"offset 0x%llx.", (ulong) pathlen, stream->offset);
|
||||
goto err;
|
||||
}
|
||||
chunk->pathlen = pathlen;
|
||||
@@ -170,7 +170,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk)
|
||||
ullval = uint8korr(tmpbuf);
|
||||
if (ullval > (ulonglong) SIZE_T_MAX) {
|
||||
msg("xb_stream_read_chunk(): chunk length is too large at "
|
||||
"offset 0x%llx: 0x%llx.\n", (ulonglong) stream->offset,
|
||||
"offset 0x%llx: 0x%llx.", (ulonglong) stream->offset,
|
||||
ullval);
|
||||
goto err;
|
||||
}
|
||||
@@ -181,7 +181,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk)
|
||||
ullval = uint8korr(tmpbuf + 8);
|
||||
if (ullval > (ulonglong) MY_OFF_T_MAX) {
|
||||
msg("xb_stream_read_chunk(): chunk offset is too large at "
|
||||
"offset 0x%llx: 0x%llx.\n", (ulonglong) stream->offset,
|
||||
"offset 0x%llx: 0x%llx.", (ulonglong) stream->offset,
|
||||
ullval);
|
||||
goto err;
|
||||
}
|
||||
@@ -194,7 +194,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk)
|
||||
MYF(MY_WME | MY_ALLOW_ZERO_PTR));
|
||||
if (chunk->data == NULL) {
|
||||
msg("xb_stream_read_chunk(): failed to increase buffer "
|
||||
"to %lu bytes.\n", (ulong) chunk->length);
|
||||
"to %lu bytes.", (ulong) chunk->length);
|
||||
goto err;
|
||||
}
|
||||
chunk->buflen = chunk->length;
|
@@ -55,7 +55,7 @@ xb_stream_default_write_callback(xb_wstream_file_t *file __attribute__((unused))
|
||||
void *userdata __attribute__((unused)),
|
||||
const void *buf, size_t len)
|
||||
{
|
||||
if (my_write(my_fileno(stdout), buf, len, MYF(MY_WME | MY_NABP)))
|
||||
if (my_write(my_fileno(stdout), (const uchar *)buf, len, MYF(MY_WME | MY_NABP)))
|
||||
return -1;
|
||||
return len;
|
||||
}
|
||||
@@ -83,7 +83,7 @@ xb_stream_write_open(xb_wstream_t *stream, const char *path,
|
||||
path_len = strlen(path);
|
||||
|
||||
if (path_len > FN_REFLEN) {
|
||||
msg("xb_stream_write_open(): file path is too long.\n");
|
||||
msg("xb_stream_write_open(): file path is too long.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ xb_stream_write_chunk(xb_wstream_file_t *file, const void *buf, size_t len)
|
||||
int8store(ptr, len); /* Payload length */
|
||||
ptr += 8;
|
||||
|
||||
checksum = crc32_iso3309(0, buf, (uint)len); /* checksum */
|
||||
checksum = crc32_iso3309(0, (const uchar *)buf, (uint)len); /* checksum */
|
||||
|
||||
pthread_mutex_lock(&stream->mutex);
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -71,7 +71,7 @@ extern char *xtrabackup_databases_file;
|
||||
extern char *xtrabackup_tables_exclude;
|
||||
extern char *xtrabackup_databases_exclude;
|
||||
|
||||
extern ibool xtrabackup_compress;
|
||||
extern uint xtrabackup_compress;
|
||||
|
||||
extern my_bool xtrabackup_backup;
|
||||
extern my_bool xtrabackup_prepare;
|
||||
@@ -86,14 +86,10 @@ extern int xtrabackup_parallel;
|
||||
|
||||
extern my_bool xb_close_files;
|
||||
extern const char *xtrabackup_compress_alg;
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
extern uint xtrabackup_compress_threads;
|
||||
extern ulonglong xtrabackup_compress_chunk_size;
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
extern uint xtrabackup_compress_threads;
|
||||
extern ulonglong xtrabackup_compress_chunk_size;
|
||||
|
||||
extern my_bool xtrabackup_export;
|
||||
extern char *xtrabackup_extra_lsndir;
|
||||
extern ulint xtrabackup_log_copy_interval;
|
||||
@@ -111,6 +107,8 @@ extern my_bool opt_noversioncheck;
|
||||
extern my_bool opt_no_backup_locks;
|
||||
extern my_bool opt_decompress;
|
||||
extern my_bool opt_remove_original;
|
||||
extern my_bool opt_extended_validation;
|
||||
extern my_bool opt_encrypted_backup;
|
||||
extern my_bool opt_lock_ddl_per_table;
|
||||
|
||||
extern char *opt_incremental_history_name;
|
||||
|
@@ -87,7 +87,7 @@ static void usage(void)
|
||||
{
|
||||
print_version();
|
||||
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
|
||||
printf("Print a description for a system error code or a MySQL error code.\n");
|
||||
printf("Print a description for a system error code or a MariaDB error code.\n");
|
||||
printf("If you want to get the error for a negative error code, you should use\n-- before the first error code to tell perror that there was no more options.\n\n");
|
||||
printf("Usage: %s [OPTIONS] [ERRORCODE [ERRORCODE...]]\n",my_progname);
|
||||
my_print_help(my_long_options);
|
||||
@@ -336,7 +336,7 @@ int main(int argc,char *argv[])
|
||||
{
|
||||
found= 1;
|
||||
if (verbose)
|
||||
printf("MySQL error code %3d: %s\n", code, msg);
|
||||
printf("MariaDB error code %3d: %s\n", code, msg);
|
||||
else
|
||||
puts(msg);
|
||||
}
|
||||
@@ -344,7 +344,7 @@ int main(int argc,char *argv[])
|
||||
{
|
||||
found= 1;
|
||||
if (verbose)
|
||||
printf("MySQL error code %3d (%s): %s\n", code, name, msg);
|
||||
printf("MariaDB error code %3d (%s): %s\n", code, name, msg);
|
||||
else
|
||||
puts(msg);
|
||||
}
|
||||
|
@@ -75,7 +75,7 @@ static void print_version(void)
|
||||
static void usage()
|
||||
{
|
||||
print_version();
|
||||
printf("MySQL AB, by Sasha Pachev\n");
|
||||
printf("MariaDB Corporation, originally created by Sasha Pachev\n");
|
||||
printf("This software comes with ABSOLUTELY NO WARRANTY\n\n");
|
||||
printf("Resolve numeric stack strace dump into symbols.\n\n");
|
||||
printf("Usage: %s [OPTIONS] symbols-file [numeric-dump-file]\n",
|
||||
|
@@ -295,6 +295,7 @@ int SSL_connect(SSL* ssl)
|
||||
sendClientHello(*ssl);
|
||||
if (!ssl->GetError())
|
||||
ssl->useStates().UseConnect() = CLIENT_HELLO_SENT;
|
||||
/* fall through */
|
||||
|
||||
case CLIENT_HELLO_SENT :
|
||||
neededState = ssl->getSecurity().get_resuming() ?
|
||||
@@ -309,6 +310,7 @@ int SSL_connect(SSL* ssl)
|
||||
}
|
||||
if (!ssl->GetError())
|
||||
ssl->useStates().UseConnect() = FIRST_REPLY_DONE;
|
||||
/* fall through */
|
||||
|
||||
case FIRST_REPLY_DONE :
|
||||
if(ssl->getCrypto().get_certManager().sendVerify())
|
||||
@@ -326,6 +328,7 @@ int SSL_connect(SSL* ssl)
|
||||
|
||||
if (!ssl->GetError())
|
||||
ssl->useStates().UseConnect() = FINISHED_DONE;
|
||||
/* fall through */
|
||||
|
||||
case FINISHED_DONE :
|
||||
if (!ssl->getSecurity().get_resuming())
|
||||
@@ -335,6 +338,7 @@ int SSL_connect(SSL* ssl)
|
||||
}
|
||||
if (!ssl->GetError())
|
||||
ssl->useStates().UseConnect() = SECOND_REPLY_DONE;
|
||||
/* fall through */
|
||||
|
||||
case SECOND_REPLY_DONE :
|
||||
ssl->verifyState(serverFinishedComplete);
|
||||
@@ -371,7 +375,6 @@ int SSL_accept(SSL* ssl)
|
||||
ssl->SetError(no_error);
|
||||
|
||||
if (ssl->GetError() == YasslError(SSL_ERROR_WANT_WRITE)) {
|
||||
|
||||
ssl->SetError(no_error);
|
||||
ssl->SendWriteBuffered();
|
||||
if (!ssl->GetError())
|
||||
@@ -385,6 +388,7 @@ int SSL_accept(SSL* ssl)
|
||||
processReply(*ssl);
|
||||
if (!ssl->GetError())
|
||||
ssl->useStates().UseAccept() = ACCEPT_FIRST_REPLY_DONE;
|
||||
/* fall through */
|
||||
|
||||
case ACCEPT_FIRST_REPLY_DONE :
|
||||
sendServerHello(*ssl);
|
||||
@@ -404,6 +408,7 @@ int SSL_accept(SSL* ssl)
|
||||
|
||||
if (!ssl->GetError())
|
||||
ssl->useStates().UseAccept() = SERVER_HELLO_DONE;
|
||||
/* fall through */
|
||||
|
||||
case SERVER_HELLO_DONE :
|
||||
if (!ssl->getSecurity().get_resuming()) {
|
||||
@@ -414,6 +419,7 @@ int SSL_accept(SSL* ssl)
|
||||
}
|
||||
if (!ssl->GetError())
|
||||
ssl->useStates().UseAccept() = ACCEPT_SECOND_REPLY_DONE;
|
||||
/* fall through */
|
||||
|
||||
case ACCEPT_SECOND_REPLY_DONE :
|
||||
sendChangeCipher(*ssl);
|
||||
@@ -422,6 +428,7 @@ int SSL_accept(SSL* ssl)
|
||||
|
||||
if (!ssl->GetError())
|
||||
ssl->useStates().UseAccept() = ACCEPT_FINISHED_DONE;
|
||||
/* fall through */
|
||||
|
||||
case ACCEPT_FINISHED_DONE :
|
||||
if (ssl->getSecurity().get_resuming()) {
|
||||
@@ -432,6 +439,7 @@ int SSL_accept(SSL* ssl)
|
||||
}
|
||||
if (!ssl->GetError())
|
||||
ssl->useStates().UseAccept() = ACCEPT_THIRD_REPLY_DONE;
|
||||
/* fall through */
|
||||
|
||||
case ACCEPT_THIRD_REPLY_DONE :
|
||||
ssl->useLog().ShowTCP(ssl->getSocket().get_fd());
|
||||
|
34
include/aria_backup.h
Normal file
34
include/aria_backup.h
Normal file
@@ -0,0 +1,34 @@
|
||||
/* Copyright (C) 2018 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
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
|
||||
|
||||
/* Interfaces for doing backups of Aria tables */
|
||||
|
||||
typedef struct st_aria_table_capabilities
|
||||
{
|
||||
my_off_t header_size;
|
||||
ulong bitmap_pages_covered;
|
||||
uint block_size;
|
||||
uint keypage_header;
|
||||
my_bool checksum;
|
||||
my_bool transactional;
|
||||
/* This is true if the table can be copied without any locks */
|
||||
my_bool online_backup_safe;
|
||||
} ARIA_TABLE_CAPABILITIES;
|
||||
|
||||
int aria_get_capabilities(File kfile, ARIA_TABLE_CAPABILITIES *cap);
|
||||
int aria_read_index(File kfile, ARIA_TABLE_CAPABILITIES *cap, ulonglong block,
|
||||
uchar *buffer);
|
||||
int aria_read_data(File dfile, ARIA_TABLE_CAPABILITIES *cap, ulonglong block,
|
||||
uchar *buffer, size_t *bytes_read);
|
@@ -174,11 +174,11 @@ enum json_value_types
|
||||
{
|
||||
JSON_VALUE_OBJECT=1,
|
||||
JSON_VALUE_ARRAY=2,
|
||||
JSON_VALUE_STRING,
|
||||
JSON_VALUE_NUMBER,
|
||||
JSON_VALUE_TRUE,
|
||||
JSON_VALUE_FALSE,
|
||||
JSON_VALUE_NULL
|
||||
JSON_VALUE_STRING=3,
|
||||
JSON_VALUE_NUMBER=4,
|
||||
JSON_VALUE_TRUE=5,
|
||||
JSON_VALUE_FALSE=6,
|
||||
JSON_VALUE_NULL=7
|
||||
};
|
||||
|
||||
|
||||
@@ -423,10 +423,15 @@ int json_path_parts_compare(
|
||||
int json_path_compare(const json_path_t *a, const json_path_t *b,
|
||||
enum json_value_types vt);
|
||||
|
||||
int json_valid(const char *js, size_t js_len, CHARSET_INFO *cs);
|
||||
|
||||
int json_locate_key(const char *js, const char *js_end,
|
||||
const char *kname,
|
||||
const char **key_start, const char **key_end,
|
||||
int *comma_pos);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* JSON_LIB_INCLUDED */
|
||||
|
||||
|
@@ -167,6 +167,8 @@ void *lf_hash_search_using_hash_value(LF_HASH *hash, LF_PINS *pins,
|
||||
int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen);
|
||||
int lf_hash_iterate(LF_HASH *hash, LF_PINS *pins,
|
||||
my_hash_walk_action action, void *argument);
|
||||
#define lf_hash_size(hash) \
|
||||
my_atomic_load32_explicit(&(hash)->count, MY_MEMORY_ORDER_RELAXED)
|
||||
/*
|
||||
shortcut macros to access underlying pinbox functions from an LF_HASH
|
||||
see lf_pinbox_get_pins() and lf_pinbox_put_pins()
|
||||
|
49
include/my_counter.h
Normal file
49
include/my_counter.h
Normal file
@@ -0,0 +1,49 @@
|
||||
#ifndef MY_COUNTER_H_INCLUDED
|
||||
#define MY_COUNTER_H_INCLUDED
|
||||
/*
|
||||
Copyright (C) 2018 MariaDB Foundation
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <atomic>
|
||||
|
||||
|
||||
template <typename Type> class Atomic_counter
|
||||
{
|
||||
std::atomic<Type> m_counter;
|
||||
|
||||
Type add(Type i) { return m_counter.fetch_add(i, std::memory_order_relaxed); }
|
||||
Type sub(Type i) { return m_counter.fetch_sub(i, std::memory_order_relaxed); }
|
||||
|
||||
public:
|
||||
Atomic_counter(const Atomic_counter<Type> &rhs)
|
||||
{ m_counter.store(rhs, std::memory_order_relaxed); }
|
||||
Atomic_counter(Type val): m_counter(val) {}
|
||||
Atomic_counter() {}
|
||||
|
||||
Type operator++(int) { return add(1); }
|
||||
Type operator--(int) { return sub(1); }
|
||||
|
||||
Type operator++() { return add(1) + 1; }
|
||||
Type operator--() { return sub(1) - 1; }
|
||||
|
||||
Type operator+=(const Type i) { return add(i) + i; }
|
||||
Type operator-=(const Type i) { return sub(i) - i; }
|
||||
|
||||
operator Type() const { return m_counter.load(std::memory_order_relaxed); }
|
||||
Type operator=(const Type val)
|
||||
{ m_counter.store(val, std::memory_order_relaxed); return val; }
|
||||
};
|
||||
#endif /* MY_COUNTER_H_INCLUDED */
|
@@ -1068,7 +1068,7 @@ typedef ulong myf; /* Type of MyFlags in my_funcs */
|
||||
static inline char *dlerror(void)
|
||||
{
|
||||
static char win_errormsg[2048];
|
||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
0, GetLastError(), 0, win_errormsg, 2048, NULL);
|
||||
return win_errormsg;
|
||||
}
|
||||
|
@@ -189,7 +189,19 @@ extern int my_pthread_create_detached;
|
||||
int sigwait(sigset_t *set, int *sig);
|
||||
#endif
|
||||
|
||||
#define my_sigwait(A,B) sigwait((A),(B))
|
||||
static inline int my_sigwait(sigset_t *set, int *sig, int *code)
|
||||
{
|
||||
#ifdef HAVE_SIGWAITINFO
|
||||
siginfo_t siginfo;
|
||||
*sig= sigwaitinfo(set, &siginfo);
|
||||
*code= siginfo.si_code;
|
||||
return *sig < 0 ? errno : 0;
|
||||
#else
|
||||
#define SI_KERNEL 128
|
||||
*code= 0;
|
||||
return sigwait(set, sig);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(HAVE_SIGTHREADMASK) && !defined(HAVE_PTHREAD_SIGMASK)
|
||||
#define pthread_sigmask(A,B,C) sigthreadmask((A),(B),(C))
|
||||
|
@@ -57,13 +57,6 @@ extern uchar days_in_month[];
|
||||
|
||||
/* Flags to str_to_datetime */
|
||||
|
||||
/*
|
||||
TIME_FUZZY_DATES is used for the result will only be used for comparison
|
||||
purposes. Conversion is as relaxed as possible.
|
||||
*/
|
||||
#define C_TIME_FUZZY_DATES 1U
|
||||
#define C_TIME_DATETIME_ONLY 2U
|
||||
#define C_TIME_TIME_ONLY 4U
|
||||
#define C_TIME_NO_ZERO_IN_DATE (1UL << 23) /* == MODE_NO_ZERO_IN_DATE */
|
||||
#define C_TIME_NO_ZERO_DATE (1UL << 24) /* == MODE_NO_ZERO_DATE */
|
||||
#define C_TIME_INVALID_DATES (1UL << 25) /* == MODE_INVALID_DATES */
|
||||
@@ -86,6 +79,16 @@ extern uchar days_in_month[];
|
||||
/* Useful constants */
|
||||
#define SECONDS_IN_24H 86400L
|
||||
|
||||
/* Limits for the INTERVAL data type */
|
||||
|
||||
/* Number of hours between '0001-01-01 00h' and '9999-12-31 23h' */
|
||||
#define TIME_MAX_INTERVAL_HOUR 87649415
|
||||
#define TIME_MAX_INTERVAL_HOUR_CHAR_LENGTH 8
|
||||
|
||||
/* Number of full days between '0001-01-01' and '9999-12-31'*/
|
||||
#define TIME_MAX_INTERVAL_DAY 3652058 /*87649415/24*/
|
||||
#define TIME_MAX_INTERVAL_DAY_CHAR_LENGTH 7
|
||||
|
||||
/* Limits for the TIME data type */
|
||||
#define TIME_MAX_HOUR 838
|
||||
#define TIME_MAX_MINUTE 59
|
||||
@@ -105,27 +108,46 @@ typedef struct st_mysql_time_status
|
||||
{
|
||||
int warnings;
|
||||
uint precision;
|
||||
uint nanoseconds;
|
||||
} MYSQL_TIME_STATUS;
|
||||
|
||||
static inline void my_time_status_init(MYSQL_TIME_STATUS *status)
|
||||
{
|
||||
status->warnings= 0;
|
||||
status->precision= 0;
|
||||
status->nanoseconds= 0;
|
||||
}
|
||||
|
||||
my_bool check_date(const MYSQL_TIME *ltime, my_bool not_zero_date,
|
||||
ulonglong flags, int *was_cut);
|
||||
my_bool str_to_DDhhmmssff(const char *str, size_t length, MYSQL_TIME *l_time,
|
||||
ulong max_hour, MYSQL_TIME_STATUS *status);
|
||||
my_bool str_to_time(const char *str, size_t length, MYSQL_TIME *l_time,
|
||||
ulonglong flag, MYSQL_TIME_STATUS *status);
|
||||
my_bool str_to_datetime(const char *str, size_t length, MYSQL_TIME *l_time,
|
||||
ulonglong flags, MYSQL_TIME_STATUS *status);
|
||||
longlong number_to_datetime(longlong nr, ulong sec_part, MYSQL_TIME *time_res,
|
||||
ulonglong flags, int *was_cut);
|
||||
my_bool str_to_datetime_or_date_or_time(const char *str, size_t length,
|
||||
MYSQL_TIME *to, ulonglong flag,
|
||||
MYSQL_TIME_STATUS *status,
|
||||
ulong time_max_hour,
|
||||
ulong time_err_hour);
|
||||
my_bool
|
||||
str_to_datetime_or_date_or_interval_hhmmssff(const char *str, size_t length,
|
||||
MYSQL_TIME *to, ulonglong flag,
|
||||
MYSQL_TIME_STATUS *status,
|
||||
ulong time_max_hour,
|
||||
ulong time_err_hour);
|
||||
my_bool
|
||||
str_to_datetime_or_date_or_interval_day(const char *str, size_t length,
|
||||
MYSQL_TIME *to, ulonglong flag,
|
||||
MYSQL_TIME_STATUS *status,
|
||||
ulong time_max_hour,
|
||||
ulong time_err_hour);
|
||||
my_bool str_to_datetime_or_date(const char *str, size_t length, MYSQL_TIME *to,
|
||||
ulonglong flags, MYSQL_TIME_STATUS *status);
|
||||
|
||||
longlong number_to_datetime_or_date(longlong nr, ulong sec_part,
|
||||
MYSQL_TIME *time_res,
|
||||
ulonglong flags, int *was_cut);
|
||||
int number_to_time_only(my_bool neg, ulonglong nr, ulong sec_part,
|
||||
ulong max_hour, MYSQL_TIME *to, int *was_cut);
|
||||
|
||||
int number_to_time(my_bool neg, ulonglong nr, ulong sec_part,
|
||||
MYSQL_TIME *ltime, int *was_cut);
|
||||
ulonglong TIME_to_ulonglong_datetime(const MYSQL_TIME *);
|
||||
ulonglong TIME_to_ulonglong_date(const MYSQL_TIME *);
|
||||
ulonglong TIME_to_ulonglong_time(const MYSQL_TIME *);
|
||||
@@ -188,6 +210,7 @@ void set_zero_time(MYSQL_TIME *tm, enum enum_mysql_timestamp_type time_type);
|
||||
#define MAX_DATE_STRING_REP_LENGTH 30
|
||||
#define AUTO_SEC_PART_DIGITS DECIMAL_NOT_SPECIFIED
|
||||
|
||||
int my_interval_DDhhmmssff_to_str(const MYSQL_TIME *, char *to, uint digits);
|
||||
int my_time_to_str(const MYSQL_TIME *l_time, char *to, uint digits);
|
||||
int my_date_to_str(const MYSQL_TIME *l_time, char *to);
|
||||
int my_datetime_to_str(const MYSQL_TIME *l_time, char *to, uint digits);
|
||||
|
@@ -75,7 +75,7 @@ typedef struct st_mysql_xid MYSQL_XID;
|
||||
#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0104
|
||||
|
||||
/* MariaDB plugin interface version */
|
||||
#define MARIA_PLUGIN_INTERFACE_VERSION 0x010d
|
||||
#define MARIA_PLUGIN_INTERFACE_VERSION 0x010e
|
||||
|
||||
/*
|
||||
The allowable types of plugins
|
||||
|
@@ -374,6 +374,51 @@ extern struct thd_wait_service_st {
|
||||
} *thd_wait_service;
|
||||
void thd_wait_begin(void* thd, int wait_type);
|
||||
void thd_wait_end(void* thd);
|
||||
enum json_types
|
||||
{
|
||||
JSV_BAD_JSON=-1,
|
||||
JSV_NOTHING=0,
|
||||
JSV_OBJECT=1,
|
||||
JSV_ARRAY=2,
|
||||
JSV_STRING=3,
|
||||
JSV_NUMBER=4,
|
||||
JSV_TRUE=5,
|
||||
JSV_FALSE=6,
|
||||
JSV_NULL=7
|
||||
};
|
||||
extern struct json_service_st {
|
||||
enum json_types (*json_type)(const char *js, const char *js_end,
|
||||
const char **value, int *value_len);
|
||||
enum json_types (*json_get_array_item)(const char *js, const char *js_end,
|
||||
int n_item,
|
||||
const char **value, int *value_len);
|
||||
enum json_types (*json_get_object_key)(const char *js, const char *js_end,
|
||||
const char *key,
|
||||
const char **value, int *value_len);
|
||||
enum json_types (*json_get_object_nkey)(const char *js,const char *js_end,
|
||||
int nkey,
|
||||
const char **keyname, const char **keyname_end,
|
||||
const char **value, int *value_len);
|
||||
int (*json_escape_string)(const char *str,const char *str_end,
|
||||
char *json, char *json_end);
|
||||
int (*json_unescape_json)(const char *json_str, const char *json_end,
|
||||
char *res, char *res_end);
|
||||
} *json_service;
|
||||
enum json_types json_type(const char *js, const char *js_end,
|
||||
const char **value, int *value_len);
|
||||
enum json_types json_get_array_item(const char *js, const char *js_end,
|
||||
int n_item,
|
||||
const char **value, int *value_len);
|
||||
enum json_types json_get_object_key(const char *js, const char *js_end,
|
||||
const char *key,
|
||||
const char **value, int *value_len);
|
||||
enum json_types json_get_object_nkey(const char *js,const char *js_end, int nkey,
|
||||
const char **keyname, const char **keyname_end,
|
||||
const char **value, int *value_len);
|
||||
int json_escape_string(const char *str,const char *str_end,
|
||||
char *json, char *json_end);
|
||||
int json_unescape_json(const char *json_str, const char *json_end,
|
||||
char *res, char *res_end);
|
||||
struct st_mysql_xid {
|
||||
long formatID;
|
||||
long gtrid_length;
|
||||
|
@@ -374,6 +374,51 @@ extern struct thd_wait_service_st {
|
||||
} *thd_wait_service;
|
||||
void thd_wait_begin(void* thd, int wait_type);
|
||||
void thd_wait_end(void* thd);
|
||||
enum json_types
|
||||
{
|
||||
JSV_BAD_JSON=-1,
|
||||
JSV_NOTHING=0,
|
||||
JSV_OBJECT=1,
|
||||
JSV_ARRAY=2,
|
||||
JSV_STRING=3,
|
||||
JSV_NUMBER=4,
|
||||
JSV_TRUE=5,
|
||||
JSV_FALSE=6,
|
||||
JSV_NULL=7
|
||||
};
|
||||
extern struct json_service_st {
|
||||
enum json_types (*json_type)(const char *js, const char *js_end,
|
||||
const char **value, int *value_len);
|
||||
enum json_types (*json_get_array_item)(const char *js, const char *js_end,
|
||||
int n_item,
|
||||
const char **value, int *value_len);
|
||||
enum json_types (*json_get_object_key)(const char *js, const char *js_end,
|
||||
const char *key,
|
||||
const char **value, int *value_len);
|
||||
enum json_types (*json_get_object_nkey)(const char *js,const char *js_end,
|
||||
int nkey,
|
||||
const char **keyname, const char **keyname_end,
|
||||
const char **value, int *value_len);
|
||||
int (*json_escape_string)(const char *str,const char *str_end,
|
||||
char *json, char *json_end);
|
||||
int (*json_unescape_json)(const char *json_str, const char *json_end,
|
||||
char *res, char *res_end);
|
||||
} *json_service;
|
||||
enum json_types json_type(const char *js, const char *js_end,
|
||||
const char **value, int *value_len);
|
||||
enum json_types json_get_array_item(const char *js, const char *js_end,
|
||||
int n_item,
|
||||
const char **value, int *value_len);
|
||||
enum json_types json_get_object_key(const char *js, const char *js_end,
|
||||
const char *key,
|
||||
const char **value, int *value_len);
|
||||
enum json_types json_get_object_nkey(const char *js,const char *js_end, int nkey,
|
||||
const char **keyname, const char **keyname_end,
|
||||
const char **value, int *value_len);
|
||||
int json_escape_string(const char *str,const char *str_end,
|
||||
char *json, char *json_end);
|
||||
int json_unescape_json(const char *json_str, const char *json_end,
|
||||
char *res, char *res_end);
|
||||
struct st_mysql_xid {
|
||||
long formatID;
|
||||
long gtrid_length;
|
||||
|
@@ -374,6 +374,51 @@ extern struct thd_wait_service_st {
|
||||
} *thd_wait_service;
|
||||
void thd_wait_begin(void* thd, int wait_type);
|
||||
void thd_wait_end(void* thd);
|
||||
enum json_types
|
||||
{
|
||||
JSV_BAD_JSON=-1,
|
||||
JSV_NOTHING=0,
|
||||
JSV_OBJECT=1,
|
||||
JSV_ARRAY=2,
|
||||
JSV_STRING=3,
|
||||
JSV_NUMBER=4,
|
||||
JSV_TRUE=5,
|
||||
JSV_FALSE=6,
|
||||
JSV_NULL=7
|
||||
};
|
||||
extern struct json_service_st {
|
||||
enum json_types (*json_type)(const char *js, const char *js_end,
|
||||
const char **value, int *value_len);
|
||||
enum json_types (*json_get_array_item)(const char *js, const char *js_end,
|
||||
int n_item,
|
||||
const char **value, int *value_len);
|
||||
enum json_types (*json_get_object_key)(const char *js, const char *js_end,
|
||||
const char *key,
|
||||
const char **value, int *value_len);
|
||||
enum json_types (*json_get_object_nkey)(const char *js,const char *js_end,
|
||||
int nkey,
|
||||
const char **keyname, const char **keyname_end,
|
||||
const char **value, int *value_len);
|
||||
int (*json_escape_string)(const char *str,const char *str_end,
|
||||
char *json, char *json_end);
|
||||
int (*json_unescape_json)(const char *json_str, const char *json_end,
|
||||
char *res, char *res_end);
|
||||
} *json_service;
|
||||
enum json_types json_type(const char *js, const char *js_end,
|
||||
const char **value, int *value_len);
|
||||
enum json_types json_get_array_item(const char *js, const char *js_end,
|
||||
int n_item,
|
||||
const char **value, int *value_len);
|
||||
enum json_types json_get_object_key(const char *js, const char *js_end,
|
||||
const char *key,
|
||||
const char **value, int *value_len);
|
||||
enum json_types json_get_object_nkey(const char *js,const char *js_end, int nkey,
|
||||
const char **keyname, const char **keyname_end,
|
||||
const char **value, int *value_len);
|
||||
int json_escape_string(const char *str,const char *str_end,
|
||||
char *json, char *json_end);
|
||||
int json_unescape_json(const char *json_str, const char *json_end,
|
||||
char *res, char *res_end);
|
||||
struct st_mysql_xid {
|
||||
long formatID;
|
||||
long gtrid_length;
|
||||
|
@@ -374,6 +374,51 @@ extern struct thd_wait_service_st {
|
||||
} *thd_wait_service;
|
||||
void thd_wait_begin(void* thd, int wait_type);
|
||||
void thd_wait_end(void* thd);
|
||||
enum json_types
|
||||
{
|
||||
JSV_BAD_JSON=-1,
|
||||
JSV_NOTHING=0,
|
||||
JSV_OBJECT=1,
|
||||
JSV_ARRAY=2,
|
||||
JSV_STRING=3,
|
||||
JSV_NUMBER=4,
|
||||
JSV_TRUE=5,
|
||||
JSV_FALSE=6,
|
||||
JSV_NULL=7
|
||||
};
|
||||
extern struct json_service_st {
|
||||
enum json_types (*json_type)(const char *js, const char *js_end,
|
||||
const char **value, int *value_len);
|
||||
enum json_types (*json_get_array_item)(const char *js, const char *js_end,
|
||||
int n_item,
|
||||
const char **value, int *value_len);
|
||||
enum json_types (*json_get_object_key)(const char *js, const char *js_end,
|
||||
const char *key,
|
||||
const char **value, int *value_len);
|
||||
enum json_types (*json_get_object_nkey)(const char *js,const char *js_end,
|
||||
int nkey,
|
||||
const char **keyname, const char **keyname_end,
|
||||
const char **value, int *value_len);
|
||||
int (*json_escape_string)(const char *str,const char *str_end,
|
||||
char *json, char *json_end);
|
||||
int (*json_unescape_json)(const char *json_str, const char *json_end,
|
||||
char *res, char *res_end);
|
||||
} *json_service;
|
||||
enum json_types json_type(const char *js, const char *js_end,
|
||||
const char **value, int *value_len);
|
||||
enum json_types json_get_array_item(const char *js, const char *js_end,
|
||||
int n_item,
|
||||
const char **value, int *value_len);
|
||||
enum json_types json_get_object_key(const char *js, const char *js_end,
|
||||
const char *key,
|
||||
const char **value, int *value_len);
|
||||
enum json_types json_get_object_nkey(const char *js,const char *js_end, int nkey,
|
||||
const char **keyname, const char **keyname_end,
|
||||
const char **value, int *value_len);
|
||||
int json_escape_string(const char *str,const char *str_end,
|
||||
char *json, char *json_end);
|
||||
int json_unescape_json(const char *json_str, const char *json_end,
|
||||
char *res, char *res_end);
|
||||
struct st_mysql_xid {
|
||||
long formatID;
|
||||
long gtrid_length;
|
||||
|
@@ -374,6 +374,51 @@ extern struct thd_wait_service_st {
|
||||
} *thd_wait_service;
|
||||
void thd_wait_begin(void* thd, int wait_type);
|
||||
void thd_wait_end(void* thd);
|
||||
enum json_types
|
||||
{
|
||||
JSV_BAD_JSON=-1,
|
||||
JSV_NOTHING=0,
|
||||
JSV_OBJECT=1,
|
||||
JSV_ARRAY=2,
|
||||
JSV_STRING=3,
|
||||
JSV_NUMBER=4,
|
||||
JSV_TRUE=5,
|
||||
JSV_FALSE=6,
|
||||
JSV_NULL=7
|
||||
};
|
||||
extern struct json_service_st {
|
||||
enum json_types (*json_type)(const char *js, const char *js_end,
|
||||
const char **value, int *value_len);
|
||||
enum json_types (*json_get_array_item)(const char *js, const char *js_end,
|
||||
int n_item,
|
||||
const char **value, int *value_len);
|
||||
enum json_types (*json_get_object_key)(const char *js, const char *js_end,
|
||||
const char *key,
|
||||
const char **value, int *value_len);
|
||||
enum json_types (*json_get_object_nkey)(const char *js,const char *js_end,
|
||||
int nkey,
|
||||
const char **keyname, const char **keyname_end,
|
||||
const char **value, int *value_len);
|
||||
int (*json_escape_string)(const char *str,const char *str_end,
|
||||
char *json, char *json_end);
|
||||
int (*json_unescape_json)(const char *json_str, const char *json_end,
|
||||
char *res, char *res_end);
|
||||
} *json_service;
|
||||
enum json_types json_type(const char *js, const char *js_end,
|
||||
const char **value, int *value_len);
|
||||
enum json_types json_get_array_item(const char *js, const char *js_end,
|
||||
int n_item,
|
||||
const char **value, int *value_len);
|
||||
enum json_types json_get_object_key(const char *js, const char *js_end,
|
||||
const char *key,
|
||||
const char **value, int *value_len);
|
||||
enum json_types json_get_object_nkey(const char *js,const char *js_end, int nkey,
|
||||
const char **keyname, const char **keyname_end,
|
||||
const char **value, int *value_len);
|
||||
int json_escape_string(const char *str,const char *str_end,
|
||||
char *json, char *json_end);
|
||||
int json_unescape_json(const char *json_str, const char *json_end,
|
||||
char *res, char *res_end);
|
||||
struct st_mysql_xid {
|
||||
long formatID;
|
||||
long gtrid_length;
|
||||
|
117
include/mysql/service_json.h
Normal file
117
include/mysql/service_json.h
Normal file
@@ -0,0 +1,117 @@
|
||||
/* Copyright (C) 2018 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
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
|
||||
|
||||
#ifndef MYSQL_SERVICE_JSON
|
||||
#define MYSQL_SERVICE_JSON
|
||||
|
||||
/**
|
||||
@file
|
||||
json service
|
||||
|
||||
Esports JSON parsing methods for plugins to use.
|
||||
|
||||
Fuctions of the service:
|
||||
js_type - returns the type of the JSON argument,
|
||||
and the parsed value if it's scalar (not object or array)
|
||||
|
||||
js_get_array_item - expecs JSON array as an argument,
|
||||
and returns the n_item's item's type and value
|
||||
Returns JSV_NOTHING type if the array is shorter
|
||||
than n_item and the actual length of the array in v_len.
|
||||
|
||||
js_get_object_key - expects JSON object as an argument,
|
||||
searches for a key in the object, return it's type and value.
|
||||
JSV_NOTHING if no such key found, the number of keys
|
||||
in v_len.
|
||||
|
||||
js_get_object_nkey - expects JSON object as an argument.
|
||||
finds n_key's key in the object, returns it's name, type and value.
|
||||
JSV_NOTHING if object has less keys than n_key.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum json_types
|
||||
{
|
||||
JSV_BAD_JSON=-1,
|
||||
JSV_NOTHING=0,
|
||||
JSV_OBJECT=1,
|
||||
JSV_ARRAY=2,
|
||||
JSV_STRING=3,
|
||||
JSV_NUMBER=4,
|
||||
JSV_TRUE=5,
|
||||
JSV_FALSE=6,
|
||||
JSV_NULL=7
|
||||
};
|
||||
|
||||
extern struct json_service_st {
|
||||
enum json_types (*json_type)(const char *js, const char *js_end,
|
||||
const char **value, int *value_len);
|
||||
enum json_types (*json_get_array_item)(const char *js, const char *js_end,
|
||||
int n_item,
|
||||
const char **value, int *value_len);
|
||||
enum json_types (*json_get_object_key)(const char *js, const char *js_end,
|
||||
const char *key,
|
||||
const char **value, int *value_len);
|
||||
enum json_types (*json_get_object_nkey)(const char *js,const char *js_end,
|
||||
int nkey,
|
||||
const char **keyname, const char **keyname_end,
|
||||
const char **value, int *value_len);
|
||||
int (*json_escape_string)(const char *str,const char *str_end,
|
||||
char *json, char *json_end);
|
||||
int (*json_unescape_json)(const char *json_str, const char *json_end,
|
||||
char *res, char *res_end);
|
||||
} *json_service;
|
||||
|
||||
#ifdef MYSQL_DYNAMIC_PLUGIN
|
||||
|
||||
#define json_type json_service->json_type
|
||||
#define json_get_array_item json_service->json_get_array_item
|
||||
#define json_get_object_key json_service->json_get_object_key
|
||||
#define json_get_object_nkey json_service->json_get_object_nkey
|
||||
#define json_escape_string json_service->json_escape_string
|
||||
#define json_unescape_json json_service->json_unescape_json
|
||||
|
||||
#else
|
||||
|
||||
enum json_types json_type(const char *js, const char *js_end,
|
||||
const char **value, int *value_len);
|
||||
enum json_types json_get_array_item(const char *js, const char *js_end,
|
||||
int n_item,
|
||||
const char **value, int *value_len);
|
||||
enum json_types json_get_object_key(const char *js, const char *js_end,
|
||||
const char *key,
|
||||
const char **value, int *value_len);
|
||||
enum json_types json_get_object_nkey(const char *js,const char *js_end, int nkey,
|
||||
const char **keyname, const char **keyname_end,
|
||||
const char **value, int *value_len);
|
||||
int json_escape_string(const char *str,const char *str_end,
|
||||
char *json, char *json_end);
|
||||
int json_unescape_json(const char *json_str, const char *json_end,
|
||||
char *res, char *res_end);
|
||||
|
||||
#endif /*MYSQL_DYNAMIC_PLUGIN*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*MYSQL_SERVICE_JSON */
|
||||
|
||||
|
@@ -1,5 +1,20 @@
|
||||
#ifndef MYSQL_SERVICE_WSREP_INCLUDED
|
||||
#define MYSQL_SERVICE_WSREP_INCLUDED
|
||||
|
||||
enum Wsrep_service_key_type
|
||||
{
|
||||
WSREP_SERVICE_KEY_SHARED,
|
||||
WSREP_SERVICE_KEY_REFERENCE,
|
||||
WSREP_SERVICE_KEY_UPDATE,
|
||||
WSREP_SERVICE_KEY_EXCLUSIVE
|
||||
};
|
||||
|
||||
#if (defined (MYSQL_DYNAMIC_PLUGIN) && defined(MYSQL_SERVICE_WSREP_DYNAMIC_INCLUDED)) || (!defined(MYSQL_DYNAMIC_PLUGIN) && defined(MYSQL_SERVICE_WSREP_STATIC_INCLUDED))
|
||||
|
||||
#else
|
||||
|
||||
/* Copyright (c) 2015 MariaDB Corporation Ab
|
||||
2018 Codership Oy <info@codership.com>
|
||||
|
||||
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
|
||||
@@ -21,153 +36,92 @@
|
||||
Interface to WSREP functionality in the server.
|
||||
For engines that want to support galera.
|
||||
*/
|
||||
|
||||
#include <my_pthread.h>
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum wsrep_conflict_state {
|
||||
NO_CONFLICT,
|
||||
MUST_ABORT,
|
||||
ABORTING,
|
||||
ABORTED,
|
||||
MUST_REPLAY,
|
||||
REPLAYING,
|
||||
RETRY_AUTOCOMMIT,
|
||||
CERT_FAILURE,
|
||||
};
|
||||
|
||||
enum wsrep_exec_mode {
|
||||
/* Transaction processing before replication. */
|
||||
LOCAL_STATE,
|
||||
/* Slave thread applying write sets from other nodes or replaying thread. */
|
||||
REPL_RECV,
|
||||
/* Total-order-isolation mode. */
|
||||
TOTAL_ORDER,
|
||||
/*
|
||||
Transaction procession after it has been replicated in prepare stage and
|
||||
has passed certification.
|
||||
*/
|
||||
LOCAL_COMMIT
|
||||
};
|
||||
|
||||
enum wsrep_query_state {
|
||||
QUERY_IDLE,
|
||||
QUERY_EXEC,
|
||||
QUERY_COMMITTING,
|
||||
QUERY_EXITING,
|
||||
QUERY_ROLLINGBACK,
|
||||
};
|
||||
|
||||
enum wsrep_trx_status {
|
||||
WSREP_TRX_OK,
|
||||
WSREP_TRX_CERT_FAIL, /* certification failure, must abort */
|
||||
WSREP_TRX_SIZE_EXCEEDED, /* trx size exceeded */
|
||||
WSREP_TRX_ERROR, /* native mysql error */
|
||||
};
|
||||
|
||||
struct xid_t;
|
||||
struct wsrep;
|
||||
struct wsrep_ws_handle;
|
||||
struct wsrep_buf;
|
||||
|
||||
/* Must match to definition in sql/mysqld.h */
|
||||
typedef int64 query_id_t;
|
||||
|
||||
|
||||
extern struct wsrep_service_st {
|
||||
struct wsrep * (*get_wsrep_func)();
|
||||
my_bool (*get_wsrep_certify_nonPK_func)();
|
||||
my_bool (*get_wsrep_debug_func)();
|
||||
my_bool (*get_wsrep_drupal_282555_workaround_func)();
|
||||
my_bool (*get_wsrep_recovery_func)();
|
||||
my_bool (*get_wsrep_load_data_splitting_func)();
|
||||
my_bool (*get_wsrep_log_conflicts_func)();
|
||||
long (*get_wsrep_protocol_version_func)();
|
||||
my_bool (*wsrep_aborting_thd_contains_func)(THD *thd);
|
||||
void (*wsrep_aborting_thd_enqueue_func)(THD *thd);
|
||||
bool (*wsrep_consistency_check_func)(THD *thd);
|
||||
int (*wsrep_is_wsrep_xid_func)(const struct xid_t *xid);
|
||||
bool (*wsrep_consistency_check_func)(MYSQL_THD thd);
|
||||
int (*wsrep_is_wsrep_xid_func)(const void *xid);
|
||||
long long (*wsrep_xid_seqno_func)(const struct xid_t *xid);
|
||||
const unsigned char* (*wsrep_xid_uuid_func)(const struct xid_t *xid);
|
||||
void (*wsrep_lock_rollback_func)();
|
||||
int (*wsrep_on_func)(MYSQL_THD);
|
||||
void (*wsrep_post_commit_func)(THD* thd, bool all);
|
||||
bool (*wsrep_prepare_key_func)(const unsigned char*, size_t, const unsigned char*, size_t, struct wsrep_buf*, size_t*);
|
||||
enum wsrep_trx_status (*wsrep_run_wsrep_commit_func)(THD *thd, bool all);
|
||||
void (*wsrep_thd_LOCK_func)(THD *thd);
|
||||
void (*wsrep_thd_UNLOCK_func)(THD *thd);
|
||||
void (*wsrep_thd_awake_func)(THD *thd, my_bool signal);
|
||||
enum wsrep_conflict_state (*wsrep_thd_conflict_state_func)(MYSQL_THD, my_bool);
|
||||
const char * (*wsrep_thd_conflict_state_str_func)(THD *thd);
|
||||
enum wsrep_exec_mode (*wsrep_thd_exec_mode_func)(THD *thd);
|
||||
const char * (*wsrep_thd_exec_mode_str_func)(THD *thd);
|
||||
enum wsrep_conflict_state (*wsrep_thd_get_conflict_state_func)(MYSQL_THD);
|
||||
my_bool (*wsrep_thd_is_BF_func)(MYSQL_THD , my_bool);
|
||||
my_bool (*wsrep_thd_is_wsrep_func)(MYSQL_THD thd);
|
||||
char * (*wsrep_thd_query_func)(THD *thd);
|
||||
enum wsrep_query_state (*wsrep_thd_query_state_func)(THD *thd);
|
||||
const char * (*wsrep_thd_query_state_str_func)(THD *thd);
|
||||
int (*wsrep_thd_retry_counter_func)(THD *thd);
|
||||
void (*wsrep_thd_set_conflict_state_func)(THD *thd, enum wsrep_conflict_state state);
|
||||
bool (*wsrep_thd_ignore_table_func)(THD *thd);
|
||||
long long (*wsrep_thd_trx_seqno_func)(THD *thd);
|
||||
struct wsrep_ws_handle * (*wsrep_thd_ws_handle_func)(THD *thd);
|
||||
int (*wsrep_trx_is_aborting_func)(MYSQL_THD thd);
|
||||
int (*wsrep_trx_order_before_func)(MYSQL_THD, MYSQL_THD);
|
||||
void (*wsrep_unlock_rollback_func)();
|
||||
my_bool (*wsrep_on_func)(const MYSQL_THD thd);
|
||||
bool (*wsrep_prepare_key_for_innodb_func)(MYSQL_THD thd, const unsigned char*, size_t, const unsigned char*, size_t, struct wsrep_buf*, size_t*);
|
||||
void (*wsrep_thd_LOCK_func)(const MYSQL_THD thd);
|
||||
void (*wsrep_thd_UNLOCK_func)(const MYSQL_THD thd);
|
||||
const char * (*wsrep_thd_query_func)(const MYSQL_THD thd);
|
||||
int (*wsrep_thd_retry_counter_func)(const MYSQL_THD thd);
|
||||
bool (*wsrep_thd_ignore_table_func)(MYSQL_THD thd);
|
||||
long long (*wsrep_thd_trx_seqno_func)(const MYSQL_THD thd);
|
||||
my_bool (*wsrep_thd_is_aborting_func)(const MYSQL_THD thd);
|
||||
void (*wsrep_set_data_home_dir_func)(const char *data_dir);
|
||||
my_bool (*wsrep_thd_is_BF_func)(const MYSQL_THD thd, my_bool sync);
|
||||
my_bool (*wsrep_thd_is_local_func)(const MYSQL_THD thd);
|
||||
void (*wsrep_thd_self_abort_func)(MYSQL_THD thd);
|
||||
int (*wsrep_thd_append_key_func)(MYSQL_THD thd, const struct wsrep_key* key,
|
||||
int n_keys, enum Wsrep_service_key_type);
|
||||
const char* (*wsrep_thd_client_state_str_func)(const MYSQL_THD thd);
|
||||
const char* (*wsrep_thd_client_mode_str_func)(const MYSQL_THD thd);
|
||||
const char* (*wsrep_thd_transaction_state_str_func)(const MYSQL_THD thd);
|
||||
query_id_t (*wsrep_thd_transaction_id_func)(const MYSQL_THD thd);
|
||||
my_bool (*wsrep_thd_bf_abort_func)(const MYSQL_THD bf_thd,
|
||||
MYSQL_THD victim_thd,
|
||||
my_bool signal);
|
||||
my_bool (*wsrep_thd_order_before_func)(const MYSQL_THD left, const MYSQL_THD right);
|
||||
void (*wsrep_handle_SR_rollback_func)(MYSQL_THD BF_thd, MYSQL_THD victim_thd);
|
||||
my_bool (*wsrep_thd_skip_locking_func)(const MYSQL_THD thd);
|
||||
const char* (*wsrep_get_sr_table_name_func)();
|
||||
my_bool (*wsrep_get_debug_func)();
|
||||
} *wsrep_service;
|
||||
|
||||
#define MYSQL_SERVICE_WSREP_INCLUDED
|
||||
#endif
|
||||
|
||||
#ifdef MYSQL_DYNAMIC_PLUGIN
|
||||
#define get_wsrep() wsrep_service->get_wsrep_func()
|
||||
#define get_wsrep_certify_nonPK() wsrep_service->get_wsrep_certify_nonPK_func()
|
||||
#define get_wsrep_debug() wsrep_service->get_wsrep_debug_func()
|
||||
#define get_wsrep_drupal_282555_workaround() wsrep_service->get_wsrep_drupal_282555_workaround_func()
|
||||
|
||||
#define MYSQL_SERVICE_WSREP_DYNAMIC_INCLUDED
|
||||
#define get_wsrep_recovery() wsrep_service->get_wsrep_recovery_func()
|
||||
#define get_wsrep_load_data_splitting() wsrep_service->get_wsrep_load_data_splitting_func()
|
||||
#define get_wsrep_log_conflicts() wsrep_service->get_wsrep_log_conflicts_func()
|
||||
#define get_wsrep_protocol_version() wsrep_service->get_wsrep_protocol_version_func()
|
||||
#define wsrep_aborting_thd_contains(T) wsrep_service->wsrep_aborting_thd_contains_func(T)
|
||||
#define wsrep_aborting_thd_enqueue(T) wsrep_service->wsrep_aborting_thd_enqueue_func(T)
|
||||
#define wsrep_consistency_check(T) wsrep_service->wsrep_consistency_check_func(T)
|
||||
#define wsrep_is_wsrep_xid(X) wsrep_service->wsrep_is_wsrep_xid_func(X)
|
||||
#define wsrep_xid_seqno(X) wsrep_service->wsrep_xid_seqno_func(X)
|
||||
#define wsrep_xid_uuid(X) wsrep_service->wsrep_xid_uuid_func(X)
|
||||
#define wsrep_lock_rollback() wsrep_service->wsrep_lock_rollback_func()
|
||||
#define wsrep_on(X) wsrep_service->wsrep_on_func(X)
|
||||
#define wsrep_post_commit(T,A) wsrep_service->wsrep_post_commit_func(T,A)
|
||||
#define wsrep_prepare_key(A,B,C,D,E,F) wsrep_service->wsrep_prepare_key_func(A,B,C,D,E,F)
|
||||
#define wsrep_run_wsrep_commit(T,A) wsrep_service->wsrep_run_wsrep_commit_func(T,A)
|
||||
#define wsrep_prepare_key_for_innodb(A,B,C,D,E,F,G) wsrep_service->wsrep_prepare_key_for_innodb_func(A,B,C,D,E,F,G)
|
||||
#define wsrep_thd_LOCK(T) wsrep_service->wsrep_thd_LOCK_func(T)
|
||||
#define wsrep_thd_UNLOCK(T) wsrep_service->wsrep_thd_UNLOCK_func(T)
|
||||
#define wsrep_thd_awake(T,S) wsrep_service->wsrep_thd_awake_func(T,S)
|
||||
#define wsrep_thd_conflict_state(T,S) wsrep_service->wsrep_thd_conflict_state_func(T,S)
|
||||
#define wsrep_thd_conflict_state_str(T) wsrep_service->wsrep_thd_conflict_state_str_func(T)
|
||||
#define wsrep_thd_exec_mode(T) wsrep_service->wsrep_thd_exec_mode_func(T)
|
||||
#define wsrep_thd_exec_mode_str(T) wsrep_service->wsrep_thd_exec_mode_str_func(T)
|
||||
#define wsrep_thd_get_conflict_state(T) wsrep_service->wsrep_thd_get_conflict_state_func(T)
|
||||
#define wsrep_thd_is_BF(T,S) wsrep_service->wsrep_thd_is_BF_func(T,S)
|
||||
#define wsrep_thd_is_wsrep(T) wsrep_service->wsrep_thd_is_wsrep_func(T)
|
||||
#define wsrep_thd_query(T) wsrep_service->wsrep_thd_query_func(T)
|
||||
#define wsrep_thd_query_state(T) wsrep_service->wsrep_thd_query_state_func(T)
|
||||
#define wsrep_thd_query_state_str(T) wsrep_service->wsrep_thd_query_state_str_func(T)
|
||||
#define wsrep_thd_retry_counter(T) wsrep_service->wsrep_thd_retry_counter_func(T)
|
||||
#define wsrep_thd_set_conflict_state(T,S) wsrep_service->wsrep_thd_set_conflict_state_func(T,S)
|
||||
#define wsrep_thd_ignore_table(T) wsrep_service->wsrep_thd_ignore_table_func(T)
|
||||
#define wsrep_thd_trx_seqno(T) wsrep_service->wsrep_thd_trx_seqno_func(T)
|
||||
#define wsrep_thd_ws_handle(T) wsrep_service->wsrep_thd_ws_handle_func(T)
|
||||
#define wsrep_trx_is_aborting(T) wsrep_service->wsrep_trx_is_aborting_func(T)
|
||||
#define wsrep_trx_order_before(T1,T2) wsrep_service->wsrep_trx_order_before_func(T1,T2)
|
||||
#define wsrep_unlock_rollback() wsrep_service->wsrep_unlock_rollback_func()
|
||||
#define wsrep_set_data_home_dir(A) wsrep_service->wsrep_set_data_home_dir_func(A)
|
||||
|
||||
#define wsrep_debug get_wsrep_debug()
|
||||
#define wsrep_log_conflicts get_wsrep_log_conflicts()
|
||||
#define wsrep_certify_nonPK get_wsrep_certify_nonPK()
|
||||
#define wsrep_load_data_splitting get_wsrep_load_data_splitting()
|
||||
#define wsrep_drupal_282555_workaround get_wsrep_drupal_282555_workaround()
|
||||
#define wsrep_recovery get_wsrep_recovery()
|
||||
#define wsrep_protocol_version get_wsrep_protocol_version()
|
||||
#define wsrep_thd_is_BF(T,S) wsrep_service->wsrep_thd_is_BF_func(T,S)
|
||||
#define wsrep_thd_is_aborting(T) wsrep_service->wsrep_thd_is_aborting_func(T)
|
||||
#define wsrep_thd_is_local(T) wsrep_service->wsrep_thd_is_local_func(T)
|
||||
#define wsrep_thd_self_abort(T) wsrep_service->wsrep_thd_self_abort_func(T)
|
||||
#define wsrep_thd_append_key(T,W,N,K) wsrep_service->wsrep_thd_append_key_func(T,W,N,K)
|
||||
#define wsrep_thd_client_state_str(T) wsrep_service->wsrep_thd_client_state_str_func(T)
|
||||
#define wsrep_thd_client_mode_str(T) wsrep_service->wsrep_thd_client_mode_str_func(T)
|
||||
#define wsrep_thd_transaction_state_str(T) wsrep_service->wsrep_thd_transaction_state_str_func(T)
|
||||
#define wsrep_thd_transaction_id(T) wsrep_service->wsrep_thd_transaction_id_func(T)
|
||||
#define wsrep_thd_bf_abort(T,T2,S) wsrep_service->wsrep_thd_bf_abort_func(T,T2,S)
|
||||
#define wsrep_thd_order_before(L,R) wsrep_service->wsrep_thd_order_before_func(L,R)
|
||||
#define wsrep_handle_SR_rollback(B,V) wsrep_service->wsrep_handle_SR_rollback_func(B,V)
|
||||
#define wsrep_thd_skip_locking(T) wsrep_service->wsrep_thd_skip_locking_func(T)
|
||||
#define wsrep_get_sr_table_name() wsrep_service->wsrep_get_sr_table_name_func()
|
||||
#define wsrep_get_debug() wsrep_service->wsrep_get_debug_func()
|
||||
|
||||
#else
|
||||
|
||||
#define MYSQL_SERVICE_WSREP_STATIC_INCLUDED
|
||||
extern my_bool wsrep_debug;
|
||||
extern my_bool wsrep_log_conflicts;
|
||||
extern my_bool wsrep_certify_nonPK;
|
||||
@@ -176,54 +130,81 @@ extern my_bool wsrep_drupal_282555_workaround;
|
||||
extern my_bool wsrep_recovery;
|
||||
extern long wsrep_protocol_version;
|
||||
|
||||
bool wsrep_consistency_check(THD *thd);
|
||||
bool wsrep_prepare_key(const unsigned char* cache_key, size_t cache_key_len, const unsigned char* row_id, size_t row_id_len, struct wsrep_buf* key, size_t* key_len);
|
||||
char *wsrep_thd_query(THD *thd);
|
||||
const char *wsrep_thd_conflict_state_str(THD *thd);
|
||||
const char *wsrep_thd_exec_mode_str(THD *thd);
|
||||
const char *wsrep_thd_query_state_str(THD *thd);
|
||||
enum wsrep_conflict_state wsrep_thd_conflict_state(MYSQL_THD thd, my_bool sync);
|
||||
enum wsrep_conflict_state wsrep_thd_get_conflict_state(MYSQL_THD thd);
|
||||
enum wsrep_exec_mode wsrep_thd_exec_mode(THD *thd);
|
||||
enum wsrep_query_state wsrep_thd_query_state(THD *thd);
|
||||
enum wsrep_trx_status wsrep_run_wsrep_commit(THD *thd, bool all);
|
||||
int wsrep_is_wsrep_xid(const struct xid_t* xid);
|
||||
long long wsrep_xid_seqno(const struct xid_t* xid);
|
||||
extern "C" bool wsrep_consistency_check(MYSQL_THD thd);
|
||||
bool wsrep_prepare_key_for_innodb(MYSQL_THD thd, const unsigned char* cache_key, size_t cache_key_len, const unsigned char* row_id, size_t row_id_len, struct wsrep_buf* key, size_t* key_len);
|
||||
extern "C" const char *wsrep_thd_query(const MYSQL_THD thd);
|
||||
extern "C" int wsrep_is_wsrep_xid(const void* xid);
|
||||
extern "C" long long wsrep_xid_seqno(const struct xid_t* xid);
|
||||
const unsigned char* wsrep_xid_uuid(const struct xid_t* xid);
|
||||
int wsrep_on(MYSQL_THD thd);
|
||||
int wsrep_thd_retry_counter(THD *thd);
|
||||
int wsrep_trx_is_aborting(MYSQL_THD thd);
|
||||
int wsrep_trx_order_before(MYSQL_THD thd1, MYSQL_THD thd2);
|
||||
long get_wsrep_protocol_version();
|
||||
long long wsrep_thd_trx_seqno(THD *thd);
|
||||
my_bool get_wsrep_certify_nonPK();
|
||||
my_bool get_wsrep_debug();
|
||||
my_bool get_wsrep_drupal_282555_workaround();
|
||||
extern "C" long long wsrep_thd_trx_seqno(const MYSQL_THD thd);
|
||||
my_bool get_wsrep_recovery();
|
||||
my_bool get_wsrep_load_data_splitting();
|
||||
my_bool get_wsrep_log_conflicts();
|
||||
my_bool wsrep_aborting_thd_contains(THD *thd);
|
||||
my_bool wsrep_thd_is_BF(MYSQL_THD thd, my_bool sync);
|
||||
my_bool wsrep_thd_is_wsrep(MYSQL_THD thd);
|
||||
struct wsrep *get_wsrep();
|
||||
struct wsrep_ws_handle *wsrep_thd_ws_handle(THD *thd);
|
||||
void wsrep_aborting_thd_enqueue(THD *thd);
|
||||
void wsrep_lock_rollback();
|
||||
void wsrep_post_commit(THD* thd, bool all);
|
||||
void wsrep_thd_LOCK(THD *thd);
|
||||
void wsrep_thd_UNLOCK(THD *thd);
|
||||
void wsrep_thd_awake(THD *thd, my_bool signal);
|
||||
void wsrep_thd_set_conflict_state(THD *thd, enum wsrep_conflict_state state);
|
||||
bool wsrep_thd_ignore_table(THD *thd);
|
||||
void wsrep_unlock_rollback();
|
||||
bool wsrep_thd_ignore_table(MYSQL_THD thd);
|
||||
void wsrep_set_data_home_dir(const char *data_dir);
|
||||
|
||||
#endif
|
||||
/* from mysql wsrep-lib */
|
||||
#include "my_global.h"
|
||||
#include "my_pthread.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
/* Return true if wsrep is enabled for a thd. This means that
|
||||
wsrep is enabled globally and the thd has wsrep on */
|
||||
extern "C" my_bool wsrep_on(const MYSQL_THD thd);
|
||||
/* Lock thd wsrep lock */
|
||||
extern "C" void wsrep_thd_LOCK(const MYSQL_THD thd);
|
||||
/* Unlock thd wsrep lock */
|
||||
extern "C" void wsrep_thd_UNLOCK(const MYSQL_THD thd);
|
||||
|
||||
#define MYSQL_SERVICE_WSREP_INCLUDED
|
||||
#endif
|
||||
/* Return thd client state string */
|
||||
extern "C" const char* wsrep_thd_client_state_str(const MYSQL_THD thd);
|
||||
/* Return thd client mode string */
|
||||
extern "C" const char* wsrep_thd_client_mode_str(const MYSQL_THD thd);
|
||||
/* Return thd transaction state string */
|
||||
extern "C" const char* wsrep_thd_transaction_state_str(const MYSQL_THD thd);
|
||||
|
||||
/* Return current transaction id */
|
||||
extern "C" query_id_t wsrep_thd_transaction_id(const MYSQL_THD thd);
|
||||
/* Mark thd own transaction as aborted */
|
||||
extern "C" void wsrep_thd_self_abort(MYSQL_THD thd);
|
||||
/* Return true if thd is in replicating mode */
|
||||
extern "C" my_bool wsrep_thd_is_local(const MYSQL_THD thd);
|
||||
/* Return true if thd is in high priority mode */
|
||||
/* todo: rename to is_high_priority() */
|
||||
extern "C" my_bool wsrep_thd_is_applying(const MYSQL_THD thd);
|
||||
/* Return true if thd is in TOI mode */
|
||||
extern "C" my_bool wsrep_thd_is_toi(const MYSQL_THD thd);
|
||||
/* Return true if thd is in replicating TOI mode */
|
||||
extern "C" my_bool wsrep_thd_is_local_toi(const MYSQL_THD thd);
|
||||
/* Return true if thd is in RSU mode */
|
||||
extern "C" my_bool wsrep_thd_is_in_rsu(const MYSQL_THD thd);
|
||||
/* Return true if thd is in BF mode, either high_priority or TOI */
|
||||
extern "C" my_bool wsrep_thd_is_BF(const MYSQL_THD thd, my_bool sync);
|
||||
/* Return true if thd is streaming */
|
||||
extern "C" my_bool wsrep_thd_is_SR(const MYSQL_THD thd);
|
||||
extern "C" void wsrep_handle_SR_rollback(MYSQL_THD BF_thd, MYSQL_THD victim_thd);
|
||||
/* Return thd retry counter */
|
||||
extern "C" int wsrep_thd_retry_counter(const MYSQL_THD thd);
|
||||
/* BF abort victim_thd */
|
||||
extern "C" my_bool wsrep_thd_bf_abort(const MYSQL_THD bf_thd,
|
||||
MYSQL_THD victim_thd,
|
||||
my_bool signal);
|
||||
/* Return true if left thd is ordered before right thd */
|
||||
extern "C" my_bool wsrep_thd_order_before(const MYSQL_THD left, const MYSQL_THD right);
|
||||
/* Return true if thd should skip locking. This means that the thd
|
||||
is operating on shared resource inside commit order critical section. */
|
||||
extern "C" my_bool wsrep_thd_skip_locking(const MYSQL_THD thd);
|
||||
/* Return true if thd is aborting */
|
||||
extern "C" my_bool wsrep_thd_is_aborting(const MYSQL_THD thd);
|
||||
|
||||
struct wsrep_key;
|
||||
struct wsrep_key_array;
|
||||
extern "C" int wsrep_thd_append_key(MYSQL_THD thd,
|
||||
const struct wsrep_key* key,
|
||||
int n_keys,
|
||||
enum Wsrep_service_key_type);
|
||||
|
||||
extern const char* wsrep_sr_table_name_full;
|
||||
|
||||
extern "C" const char* wsrep_get_sr_table_name();
|
||||
|
||||
extern "C" my_bool wsrep_get_debug();
|
||||
#endif
|
||||
#endif /* MYSQL_SERVICE_WSREP_INCLUDED */
|
||||
|
@@ -39,6 +39,7 @@ extern "C" {
|
||||
#include <mysql/service_thd_specifics.h>
|
||||
#include <mysql/service_thd_timezone.h>
|
||||
#include <mysql/service_thd_wait.h>
|
||||
#include <mysql/service_json.h>
|
||||
/*#include <mysql/service_wsrep.h>*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -231,6 +231,7 @@ enum enum_indicator_type
|
||||
#define REFRESH_DES_KEY_FILE (1ULL << 18)
|
||||
#define REFRESH_USER_RESOURCES (1ULL << 19)
|
||||
#define REFRESH_FOR_EXPORT (1ULL << 20) /* FLUSH TABLES ... FOR EXPORT */
|
||||
#define REFRESH_SSL (1ULL << 21)
|
||||
|
||||
#define REFRESH_GENERIC (1ULL << 30)
|
||||
#define REFRESH_FAST (1ULL << 31) /* Intern flag */
|
||||
|
@@ -42,3 +42,4 @@
|
||||
#define VERSION_thd_timezone 0x0100
|
||||
#define VERSION_thd_wait 0x0100
|
||||
#define VERSION_wsrep 0x0202
|
||||
#define VERSION_json 0x0100
|
||||
|
@@ -168,9 +168,9 @@ void thr_set_lock_wait_callback(void (*before_wait)(void),
|
||||
void (*after_wait)(void));
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
typedef my_bool (* wsrep_thd_is_brute_force_fun)(void *, my_bool);
|
||||
typedef int (* wsrep_abort_thd_fun)(void *, void *, my_bool);
|
||||
typedef int (* wsrep_on_fun)(void *);
|
||||
typedef my_bool (* wsrep_thd_is_brute_force_fun)(const MYSQL_THD, my_bool);
|
||||
typedef my_bool(* wsrep_abort_thd_fun)(const MYSQL_THD, MYSQL_THD, my_bool);
|
||||
typedef my_bool (* wsrep_on_fun)(const MYSQL_THD);
|
||||
void wsrep_thr_lock_init(
|
||||
wsrep_thd_is_brute_force_fun bf_fun, wsrep_abort_thd_fun abort_fun,
|
||||
my_bool debug, my_bool convert_LOCK_to_trx, wsrep_on_fun on_fun);
|
||||
|
@@ -61,9 +61,6 @@ void thd_set_mysys_var(THD *thd, st_my_thread_var *mysys_var);
|
||||
my_socket thd_get_fd(THD *thd);
|
||||
int thd_store_globals(THD* thd);
|
||||
|
||||
THD *first_global_thread();
|
||||
THD *next_global_thread(THD *thd);
|
||||
|
||||
/* Print to the MySQL error log */
|
||||
void sql_print_error(const char *format, ...);
|
||||
|
||||
|
@@ -13,11 +13,11 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
|
||||
|
||||
#include <my_config.h>
|
||||
|
||||
#ifndef WSREP_INCLUDED
|
||||
#define WSREP_INCLUDED
|
||||
|
||||
#include <my_config.h>
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
#define IF_WSREP(A,B) A
|
||||
#define DBUG_ASSERT_IF_WSREP(A) DBUG_ASSERT(A)
|
||||
@@ -28,12 +28,14 @@
|
||||
goto wsrep_error_label;
|
||||
|
||||
#define WSREP_TO_ISOLATION_BEGIN_ALTER(db_, table_, table_list_, alter_info_) \
|
||||
if (WSREP_ON && WSREP(thd) && wsrep_to_isolation_begin(thd, db_, table_, \
|
||||
table_list_, alter_info_)) \
|
||||
if (WSREP(thd) && wsrep_thd_is_local(thd) && \
|
||||
wsrep_to_isolation_begin(thd, db_, table_, \
|
||||
table_list_, alter_info_)) \
|
||||
goto wsrep_error_label;
|
||||
|
||||
#define WSREP_TO_ISOLATION_END \
|
||||
if (WSREP_ON && (WSREP(thd) || (thd && thd->wsrep_exec_mode==TOTAL_ORDER))) \
|
||||
#define WSREP_TO_ISOLATION_END \
|
||||
if ((WSREP(thd) && wsrep_thd_is_local_toi(thd)) || \
|
||||
wsrep_thd_is_in_rsu(thd)) \
|
||||
wsrep_to_isolation_end(thd);
|
||||
|
||||
/*
|
||||
@@ -54,19 +56,22 @@
|
||||
{ if (WSREP_CLIENT(thd_) && \
|
||||
wsrep_sync_wait(thd_, before_)) goto wsrep_error_label; }
|
||||
|
||||
#else
|
||||
#else /* !WITH_WSREP */
|
||||
|
||||
/* These macros are needed to compile MariaDB without WSREP support
|
||||
* (e.g. embedded) */
|
||||
|
||||
#define IF_WSREP(A,B) B
|
||||
#define DBUG_ASSERT_IF_WSREP(A)
|
||||
//#define DBUG_ASSERT_IF_WSREP(A)
|
||||
#define WSREP_DEBUG(...)
|
||||
#define WSREP_INFO(...)
|
||||
#define WSREP_WARN(...)
|
||||
//#define WSREP_INFO(...)
|
||||
//#define WSREP_WARN(...)
|
||||
#define WSREP_ERROR(...)
|
||||
#define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_) do { } while(0)
|
||||
#define WSREP_TO_ISOLATION_BEGIN_ALTER(db_, table_, table_list_, alter_info_)
|
||||
#define WSREP_TO_ISOLATION_END
|
||||
#define WSREP_TO_ISOLATION_BEGIN_WRTCHK(db_, table_, table_list_)
|
||||
#define WSREP_SYNC_WAIT(thd_, before_)
|
||||
|
||||
#endif /* WITH_WSREP */
|
||||
|
||||
#endif /* WSREP_INCLUDED */
|
||||
|
Submodule libmariadb updated: 17d0e53176...34f8887af0
@@ -118,7 +118,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
|
||||
../sql/ha_sequence.cc ../sql/ha_sequence.h
|
||||
../sql/temporary_tables.cc
|
||||
../sql/session_tracker.cc
|
||||
../sql/proxy_protocol.cc
|
||||
../sql/proxy_protocol.cc ../sql/backup.cc
|
||||
../sql/sql_tvc.cc ../sql/sql_tvc.h
|
||||
../sql/opt_split.cc
|
||||
../sql/item_vers.cc
|
||||
|
@@ -34,7 +34,7 @@ ENDIF(UNIX)
|
||||
|
||||
MYSQL_ADD_EXECUTABLE(mysqltest_embedded ../../client/mysqltest.cc
|
||||
COMPONENT Test)
|
||||
TARGET_LINK_LIBRARIES(mysqltest_embedded mysqlserver pcre pcreposix)
|
||||
TARGET_LINK_LIBRARIES(mysqltest_embedded mysqlserver pcreposix pcre)
|
||||
|
||||
IF(CMAKE_GENERATOR MATCHES "Xcode")
|
||||
# It does not seem possible to tell Xcode the resulting target might need
|
||||
|
@@ -432,11 +432,9 @@ int emb_unbuffered_fetch(MYSQL *mysql, char **row)
|
||||
static void emb_free_embedded_thd(MYSQL *mysql)
|
||||
{
|
||||
THD *thd= (THD*)mysql->thd;
|
||||
mysql_mutex_lock(&LOCK_thread_count);
|
||||
server_threads.erase(thd);
|
||||
thd->clear_data_list();
|
||||
thd->store_globals();
|
||||
thd->unlink();
|
||||
mysql_mutex_unlock(&LOCK_thread_count);
|
||||
delete thd;
|
||||
my_pthread_setspecific_ptr(THR_THD, 0);
|
||||
mysql->thd=0;
|
||||
@@ -711,10 +709,7 @@ void *create_embedded_thd(int client_flag)
|
||||
thd->first_data= 0;
|
||||
thd->data_tail= &thd->first_data;
|
||||
bzero((char*) &thd->net, sizeof(thd->net));
|
||||
|
||||
mysql_mutex_lock(&LOCK_thread_count);
|
||||
threads.append(thd);
|
||||
mysql_mutex_unlock(&LOCK_thread_count);
|
||||
server_threads.insert(thd);
|
||||
thd->mysys_var= 0;
|
||||
thd->reset_globals();
|
||||
return thd;
|
||||
|
@@ -3215,7 +3215,8 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value, size_t
|
||||
{
|
||||
MYSQL_TIME *tm= (MYSQL_TIME *)buffer;
|
||||
MYSQL_TIME_STATUS status;
|
||||
str_to_time(value, length, tm, 0, &status);
|
||||
str_to_datetime_or_date_or_time(value, length, tm, 0, &status,
|
||||
TIME_MAX_HOUR, UINT_MAX32);
|
||||
err= status.warnings;
|
||||
*param->error= MY_TEST(err);
|
||||
break;
|
||||
@@ -3226,7 +3227,7 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value, size_t
|
||||
{
|
||||
MYSQL_TIME *tm= (MYSQL_TIME *)buffer;
|
||||
MYSQL_TIME_STATUS status;
|
||||
(void) str_to_datetime(value, length, tm, 0, &status);
|
||||
(void) str_to_datetime_or_date(value, length, tm, 0, &status);
|
||||
err= status.warnings;
|
||||
*param->error= MY_TEST(err) && (param->buffer_type == MYSQL_TYPE_DATE &&
|
||||
tm->time_type != MYSQL_TIMESTAMP_DATE);
|
||||
@@ -3350,7 +3351,7 @@ static void fetch_long_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
|
||||
case MYSQL_TYPE_DATETIME:
|
||||
{
|
||||
int error;
|
||||
value= number_to_datetime(value, 0, (MYSQL_TIME *) buffer, 0, &error);
|
||||
value= number_to_datetime_or_date(value, 0, (MYSQL_TIME *) buffer, 0, &error);
|
||||
*param->error= MY_TEST(error);
|
||||
break;
|
||||
}
|
||||
|
@@ -37,6 +37,7 @@ SET(MYSQLSERVICES_SOURCES
|
||||
thd_timezone_service.c
|
||||
thd_wait_service.c
|
||||
wsrep_service.c
|
||||
json_service.c
|
||||
)
|
||||
|
||||
ADD_CONVENIENCE_LIBRARY(mysqlservices ${MYSQLSERVICES_SOURCES})
|
||||
|
19
libservices/json_service.c
Normal file
19
libservices/json_service.c
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
/* Copyright (c) 2018, Monty Program 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
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <service_versions.h>
|
||||
SERVICE_VERSION json_service= (void*)VERSION_json;
|
@@ -25,7 +25,6 @@ SET(MAN1_SERVER innochecksum.1 my_print_defaults.1 myisam_ftdump.1 myisamchk.1
|
||||
resolveip.1 mariadb-service-convert.1
|
||||
mysqld_safe_helper.1 tokuftdump.1 wsrep_sst_common.1
|
||||
wsrep_sst_mysqldump.1 wsrep_sst_rsync.1
|
||||
wsrep_sst_xtrabackup-v2.1 wsrep_sst_xtrabackup.1
|
||||
galera_recovery.1 galera_new_cluster.1 tokuft_logprint.1
|
||||
mysql_ldb.1
|
||||
wsrep_sst_mariabackup.1 mbstream.1 mariabackup.1
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user