Compare commits
No commits in common. "master" and "pristine-tar" have entirely different histories.
master
...
pristine-t
20
.bzrignore
20
.bzrignore
@ -1,20 +0,0 @@
|
|||||||
mydumper
|
|
||||||
myloader
|
|
||||||
*~
|
|
||||||
*.dSYM
|
|
||||||
export
|
|
||||||
CMakeCache.txt
|
|
||||||
CMakeFiles/
|
|
||||||
Makefile
|
|
||||||
cmake_install.cmake
|
|
||||||
config.h
|
|
||||||
docs/CMakeFiles/
|
|
||||||
docs/Makefile
|
|
||||||
docs/_doctrees/
|
|
||||||
docs/_sources/
|
|
||||||
docs/cmake_install.cmake
|
|
||||||
docs/html/
|
|
||||||
docs/man/
|
|
||||||
docs/_build/conf.py
|
|
||||||
docs/_build/sources.cmake
|
|
||||||
.project
|
|
@ -1,73 +0,0 @@
|
|||||||
cmake_minimum_required(VERSION 2.6)
|
|
||||||
project(mydumper)
|
|
||||||
set(VERSION 0.9.5)
|
|
||||||
set(ARCHIVE_NAME "${CMAKE_PROJECT_NAME}-${VERSION}")
|
|
||||||
|
|
||||||
#Required packages
|
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
|
|
||||||
find_package(MySQL)
|
|
||||||
find_package(ZLIB)
|
|
||||||
find_package(GLIB2)
|
|
||||||
find_package(PCRE)
|
|
||||||
|
|
||||||
option(BUILD_DOCS "Build the documentation" ON)
|
|
||||||
|
|
||||||
if (BUILD_DOCS)
|
|
||||||
add_subdirectory(docs)
|
|
||||||
endif (BUILD_DOCS)
|
|
||||||
|
|
||||||
option(WITH_BINLOG "Build binlog dump options" OFF)
|
|
||||||
option(WITH_SSL "Build SSL support" ON)
|
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS "-Wall -Wno-deprecated-declarations -Wunused -Wwrite-strings -Wno-strict-aliasing -Wextra -Wshadow -Werror -O3 -g ${MYSQL_CFLAGS}")
|
|
||||||
|
|
||||||
include_directories(${MYDUMPER_SOURCE_DIR} ${MYSQL_INCLUDE_DIR} ${GLIB2_INCLUDE_DIR} ${PCRE_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS})
|
|
||||||
|
|
||||||
if (NOT CMAKE_INSTALL_PREFIX)
|
|
||||||
SET(CMAKE_INSTALL_PREFIX "/usr/local" CACHE STRING "Install path" FORCE)
|
|
||||||
endif (NOT CMAKE_INSTALL_PREFIX)
|
|
||||||
MARK_AS_ADVANCED(CMAKE)
|
|
||||||
|
|
||||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/config.h)
|
|
||||||
|
|
||||||
|
|
||||||
if (WITH_BINLOG)
|
|
||||||
|
|
||||||
add_executable(mydumper mydumper.c binlog.c server_detect.c g_unix_signal.c connection.c getPassword.c)
|
|
||||||
else (WITH_BINLOG)
|
|
||||||
add_executable(mydumper mydumper.c server_detect.c g_unix_signal.c connection.c getPassword.c)
|
|
||||||
endif (WITH_BINLOG)
|
|
||||||
target_link_libraries(mydumper ${MYSQL_LIBRARIES} ${GLIB2_LIBRARIES} ${GTHREAD2_LIBRARIES} ${PCRE_PCRE_LIBRARY} ${ZLIB_LIBRARIES} stdc++)
|
|
||||||
|
|
||||||
|
|
||||||
add_executable(myloader myloader.c connection.c getPassword.c)
|
|
||||||
target_link_libraries(myloader ${MYSQL_LIBRARIES} ${GLIB2_LIBRARIES} ${GTHREAD2_LIBRARIES} ${PCRE_PCRE_LIBRARY} ${ZLIB_LIBRARIES} stdc++)
|
|
||||||
|
|
||||||
INSTALL(TARGETS mydumper myloader
|
|
||||||
RUNTIME DESTINATION bin
|
|
||||||
)
|
|
||||||
|
|
||||||
add_custom_target(dist
|
|
||||||
COMMAND bzr export --root=${ARCHIVE_NAME}
|
|
||||||
${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.gz
|
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
|
||||||
|
|
||||||
OPTION(RUN_CPPCHECK "Run cppcheck" OFF)
|
|
||||||
|
|
||||||
IF(RUN_CPPCHECK)
|
|
||||||
include(CppcheckTargets)
|
|
||||||
add_cppcheck(mydumper)
|
|
||||||
add_cppcheck(myloader)
|
|
||||||
ENDIF(RUN_CPPCHECK)
|
|
||||||
|
|
||||||
|
|
||||||
MESSAGE(STATUS "------------------------------------------------")
|
|
||||||
MESSAGE(STATUS "MYSQL_CONFIG = ${MYSQL_CONFIG}")
|
|
||||||
MESSAGE(STATUS "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}")
|
|
||||||
MESSAGE(STATUS "BUILD_DOCS = ${BUILD_DOCS}")
|
|
||||||
MESSAGE(STATUS "WITH_BINLOG = ${WITH_BINLOG}")
|
|
||||||
MESSAGE(STATUS "RUN_CPPCHECK = ${RUN_CPPCHECK}")
|
|
||||||
MESSAGE(STATUS "Change a values with: cmake -D<Variable>=<Value>")
|
|
||||||
MESSAGE(STATUS "------------------------------------------------")
|
|
||||||
MESSAGE(STATUS)
|
|
||||||
|
|
674
LICENSE
674
LICENSE
@ -1,674 +0,0 @@
|
|||||||
GNU GENERAL PUBLIC LICENSE
|
|
||||||
Version 3, 29 June 2007
|
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
Preamble
|
|
||||||
|
|
||||||
The GNU General Public License is a free, copyleft license for
|
|
||||||
software and other kinds of works.
|
|
||||||
|
|
||||||
The licenses for most software and other practical works are designed
|
|
||||||
to take away your freedom to share and change the works. By contrast,
|
|
||||||
the GNU General Public License is intended to guarantee your freedom to
|
|
||||||
share and change all versions of a program--to make sure it remains free
|
|
||||||
software for all its users. We, the Free Software Foundation, use the
|
|
||||||
GNU General Public License for most of our software; it applies also to
|
|
||||||
any other work released this way by its authors. You can apply it to
|
|
||||||
your programs, too.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
|
||||||
have the freedom to distribute copies of free software (and charge for
|
|
||||||
them if you wish), that you receive source code or can get it if you
|
|
||||||
want it, that you can change the software or use pieces of it in new
|
|
||||||
free programs, and that you know you can do these things.
|
|
||||||
|
|
||||||
To protect your rights, we need to prevent others from denying you
|
|
||||||
these rights or asking you to surrender the rights. Therefore, you have
|
|
||||||
certain responsibilities if you distribute copies of the software, or if
|
|
||||||
you modify it: responsibilities to respect the freedom of others.
|
|
||||||
|
|
||||||
For example, if you distribute copies of such a program, whether
|
|
||||||
gratis or for a fee, you must pass on to the recipients the same
|
|
||||||
freedoms that you received. You must make sure that they, too, receive
|
|
||||||
or can get the source code. And you must show them these terms so they
|
|
||||||
know their rights.
|
|
||||||
|
|
||||||
Developers that use the GNU GPL protect your rights with two steps:
|
|
||||||
(1) assert copyright on the software, and (2) offer you this License
|
|
||||||
giving you legal permission to copy, distribute and/or modify it.
|
|
||||||
|
|
||||||
For the developers' and authors' protection, the GPL clearly explains
|
|
||||||
that there is no warranty for this free software. For both users' and
|
|
||||||
authors' sake, the GPL requires that modified versions be marked as
|
|
||||||
changed, so that their problems will not be attributed erroneously to
|
|
||||||
authors of previous versions.
|
|
||||||
|
|
||||||
Some devices are designed to deny users access to install or run
|
|
||||||
modified versions of the software inside them, although the manufacturer
|
|
||||||
can do so. This is fundamentally incompatible with the aim of
|
|
||||||
protecting users' freedom to change the software. The systematic
|
|
||||||
pattern of such abuse occurs in the area of products for individuals to
|
|
||||||
use, which is precisely where it is most unacceptable. Therefore, we
|
|
||||||
have designed this version of the GPL to prohibit the practice for those
|
|
||||||
products. If such problems arise substantially in other domains, we
|
|
||||||
stand ready to extend this provision to those domains in future versions
|
|
||||||
of the GPL, as needed to protect the freedom of users.
|
|
||||||
|
|
||||||
Finally, every program is threatened constantly by software patents.
|
|
||||||
States should not allow patents to restrict development and use of
|
|
||||||
software on general-purpose computers, but in those that do, we wish to
|
|
||||||
avoid the special danger that patents applied to a free program could
|
|
||||||
make it effectively proprietary. To prevent this, the GPL assures that
|
|
||||||
patents cannot be used to render the program non-free.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow.
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
0. Definitions.
|
|
||||||
|
|
||||||
"This License" refers to version 3 of the GNU General Public License.
|
|
||||||
|
|
||||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
|
||||||
works, such as semiconductor masks.
|
|
||||||
|
|
||||||
"The Program" refers to any copyrightable work licensed under this
|
|
||||||
License. Each licensee is addressed as "you". "Licensees" and
|
|
||||||
"recipients" may be individuals or organizations.
|
|
||||||
|
|
||||||
To "modify" a work means to copy from or adapt all or part of the work
|
|
||||||
in a fashion requiring copyright permission, other than the making of an
|
|
||||||
exact copy. The resulting work is called a "modified version" of the
|
|
||||||
earlier work or a work "based on" the earlier work.
|
|
||||||
|
|
||||||
A "covered work" means either the unmodified Program or a work based
|
|
||||||
on the Program.
|
|
||||||
|
|
||||||
To "propagate" a work means to do anything with it that, without
|
|
||||||
permission, would make you directly or secondarily liable for
|
|
||||||
infringement under applicable copyright law, except executing it on a
|
|
||||||
computer or modifying a private copy. Propagation includes copying,
|
|
||||||
distribution (with or without modification), making available to the
|
|
||||||
public, and in some countries other activities as well.
|
|
||||||
|
|
||||||
To "convey" a work means any kind of propagation that enables other
|
|
||||||
parties to make or receive copies. Mere interaction with a user through
|
|
||||||
a computer network, with no transfer of a copy, is not conveying.
|
|
||||||
|
|
||||||
An interactive user interface displays "Appropriate Legal Notices"
|
|
||||||
to the extent that it includes a convenient and prominently visible
|
|
||||||
feature that (1) displays an appropriate copyright notice, and (2)
|
|
||||||
tells the user that there is no warranty for the work (except to the
|
|
||||||
extent that warranties are provided), that licensees may convey the
|
|
||||||
work under this License, and how to view a copy of this License. If
|
|
||||||
the interface presents a list of user commands or options, such as a
|
|
||||||
menu, a prominent item in the list meets this criterion.
|
|
||||||
|
|
||||||
1. Source Code.
|
|
||||||
|
|
||||||
The "source code" for a work means the preferred form of the work
|
|
||||||
for making modifications to it. "Object code" means any non-source
|
|
||||||
form of a work.
|
|
||||||
|
|
||||||
A "Standard Interface" means an interface that either is an official
|
|
||||||
standard defined by a recognized standards body, or, in the case of
|
|
||||||
interfaces specified for a particular programming language, one that
|
|
||||||
is widely used among developers working in that language.
|
|
||||||
|
|
||||||
The "System Libraries" of an executable work include anything, other
|
|
||||||
than the work as a whole, that (a) is included in the normal form of
|
|
||||||
packaging a Major Component, but which is not part of that Major
|
|
||||||
Component, and (b) serves only to enable use of the work with that
|
|
||||||
Major Component, or to implement a Standard Interface for which an
|
|
||||||
implementation is available to the public in source code form. A
|
|
||||||
"Major Component", in this context, means a major essential component
|
|
||||||
(kernel, window system, and so on) of the specific operating system
|
|
||||||
(if any) on which the executable work runs, or a compiler used to
|
|
||||||
produce the work, or an object code interpreter used to run it.
|
|
||||||
|
|
||||||
The "Corresponding Source" for a work in object code form means all
|
|
||||||
the source code needed to generate, install, and (for an executable
|
|
||||||
work) run the object code and to modify the work, including scripts to
|
|
||||||
control those activities. However, it does not include the work's
|
|
||||||
System Libraries, or general-purpose tools or generally available free
|
|
||||||
programs which are used unmodified in performing those activities but
|
|
||||||
which are not part of the work. For example, Corresponding Source
|
|
||||||
includes interface definition files associated with source files for
|
|
||||||
the work, and the source code for shared libraries and dynamically
|
|
||||||
linked subprograms that the work is specifically designed to require,
|
|
||||||
such as by intimate data communication or control flow between those
|
|
||||||
subprograms and other parts of the work.
|
|
||||||
|
|
||||||
The Corresponding Source need not include anything that users
|
|
||||||
can regenerate automatically from other parts of the Corresponding
|
|
||||||
Source.
|
|
||||||
|
|
||||||
The Corresponding Source for a work in source code form is that
|
|
||||||
same work.
|
|
||||||
|
|
||||||
2. Basic Permissions.
|
|
||||||
|
|
||||||
All rights granted under this License are granted for the term of
|
|
||||||
copyright on the Program, and are irrevocable provided the stated
|
|
||||||
conditions are met. This License explicitly affirms your unlimited
|
|
||||||
permission to run the unmodified Program. The output from running a
|
|
||||||
covered work is covered by this License only if the output, given its
|
|
||||||
content, constitutes a covered work. This License acknowledges your
|
|
||||||
rights of fair use or other equivalent, as provided by copyright law.
|
|
||||||
|
|
||||||
You may make, run and propagate covered works that you do not
|
|
||||||
convey, without conditions so long as your license otherwise remains
|
|
||||||
in force. You may convey covered works to others for the sole purpose
|
|
||||||
of having them make modifications exclusively for you, or provide you
|
|
||||||
with facilities for running those works, provided that you comply with
|
|
||||||
the terms of this License in conveying all material for which you do
|
|
||||||
not control copyright. Those thus making or running the covered works
|
|
||||||
for you must do so exclusively on your behalf, under your direction
|
|
||||||
and control, on terms that prohibit them from making any copies of
|
|
||||||
your copyrighted material outside their relationship with you.
|
|
||||||
|
|
||||||
Conveying under any other circumstances is permitted solely under
|
|
||||||
the conditions stated below. Sublicensing is not allowed; section 10
|
|
||||||
makes it unnecessary.
|
|
||||||
|
|
||||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
|
||||||
|
|
||||||
No covered work shall be deemed part of an effective technological
|
|
||||||
measure under any applicable law fulfilling obligations under article
|
|
||||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
|
||||||
similar laws prohibiting or restricting circumvention of such
|
|
||||||
measures.
|
|
||||||
|
|
||||||
When you convey a covered work, you waive any legal power to forbid
|
|
||||||
circumvention of technological measures to the extent such circumvention
|
|
||||||
is effected by exercising rights under this License with respect to
|
|
||||||
the covered work, and you disclaim any intention to limit operation or
|
|
||||||
modification of the work as a means of enforcing, against the work's
|
|
||||||
users, your or third parties' legal rights to forbid circumvention of
|
|
||||||
technological measures.
|
|
||||||
|
|
||||||
4. Conveying Verbatim Copies.
|
|
||||||
|
|
||||||
You may convey verbatim copies of the Program's source code as you
|
|
||||||
receive it, in any medium, provided that you conspicuously and
|
|
||||||
appropriately publish on each copy an appropriate copyright notice;
|
|
||||||
keep intact all notices stating that this License and any
|
|
||||||
non-permissive terms added in accord with section 7 apply to the code;
|
|
||||||
keep intact all notices of the absence of any warranty; and give all
|
|
||||||
recipients a copy of this License along with the Program.
|
|
||||||
|
|
||||||
You may charge any price or no price for each copy that you convey,
|
|
||||||
and you may offer support or warranty protection for a fee.
|
|
||||||
|
|
||||||
5. Conveying Modified Source Versions.
|
|
||||||
|
|
||||||
You may convey a work based on the Program, or the modifications to
|
|
||||||
produce it from the Program, in the form of source code under the
|
|
||||||
terms of section 4, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) The work must carry prominent notices stating that you modified
|
|
||||||
it, and giving a relevant date.
|
|
||||||
|
|
||||||
b) The work must carry prominent notices stating that it is
|
|
||||||
released under this License and any conditions added under section
|
|
||||||
7. This requirement modifies the requirement in section 4 to
|
|
||||||
"keep intact all notices".
|
|
||||||
|
|
||||||
c) You must license the entire work, as a whole, under this
|
|
||||||
License to anyone who comes into possession of a copy. This
|
|
||||||
License will therefore apply, along with any applicable section 7
|
|
||||||
additional terms, to the whole of the work, and all its parts,
|
|
||||||
regardless of how they are packaged. This License gives no
|
|
||||||
permission to license the work in any other way, but it does not
|
|
||||||
invalidate such permission if you have separately received it.
|
|
||||||
|
|
||||||
d) If the work has interactive user interfaces, each must display
|
|
||||||
Appropriate Legal Notices; however, if the Program has interactive
|
|
||||||
interfaces that do not display Appropriate Legal Notices, your
|
|
||||||
work need not make them do so.
|
|
||||||
|
|
||||||
A compilation of a covered work with other separate and independent
|
|
||||||
works, which are not by their nature extensions of the covered work,
|
|
||||||
and which are not combined with it such as to form a larger program,
|
|
||||||
in or on a volume of a storage or distribution medium, is called an
|
|
||||||
"aggregate" if the compilation and its resulting copyright are not
|
|
||||||
used to limit the access or legal rights of the compilation's users
|
|
||||||
beyond what the individual works permit. Inclusion of a covered work
|
|
||||||
in an aggregate does not cause this License to apply to the other
|
|
||||||
parts of the aggregate.
|
|
||||||
|
|
||||||
6. Conveying Non-Source Forms.
|
|
||||||
|
|
||||||
You may convey a covered work in object code form under the terms
|
|
||||||
of sections 4 and 5, provided that you also convey the
|
|
||||||
machine-readable Corresponding Source under the terms of this License,
|
|
||||||
in one of these ways:
|
|
||||||
|
|
||||||
a) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by the
|
|
||||||
Corresponding Source fixed on a durable physical medium
|
|
||||||
customarily used for software interchange.
|
|
||||||
|
|
||||||
b) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by a
|
|
||||||
written offer, valid for at least three years and valid for as
|
|
||||||
long as you offer spare parts or customer support for that product
|
|
||||||
model, to give anyone who possesses the object code either (1) a
|
|
||||||
copy of the Corresponding Source for all the software in the
|
|
||||||
product that is covered by this License, on a durable physical
|
|
||||||
medium customarily used for software interchange, for a price no
|
|
||||||
more than your reasonable cost of physically performing this
|
|
||||||
conveying of source, or (2) access to copy the
|
|
||||||
Corresponding Source from a network server at no charge.
|
|
||||||
|
|
||||||
c) Convey individual copies of the object code with a copy of the
|
|
||||||
written offer to provide the Corresponding Source. This
|
|
||||||
alternative is allowed only occasionally and noncommercially, and
|
|
||||||
only if you received the object code with such an offer, in accord
|
|
||||||
with subsection 6b.
|
|
||||||
|
|
||||||
d) Convey the object code by offering access from a designated
|
|
||||||
place (gratis or for a charge), and offer equivalent access to the
|
|
||||||
Corresponding Source in the same way through the same place at no
|
|
||||||
further charge. You need not require recipients to copy the
|
|
||||||
Corresponding Source along with the object code. If the place to
|
|
||||||
copy the object code is a network server, the Corresponding Source
|
|
||||||
may be on a different server (operated by you or a third party)
|
|
||||||
that supports equivalent copying facilities, provided you maintain
|
|
||||||
clear directions next to the object code saying where to find the
|
|
||||||
Corresponding Source. Regardless of what server hosts the
|
|
||||||
Corresponding Source, you remain obligated to ensure that it is
|
|
||||||
available for as long as needed to satisfy these requirements.
|
|
||||||
|
|
||||||
e) Convey the object code using peer-to-peer transmission, provided
|
|
||||||
you inform other peers where the object code and Corresponding
|
|
||||||
Source of the work are being offered to the general public at no
|
|
||||||
charge under subsection 6d.
|
|
||||||
|
|
||||||
A separable portion of the object code, whose source code is excluded
|
|
||||||
from the Corresponding Source as a System Library, need not be
|
|
||||||
included in conveying the object code work.
|
|
||||||
|
|
||||||
A "User Product" is either (1) a "consumer product", which means any
|
|
||||||
tangible personal property which is normally used for personal, family,
|
|
||||||
or household purposes, or (2) anything designed or sold for incorporation
|
|
||||||
into a dwelling. In determining whether a product is a consumer product,
|
|
||||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
|
||||||
product received by a particular user, "normally used" refers to a
|
|
||||||
typical or common use of that class of product, regardless of the status
|
|
||||||
of the particular user or of the way in which the particular user
|
|
||||||
actually uses, or expects or is expected to use, the product. A product
|
|
||||||
is a consumer product regardless of whether the product has substantial
|
|
||||||
commercial, industrial or non-consumer uses, unless such uses represent
|
|
||||||
the only significant mode of use of the product.
|
|
||||||
|
|
||||||
"Installation Information" for a User Product means any methods,
|
|
||||||
procedures, authorization keys, or other information required to install
|
|
||||||
and execute modified versions of a covered work in that User Product from
|
|
||||||
a modified version of its Corresponding Source. The information must
|
|
||||||
suffice to ensure that the continued functioning of the modified object
|
|
||||||
code is in no case prevented or interfered with solely because
|
|
||||||
modification has been made.
|
|
||||||
|
|
||||||
If you convey an object code work under this section in, or with, or
|
|
||||||
specifically for use in, a User Product, and the conveying occurs as
|
|
||||||
part of a transaction in which the right of possession and use of the
|
|
||||||
User Product is transferred to the recipient in perpetuity or for a
|
|
||||||
fixed term (regardless of how the transaction is characterized), the
|
|
||||||
Corresponding Source conveyed under this section must be accompanied
|
|
||||||
by the Installation Information. But this requirement does not apply
|
|
||||||
if neither you nor any third party retains the ability to install
|
|
||||||
modified object code on the User Product (for example, the work has
|
|
||||||
been installed in ROM).
|
|
||||||
|
|
||||||
The requirement to provide Installation Information does not include a
|
|
||||||
requirement to continue to provide support service, warranty, or updates
|
|
||||||
for a work that has been modified or installed by the recipient, or for
|
|
||||||
the User Product in which it has been modified or installed. Access to a
|
|
||||||
network may be denied when the modification itself materially and
|
|
||||||
adversely affects the operation of the network or violates the rules and
|
|
||||||
protocols for communication across the network.
|
|
||||||
|
|
||||||
Corresponding Source conveyed, and Installation Information provided,
|
|
||||||
in accord with this section must be in a format that is publicly
|
|
||||||
documented (and with an implementation available to the public in
|
|
||||||
source code form), and must require no special password or key for
|
|
||||||
unpacking, reading or copying.
|
|
||||||
|
|
||||||
7. Additional Terms.
|
|
||||||
|
|
||||||
"Additional permissions" are terms that supplement the terms of this
|
|
||||||
License by making exceptions from one or more of its conditions.
|
|
||||||
Additional permissions that are applicable to the entire Program shall
|
|
||||||
be treated as though they were included in this License, to the extent
|
|
||||||
that they are valid under applicable law. If additional permissions
|
|
||||||
apply only to part of the Program, that part may be used separately
|
|
||||||
under those permissions, but the entire Program remains governed by
|
|
||||||
this License without regard to the additional permissions.
|
|
||||||
|
|
||||||
When you convey a copy of a covered work, you may at your option
|
|
||||||
remove any additional permissions from that copy, or from any part of
|
|
||||||
it. (Additional permissions may be written to require their own
|
|
||||||
removal in certain cases when you modify the work.) You may place
|
|
||||||
additional permissions on material, added by you to a covered work,
|
|
||||||
for which you have or can give appropriate copyright permission.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, for material you
|
|
||||||
add to a covered work, you may (if authorized by the copyright holders of
|
|
||||||
that material) supplement the terms of this License with terms:
|
|
||||||
|
|
||||||
a) Disclaiming warranty or limiting liability differently from the
|
|
||||||
terms of sections 15 and 16 of this License; or
|
|
||||||
|
|
||||||
b) Requiring preservation of specified reasonable legal notices or
|
|
||||||
author attributions in that material or in the Appropriate Legal
|
|
||||||
Notices displayed by works containing it; or
|
|
||||||
|
|
||||||
c) Prohibiting misrepresentation of the origin of that material, or
|
|
||||||
requiring that modified versions of such material be marked in
|
|
||||||
reasonable ways as different from the original version; or
|
|
||||||
|
|
||||||
d) Limiting the use for publicity purposes of names of licensors or
|
|
||||||
authors of the material; or
|
|
||||||
|
|
||||||
e) Declining to grant rights under trademark law for use of some
|
|
||||||
trade names, trademarks, or service marks; or
|
|
||||||
|
|
||||||
f) Requiring indemnification of licensors and authors of that
|
|
||||||
material by anyone who conveys the material (or modified versions of
|
|
||||||
it) with contractual assumptions of liability to the recipient, for
|
|
||||||
any liability that these contractual assumptions directly impose on
|
|
||||||
those licensors and authors.
|
|
||||||
|
|
||||||
All other non-permissive additional terms are considered "further
|
|
||||||
restrictions" within the meaning of section 10. If the Program as you
|
|
||||||
received it, or any part of it, contains a notice stating that it is
|
|
||||||
governed by this License along with a term that is a further
|
|
||||||
restriction, you may remove that term. If a license document contains
|
|
||||||
a further restriction but permits relicensing or conveying under this
|
|
||||||
License, you may add to a covered work material governed by the terms
|
|
||||||
of that license document, provided that the further restriction does
|
|
||||||
not survive such relicensing or conveying.
|
|
||||||
|
|
||||||
If you add terms to a covered work in accord with this section, you
|
|
||||||
must place, in the relevant source files, a statement of the
|
|
||||||
additional terms that apply to those files, or a notice indicating
|
|
||||||
where to find the applicable terms.
|
|
||||||
|
|
||||||
Additional terms, permissive or non-permissive, may be stated in the
|
|
||||||
form of a separately written license, or stated as exceptions;
|
|
||||||
the above requirements apply either way.
|
|
||||||
|
|
||||||
8. Termination.
|
|
||||||
|
|
||||||
You may not propagate or modify a covered work except as expressly
|
|
||||||
provided under this License. Any attempt otherwise to propagate or
|
|
||||||
modify it is void, and will automatically terminate your rights under
|
|
||||||
this License (including any patent licenses granted under the third
|
|
||||||
paragraph of section 11).
|
|
||||||
|
|
||||||
However, if you cease all violation of this License, then your
|
|
||||||
license from a particular copyright holder is reinstated (a)
|
|
||||||
provisionally, unless and until the copyright holder explicitly and
|
|
||||||
finally terminates your license, and (b) permanently, if the copyright
|
|
||||||
holder fails to notify you of the violation by some reasonable means
|
|
||||||
prior to 60 days after the cessation.
|
|
||||||
|
|
||||||
Moreover, your license from a particular copyright holder is
|
|
||||||
reinstated permanently if the copyright holder notifies you of the
|
|
||||||
violation by some reasonable means, this is the first time you have
|
|
||||||
received notice of violation of this License (for any work) from that
|
|
||||||
copyright holder, and you cure the violation prior to 30 days after
|
|
||||||
your receipt of the notice.
|
|
||||||
|
|
||||||
Termination of your rights under this section does not terminate the
|
|
||||||
licenses of parties who have received copies or rights from you under
|
|
||||||
this License. If your rights have been terminated and not permanently
|
|
||||||
reinstated, you do not qualify to receive new licenses for the same
|
|
||||||
material under section 10.
|
|
||||||
|
|
||||||
9. Acceptance Not Required for Having Copies.
|
|
||||||
|
|
||||||
You are not required to accept this License in order to receive or
|
|
||||||
run a copy of the Program. Ancillary propagation of a covered work
|
|
||||||
occurring solely as a consequence of using peer-to-peer transmission
|
|
||||||
to receive a copy likewise does not require acceptance. However,
|
|
||||||
nothing other than this License grants you permission to propagate or
|
|
||||||
modify any covered work. These actions infringe copyright if you do
|
|
||||||
not accept this License. Therefore, by modifying or propagating a
|
|
||||||
covered work, you indicate your acceptance of this License to do so.
|
|
||||||
|
|
||||||
10. Automatic Licensing of Downstream Recipients.
|
|
||||||
|
|
||||||
Each time you convey a covered work, the recipient automatically
|
|
||||||
receives a license from the original licensors, to run, modify and
|
|
||||||
propagate that work, subject to this License. You are not responsible
|
|
||||||
for enforcing compliance by third parties with this License.
|
|
||||||
|
|
||||||
An "entity transaction" is a transaction transferring control of an
|
|
||||||
organization, or substantially all assets of one, or subdividing an
|
|
||||||
organization, or merging organizations. If propagation of a covered
|
|
||||||
work results from an entity transaction, each party to that
|
|
||||||
transaction who receives a copy of the work also receives whatever
|
|
||||||
licenses to the work the party's predecessor in interest had or could
|
|
||||||
give under the previous paragraph, plus a right to possession of the
|
|
||||||
Corresponding Source of the work from the predecessor in interest, if
|
|
||||||
the predecessor has it or can get it with reasonable efforts.
|
|
||||||
|
|
||||||
You may not impose any further restrictions on the exercise of the
|
|
||||||
rights granted or affirmed under this License. For example, you may
|
|
||||||
not impose a license fee, royalty, or other charge for exercise of
|
|
||||||
rights granted under this License, and you may not initiate litigation
|
|
||||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
|
||||||
any patent claim is infringed by making, using, selling, offering for
|
|
||||||
sale, or importing the Program or any portion of it.
|
|
||||||
|
|
||||||
11. Patents.
|
|
||||||
|
|
||||||
A "contributor" is a copyright holder who authorizes use under this
|
|
||||||
License of the Program or a work on which the Program is based. The
|
|
||||||
work thus licensed is called the contributor's "contributor version".
|
|
||||||
|
|
||||||
A contributor's "essential patent claims" are all patent claims
|
|
||||||
owned or controlled by the contributor, whether already acquired or
|
|
||||||
hereafter acquired, that would be infringed by some manner, permitted
|
|
||||||
by this License, of making, using, or selling its contributor version,
|
|
||||||
but do not include claims that would be infringed only as a
|
|
||||||
consequence of further modification of the contributor version. For
|
|
||||||
purposes of this definition, "control" includes the right to grant
|
|
||||||
patent sublicenses in a manner consistent with the requirements of
|
|
||||||
this License.
|
|
||||||
|
|
||||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
|
||||||
patent license under the contributor's essential patent claims, to
|
|
||||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
|
||||||
propagate the contents of its contributor version.
|
|
||||||
|
|
||||||
In the following three paragraphs, a "patent license" is any express
|
|
||||||
agreement or commitment, however denominated, not to enforce a patent
|
|
||||||
(such as an express permission to practice a patent or covenant not to
|
|
||||||
sue for patent infringement). To "grant" such a patent license to a
|
|
||||||
party means to make such an agreement or commitment not to enforce a
|
|
||||||
patent against the party.
|
|
||||||
|
|
||||||
If you convey a covered work, knowingly relying on a patent license,
|
|
||||||
and the Corresponding Source of the work is not available for anyone
|
|
||||||
to copy, free of charge and under the terms of this License, through a
|
|
||||||
publicly available network server or other readily accessible means,
|
|
||||||
then you must either (1) cause the Corresponding Source to be so
|
|
||||||
available, or (2) arrange to deprive yourself of the benefit of the
|
|
||||||
patent license for this particular work, or (3) arrange, in a manner
|
|
||||||
consistent with the requirements of this License, to extend the patent
|
|
||||||
license to downstream recipients. "Knowingly relying" means you have
|
|
||||||
actual knowledge that, but for the patent license, your conveying the
|
|
||||||
covered work in a country, or your recipient's use of the covered work
|
|
||||||
in a country, would infringe one or more identifiable patents in that
|
|
||||||
country that you have reason to believe are valid.
|
|
||||||
|
|
||||||
If, pursuant to or in connection with a single transaction or
|
|
||||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
|
||||||
covered work, and grant a patent license to some of the parties
|
|
||||||
receiving the covered work authorizing them to use, propagate, modify
|
|
||||||
or convey a specific copy of the covered work, then the patent license
|
|
||||||
you grant is automatically extended to all recipients of the covered
|
|
||||||
work and works based on it.
|
|
||||||
|
|
||||||
A patent license is "discriminatory" if it does not include within
|
|
||||||
the scope of its coverage, prohibits the exercise of, or is
|
|
||||||
conditioned on the non-exercise of one or more of the rights that are
|
|
||||||
specifically granted under this License. You may not convey a covered
|
|
||||||
work if you are a party to an arrangement with a third party that is
|
|
||||||
in the business of distributing software, under which you make payment
|
|
||||||
to the third party based on the extent of your activity of conveying
|
|
||||||
the work, and under which the third party grants, to any of the
|
|
||||||
parties who would receive the covered work from you, a discriminatory
|
|
||||||
patent license (a) in connection with copies of the covered work
|
|
||||||
conveyed by you (or copies made from those copies), or (b) primarily
|
|
||||||
for and in connection with specific products or compilations that
|
|
||||||
contain the covered work, unless you entered into that arrangement,
|
|
||||||
or that patent license was granted, prior to 28 March 2007.
|
|
||||||
|
|
||||||
Nothing in this License shall be construed as excluding or limiting
|
|
||||||
any implied license or other defenses to infringement that may
|
|
||||||
otherwise be available to you under applicable patent law.
|
|
||||||
|
|
||||||
12. No Surrender of Others' Freedom.
|
|
||||||
|
|
||||||
If conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot convey a
|
|
||||||
covered work so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you may
|
|
||||||
not convey it at all. For example, if you agree to terms that obligate you
|
|
||||||
to collect a royalty for further conveying from those to whom you convey
|
|
||||||
the Program, the only way you could satisfy both those terms and this
|
|
||||||
License would be to refrain entirely from conveying the Program.
|
|
||||||
|
|
||||||
13. Use with the GNU Affero General Public License.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, you have
|
|
||||||
permission to link or combine any covered work with a work licensed
|
|
||||||
under version 3 of the GNU Affero General Public License into a single
|
|
||||||
combined work, and to convey the resulting work. The terms of this
|
|
||||||
License will continue to apply to the part which is the covered work,
|
|
||||||
but the special requirements of the GNU Affero General Public License,
|
|
||||||
section 13, concerning interaction through a network will apply to the
|
|
||||||
combination as such.
|
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
|
||||||
the GNU General Public License from time to time. Such new versions will
|
|
||||||
be similar in spirit to the present version, but may differ in detail to
|
|
||||||
address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
|
||||||
Program specifies that a certain numbered version of the GNU General
|
|
||||||
Public License "or any later version" applies to it, you have the
|
|
||||||
option of following the terms and conditions either of that numbered
|
|
||||||
version or of any later version published by the Free Software
|
|
||||||
Foundation. If the Program does not specify a version number of the
|
|
||||||
GNU General Public License, you may choose any version ever published
|
|
||||||
by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Program specifies that a proxy can decide which future
|
|
||||||
versions of the GNU General Public License can be used, that proxy's
|
|
||||||
public statement of acceptance of a version permanently authorizes you
|
|
||||||
to choose that version for the Program.
|
|
||||||
|
|
||||||
Later license versions may give you additional or different
|
|
||||||
permissions. However, no additional obligations are imposed on any
|
|
||||||
author or copyright holder as a result of your choosing to follow a
|
|
||||||
later version.
|
|
||||||
|
|
||||||
15. Disclaimer of Warranty.
|
|
||||||
|
|
||||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
|
||||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
|
||||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
|
||||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
|
||||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
|
||||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
16. Limitation of Liability.
|
|
||||||
|
|
||||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
||||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
|
||||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
|
||||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
|
||||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
|
||||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
|
||||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
|
||||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
|
||||||
SUCH DAMAGES.
|
|
||||||
|
|
||||||
17. Interpretation of Sections 15 and 16.
|
|
||||||
|
|
||||||
If the disclaimer of warranty and limitation of liability provided
|
|
||||||
above cannot be given local legal effect according to their terms,
|
|
||||||
reviewing courts shall apply local law that most closely approximates
|
|
||||||
an absolute waiver of all civil liability in connection with the
|
|
||||||
Program, unless a warranty or assumption of liability accompanies a
|
|
||||||
copy of the Program in return for a fee.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
|
||||||
possible use to the public, the best way to achieve this is to make it
|
|
||||||
free software which everyone can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest
|
|
||||||
to attach them to the start of each source file to most effectively
|
|
||||||
state the exclusion of warranty; and each file should have at least
|
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
{one line to give the program's name and a brief idea of what it does.}
|
|
||||||
Copyright (C) {year} {name of author}
|
|
||||||
|
|
||||||
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, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
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, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If the program does terminal interaction, make it output a short
|
|
||||||
notice like this when it starts in an interactive mode:
|
|
||||||
|
|
||||||
{project} Copyright (C) {year} {fullname}
|
|
||||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
|
||||||
This is free software, and you are welcome to redistribute it
|
|
||||||
under certain conditions; type `show c' for details.
|
|
||||||
|
|
||||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
|
||||||
parts of the General Public License. Of course, your program's commands
|
|
||||||
might be different; for a GUI interface, you would use an "about box".
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or school,
|
|
||||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
|
||||||
For more information on this, and how to apply and follow the GNU GPL, see
|
|
||||||
<http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
The GNU General Public License does not permit incorporating your program
|
|
||||||
into proprietary programs. If your program is a subroutine library, you
|
|
||||||
may consider it more useful to permit linking proprietary applications with
|
|
||||||
the library. If this is what you want to do, use the GNU Lesser General
|
|
||||||
Public License instead of this License. But first, please read
|
|
||||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
|
84
README.md
84
README.md
@ -1,84 +0,0 @@
|
|||||||
# What is mydumper? Why?
|
|
||||||
|
|
||||||
* Parallelism (hence, speed) and performance (avoids expensive character set conversion routines, efficient code overall)
|
|
||||||
* Easier to manage output (separate files for tables, dump metadata, etc, easy to view/parse data)
|
|
||||||
* Consistency - maintains snapshot across all threads, provides accurate master and slave log positions, etc
|
|
||||||
* Manageability - supports PCRE for specifying database and tables inclusions and exclusions
|
|
||||||
|
|
||||||
## How to install mydumper/myloader?
|
|
||||||
|
|
||||||
First get the correct url from the [releases section](https://github.com/maxbube/mydumper/releases) then:
|
|
||||||
|
|
||||||
### RedHat / Centos
|
|
||||||
|
|
||||||
```bash
|
|
||||||
yum install https://github.com/maxbube/mydumper/releases/download/v0.9.5/mydumper-0.9.5-1.el7.x86_64.rpm
|
|
||||||
```
|
|
||||||
|
|
||||||
### Ubuntu / Debian
|
|
||||||
|
|
||||||
```bash
|
|
||||||
wget https://github.com/maxbube/mydumper/releases/download/v0.9.5/mydumper_0.9.5-1.xenial_amd64.deb
|
|
||||||
dpkg -i mydumper_0.9.5-1.xenial_amd64.deb
|
|
||||||
```
|
|
||||||
|
|
||||||
## How to build it?
|
|
||||||
|
|
||||||
Run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cmake .
|
|
||||||
make
|
|
||||||
```
|
|
||||||
|
|
||||||
One needs to install development versions of required libaries (MySQL, GLib, ZLib, PCRE):
|
|
||||||
NOTE: you must use the correspondent mysql devel package.
|
|
||||||
|
|
||||||
* Ubuntu or Debian: apt-get install libglib2.0-dev libmysqlclient15-dev zlib1g-dev libpcre3-dev libssl-dev
|
|
||||||
* Fedora, RedHat and CentOS: yum install glib2-devel mysql-devel zlib-devel pcre-devel openssl-devel
|
|
||||||
* openSUSE: zypper install glib2-devel libmysqlclient-devel pcre-devel zlib-devel
|
|
||||||
* MacOSX: port install glib2 mysql5 pcre pkgconfig cmake
|
|
||||||
(You may want to run 'port select mysql mysql5' afterwards)
|
|
||||||
|
|
||||||
One has to make sure, that pkg-config, mysql_config, pcre-config are all in $PATH
|
|
||||||
|
|
||||||
Binlog dump is disabled by default to compile with it you need to add -DWITH_BINLOG=ON to cmake options
|
|
||||||
|
|
||||||
To build against mysql libs < 5.7 you need to disable SSL adding -DWITH_SSL=OFF
|
|
||||||
|
|
||||||
## How does consistent snapshot work?
|
|
||||||
|
|
||||||
This is all done following best MySQL practices and traditions:
|
|
||||||
|
|
||||||
* As a precaution, slow running queries on the server either abort the dump, or get killed
|
|
||||||
* Global write lock is acquired ("FLUSH TABLES WITH READ LOCK")
|
|
||||||
* Various metadata is read ("SHOW SLAVE STATUS","SHOW MASTER STATUS")
|
|
||||||
* Other threads connect and establish snapshots ("START TRANSACTION WITH CONSISTENT SNAPSHOT")
|
|
||||||
** On pre-4.1.8 it creates dummy InnoDB table, and reads from it.
|
|
||||||
* Once all worker threads announce the snapshot establishment, master executes "UNLOCK TABLES" and starts queueing jobs.
|
|
||||||
|
|
||||||
This for now does not provide consistent snapshots for non-transactional engines - support for that is expected in 0.2 :)
|
|
||||||
|
|
||||||
## How to exclude (or include) databases?
|
|
||||||
|
|
||||||
Once can use --regex functionality, for example not to dump mysql and test databases:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
mydumper --regex '^(?!(mysql\.|test\.))'
|
|
||||||
```
|
|
||||||
|
|
||||||
To dump only mysql and test databases:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
mydumper --regex '^(mysql\.|test\.)'
|
|
||||||
```
|
|
||||||
|
|
||||||
To not dump all databases starting with test:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
mydumper --regex '^(?!(test))'
|
|
||||||
```
|
|
||||||
|
|
||||||
Of course, regex functionality can be used to describe pretty much any list of tables.
|
|
||||||
|
|
||||||
|
|
284
binlog.c
284
binlog.c
@ -1,284 +0,0 @@
|
|||||||
/*
|
|
||||||
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, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
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, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Authors: Domas Mituzas, Facebook ( domas at fb dot com )
|
|
||||||
Mark Leith, Oracle Corporation (mark dot leith at oracle dot com)
|
|
||||||
Andrew Hutchings, SkySQL (andrew at skysql dot com)
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
#include <glib/gstdio.h>
|
|
||||||
#include <my_global.h>
|
|
||||||
#include <mysql.h>
|
|
||||||
#include <my_sys.h>
|
|
||||||
#include <mysqld_error.h>
|
|
||||||
#include <sql_common.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <zlib.h>
|
|
||||||
#include "mydumper.h"
|
|
||||||
#include "binlog.h"
|
|
||||||
|
|
||||||
#define BINLOG_MAGIC "\xfe\x62\x69\x6e"
|
|
||||||
|
|
||||||
#define EVENT_HEADER_LENGTH 19
|
|
||||||
#define EVENT_ROTATE_FIXED_LENGTH 8
|
|
||||||
|
|
||||||
enum event_postions {
|
|
||||||
EVENT_TIMESTAMP_POSITION= 0,
|
|
||||||
EVENT_TYPE_POSITION= 4,
|
|
||||||
EVENT_SERVERID_POSITION= 5,
|
|
||||||
EVENT_LENGTH_POSITION= 9,
|
|
||||||
EVENT_NEXT_POSITION= 13,
|
|
||||||
EVENT_FLAGS_POSITION= 17,
|
|
||||||
EVENT_EXTRA_FLAGS_POSITION= 19 // currently unused in v4 binlogs, but a good marker for end of header
|
|
||||||
};
|
|
||||||
|
|
||||||
enum event_type {
|
|
||||||
ROTATE_EVENT= 4,
|
|
||||||
FORMAT_DESCRIPTION_EVENT= 15,
|
|
||||||
EVENT_TOO_SHORT= 254 // arbitrary high number, in 5.1 the max event type number is 27 so this should be fine for a while
|
|
||||||
};
|
|
||||||
|
|
||||||
extern int compress_output;
|
|
||||||
extern gboolean daemon_mode;
|
|
||||||
extern gboolean shutdown_triggered;
|
|
||||||
|
|
||||||
FILE *new_binlog_file(char *binlog_file, const char *binlog_dir);
|
|
||||||
void close_binlog_file(FILE *outfile);
|
|
||||||
char *rotate_file_name(const char *buf);
|
|
||||||
|
|
||||||
void get_binlogs(MYSQL *conn, struct configuration *conf) {
|
|
||||||
// TODO: find logs we already have, use start position based on position of last log.
|
|
||||||
MYSQL_RES *result;
|
|
||||||
MYSQL_ROW row;
|
|
||||||
char* last_filename = NULL;
|
|
||||||
guint64 last_position;
|
|
||||||
|
|
||||||
// Only snapshot dump the binlogs once in daemon mode
|
|
||||||
static gboolean got_binlogs= FALSE;
|
|
||||||
if (got_binlogs)
|
|
||||||
return;
|
|
||||||
else
|
|
||||||
got_binlogs= TRUE;
|
|
||||||
|
|
||||||
if (mysql_query(conn, "SHOW MASTER STATUS")) {
|
|
||||||
g_critical("Error: Could not execute query: %s", mysql_error(conn));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = mysql_store_result(conn);
|
|
||||||
if ((row = mysql_fetch_row(result))) {
|
|
||||||
last_filename= g_strdup(row[0]);
|
|
||||||
last_position= strtoll(row[1], NULL, 10);
|
|
||||||
} else {
|
|
||||||
g_critical("Error: Could not obtain binary log stop position");
|
|
||||||
if (last_filename != NULL)
|
|
||||||
g_free(last_filename);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
mysql_free_result(result);
|
|
||||||
|
|
||||||
if (mysql_query(conn, "SHOW BINARY LOGS")) {
|
|
||||||
g_critical("Error: Could not execute query: %s", mysql_error(conn));
|
|
||||||
if (last_filename != NULL)
|
|
||||||
g_free(last_filename);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
result = mysql_store_result(conn);
|
|
||||||
while ((row = mysql_fetch_row(result))) {
|
|
||||||
struct job *j = g_new0(struct job,1);
|
|
||||||
struct binlog_job *bj = g_new0(struct binlog_job,1);
|
|
||||||
j->job_data=(void*) bj;
|
|
||||||
bj->filename=g_strdup(row[0]);
|
|
||||||
bj->start_position=4;
|
|
||||||
bj->stop_position= (!strcasecmp(row[0], last_filename)) ? last_position : 0;
|
|
||||||
j->conf=conf;
|
|
||||||
j->type=JOB_BINLOG;
|
|
||||||
g_async_queue_push(conf->queue,j);
|
|
||||||
}
|
|
||||||
mysql_free_result(result);
|
|
||||||
if (last_filename != NULL)
|
|
||||||
g_free(last_filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
void get_binlog_file(MYSQL *conn, char *binlog_file, const char *binlog_directory, guint64 start_position, guint64 stop_position, gboolean continuous) {
|
|
||||||
// set serverID = max serverID - threadID to try an eliminate conflicts,
|
|
||||||
// 0 is bad because mysqld will disconnect at the end of the last log
|
|
||||||
// dupes aren't too bad since it is up to the client to check for them
|
|
||||||
uchar buf[128];
|
|
||||||
// We need to read the raw network packets
|
|
||||||
NET* net;
|
|
||||||
net= &conn->net;
|
|
||||||
unsigned long len;
|
|
||||||
FILE* outfile;
|
|
||||||
guint32 event_type;
|
|
||||||
gboolean read_error= FALSE;
|
|
||||||
gboolean read_end= FALSE;
|
|
||||||
gboolean rotated= FALSE;
|
|
||||||
guint32 server_id= G_MAXUINT32 - mysql_thread_id(conn);
|
|
||||||
guint64 pos_counter= 0;
|
|
||||||
|
|
||||||
int4store(buf, (guint32)start_position);
|
|
||||||
// Binlog flags (2 byte int)
|
|
||||||
int2store(buf + 4, 0);
|
|
||||||
// ServerID
|
|
||||||
int4store(buf + 6, server_id);
|
|
||||||
memcpy(buf + 10, binlog_file, strlen(binlog_file));
|
|
||||||
#if MYSQL_VERSION_ID < 50100
|
|
||||||
if (simple_command(conn, COM_BINLOG_DUMP, (const char *)buf,
|
|
||||||
#else
|
|
||||||
if (simple_command(conn, COM_BINLOG_DUMP, buf,
|
|
||||||
#endif
|
|
||||||
strlen(binlog_file) + 10, 1)) {
|
|
||||||
g_critical("Error: binlog: Critical error whilst requesting binary log");
|
|
||||||
}
|
|
||||||
|
|
||||||
while(1) {
|
|
||||||
outfile= new_binlog_file(binlog_file, binlog_directory);
|
|
||||||
if (outfile == NULL) {
|
|
||||||
g_critical("Error: binlog: Could not create binlog file '%s', %d", binlog_file, errno);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
write_binlog(outfile, BINLOG_MAGIC, 4);
|
|
||||||
while(1) {
|
|
||||||
len = 0;
|
|
||||||
if (net->vio != 0) len=my_net_read(net);
|
|
||||||
if ((len == 0) || (len == ~(unsigned long) 0)) {
|
|
||||||
// Net timeout (set to 1 second)
|
|
||||||
if (mysql_errno(conn) == ER_NET_READ_INTERRUPTED) {
|
|
||||||
if (shutdown_triggered) {
|
|
||||||
close_binlog_file(outfile);
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// A real error
|
|
||||||
} else {
|
|
||||||
g_critical("Error: binlog: Network packet read error getting binlog file: %s", binlog_file);
|
|
||||||
close_binlog_file(outfile);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (len < 8 && net->read_pos[0]) {
|
|
||||||
// end of data
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
pos_counter += len;
|
|
||||||
event_type= get_event((const char*)net->read_pos + 1, len -1);
|
|
||||||
switch (event_type) {
|
|
||||||
case EVENT_TOO_SHORT:
|
|
||||||
g_critical("Error: binlog: Event too short in binlog file: %s", binlog_file);
|
|
||||||
read_error= TRUE;
|
|
||||||
break;
|
|
||||||
case ROTATE_EVENT:
|
|
||||||
if (rotated) {
|
|
||||||
read_end= TRUE;
|
|
||||||
} else {
|
|
||||||
len= 1;
|
|
||||||
rotated= TRUE;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
// if we get this far this is a normal event to record
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (read_error) break;
|
|
||||||
write_binlog(outfile, (const char*)net->read_pos + 1, len - 1);
|
|
||||||
if (read_end) {
|
|
||||||
if (!continuous) {
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
g_free(binlog_file);
|
|
||||||
binlog_file= rotate_file_name((const char*)net->read_pos + 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// stop if we are at requested end of last log
|
|
||||||
if ((stop_position > 0) && (pos_counter >= stop_position)) break;
|
|
||||||
}
|
|
||||||
close_binlog_file(outfile);
|
|
||||||
if ((!continuous) || (!read_end)) break;
|
|
||||||
|
|
||||||
if (continuous && read_end) {
|
|
||||||
read_end= FALSE;
|
|
||||||
rotated= FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
char *rotate_file_name(const char *buf) {
|
|
||||||
guint32 event_length= 0;
|
|
||||||
|
|
||||||
// event length is 4 bytes at position 9
|
|
||||||
event_length= uint4korr(&buf[EVENT_LENGTH_POSITION]);
|
|
||||||
// event length includes the header, plus a rotate event has a fixed 8byte part we don't need
|
|
||||||
event_length= event_length - EVENT_HEADER_LENGTH - EVENT_ROTATE_FIXED_LENGTH;
|
|
||||||
|
|
||||||
return g_strndup(&buf[EVENT_HEADER_LENGTH + EVENT_ROTATE_FIXED_LENGTH], event_length);
|
|
||||||
}
|
|
||||||
|
|
||||||
FILE *new_binlog_file(char *binlog_file, const char *binlog_dir) {
|
|
||||||
FILE *outfile;
|
|
||||||
char* filename;
|
|
||||||
|
|
||||||
if (!compress_output) {
|
|
||||||
filename= g_strdup_printf("%s/%s", binlog_dir, binlog_file);
|
|
||||||
outfile= g_fopen(filename, "w");
|
|
||||||
} else {
|
|
||||||
filename= g_strdup_printf("%s/%s.gz", binlog_dir, binlog_file);
|
|
||||||
outfile= (void*) gzopen(filename, "w");
|
|
||||||
}
|
|
||||||
g_free(filename);
|
|
||||||
|
|
||||||
return outfile;
|
|
||||||
}
|
|
||||||
|
|
||||||
void close_binlog_file(FILE *outfile) {
|
|
||||||
if (!compress_output)
|
|
||||||
fclose(outfile);
|
|
||||||
else
|
|
||||||
gzclose((gzFile) outfile);
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int get_event(const char *buf, unsigned int len) {
|
|
||||||
if (len < EVENT_TYPE_POSITION)
|
|
||||||
return EVENT_TOO_SHORT;
|
|
||||||
return buf[EVENT_TYPE_POSITION];
|
|
||||||
|
|
||||||
// TODO: Would be good if we can check for valid event type, unfortunately this check can change from version to version
|
|
||||||
}
|
|
||||||
|
|
||||||
void write_binlog(FILE* file, const char* data, guint64 len) {
|
|
||||||
int err;
|
|
||||||
|
|
||||||
if (len > 0) {
|
|
||||||
int write_result;
|
|
||||||
|
|
||||||
if (!compress_output)
|
|
||||||
write_result= write(fileno(file), data, len);
|
|
||||||
else
|
|
||||||
write_result= gzwrite((gzFile)file, data, len);
|
|
||||||
|
|
||||||
if (write_result <= 0) {
|
|
||||||
if (!compress_output)
|
|
||||||
g_critical("Error: binlog: Error writing binary log: %s", strerror(errno));
|
|
||||||
else
|
|
||||||
g_critical("Error: binlog: Error writing compressed binary log: %s", gzerror((gzFile)file, &err));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
30
binlog.h
30
binlog.h
@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
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, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
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, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Authors: Domas Mituzas, Facebook ( domas at fb dot com )
|
|
||||||
Mark Leith, Oracle Corporation (mark dot leith at oracle dot com)
|
|
||||||
Andrew Hutchings, SkySQL (andrew at skysql dot com)
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _binlog_h
|
|
||||||
#define _binlog_h
|
|
||||||
#include "mydumper.h"
|
|
||||||
|
|
||||||
void get_binlogs(MYSQL *conn, struct configuration *conf);
|
|
||||||
void get_binlog_file(MYSQL *conn, char *binlog_file, const char *binlog_directory, guint64 start_position, guint64 stop_position, gboolean continuous);
|
|
||||||
unsigned int get_event(const char *buf, unsigned int len);
|
|
||||||
void write_binlog(FILE* file, const char* data, guint64 len);
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,214 +0,0 @@
|
|||||||
# - Run cppcheck on c++ source files as a custom target and a test
|
|
||||||
#
|
|
||||||
# include(CppcheckTargets)
|
|
||||||
# add_cppcheck(<target-name> [UNUSED_FUNCTIONS] [STYLE] [POSSIBLE_ERROR] [FAIL_ON_WARNINGS]) -
|
|
||||||
# Create a target to check a target's sources with cppcheck and the indicated options
|
|
||||||
# add_cppcheck_sources(<target-name> [UNUSED_FUNCTIONS] [STYLE] [POSSIBLE_ERROR] [FAIL_ON_WARNINGS]) -
|
|
||||||
# Create a target to check standalone sources with cppcheck and the indicated options
|
|
||||||
#
|
|
||||||
# Requires these CMake modules:
|
|
||||||
# Findcppcheck
|
|
||||||
#
|
|
||||||
# Requires CMake 2.6 or newer (uses the 'function' command)
|
|
||||||
#
|
|
||||||
# Original Author:
|
|
||||||
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
|
|
||||||
# http://academic.cleardefinition.com
|
|
||||||
# Iowa State University HCI Graduate Program/VRAC
|
|
||||||
#
|
|
||||||
# Copyright Iowa State University 2009-2010.
|
|
||||||
# Distributed under the Boost Software License, Version 1.0.
|
|
||||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
|
||||||
# http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
|
|
||||||
if(__add_cppcheck)
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
set(__add_cppcheck YES)
|
|
||||||
|
|
||||||
if(NOT CPPCHECK_FOUND)
|
|
||||||
find_package(cppcheck QUIET)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CPPCHECK_FOUND)
|
|
||||||
if(NOT TARGET all_cppcheck)
|
|
||||||
add_custom_target(all_cppcheck)
|
|
||||||
set_target_properties(all_cppcheck PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
function(add_cppcheck_sources _targetname)
|
|
||||||
if(CPPCHECK_FOUND)
|
|
||||||
set(_cppcheck_args)
|
|
||||||
set(_input ${ARGN})
|
|
||||||
list(FIND _input UNUSED_FUNCTIONS _unused_func)
|
|
||||||
if("${_unused_func}" GREATER "-1")
|
|
||||||
list(APPEND _cppcheck_args ${CPPCHECK_UNUSEDFUNC_ARG})
|
|
||||||
list(REMOVE_AT _input ${_unused_func})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
list(FIND _input STYLE _style)
|
|
||||||
if("${_style}" GREATER "-1")
|
|
||||||
list(APPEND _cppcheck_args ${CPPCHECK_STYLE_ARG})
|
|
||||||
list(REMOVE_AT _input ${_style})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
list(FIND _input POSSIBLE_ERROR _poss_err)
|
|
||||||
if("${_poss_err}" GREATER "-1")
|
|
||||||
list(APPEND _cppcheck_args ${CPPCHECK_POSSIBLEERROR_ARG})
|
|
||||||
list(REMOVE_AT _input ${_poss_err})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
list(FIND _input FAIL_ON_WARNINGS _fail_on_warn)
|
|
||||||
if("${_fail_on_warn}" GREATER "-1")
|
|
||||||
list(APPEND
|
|
||||||
CPPCHECK_FAIL_REGULAR_EXPRESSION
|
|
||||||
${CPPCHECK_WARN_REGULAR_EXPRESSION})
|
|
||||||
list(REMOVE_AT _input ${_fail_on_warn})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(_files)
|
|
||||||
foreach(_source ${_input})
|
|
||||||
get_source_file_property(_cppcheck_loc "${_source}" LOCATION)
|
|
||||||
if(_cppcheck_loc)
|
|
||||||
# This file has a source file property, carry on.
|
|
||||||
get_source_file_property(_cppcheck_lang "${_source}" LANGUAGE)
|
|
||||||
if("${_cppcheck_lang}" MATCHES "C")
|
|
||||||
list(APPEND _files "${_cppcheck_loc}")
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
# This file doesn't have source file properties - figure it out.
|
|
||||||
get_filename_component(_cppcheck_loc "${_source}" ABSOLUTE)
|
|
||||||
if(EXISTS "${_cppcheck_loc}")
|
|
||||||
list(APPEND _files "${_cppcheck_loc}")
|
|
||||||
else()
|
|
||||||
message(FATAL_ERROR
|
|
||||||
"Adding CPPCHECK for file target ${_targetname}: "
|
|
||||||
"File ${_source} does not exist or needs a corrected path location "
|
|
||||||
"since we think its absolute path is ${_cppcheck_loc}")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
if("1.${CMAKE_VERSION}" VERSION_LESS "1.2.8.0")
|
|
||||||
# Older than CMake 2.8.0
|
|
||||||
add_test(${_targetname}_cppcheck_test
|
|
||||||
"${CPPCHECK_EXECUTABLE}"
|
|
||||||
${CPPCHECK_TEMPLATE_ARG}
|
|
||||||
${_cppcheck_args}
|
|
||||||
${_files})
|
|
||||||
else()
|
|
||||||
# CMake 2.8.0 and newer
|
|
||||||
add_test(NAME
|
|
||||||
${_targetname}_cppcheck_test
|
|
||||||
COMMAND
|
|
||||||
"${CPPCHECK_EXECUTABLE}"
|
|
||||||
${CPPCHECK_TEMPLATE_ARG}
|
|
||||||
${_cppcheck_args}
|
|
||||||
${_files})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set_tests_properties(${_targetname}_cppcheck_test
|
|
||||||
PROPERTIES
|
|
||||||
FAIL_REGULAR_EXPRESSION
|
|
||||||
"${CPPCHECK_FAIL_REGULAR_EXPRESSION}")
|
|
||||||
|
|
||||||
add_custom_command(TARGET
|
|
||||||
all_cppcheck
|
|
||||||
PRE_BUILD
|
|
||||||
COMMAND
|
|
||||||
${CPPCHECK_EXECUTABLE}
|
|
||||||
${CPPCHECK_QUIET_ARG}
|
|
||||||
${CPPCHECK_TEMPLATE_ARG}
|
|
||||||
${_cppcheck_args}
|
|
||||||
${_files}
|
|
||||||
WORKING_DIRECTORY
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
|
||||||
COMMENT
|
|
||||||
"${_targetname}_cppcheck: Running cppcheck on target ${_targetname}..."
|
|
||||||
VERBATIM)
|
|
||||||
endif()
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
function(add_cppcheck _name)
|
|
||||||
if(NOT TARGET ${_name})
|
|
||||||
message(FATAL_ERROR
|
|
||||||
"add_cppcheck given a target name that does not exist: '${_name}' !")
|
|
||||||
endif()
|
|
||||||
if(CPPCHECK_FOUND)
|
|
||||||
set(_cppcheck_args)
|
|
||||||
|
|
||||||
list(FIND ARGN UNUSED_FUNCTIONS _unused_func)
|
|
||||||
if("${_unused_func}" GREATER "-1")
|
|
||||||
list(APPEND _cppcheck_args ${CPPCHECK_UNUSEDFUNC_ARG})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
list(FIND ARGN STYLE _style)
|
|
||||||
if("${_style}" GREATER "-1")
|
|
||||||
list(APPEND _cppcheck_args ${CPPCHECK_STYLE_ARG})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
list(FIND ARGN POSSIBLE_ERROR _poss_err)
|
|
||||||
if("${_poss_err}" GREATER "-1")
|
|
||||||
list(APPEND _cppcheck_args ${CPPCHECK_POSSIBLEERROR_ARG})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
list(FIND _input FAIL_ON_WARNINGS _fail_on_warn)
|
|
||||||
if("${_fail_on_warn}" GREATER "-1")
|
|
||||||
list(APPEND
|
|
||||||
CPPCHECK_FAIL_REGULAR_EXPRESSION
|
|
||||||
${CPPCHECK_WARN_REGULAR_EXPRESSION})
|
|
||||||
list(REMOVE_AT _input ${_unused_func})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
get_target_property(_cppcheck_sources "${_name}" SOURCES)
|
|
||||||
set(_files)
|
|
||||||
foreach(_source ${_cppcheck_sources})
|
|
||||||
get_source_file_property(_cppcheck_lang "${_source}" LANGUAGE)
|
|
||||||
get_source_file_property(_cppcheck_loc "${_source}" LOCATION)
|
|
||||||
if("${_cppcheck_lang}" MATCHES "C")
|
|
||||||
list(APPEND _files "${_cppcheck_loc}")
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
if("1.${CMAKE_VERSION}" VERSION_LESS "1.2.8.0")
|
|
||||||
# Older than CMake 2.8.0
|
|
||||||
add_test(${_name}_cppcheck_test
|
|
||||||
"${CPPCHECK_EXECUTABLE}"
|
|
||||||
${CPPCHECK_TEMPLATE_ARG}
|
|
||||||
${_cppcheck_args}
|
|
||||||
${_files})
|
|
||||||
else()
|
|
||||||
# CMake 2.8.0 and newer
|
|
||||||
add_test(NAME
|
|
||||||
${_name}_cppcheck_test
|
|
||||||
COMMAND
|
|
||||||
"${CPPCHECK_EXECUTABLE}"
|
|
||||||
${CPPCHECK_TEMPLATE_ARG}
|
|
||||||
${_cppcheck_args}
|
|
||||||
${_files})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set_tests_properties(${_name}_cppcheck_test
|
|
||||||
PROPERTIES
|
|
||||||
FAIL_REGULAR_EXPRESSION
|
|
||||||
"${CPPCHECK_FAIL_REGULAR_EXPRESSION}")
|
|
||||||
|
|
||||||
add_custom_command(TARGET
|
|
||||||
all_cppcheck
|
|
||||||
PRE_BUILD
|
|
||||||
COMMAND
|
|
||||||
${CPPCHECK_EXECUTABLE}
|
|
||||||
${CPPCHECK_QUIET_ARG}
|
|
||||||
${CPPCHECK_TEMPLATE_ARG}
|
|
||||||
"--enable=style,information,unusedFunction"
|
|
||||||
${_cppcheck_args}
|
|
||||||
${_files}
|
|
||||||
WORKING_DIRECTORY
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
|
||||||
COMMENT
|
|
||||||
"${_name}_cppcheck: Running cppcheck on target ${_name}..."
|
|
||||||
VERBATIM)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
endfunction()
|
|
@ -1,22 +0,0 @@
|
|||||||
# - Try to find the GLIB2 libraries
|
|
||||||
|
|
||||||
if(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES AND GTHREAD2_LIBRARIES)
|
|
||||||
# Already in cache, be silent
|
|
||||||
set(GLIB2_FIND_QUIETLY TRUE)
|
|
||||||
endif(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES AND GTHREAD2_LIBRARIES)
|
|
||||||
|
|
||||||
if (NOT WIN32)
|
|
||||||
include(FindPkgConfig)
|
|
||||||
pkg_search_module(PC_GLIB2 REQUIRED glib-2.0)
|
|
||||||
pkg_search_module(PC_GTHREAD2 REQUIRED gthread-2.0)
|
|
||||||
endif(NOT WIN32)
|
|
||||||
|
|
||||||
set(GLIB2_INCLUDE_DIR ${PC_GLIB2_INCLUDE_DIRS})
|
|
||||||
|
|
||||||
find_library(GLIB2_LIBRARIES NAMES glib-2.0 HINTS ${PC_GLIB2_LIBDIR} ${PC_GLIB2_LIBRARY_DIRS})
|
|
||||||
|
|
||||||
find_library(GTHREAD2_LIBRARIES NAMES gthread-2.0 HINTS ${PC_GTHREAD2_LIBDIR} ${PC_GTHREAD2_LIBRARY_DIRS})
|
|
||||||
|
|
||||||
|
|
||||||
mark_as_advanced(GLIB2_INCLUDE_DIR GLIB2_LIBRARIES GTHREAD2_LIBRARIES)
|
|
||||||
|
|
@ -1,111 +0,0 @@
|
|||||||
# - Find MySQL
|
|
||||||
# Find the MySQL includes and client library
|
|
||||||
# This module defines
|
|
||||||
# MYSQL_INCLUDE_DIR, where to find mysql.h
|
|
||||||
# MYSQL_LIBRARIES, the libraries needed to use MySQL.
|
|
||||||
# MYSQL_FOUND, If false, do not try to use MySQL.
|
|
||||||
#
|
|
||||||
# Copyright (c) 2006, Jaroslaw Staniek, <js@iidea.pl>
|
|
||||||
# Lot of adustmens by Michal Cihar <michal@cihar.com>
|
|
||||||
#
|
|
||||||
# vim: expandtab sw=4 ts=4 sts=4:
|
|
||||||
#
|
|
||||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
|
||||||
|
|
||||||
if(UNIX)
|
|
||||||
set(MYSQL_CONFIG_PREFER_PATH "$ENV{MYSQL_HOME}/bin" CACHE FILEPATH
|
|
||||||
"preferred path to MySQL (mysql_config)")
|
|
||||||
find_program(MYSQL_CONFIG mysql_config
|
|
||||||
${MYSQL_CONFIG_PREFER_PATH}
|
|
||||||
/usr/local/mysql/bin/
|
|
||||||
/usr/local/bin/
|
|
||||||
/usr/bin/
|
|
||||||
)
|
|
||||||
|
|
||||||
if(MYSQL_CONFIG)
|
|
||||||
message(STATUS "Using mysql-config: ${MYSQL_CONFIG}")
|
|
||||||
# set CFLAGS
|
|
||||||
exec_program(${MYSQL_CONFIG}
|
|
||||||
ARGS --cflags
|
|
||||||
OUTPUT_VARIABLE MY_TMP)
|
|
||||||
|
|
||||||
set(MYSQL_CFLAGS ${MY_TMP} CACHE STRING INTERNAL)
|
|
||||||
|
|
||||||
# set INCLUDE_DIR
|
|
||||||
exec_program(${MYSQL_CONFIG}
|
|
||||||
ARGS --include
|
|
||||||
OUTPUT_VARIABLE MY_TMP)
|
|
||||||
|
|
||||||
string(REGEX REPLACE "-I([^ ]*)( .*)?" "\\1" MY_TMP "${MY_TMP}")
|
|
||||||
|
|
||||||
set(MYSQL_ADD_INCLUDE_DIR ${MY_TMP} CACHE FILEPATH INTERNAL)
|
|
||||||
|
|
||||||
# set LIBRARY_DIR
|
|
||||||
exec_program(${MYSQL_CONFIG}
|
|
||||||
ARGS --libs_r
|
|
||||||
OUTPUT_VARIABLE MY_TMP)
|
|
||||||
|
|
||||||
set(MYSQL_ADD_LIBRARIES "")
|
|
||||||
|
|
||||||
# prepend space in order to match separate words only (e.g. rather
|
|
||||||
# than "-linux" from within "-L/usr/lib/i386-linux-gnu")
|
|
||||||
string(REGEX MATCHALL " +-l[^ ]*" MYSQL_LIB_LIST " ${MY_TMP}")
|
|
||||||
foreach(MY_LIB ${MYSQL_LIB_LIST})
|
|
||||||
string(REGEX REPLACE "[ ]*-l([^ ]*)" "\\1" MY_LIB "${MY_LIB}")
|
|
||||||
list(APPEND MYSQL_ADD_LIBRARIES "${MY_LIB}")
|
|
||||||
endforeach(MY_LIB ${MYSQL_LIBS})
|
|
||||||
|
|
||||||
set(MYSQL_ADD_LIBRARY_PATH "")
|
|
||||||
|
|
||||||
string(REGEX MATCHALL " +-L[^ ]*" MYSQL_LIBDIR_LIST " ${MY_TMP}")
|
|
||||||
foreach(MY_LIB ${MYSQL_LIBDIR_LIST})
|
|
||||||
string(REGEX REPLACE "[ ]*-L([^ ]*)" "\\1" MY_LIB "${MY_LIB}")
|
|
||||||
list(APPEND MYSQL_ADD_LIBRARY_PATH "${MY_LIB}")
|
|
||||||
endforeach(MY_LIB ${MYSQL_LIBS})
|
|
||||||
|
|
||||||
else(MYSQL_CONFIG)
|
|
||||||
set(MYSQL_ADD_LIBRARIES "")
|
|
||||||
list(APPEND MYSQL_ADD_LIBRARIES "mysqlclient")
|
|
||||||
endif(MYSQL_CONFIG)
|
|
||||||
else(UNIX)
|
|
||||||
set(MYSQL_ADD_INCLUDE_DIR "c:/msys/local/include" CACHE FILEPATH INTERNAL)
|
|
||||||
set(MYSQL_ADD_LIBRARY_PATH "c:/msys/local/lib" CACHE FILEPATH INTERNAL)
|
|
||||||
ENDIF(UNIX)
|
|
||||||
|
|
||||||
find_path(MYSQL_INCLUDE_DIR mysql.h
|
|
||||||
${MYSQL_ADD_INCLUDE_DIR}
|
|
||||||
/usr/local/include
|
|
||||||
/usr/local/include/mysql
|
|
||||||
/usr/local/mysql/include
|
|
||||||
/usr/local/mysql/include/mysql
|
|
||||||
/usr/include
|
|
||||||
/usr/include/mysql
|
|
||||||
/usr/include/mysql/private
|
|
||||||
)
|
|
||||||
|
|
||||||
set(TMP_MYSQL_LIBRARIES "")
|
|
||||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .so .a .lib .so.1)
|
|
||||||
foreach(MY_LIB ${MYSQL_ADD_LIBRARIES})
|
|
||||||
find_library("MYSQL_LIBRARIES_${MY_LIB}" NAMES ${MY_LIB}
|
|
||||||
HINTS
|
|
||||||
${MYSQL_ADD_LIBRARY_PATH}
|
|
||||||
/usr/lib/mysql
|
|
||||||
/usr/lib
|
|
||||||
/usr/local/lib
|
|
||||||
/usr/local/lib/mysql
|
|
||||||
/usr/local/mysql/lib
|
|
||||||
)
|
|
||||||
list(APPEND TMP_MYSQL_LIBRARIES "${MYSQL_LIBRARIES_${MY_LIB}}")
|
|
||||||
endforeach(MY_LIB ${MYSQL_ADD_LIBRARIES})
|
|
||||||
|
|
||||||
set(MYSQL_LIBRARIES ${TMP_MYSQL_LIBRARIES} CACHE FILEPATH INTERNAL)
|
|
||||||
|
|
||||||
if(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
|
|
||||||
set(MYSQL_FOUND TRUE CACHE INTERNAL "MySQL found")
|
|
||||||
message(STATUS "Found MySQL: ${MYSQL_INCLUDE_DIR}, ${MYSQL_LIBRARIES}")
|
|
||||||
else(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
|
|
||||||
set(MYSQL_FOUND FALSE CACHE INTERNAL "MySQL found")
|
|
||||||
message(STATUS "MySQL not found.")
|
|
||||||
endif(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
|
|
||||||
|
|
||||||
mark_as_advanced(MYSQL_INCLUDE_DIR MYSQL_LIBRARIES MYSQL_CFLAGS)
|
|
@ -1,45 +0,0 @@
|
|||||||
# - Try to find the PCRE regular expression library
|
|
||||||
# Once done this will define
|
|
||||||
#
|
|
||||||
# PCRE_FOUND - system has the PCRE library
|
|
||||||
# PCRE_INCLUDE_DIR - the PCRE include directory
|
|
||||||
# PCRE_LIBRARIES - The libraries needed to use PCRE
|
|
||||||
|
|
||||||
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
|
|
||||||
#
|
|
||||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
|
||||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
|
||||||
|
|
||||||
|
|
||||||
if (PCRE_INCLUDE_DIR AND PCRE_PCREPOSIX_LIBRARY AND PCRE_PCRE_LIBRARY)
|
|
||||||
# Already in cache, be silent
|
|
||||||
set(PCRE_FIND_QUIETLY TRUE)
|
|
||||||
endif (PCRE_INCLUDE_DIR AND PCRE_PCREPOSIX_LIBRARY AND PCRE_PCRE_LIBRARY)
|
|
||||||
|
|
||||||
|
|
||||||
if (NOT WIN32)
|
|
||||||
# use pkg-config to get the directories and then use these values
|
|
||||||
# in the FIND_PATH() and FIND_LIBRARY() calls
|
|
||||||
find_package(PkgConfig)
|
|
||||||
|
|
||||||
pkg_check_modules(PC_PCRE REQUIRED libpcre)
|
|
||||||
|
|
||||||
set(PCRE_DEFINITIONS ${PC_PCRE_CFLAGS_OTHER})
|
|
||||||
|
|
||||||
endif (NOT WIN32)
|
|
||||||
|
|
||||||
find_path(PCRE_INCLUDE_DIR pcre.h
|
|
||||||
HINTS ${PC_PCRE_INCLUDEDIR} ${PC_PCRE_INCLUDE_DIRS}
|
|
||||||
PATH_SUFFIXES pcre)
|
|
||||||
|
|
||||||
find_library(PCRE_PCRE_LIBRARY NAMES pcre HINTS ${PC_PCRE_LIBDIR} ${PC_PCRE_LIBRARY_DIRS})
|
|
||||||
|
|
||||||
find_library(PCRE_PCREPOSIX_LIBRARY NAMES pcreposix HINTS ${PC_PCRE_LIBDIR} ${PC_PCRE_LIBRARY_DIRS})
|
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
|
||||||
find_package_handle_standard_args(PCRE DEFAULT_MSG PCRE_INCLUDE_DIR PCRE_PCRE_LIBRARY PCRE_PCREPOSIX_LIBRARY )
|
|
||||||
|
|
||||||
set(PCRE_LIBRARIES ${PCRE_PCRE_LIBRARY} ${PCRE_PCREPOSIX_LIBRARY})
|
|
||||||
|
|
||||||
mark_as_advanced(PCRE_INCLUDE_DIR PCRE_LIBRARIES PCRE_PCREPOSIX_LIBRARY PCRE_PCRE_LIBRARY)
|
|
||||||
|
|
@ -1,57 +0,0 @@
|
|||||||
# - This module looks for Sphinx
|
|
||||||
# Find the Sphinx documentation generator
|
|
||||||
#
|
|
||||||
# This modules defines
|
|
||||||
# SPHINX_EXECUTABLE
|
|
||||||
# SPHINX_FOUND
|
|
||||||
# SPHINX_MAJOR_VERSION
|
|
||||||
# SPHINX_MINOR_VERSION
|
|
||||||
# SPHINX_VERSION
|
|
||||||
|
|
||||||
#=============================================================================
|
|
||||||
# Copyright 2002-2009 Kitware, Inc.
|
|
||||||
# Copyright 2009-2011 Peter Colberg
|
|
||||||
#
|
|
||||||
# Distributed under the OSI-approved BSD License (the "License");
|
|
||||||
# see accompanying file COPYING-CMAKE-SCRIPTS for details.
|
|
||||||
#
|
|
||||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
||||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the License for more information.
|
|
||||||
#=============================================================================
|
|
||||||
# (To distribute this file outside of CMake, substitute the full
|
|
||||||
# License text for the above reference.)
|
|
||||||
|
|
||||||
find_program(SPHINX_EXECUTABLE NAMES sphinx-build
|
|
||||||
HINTS
|
|
||||||
$ENV{SPHINX_DIR}
|
|
||||||
PATH_SUFFIXES bin
|
|
||||||
DOC "Sphinx documentation generator"
|
|
||||||
)
|
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
|
||||||
|
|
||||||
find_package_handle_standard_args(Sphinx DEFAULT_MSG
|
|
||||||
SPHINX_EXECUTABLE
|
|
||||||
)
|
|
||||||
|
|
||||||
if (SPHINX_EXECUTABLE)
|
|
||||||
execute_process (
|
|
||||||
COMMAND "${SPHINX_EXECUTABLE}" -h
|
|
||||||
OUTPUT_VARIABLE _SPHINX_VERSION_OUTPUT
|
|
||||||
ERROR_VARIABLE _SPHINX_VERSION_OUTPUT
|
|
||||||
)
|
|
||||||
if (_SPHINX_VERSION_OUTPUT MATCHES "Sphinx v([0-9]+\\.[0-9]+\\.[0-9]+)")
|
|
||||||
set (SPHINX_VERSION "${CMAKE_MATCH_1}")
|
|
||||||
string (REPLACE "." ";" _SPHINX_VERSION_LIST "${SPHINX_VERSION}")
|
|
||||||
list (GET _SPHINX_VERSION_LIST 0 SPHINX_MAJOR_VERSION)
|
|
||||||
list (GET _SPHINX_VERSION_LIST 1 SPHINX_MINOR_VERSION)
|
|
||||||
# patch version meh :)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
message("${SPHINX_MAJOR_VERSION}")
|
|
||||||
|
|
||||||
mark_as_advanced(
|
|
||||||
SPHINX_EXECUTABLE
|
|
||||||
)
|
|
@ -1,142 +0,0 @@
|
|||||||
# - try to find cppcheck tool
|
|
||||||
#
|
|
||||||
# Cache Variables:
|
|
||||||
# CPPCHECK_EXECUTABLE
|
|
||||||
#
|
|
||||||
# Non-cache variables you might use in your CMakeLists.txt:
|
|
||||||
# CPPCHECK_FOUND
|
|
||||||
# CPPCHECK_POSSIBLEERROR_ARG
|
|
||||||
# CPPCHECK_UNUSEDFUNC_ARG
|
|
||||||
# CPPCHECK_STYLE_ARG
|
|
||||||
# CPPCHECK_QUIET_ARG
|
|
||||||
# CPPCHECK_INCLUDEPATH_ARG
|
|
||||||
# CPPCHECK_FAIL_REGULAR_EXPRESSION
|
|
||||||
# CPPCHECK_WARN_REGULAR_EXPRESSION
|
|
||||||
# CPPCHECK_MARK_AS_ADVANCED - whether to mark our vars as advanced even
|
|
||||||
# if we don't find this program.
|
|
||||||
#
|
|
||||||
# Requires these CMake modules:
|
|
||||||
# FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
|
|
||||||
#
|
|
||||||
# Original Author:
|
|
||||||
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
|
|
||||||
# http://academic.cleardefinition.com
|
|
||||||
# Iowa State University HCI Graduate Program/VRAC
|
|
||||||
#
|
|
||||||
# Copyright Iowa State University 2009-2010.
|
|
||||||
# Distributed under the Boost Software License, Version 1.0.
|
|
||||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
|
||||||
# http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
|
|
||||||
file(TO_CMAKE_PATH "${CPPCHECK_ROOT_DIR}" CPPCHECK_ROOT_DIR)
|
|
||||||
set(CPPCHECK_ROOT_DIR
|
|
||||||
"${CPPCHECK_ROOT_DIR}"
|
|
||||||
CACHE
|
|
||||||
PATH
|
|
||||||
"Path to search for cppcheck")
|
|
||||||
|
|
||||||
# cppcheck app bundles on Mac OS X are GUI, we want command line only
|
|
||||||
set(_oldappbundlesetting ${CMAKE_FIND_APPBUNDLE})
|
|
||||||
set(CMAKE_FIND_APPBUNDLE NEVER)
|
|
||||||
|
|
||||||
# If we have a custom path, look there first.
|
|
||||||
if(CPPCHECK_ROOT_DIR)
|
|
||||||
find_program(CPPCHECK_EXECUTABLE
|
|
||||||
NAMES
|
|
||||||
cppcheck
|
|
||||||
cli
|
|
||||||
PATHS
|
|
||||||
"${CPPCHECK_ROOT_DIR}"
|
|
||||||
PATH_SUFFIXES
|
|
||||||
cli
|
|
||||||
NO_DEFAULT_PATH)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
find_program(CPPCHECK_EXECUTABLE NAMES cppcheck)
|
|
||||||
|
|
||||||
# Restore original setting for appbundle finding
|
|
||||||
set(CMAKE_FIND_APPBUNDLE ${_oldappbundlesetting})
|
|
||||||
|
|
||||||
if(CPPCHECK_EXECUTABLE)
|
|
||||||
# Find out where our test file is
|
|
||||||
get_filename_component(_cppcheckmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
|
|
||||||
set(_cppcheckdummyfile "${_cppcheckmoddir}/Findcppcheck.cpp")
|
|
||||||
|
|
||||||
# Check for the two types of command line arguments by just trying them
|
|
||||||
execute_process(COMMAND
|
|
||||||
"${CPPCHECK_EXECUTABLE}"
|
|
||||||
"--enable=style"
|
|
||||||
"--quiet"
|
|
||||||
"${_cppcheckdummyfile}"
|
|
||||||
RESULT_VARIABLE
|
|
||||||
_cppcheck_new_result
|
|
||||||
OUTPUT_QUIET
|
|
||||||
ERROR_QUIET)
|
|
||||||
execute_process(COMMAND
|
|
||||||
"${CPPCHECK_EXECUTABLE}"
|
|
||||||
"--style"
|
|
||||||
"--quiet"
|
|
||||||
"${_cppcheckdummyfile}"
|
|
||||||
RESULT_VARIABLE
|
|
||||||
_cppcheck_old_result
|
|
||||||
OUTPUT_QUIET
|
|
||||||
ERROR_QUIET)
|
|
||||||
if("${_cppcheck_new_result}" EQUAL 0)
|
|
||||||
# New arguments
|
|
||||||
set(CPPCHECK_UNUSEDFUNC_ARG "--enable=unusedFunctions")
|
|
||||||
set(CPPCHECK_POSSIBLEERROR_ARG "--enable=possibleError")
|
|
||||||
set(CPPCHECK_STYLE_ARG "--enable=style")
|
|
||||||
set(CPPCHECK_QUIET_ARG "--quiet")
|
|
||||||
set(CPPCHECK_INCLUDEPATH_ARG "-I")
|
|
||||||
if(MSVC)
|
|
||||||
set(CPPCHECK_TEMPLATE_ARG --template vs)
|
|
||||||
set(CPPCHECK_FAIL_REGULAR_EXPRESSION "[(]error[)]")
|
|
||||||
set(CPPCHECK_WARN_REGULAR_EXPRESSION "[(]style[)]")
|
|
||||||
elseif(CMAKE_COMPILER_IS_GNUCXX)
|
|
||||||
set(CPPCHECK_TEMPLATE_ARG --template gcc)
|
|
||||||
set(CPPCHECK_FAIL_REGULAR_EXPRESSION " error: ")
|
|
||||||
set(CPPCHECK_WARN_REGULAR_EXPRESSION " style: ")
|
|
||||||
else()
|
|
||||||
message(STATUS
|
|
||||||
"Warning: FindCppcheck doesn't know how to format error messages for your compiler!")
|
|
||||||
set(CPPCHECK_TEMPLATE_ARG --template gcc)
|
|
||||||
set(CPPCHECK_FAIL_REGULAR_EXPRESSION " error: ")
|
|
||||||
set(CPPCHECK_WARN_REGULAR_EXPRESSION " style: ")
|
|
||||||
endif()
|
|
||||||
elseif("${_cppcheck_old_result}" EQUAL 0)
|
|
||||||
# Old arguments
|
|
||||||
set(CPPCHECK_UNUSEDFUNC_ARG "--unused-functions")
|
|
||||||
set(CPPCHECK_POSSIBLEERROR_ARG "--all")
|
|
||||||
set(CPPCHECK_STYLE_ARG "--style")
|
|
||||||
set(CPPCHECK_QUIET_ARG "--quiet")
|
|
||||||
set(CPPCHECK_INCLUDEPATH_ARG "-I")
|
|
||||||
set(CPPCHECK_FAIL_REGULAR_EXPRESSION "error:")
|
|
||||||
set(CPPCHECK_WARN_REGULAR_EXPRESSION "[(]style[)]")
|
|
||||||
else()
|
|
||||||
# No idea - some other issue must be getting in the way
|
|
||||||
message(STATUS
|
|
||||||
"WARNING: Can't detect whether CPPCHECK wants new or old-style arguments!")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(CPPCHECK_ALL
|
|
||||||
"${CPPCHECK_EXECUTABLE} ${CPPCHECK_POSSIBLEERROR_ARG} ${CPPCHECK_UNUSEDFUNC_ARG} ${CPPCHECK_STYLE_ARG} ${CPPCHECK_QUIET_ARG} ${CPPCHECK_INCLUDEPATH_ARG} some/include/path")
|
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
|
||||||
find_package_handle_standard_args(cppcheck
|
|
||||||
DEFAULT_MSG
|
|
||||||
CPPCHECK_ALL
|
|
||||||
CPPCHECK_EXECUTABLE
|
|
||||||
CPPCHECK_POSSIBLEERROR_ARG
|
|
||||||
CPPCHECK_UNUSEDFUNC_ARG
|
|
||||||
CPPCHECK_STYLE_ARG
|
|
||||||
CPPCHECK_INCLUDEPATH_ARG
|
|
||||||
CPPCHECK_QUIET_ARG)
|
|
||||||
|
|
||||||
if(CPPCHECK_FOUND OR CPPCHECK_MARK_AS_ADVANCED)
|
|
||||||
mark_as_advanced(CPPCHECK_ROOT_DIR)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
mark_as_advanced(CPPCHECK_EXECUTABLE)
|
|
@ -1,16 +0,0 @@
|
|||||||
/**
|
|
||||||
* \file Findcppcheck.cpp
|
|
||||||
* \brief Dummy C++ source file used by CMake module Findcppcheck.cmake
|
|
||||||
*
|
|
||||||
* \author
|
|
||||||
* Ryan Pavlik, 2009-2010
|
|
||||||
* <rpavlik@iastate.edu>
|
|
||||||
* http://academic.cleardefinition.com/
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
66
common.h
66
common.h
@ -1,66 +0,0 @@
|
|||||||
/*
|
|
||||||
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, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
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, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Authors: Andrew Hutchings, SkySQL (andrew at skysql dot com)
|
|
||||||
*/
|
|
||||||
#ifndef _common_h
|
|
||||||
#define _common_h
|
|
||||||
|
|
||||||
char *hostname=NULL;
|
|
||||||
char *username=NULL;
|
|
||||||
char *password=NULL;
|
|
||||||
char *socket_path=NULL;
|
|
||||||
char *db=NULL;
|
|
||||||
char *defaults_file=NULL;
|
|
||||||
#ifdef WITH_SSL
|
|
||||||
char *key=NULL;
|
|
||||||
char *cert=NULL;
|
|
||||||
char *ca=NULL;
|
|
||||||
char *capath=NULL;
|
|
||||||
char *cipher=NULL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gboolean askPassword=FALSE;
|
|
||||||
guint port=0;
|
|
||||||
guint num_threads= 4;
|
|
||||||
guint verbose=2;
|
|
||||||
gboolean ssl= FALSE;
|
|
||||||
gboolean compress_protocol= FALSE;
|
|
||||||
gboolean program_version= FALSE;
|
|
||||||
|
|
||||||
GOptionEntry common_entries[] =
|
|
||||||
{
|
|
||||||
{ "host", 'h', 0, G_OPTION_ARG_STRING, &hostname, "The host to connect to", NULL },
|
|
||||||
{ "user", 'u', 0, G_OPTION_ARG_STRING, &username, "Username with the necessary privileges", NULL },
|
|
||||||
{ "password", 'p', 0, G_OPTION_ARG_STRING, &password, "User password", NULL },
|
|
||||||
{ "ask-password", 'a', 0, G_OPTION_ARG_NONE, &askPassword, "Prompt For User password", NULL },
|
|
||||||
{ "port", 'P', 0, G_OPTION_ARG_INT, &port, "TCP/IP port to connect to", NULL },
|
|
||||||
{ "socket", 'S', 0, G_OPTION_ARG_STRING, &socket_path, "UNIX domain socket file to use for connection", NULL },
|
|
||||||
{ "threads", 't', 0, G_OPTION_ARG_INT, &num_threads, "Number of threads to use, default 4", NULL },
|
|
||||||
{ "compress-protocol", 'C', 0, G_OPTION_ARG_NONE, &compress_protocol, "Use compression on the MySQL connection", NULL },
|
|
||||||
{ "version", 'V', 0, G_OPTION_ARG_NONE, &program_version, "Show the program version and exit", NULL },
|
|
||||||
{ "verbose", 'v', 0, G_OPTION_ARG_INT, &verbose, "Verbosity of output, 0 = silent, 1 = errors, 2 = warnings, 3 = info, default 2", NULL },
|
|
||||||
{ "defaults-file", 0, 0, G_OPTION_ARG_FILENAME, &defaults_file, "Use a specific defaults file", NULL },
|
|
||||||
#ifdef WITH_SSL
|
|
||||||
{ "ssl", 0, 0, G_OPTION_ARG_NONE, &ssl, "Connect using SSL", NULL},
|
|
||||||
{ "key", 0, 0, G_OPTION_ARG_STRING, &key, "The path name to the key file", NULL },
|
|
||||||
{ "cert", 0, 0, G_OPTION_ARG_STRING, &cert, "The path name to the certificate file", NULL },
|
|
||||||
{ "ca", 0, 0, G_OPTION_ARG_STRING, &ca, "The path name to the certificate authority file", NULL },
|
|
||||||
{ "capath", 0, 0, G_OPTION_ARG_STRING, &capath, "The path name to a directory that contains trusted SSL CA certificates in PEM format", NULL },
|
|
||||||
{ "cipher", 0, 0, G_OPTION_ARG_STRING, &cipher, "A list of permissible ciphers to use for SSL encryption", NULL },
|
|
||||||
#endif
|
|
||||||
{ NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
17
config.h.in
17
config.h.in
@ -1,17 +0,0 @@
|
|||||||
#ifndef CONFIG_H
|
|
||||||
#define CONFIG_H
|
|
||||||
|
|
||||||
#cmakedefine VERSION "@VERSION@"
|
|
||||||
#cmakedefine WITH_BINLOG
|
|
||||||
|
|
||||||
#if defined(LIBMYSQL_VERSION)
|
|
||||||
#define MYSQL_VERSION_STR LIBMYSQL_VERSION
|
|
||||||
#elif defined(MARIADB_CLIENT_VERSION_STR)
|
|
||||||
#define MYSQL_VERSION_STR MARIADB_CLIENT_VERSION_STR
|
|
||||||
#elif defined(MYSQL_VERSION_NUMBER)
|
|
||||||
#define MYSQL_VERSION_STR MYSQL_VERSION_NUMBER
|
|
||||||
#else
|
|
||||||
#define MYSQL_VERSION_STR MYSQL_SERVER_VERSION
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
54
connection.c
54
connection.c
@ -1,54 +0,0 @@
|
|||||||
/*
|
|
||||||
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, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
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, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Authors: Aaron Brady, Shopify (insom)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <pcre.h>
|
|
||||||
#include <glib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include "connection.h"
|
|
||||||
|
|
||||||
extern char *defaults_file;
|
|
||||||
#ifdef WITH_SSL
|
|
||||||
extern char *key;
|
|
||||||
extern char *cert;
|
|
||||||
extern char *ca;
|
|
||||||
extern char *capath;
|
|
||||||
extern char *cipher;
|
|
||||||
extern gboolean ssl;
|
|
||||||
#endif
|
|
||||||
extern guint compress_protocol;
|
|
||||||
|
|
||||||
void configure_connection(MYSQL *conn, const char *name) {
|
|
||||||
if (defaults_file != NULL) {
|
|
||||||
mysql_options(conn,MYSQL_READ_DEFAULT_FILE,defaults_file);
|
|
||||||
}
|
|
||||||
mysql_options(conn, MYSQL_READ_DEFAULT_GROUP, name);
|
|
||||||
|
|
||||||
if (compress_protocol)
|
|
||||||
mysql_options(conn, MYSQL_OPT_COMPRESS, NULL);
|
|
||||||
|
|
||||||
#ifdef WITH_SSL
|
|
||||||
unsigned int i;
|
|
||||||
if (ssl) {
|
|
||||||
i = SSL_MODE_REQUIRED;
|
|
||||||
} else {
|
|
||||||
i = SSL_MODE_DISABLED;
|
|
||||||
}
|
|
||||||
|
|
||||||
mysql_ssl_set(conn,key,cert,ca,capath,cipher);
|
|
||||||
mysql_options(conn,MYSQL_OPT_SSL_MODE,&i);
|
|
||||||
#endif
|
|
||||||
}
|
|
22
connection.h
22
connection.h
@ -1,22 +0,0 @@
|
|||||||
/*
|
|
||||||
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, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
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, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Authors: Aaron Brady, Shopify (insom)
|
|
||||||
*/
|
|
||||||
#ifndef _connection_h
|
|
||||||
#define _connection_h
|
|
||||||
#include <mysql.h>
|
|
||||||
|
|
||||||
void configure_connection(MYSQL *conn, const char* name);
|
|
||||||
#endif
|
|
93
debian/changelog
vendored
93
debian/changelog
vendored
@ -1,93 +0,0 @@
|
|||||||
mydumper (0.9.5-1) unstable; urgency=medium
|
|
||||||
|
|
||||||
* add patch to FindMySQL cmake module to find libatomic when it's needed
|
|
||||||
|
|
||||||
-- Mateusz Kijowski <mateusz.kijowski@gmail.com> Wed, 18 Jan 2017 01:09:19 +0100
|
|
||||||
|
|
||||||
mydumper (0.9.1-4) unstable; urgency=medium
|
|
||||||
|
|
||||||
* manpages are generated by Sphinx, so moving back python-sphinx
|
|
||||||
to B-D (Closes: #851433)
|
|
||||||
* Add a Breaks+Replaces relation to mydumper-doc since it replaces
|
|
||||||
doc-base files from main package (Closes: #851221)
|
|
||||||
|
|
||||||
-- Mateusz Kijowski <mateusz.kijowski@gmail.com> Sun, 15 Jan 2017 16:57:52 +0100
|
|
||||||
|
|
||||||
mydumper (0.9.1-3) unstable; urgency=medium
|
|
||||||
|
|
||||||
* use sphinxdoc dh helper only in appropriate targets (Closes: #850847,
|
|
||||||
#850969)
|
|
||||||
|
|
||||||
-- Mateusz Kijowski <mateusz.kijowski@gmail.com> Wed, 11 Jan 2017 11:44:34 +0100
|
|
||||||
|
|
||||||
mydumper (0.9.1-2) unstable; urgency=medium
|
|
||||||
|
|
||||||
* Depend on default-libmysqlclient-dev (Closes: #845877, #841607)
|
|
||||||
* bump standards version to 3.9.8
|
|
||||||
* Separate doc package to comply with standards 3.9.7
|
|
||||||
* dh compat level bumped to 9
|
|
||||||
* changed homepage and debian/watch to github
|
|
||||||
|
|
||||||
-- Mateusz Kijowski <mateusz.kijowski@gmail.com> Mon, 02 Jan 2017 15:40:34 +0100
|
|
||||||
|
|
||||||
mydumper (0.9.1-1) unstable; urgency=medium
|
|
||||||
|
|
||||||
* Imported Upstream version 0.9.1
|
|
||||||
|
|
||||||
-- Mateusz Kijowski <mateusz.kijowski@gmail.com> Tue, 10 Nov 2015 17:59:57 +0100
|
|
||||||
|
|
||||||
mydumper (0.6.2-1) unstable; urgency=medium
|
|
||||||
|
|
||||||
* Imported Upstream version 0.6.2 (Closes: #790640)
|
|
||||||
* fix manpage inconsistencies (Closes: #773990) (LP: #1402381)
|
|
||||||
* bump standards version to 3.9.6 (no changes needed)
|
|
||||||
* allow uscan to verify upstream tarball
|
|
||||||
|
|
||||||
-- Mateusz Kijowski <mateusz.kijowski@gmail.com> Wed, 01 Jul 2015 13:54:15 +0200
|
|
||||||
|
|
||||||
mydumper (0.6.1-1) unstable; urgency=medium
|
|
||||||
|
|
||||||
* updated standards version
|
|
||||||
* move sphinxdoc depends to recommends (Closes: #730443)
|
|
||||||
* homepage updated (Closes: #714921)
|
|
||||||
* explicitly tell CMAKE to link libm
|
|
||||||
patch 0003-explicitly-link-libm.patch
|
|
||||||
* Imported Upstream version 0.6.1 (Closes: #735851) (LP: #1270330)
|
|
||||||
|
|
||||||
-- Mateusz Kijowski <mateusz.kijowski@gmail.com> Thu, 20 Mar 2014 01:17:43 +0100
|
|
||||||
|
|
||||||
mydumper (0.5.2-1) unstable; urgency=low
|
|
||||||
|
|
||||||
* Imported Upstream version 0.5.2 (Closes: #707458)
|
|
||||||
* removed patches merged by upstream
|
|
||||||
|
|
||||||
-- Mateusz Kijowski <mateusz.kijowski@gmail.com> Thu, 09 May 2013 12:08:05 +0200
|
|
||||||
|
|
||||||
mydumper (0.5.1-3) unstable; urgency=low
|
|
||||||
|
|
||||||
* fix FTBFS in multiarch env (Closes: #673262) (LP: #1002291)
|
|
||||||
patch 0006-fix-runaway-regexp-in-in-cmake.patch
|
|
||||||
|
|
||||||
-- Mateusz Kijowski <mateusz.kijowski@gmail.com> Mon, 04 Jun 2012 17:35:01 +0200
|
|
||||||
|
|
||||||
mydumper (0.5.1-2) unstable; urgency=low
|
|
||||||
|
|
||||||
* fixed watch file
|
|
||||||
* updated standards version
|
|
||||||
* patch 0005-zlib-file-type-change-fixes.patch added
|
|
||||||
fix FTBFS from zlib > 1.2.4 (Closes: #662582) (LP: #948122)
|
|
||||||
|
|
||||||
-- Mateusz Kijowski <mateusz.kijowski@gmail.com> Fri, 23 Mar 2012 17:27:57 +0100
|
|
||||||
|
|
||||||
mydumper (0.5.1-1) unstable; urgency=low
|
|
||||||
|
|
||||||
* Initial release (Closes: #648711)
|
|
||||||
* This is my first Debian package, be gentle
|
|
||||||
* Patched CMakeLists.txt so that generated config.h file is put in the
|
|
||||||
sources dir, where it is expected during the build
|
|
||||||
* Patched documenation CMakeLists.txt so that it won't install
|
|
||||||
documentation source files
|
|
||||||
* Patch added to fix missing description in the manpages
|
|
||||||
* Fixed typo in myloader
|
|
||||||
|
|
||||||
-- Mateusz Kijowski <mateusz.kijowski@gmail.com> Thu, 15 Nov 2011 11:26:38 +0100
|
|
1
debian/compat
vendored
1
debian/compat
vendored
@ -1 +0,0 @@
|
|||||||
9
|
|
48
debian/control
vendored
48
debian/control
vendored
@ -1,48 +0,0 @@
|
|||||||
Source: mydumper
|
|
||||||
Section: database
|
|
||||||
Priority: extra
|
|
||||||
Maintainer: Mateusz Kijowski <mateusz.kijowski@gmail.com>
|
|
||||||
Build-Depends: debhelper (>= 9.0.0), cmake, quilt, default-libmysqlclient-dev | libmysqlclient-dev, libglib2.0-dev, libpcre3-dev, zlib1g-dev, python-sphinx (>= 1.0.7+dfsg), python-docutils, libatomic1 | libatomic-ops-dev
|
|
||||||
Standards-Version: 3.9.8
|
|
||||||
Homepage: https://github.com/maxbube/mydumper
|
|
||||||
#Vcs-Git: git://git.debian.org/collab-maint/mydumper.git
|
|
||||||
#Vcs-Browser: http://git.debian.org/?p=collab-maint/mydumper.git;a=summary
|
|
||||||
|
|
||||||
Package: mydumper
|
|
||||||
Architecture: any
|
|
||||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
|
||||||
Suggests: mydumper-doc
|
|
||||||
Description: High-performance MySQL backup tool
|
|
||||||
Mydumper (aka. MySQL Data Dumper) is a high-performance multi-threaded
|
|
||||||
backup (and restore) toolset for MySQL and Drizzle. The main developers
|
|
||||||
originally worked as Support Engineers at MySQL (one has moved to
|
|
||||||
Facebook and another to SkySQL) and this is how they would envisage
|
|
||||||
mysqldump based on years of user feedback.
|
|
||||||
.
|
|
||||||
Mydumper features
|
|
||||||
.
|
|
||||||
Lightweight C source
|
|
||||||
Up to 10x faster dumps compared to mysqldump
|
|
||||||
Consistent snapshots for transactional and non-transactional tables
|
|
||||||
File compression on-the-fly
|
|
||||||
Binary log dumps
|
|
||||||
Multi-threaded restore utility
|
|
||||||
Daemon mode for timed snapshots and continuous binary logs
|
|
||||||
.
|
|
||||||
Mydumper is still under active development but is well tested/used in
|
|
||||||
production on some large installations.
|
|
||||||
|
|
||||||
Package: mydumper-doc
|
|
||||||
Architecture: all
|
|
||||||
Depends: ${misc:Depends}, ${sphinxdoc:Depends}
|
|
||||||
Breaks: mydumper (<< 0.9.1-2)
|
|
||||||
Replaces: mydumper (<< 0.9.1-2)
|
|
||||||
Section: doc
|
|
||||||
Description: High-performance MySQL backup tool - documentation
|
|
||||||
Mydumper (aka. MySQL Data Dumper) is a high-performance multi-threaded
|
|
||||||
backup (and restore) toolset for MySQL and Drizzle. The main developers
|
|
||||||
originally worked as Support Engineers at MySQL (one has moved to
|
|
||||||
Facebook and another to SkySQL) and this is how they would envisage
|
|
||||||
mysqldump based on years of user feedback.
|
|
||||||
.
|
|
||||||
This package contains documentation for mydumper generated by sphinx
|
|
30
debian/copyright
vendored
30
debian/copyright
vendored
@ -1,30 +0,0 @@
|
|||||||
Format: http://anonscm.debian.org/viewvc/dep/web/deps/dep5.mdwn?revision=174
|
|
||||||
Upstream-Name: mydumper
|
|
||||||
Source: https://launchpad.net/mydumper/+download
|
|
||||||
|
|
||||||
Files: *
|
|
||||||
Copyright: 2009-2011 Domas Mituzas ( domas at fb dot com )
|
|
||||||
2009-2011 Andrew Hutchings ( andrew at skysql dot com )
|
|
||||||
2009-2011 Mark Leith ( mark dot leith at oracle dot com )
|
|
||||||
License: GPL-3.0+
|
|
||||||
|
|
||||||
Files: debian/*
|
|
||||||
Copyright: 2011 Mateusz Kijowski <mateusz.kijowski@gmail.com>
|
|
||||||
License: GPL-3.0+
|
|
||||||
|
|
||||||
License: GPL-3.0+
|
|
||||||
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, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
.
|
|
||||||
This package 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
.
|
|
||||||
On Debian systems, the complete text of the GNU General
|
|
||||||
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
|
|
1
debian/docs
vendored
1
debian/docs
vendored
@ -1 +0,0 @@
|
|||||||
README.md
|
|
1
debian/install
vendored
1
debian/install
vendored
@ -1 +0,0 @@
|
|||||||
usr/bin/*
|
|
2
debian/manpages
vendored
2
debian/manpages
vendored
@ -1,2 +0,0 @@
|
|||||||
debian/tmp/usr/share/man/man1/mydumper.1
|
|
||||||
debian/tmp/usr/share/man/man1/myloader.1
|
|
11
debian/mydumper-doc.doc-base
vendored
11
debian/mydumper-doc.doc-base
vendored
@ -1,11 +0,0 @@
|
|||||||
Document: mydumper
|
|
||||||
Title: MySQL Data Dumper documentation
|
|
||||||
Author: Domas Mituzas, Andrew Hutchings, Mark Leith
|
|
||||||
Max Bubenick
|
|
||||||
Abstract: This is the documentation shipped with
|
|
||||||
mydumper, describing usage and prvoding examples
|
|
||||||
Section: Data Management
|
|
||||||
|
|
||||||
Format: HTML
|
|
||||||
Index: /usr/share/doc/mydumper-doc/html/index.html
|
|
||||||
Files: /usr/share/doc/mydumper-doc/html/*.html
|
|
1
debian/mydumper-doc.docs
vendored
1
debian/mydumper-doc.docs
vendored
@ -1 +0,0 @@
|
|||||||
debian/tmp/usr/share/doc/mydumper/html
|
|
@ -1,39 +0,0 @@
|
|||||||
From: Mateusz Kijowski <mkijowski@trojmiasto.pl>
|
|
||||||
Date: Tue, 15 Nov 2011 11:19:01 +0100
|
|
||||||
Subject: manpage whatis description
|
|
||||||
|
|
||||||
---
|
|
||||||
docs/CMakeLists.txt | 4 ++++
|
|
||||||
docs/_build/conf.py.in | 4 ++--
|
|
||||||
2 files changed, 6 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt
|
|
||||||
index 8fdb6b4..c43d246 100644
|
|
||||||
--- a/docs/CMakeLists.txt
|
|
||||||
+++ b/docs/CMakeLists.txt
|
|
||||||
@@ -27,6 +27,10 @@ if(GENERATE_DOC)
|
|
||||||
# master document with modules index
|
|
||||||
set(REF_MASTER_DOC "modules")
|
|
||||||
|
|
||||||
+ # vars necessary for manpages generation
|
|
||||||
+ set(MYDUMPER_PROGRAM_DESC "multi-threaded MySQL dumping")
|
|
||||||
+ set(MYLOADER_PROGRAM_DESC "multi-threaded MySQL loader")
|
|
||||||
+
|
|
||||||
# substitute variables in configuration and scripts
|
|
||||||
foreach(file
|
|
||||||
conf.py
|
|
||||||
diff --git a/docs/_build/conf.py.in b/docs/_build/conf.py.in
|
|
||||||
index 9985c74..4844933 100644
|
|
||||||
--- a/docs/_build/conf.py.in
|
|
||||||
+++ b/docs/_build/conf.py.in
|
|
||||||
@@ -211,8 +211,8 @@ latex_documents = [
|
|
||||||
# One entry per manual page. List of tuples
|
|
||||||
# (source start file, name, description, authors, manual section).
|
|
||||||
man_pages = [
|
|
||||||
- ('mydumper_usage', 'mydumper', u'@PROGRAM_DESC@',
|
|
||||||
+ ('mydumper_usage', 'mydumper', u'@MYDUMPER_PROGRAM_DESC@',
|
|
||||||
[u'Andrew Hutchings'], 1),
|
|
||||||
- ('myloader_usage', 'myloader', u'@PROGRAM_DESC@',
|
|
||||||
+ ('myloader_usage', 'myloader', u'@MYLOADER_PROGRAM_DESC@',
|
|
||||||
[u'Andrew Hutchings'], 1)
|
|
||||||
]
|
|
@ -1,24 +0,0 @@
|
|||||||
From: Mateusz Kijowski <mkijowski@trojmiasto.pl>
|
|
||||||
Date: Tue, 22 Nov 2011 17:44:04 +0100
|
|
||||||
Subject: dont install documentation source
|
|
||||||
|
|
||||||
---
|
|
||||||
docs/CMakeLists.txt | 5 -----
|
|
||||||
1 file changed, 5 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt
|
|
||||||
index c43d246..7c75c99 100644
|
|
||||||
--- a/docs/CMakeLists.txt
|
|
||||||
+++ b/docs/CMakeLists.txt
|
|
||||||
@@ -61,11 +61,6 @@ if(GENERATE_DOC)
|
|
||||||
"${SOURCES_DIR}"
|
|
||||||
)
|
|
||||||
|
|
||||||
- # note the trailing slash to exclude directory name
|
|
||||||
- install(DIRECTORY "${SOURCES_DIR}/"
|
|
||||||
- DESTINATION "share/doc/mydumper"
|
|
||||||
- )
|
|
||||||
-
|
|
||||||
# Sphinx cache with pickled ReST documents
|
|
||||||
set(SPHINX_CACHE_DIR "${CMAKE_CURRENT_BINARY_DIR}/_doctrees")
|
|
||||||
# HTML output directory
|
|
34
debian/patches/0003-explicitly-link-libm.patch
vendored
34
debian/patches/0003-explicitly-link-libm.patch
vendored
@ -1,34 +0,0 @@
|
|||||||
From: Mateusz Kijowski <mateusz.kijowski@gmail.com>
|
|
||||||
Date: Mon, 20 Jan 2014 21:42:40 +0100
|
|
||||||
Subject: explicitly link libm
|
|
||||||
|
|
||||||
---
|
|
||||||
CMakeLists.txt | 7 +++----
|
|
||||||
1 file changed, 3 insertions(+), 4 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
||||||
index 5da3828..0a6f7e7 100644
|
|
||||||
--- a/CMakeLists.txt
|
|
||||||
+++ b/CMakeLists.txt
|
|
||||||
@@ -9,6 +9,7 @@
|
|
||||||
find_package(ZLIB)
|
|
||||||
find_package(GLIB2)
|
|
||||||
find_package(PCRE)
|
|
||||||
+find_library(M_LIB m)
|
|
||||||
|
|
||||||
option(BUILD_DOCS "Build the documentation" ON)
|
|
||||||
|
|
||||||
@@ -37,11 +38,11 @@
|
|
||||||
else (WITH_BINLOG)
|
|
||||||
add_executable(mydumper mydumper.c server_detect.c g_unix_signal.c connection.c getPassword.c)
|
|
||||||
endif (WITH_BINLOG)
|
|
||||||
-target_link_libraries(mydumper ${MYSQL_LIBRARIES} ${GLIB2_LIBRARIES} ${GTHREAD2_LIBRARIES} ${PCRE_PCRE_LIBRARY} ${ZLIB_LIBRARIES} stdc++)
|
|
||||||
+target_link_libraries(mydumper ${MYSQL_LIBRARIES} ${GLIB2_LIBRARIES} ${GTHREAD2_LIBRARIES} ${PCRE_PCRE_LIBRARY} ${ZLIB_LIBRARIES} ${M_LIB} stdc++)
|
|
||||||
|
|
||||||
|
|
||||||
add_executable(myloader myloader.c connection.c getPassword.c)
|
|
||||||
-target_link_libraries(myloader ${MYSQL_LIBRARIES} ${GLIB2_LIBRARIES} ${GTHREAD2_LIBRARIES} ${PCRE_PCRE_LIBRARY} ${ZLIB_LIBRARIES} stdc++)
|
|
||||||
+target_link_libraries(myloader ${MYSQL_LIBRARIES} ${GLIB2_LIBRARIES} ${GTHREAD2_LIBRARIES} ${PCRE_PCRE_LIBRARY} ${ZLIB_LIBRARIES} ${M_LIB} stdc++)
|
|
||||||
|
|
||||||
INSTALL(TARGETS mydumper myloader
|
|
||||||
RUNTIME DESTINATION bin
|
|
3
debian/patches/series
vendored
3
debian/patches/series
vendored
@ -1,3 +0,0 @@
|
|||||||
0001-manpage-whatis-description.patch
|
|
||||||
0002-dont-install-documentation-source.patch
|
|
||||||
0003-explicitly-link-libm.patch
|
|
13
debian/rules
vendored
13
debian/rules
vendored
@ -1,13 +0,0 @@
|
|||||||
#!/usr/bin/make -f
|
|
||||||
# -*- makefile -*-
|
|
||||||
# Sample debian/rules that uses debhelper.
|
|
||||||
# This file was originally written by Joey Hess and Craig Small.
|
|
||||||
# As a special exception, when this file is copied by dh-make into a
|
|
||||||
# dh-make output file, you may use that output file without restriction.
|
|
||||||
# This special exception was added by Craig Small in version 0.37 of dh-make.
|
|
||||||
|
|
||||||
# Uncomment this to turn on verbose mode.
|
|
||||||
export DH_VERBOSE=1
|
|
||||||
|
|
||||||
%:
|
|
||||||
dh $@ --with=sphinxdoc
|
|
1
debian/source/format
vendored
1
debian/source/format
vendored
@ -1 +0,0 @@
|
|||||||
3.0 (quilt)
|
|
39
debian/upstream/signing-key.asc
vendored
39
debian/upstream/signing-key.asc
vendored
@ -1,39 +0,0 @@
|
|||||||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
|
||||||
Version: GnuPG v1
|
|
||||||
|
|
||||||
mQMuBFGKRv4RCAC4Kooe3nlePJ+y9+sYkLK0uM69HZ1VkgiOn02jxJSe43TQt0pd
|
|
||||||
Co6LZjaURef9r0pJFZhFnnll+HwwjkYkFZDSViegCoYB1rmhqio7JOe2c3AIx69b
|
|
||||||
Nm94u0SVJejXhbpguEAx2pmJiUa2b8Fbpzib/7bj+xGixI+AZC/IeKCvXPw4s3c0
|
|
||||||
G8OvmFXHGjVJth4kNbjSB90QFK2NMMtGtHFaak8rahWWvN2JPMCjHfpSc4QhOZ17
|
|
||||||
dCaz580QCRrmlnWN4q/p8vrBBpFzMkOU6+ww27JRw/uHEt49Q9YOy19XjXf6W99Q
|
|
||||||
pXiMsO5hZo3wwFxWCBGnTqP4cMA/0wxyqFbnAQDj56SEGk5vGitBlxjGw1U5mQJS
|
|
||||||
9rZvUejxsgpR3Fjonwf8CsVSh3B+w9HTQu56L3OtWVgfhY72OyQ04Gbt57BDCX7B
|
|
||||||
k5EejeeRYJwdcDpmLDV+rjONnpHCtWT91v7Lxex9McOiwE01c85yrCbydYcPOYuy
|
|
||||||
q5aWs3kIJX8/7O5YRc1Q3mOd8/JcBHvmVQtvKKQFOpjlpRb4uoBz+yaqvgiiWedC
|
|
||||||
rG/NOyn2ZiDafBclI4+u1xt0J+0ebZzzNcRxDMa1C8uBGedDStc1TGsZfA2vHXnO
|
|
||||||
cEKXUwA4b03alcj7eHc3zYCsaU+DDbY1DxUL8tWM3Kax3vsJk6Lu/D5ez/f8wo4P
|
|
||||||
l/PexQZn0gByUjorxGq8dOlwduqJ+yyOmxOaUA/MjAgAgHnUHBneTNr6LXV6C+mX
|
|
||||||
9hSCnb6uGNUH/m2SCoWsE8XSM/HRdYjyBTOXeYhA+v+TkHuH9GRzY3Jrh417jhbB
|
|
||||||
NbWPSqbxaZwY7hF4RIPPxXn70nROgQ58hxUPEsLtGTTfY97RhrVqYWp6LfiEUFEl
|
|
||||||
i0afQJSSYFTr6bpALhoRqd3qBd+ZGu8G+JQ44zYbiEIxdvFXISbhDminmZmR0n0O
|
|
||||||
iE24WsKqvHFPBztKd/yXaA0L32Rwl48/BWxUBiKNPDjmXu9BVDmZlYzEg/9HzDvW
|
|
||||||
lk0NSe9pN6JirmHmwpeO2e2X586XyjSM6PVTHSQQQibhf5iYzAILx3G5GGxZfVQ2
|
|
||||||
tbQnTWF4IEJ1YmVuaWNrIDxtYXguYnViZW5pY2tAcGVyY29uYS5jb20+iHoEExEI
|
|
||||||
ACIFAlGKRv4CGwMGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEEQzg2b5a/CS
|
|
||||||
cw4A/1D494VgJAZFB2P+e+tLWtRYszDy6V3fDeX+v/0vv0+EAQCeP0TXA6Q92pE7
|
|
||||||
3szZh7u7ddRkn494f52CJEDp8lb4XrkCDQRRikb+EAgAwP3I6mrBeDDLh2QbIS5G
|
|
||||||
9U8hi1L7CAaFK7sLS2n/Uzy3PAQzyLTkMY4C0BmdnY+nEHFB99CiEiuQw2a8/NsM
|
|
||||||
JCLPgOlkzklfAyR2Dl3EPbwbTpglpjUpjFf5IehWBFNh1VwYMSNw4jom362B+E1b
|
|
||||||
uhtGSQLAtpTl/h2m6udAaVvjmSS6UMjH9nuX5gVfUUiJI2m6kSLfrENEVACmqXmF
|
|
||||||
Js2LqD+GVGZh5nHnWC8ldfGPBYGNArwefzG4w9X4YpKOtOGfvjb3nqA3tBnypnXA
|
|
||||||
KIUol96JdA7Bq2bDtROG2fJWXuTlqdOebo7IiBcKNi2QsIgH84DmUYaWssQCUbEI
|
|
||||||
vwAEDQf9Gw1BgAIrpFS7Gxzt+iedIW0uk4m1/LZEcvgcoY/g+c4u+439kfZFMjIR
|
|
||||||
h6ReGGT21fRkKt2l0hoMebpgR1idPIIP3AmIZ2tf/lsXe74oK3FTK5/Stq9wKd4r
|
|
||||||
VGTVHQg10jZLBN6ksHMz+Kz3wnswfnfaABnvqzLcYrWrQjgusNCu6gKnoLv+X4bi
|
|
||||||
5sQPxFFFTXacGQ+MLXqY2f7WKb2OeXW8ViMXNoHwiUh1+7CEuW+4+8yhykC1r7lu
|
|
||||||
0taS++XuEeixoz149HlZcwuO7PIe92OZFaKCKJ+TfdegAGZlsEDdWn6JcDMDdjqw
|
|
||||||
TYLUg98u32VZB2KwgzEDZL8O/DD/SohhBBgRCAAJBQJRikb+AhsMAAoJEEQzg2b5
|
|
||||||
a/CSST8A/3qV/GXE0ABPxlAEF8yI5htqJHnSQDIEpr3QWt1ti+rDAQCRVFO7UHOS
|
|
||||||
XmBM/2ByCbTTKokM+QivLrDB9Paf+xRmag==
|
|
||||||
=zxkn
|
|
||||||
-----END PGP PUBLIC KEY BLOCK-----
|
|
3
debian/watch
vendored
3
debian/watch
vendored
@ -1,3 +0,0 @@
|
|||||||
version=3
|
|
||||||
opts=filenamemangle=s/.+\/v?(\d\S+)\.tar\.gz/mydumper-$1\.tar\.gz/ \
|
|
||||||
https://github.com/maxbube/mydumper/releases .*/v?(\d\S+)\.tar\.gz
|
|
@ -1,156 +0,0 @@
|
|||||||
# Generate documentation in HTML and PDF format using Sphinx.
|
|
||||||
|
|
||||||
set(GENERATE_DOC TRUE)
|
|
||||||
|
|
||||||
# We use the Sphinx documentation generator to render HTML and manual
|
|
||||||
# pages from the user and reference documentation in ReST format.
|
|
||||||
find_package(Sphinx QUIET)
|
|
||||||
if(NOT SPHINX_FOUND)
|
|
||||||
message(WARNING "Unable to find Sphinx documentation generator")
|
|
||||||
set(GENERATE_DOC FALSE)
|
|
||||||
endif(NOT SPHINX_FOUND)
|
|
||||||
|
|
||||||
if(SPHINX_MAJOR_VERSION LESS 1)
|
|
||||||
message(WARNING "Sphinx is older than v1.0, not building docs")
|
|
||||||
set(GENERATE_DOC FALSE)
|
|
||||||
endif(SPHINX_MAJOR_VERSION LESS 1)
|
|
||||||
|
|
||||||
if(GENERATE_DOC)
|
|
||||||
# documentation tools
|
|
||||||
set(SOURCE_BUILD_DIR "${CMAKE_CURRENT_SOURCE_DIR}/_build")
|
|
||||||
# configured documentation tools and intermediate build results
|
|
||||||
set(BINARY_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/_build")
|
|
||||||
# static ReST documentation sources
|
|
||||||
set(SOURCES_DIR "${CMAKE_CURRENT_BINARY_DIR}/_sources")
|
|
||||||
# generated ReST documentation sources
|
|
||||||
set(REF_SOURCES_DIR "${SOURCES_DIR}/reference")
|
|
||||||
# master document with modules index
|
|
||||||
set(REF_MASTER_DOC "modules")
|
|
||||||
|
|
||||||
# substitute variables in configuration and scripts
|
|
||||||
foreach(file
|
|
||||||
conf.py
|
|
||||||
sources.cmake
|
|
||||||
)
|
|
||||||
configure_file(
|
|
||||||
"${SOURCE_BUILD_DIR}/${file}.in"
|
|
||||||
"${BINARY_BUILD_DIR}/${file}"
|
|
||||||
@ONLY
|
|
||||||
)
|
|
||||||
endforeach(file)
|
|
||||||
|
|
||||||
set(CLEAN_FILES
|
|
||||||
"${BINARY_BUILD_DIR}/html"
|
|
||||||
)
|
|
||||||
|
|
||||||
add_custom_target(ALL
|
|
||||||
DEPENDS "${REF_SOURCES_DIR}/${REF_MASTER_DOC}.rst"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Sphinx requires all sources in the same directory tree. As we wish
|
|
||||||
# to include generated reference documention from the build tree, we
|
|
||||||
# copy static ReST documents to the build tree before calling Sphinx.
|
|
||||||
add_custom_target(doc_sources ALL
|
|
||||||
"${CMAKE_COMMAND}" -P "${BINARY_BUILD_DIR}/sources.cmake"
|
|
||||||
)
|
|
||||||
list(APPEND CLEAN_FILES
|
|
||||||
"${SOURCES_DIR}"
|
|
||||||
)
|
|
||||||
|
|
||||||
# note the trailing slash to exclude directory name
|
|
||||||
install(DIRECTORY "${SOURCES_DIR}/"
|
|
||||||
DESTINATION "share/doc/mydumper"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Sphinx cache with pickled ReST documents
|
|
||||||
set(SPHINX_CACHE_DIR "${CMAKE_CURRENT_BINARY_DIR}/_doctrees")
|
|
||||||
# HTML output directory
|
|
||||||
set(SPHINX_HTML_DIR "${CMAKE_CURRENT_BINARY_DIR}/html")
|
|
||||||
|
|
||||||
# This target builds HTML documentation using Sphinx.
|
|
||||||
add_custom_target(doc_html ALL
|
|
||||||
${SPHINX_EXECUTABLE}
|
|
||||||
-q -b html
|
|
||||||
-c "${BINARY_BUILD_DIR}"
|
|
||||||
-d "${SPHINX_CACHE_DIR}"
|
|
||||||
"${SOURCES_DIR}"
|
|
||||||
"${SPHINX_HTML_DIR}"
|
|
||||||
COMMENT "Building HTML documentation with Sphinx"
|
|
||||||
)
|
|
||||||
list(APPEND CLEAN_FILES
|
|
||||||
"${SPHINX_CACHE_DIR}"
|
|
||||||
"${SPHINX_HTML_DIR}"
|
|
||||||
)
|
|
||||||
add_dependencies(doc_html
|
|
||||||
doc_sources
|
|
||||||
)
|
|
||||||
install(DIRECTORY "${SPHINX_HTML_DIR}"
|
|
||||||
DESTINATION "share/doc/mydumper"
|
|
||||||
)
|
|
||||||
|
|
||||||
# HTML output directory
|
|
||||||
set(SPHINX_MAN_DIR "${CMAKE_CURRENT_BINARY_DIR}/man")
|
|
||||||
# This target builds a manual page using Sphinx.
|
|
||||||
|
|
||||||
add_custom_target(doc_man ALL
|
|
||||||
${SPHINX_EXECUTABLE}
|
|
||||||
-q -b man
|
|
||||||
-c "${BINARY_BUILD_DIR}"
|
|
||||||
-d "${SPHINX_CACHE_DIR}"
|
|
||||||
"${SOURCES_DIR}"
|
|
||||||
"${SPHINX_MAN_DIR}"
|
|
||||||
COMMENT "Building manual page with Sphinx"
|
|
||||||
)
|
|
||||||
list(APPEND CLEAN_FILES
|
|
||||||
"${SPHINX_MAN_DIR}"
|
|
||||||
)
|
|
||||||
add_dependencies(doc_man
|
|
||||||
doc_sources
|
|
||||||
)
|
|
||||||
# serialize Sphinx targets to avoid cache conflicts in parallel builds
|
|
||||||
add_dependencies(doc_man
|
|
||||||
doc_html
|
|
||||||
)
|
|
||||||
install(FILES "${SPHINX_MAN_DIR}/mydumper.1" "${SPHINX_MAN_DIR}/myloader.1"
|
|
||||||
DESTINATION "share/man/man1"
|
|
||||||
)
|
|
||||||
|
|
||||||
# This target builds PDF documentation using Sphinx and LaTeX.
|
|
||||||
if(PDFLATEX_COMPILER)
|
|
||||||
# PDF output directory
|
|
||||||
set(SPHINX_PDF_DIR "${CMAKE_CURRENT_BINARY_DIR}/pdf")
|
|
||||||
|
|
||||||
add_custom_target(doc_pdf ALL
|
|
||||||
${SPHINX_EXECUTABLE}
|
|
||||||
-q -b latex
|
|
||||||
-c "${BINARY_BUILD_DIR}"
|
|
||||||
-d "${SPHINX_CACHE_DIR}"
|
|
||||||
"${SOURCES_DIR}"
|
|
||||||
"${SPHINX_PDF_DIR}"
|
|
||||||
COMMENT "Building PDF documentation with Sphinx"
|
|
||||||
)
|
|
||||||
add_custom_command(TARGET doc_pdf POST_BUILD
|
|
||||||
COMMAND ${CMAKE_MAKE_PROGRAM} LATEXOPTS=-interaction=batchmode
|
|
||||||
WORKING_DIRECTORY "${SPHINX_PDF_DIR}"
|
|
||||||
)
|
|
||||||
list(APPEND CLEAN_FILES
|
|
||||||
"${SPHINX_PDF_DIR}"
|
|
||||||
)
|
|
||||||
add_dependencies(doc_pdf
|
|
||||||
doc_sources
|
|
||||||
)
|
|
||||||
# serialize Sphinx targets to avoid cache conflicts in parallel builds
|
|
||||||
add_dependencies(doc_pdf
|
|
||||||
doc_man
|
|
||||||
)
|
|
||||||
install(FILES "${SPHINX_PDF_DIR}/mydumper.pdf"
|
|
||||||
DESTINATION "share/doc/mydumper"
|
|
||||||
)
|
|
||||||
endif(PDFLATEX_COMPILER)
|
|
||||||
|
|
||||||
# Add output directories to clean target.
|
|
||||||
set_directory_properties(PROPERTIES
|
|
||||||
ADDITIONAL_MAKE_CLEAN_FILES "${CLEAN_FILES}"
|
|
||||||
)
|
|
||||||
|
|
||||||
endif(GENERATE_DOC)
|
|
218
docs/_build/conf.py.in
vendored
218
docs/_build/conf.py.in
vendored
@ -1,218 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# MySQL Data Dumper documentation build configuration file, created by
|
|
||||||
# sphinx-quickstart on Tue Apr 26 11:44:25 2011.
|
|
||||||
#
|
|
||||||
# This file is execfile()d with the current directory set to its containing dir.
|
|
||||||
#
|
|
||||||
# Note that not all possible configuration values are present in this
|
|
||||||
# autogenerated file.
|
|
||||||
#
|
|
||||||
# All configuration values have a default; values that are commented out
|
|
||||||
# serve to show the default.
|
|
||||||
|
|
||||||
import sys, os
|
|
||||||
|
|
||||||
# If extensions (or modules to document with autodoc) are in another directory,
|
|
||||||
# add these directories to sys.path here. If the directory is relative to the
|
|
||||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
|
||||||
#sys.path.insert(0, os.path.abspath('.'))
|
|
||||||
|
|
||||||
# -- General configuration -----------------------------------------------------
|
|
||||||
|
|
||||||
# If your documentation needs a minimal Sphinx version, state it here.
|
|
||||||
#needs_sphinx = '1.0'
|
|
||||||
|
|
||||||
# Add any Sphinx extension module names here, as strings. They can be extensions
|
|
||||||
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
|
||||||
extensions = ['sphinx.ext.todo']
|
|
||||||
|
|
||||||
# Add any paths that contain templates here, relative to this directory.
|
|
||||||
templates_path = ['@CMAKE_CURRENT_SOURCE_DIR@/_templates']
|
|
||||||
|
|
||||||
# The suffix of source filenames.
|
|
||||||
source_suffix = '.rst'
|
|
||||||
|
|
||||||
# The encoding of source files.
|
|
||||||
#source_encoding = 'utf-8-sig'
|
|
||||||
|
|
||||||
# The master toctree document.
|
|
||||||
master_doc = 'index'
|
|
||||||
|
|
||||||
# General information about the project.
|
|
||||||
project = u'@PROJECT_NAME@'
|
|
||||||
copyright = u'2011, Andrew Hutchings'
|
|
||||||
|
|
||||||
# The version info for the project you're documenting, acts as replacement for
|
|
||||||
# |version| and |release|, also used in various other places throughout the
|
|
||||||
# built documents.
|
|
||||||
#
|
|
||||||
# The short X.Y version.
|
|
||||||
version = '@VERSION@'
|
|
||||||
# The full version, including alpha/beta/rc tags.
|
|
||||||
release = '@VERSION@'
|
|
||||||
|
|
||||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
|
||||||
# for a list of supported languages.
|
|
||||||
#language = None
|
|
||||||
|
|
||||||
# There are two options for replacing |today|: either, you set today to some
|
|
||||||
# non-false value, then it is used:
|
|
||||||
#today = ''
|
|
||||||
# Else, today_fmt is used as the format for a strftime call.
|
|
||||||
#today_fmt = '%B %d, %Y'
|
|
||||||
|
|
||||||
# List of patterns, relative to source directory, that match files and
|
|
||||||
# directories to ignore when looking for source files.
|
|
||||||
exclude_patterns = ['_build']
|
|
||||||
|
|
||||||
# The reST default role (used for this markup: `text`) to use for all documents.
|
|
||||||
#default_role = None
|
|
||||||
|
|
||||||
# If true, '()' will be appended to :func: etc. cross-reference text.
|
|
||||||
#add_function_parentheses = True
|
|
||||||
|
|
||||||
# If true, the current module name will be prepended to all description
|
|
||||||
# unit titles (such as .. function::).
|
|
||||||
#add_module_names = True
|
|
||||||
|
|
||||||
# If true, sectionauthor and moduleauthor directives will be shown in the
|
|
||||||
# output. They are ignored by default.
|
|
||||||
#show_authors = False
|
|
||||||
|
|
||||||
# The name of the Pygments (syntax highlighting) style to use.
|
|
||||||
pygments_style = 'sphinx'
|
|
||||||
|
|
||||||
# A list of ignored prefixes for module index sorting.
|
|
||||||
#modindex_common_prefix = []
|
|
||||||
|
|
||||||
|
|
||||||
# -- Options for HTML output ---------------------------------------------------
|
|
||||||
|
|
||||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
|
||||||
# a list of builtin themes.
|
|
||||||
html_theme = 'default'
|
|
||||||
|
|
||||||
# Theme options are theme-specific and customize the look and feel of a theme
|
|
||||||
# further. For a list of options available for each theme, see the
|
|
||||||
# documentation.
|
|
||||||
#html_theme_options = {}
|
|
||||||
|
|
||||||
# Add any paths that contain custom themes here, relative to this directory.
|
|
||||||
#html_theme_path = []
|
|
||||||
|
|
||||||
# The name for this set of Sphinx documents. If None, it defaults to
|
|
||||||
# "<project> v<release> documentation".
|
|
||||||
#html_title = None
|
|
||||||
|
|
||||||
# A shorter title for the navigation bar. Default is the same as html_title.
|
|
||||||
#html_short_title = None
|
|
||||||
|
|
||||||
# The name of an image file (relative to this directory) to place at the top
|
|
||||||
# of the sidebar.
|
|
||||||
#html_logo = None
|
|
||||||
|
|
||||||
# The name of an image file (within the static path) to use as favicon of the
|
|
||||||
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
|
||||||
# pixels large.
|
|
||||||
#html_favicon = None
|
|
||||||
|
|
||||||
# Add any paths that contain custom static files (such as style sheets) here,
|
|
||||||
# relative to this directory. They are copied after the builtin static files,
|
|
||||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
|
||||||
html_static_path = ['@CMAKE_CURRENT_SOURCE_DIR@/_static']
|
|
||||||
|
|
||||||
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
|
||||||
# using the given strftime format.
|
|
||||||
#html_last_updated_fmt = '%b %d, %Y'
|
|
||||||
|
|
||||||
# If true, SmartyPants will be used to convert quotes and dashes to
|
|
||||||
# typographically correct entities.
|
|
||||||
#html_use_smartypants = True
|
|
||||||
|
|
||||||
# Custom sidebar templates, maps document names to template names.
|
|
||||||
#html_sidebars = {}
|
|
||||||
|
|
||||||
# Additional templates that should be rendered to pages, maps page names to
|
|
||||||
# template names.
|
|
||||||
#html_additional_pages = {}
|
|
||||||
|
|
||||||
# If false, no module index is generated.
|
|
||||||
#html_domain_indices = True
|
|
||||||
|
|
||||||
# If false, no index is generated.
|
|
||||||
#html_use_index = True
|
|
||||||
|
|
||||||
# If true, the index is split into individual pages for each letter.
|
|
||||||
#html_split_index = False
|
|
||||||
|
|
||||||
# If true, links to the reST sources are added to the pages.
|
|
||||||
#html_show_sourcelink = True
|
|
||||||
|
|
||||||
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
|
|
||||||
#html_show_sphinx = True
|
|
||||||
|
|
||||||
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
|
|
||||||
#html_show_copyright = True
|
|
||||||
|
|
||||||
# If true, an OpenSearch description file will be output, and all pages will
|
|
||||||
# contain a <link> tag referring to it. The value of this option must be the
|
|
||||||
# base URL from which the finished HTML is served.
|
|
||||||
#html_use_opensearch = ''
|
|
||||||
|
|
||||||
# This is the file name suffix for HTML files (e.g. ".xhtml").
|
|
||||||
#html_file_suffix = None
|
|
||||||
|
|
||||||
# Output file base name for HTML help builder.
|
|
||||||
htmlhelp_basename = 'MySQLDataDumperdoc'
|
|
||||||
|
|
||||||
|
|
||||||
# -- Options for LaTeX output --------------------------------------------------
|
|
||||||
|
|
||||||
# The paper size ('letter' or 'a4').
|
|
||||||
#latex_paper_size = 'letter'
|
|
||||||
|
|
||||||
# The font size ('10pt', '11pt' or '12pt').
|
|
||||||
#latex_font_size = '10pt'
|
|
||||||
|
|
||||||
# Grouping the document tree into LaTeX files. List of tuples
|
|
||||||
# (source start file, target name, title, author, documentclass [howto/manual]).
|
|
||||||
latex_documents = [
|
|
||||||
('index', 'MySQLDataDumper.tex', u'@PROJECT_NAME@ Documentation',
|
|
||||||
u'Andrew Hutchings', 'manual'),
|
|
||||||
]
|
|
||||||
|
|
||||||
# The name of an image file (relative to this directory) to place at the top of
|
|
||||||
# the title page.
|
|
||||||
#latex_logo = None
|
|
||||||
|
|
||||||
# For "manual" documents, if this is true, then toplevel headings are parts,
|
|
||||||
# not chapters.
|
|
||||||
#latex_use_parts = False
|
|
||||||
|
|
||||||
# If true, show page references after internal links.
|
|
||||||
#latex_show_pagerefs = False
|
|
||||||
|
|
||||||
# If true, show URL addresses after external links.
|
|
||||||
#latex_show_urls = False
|
|
||||||
|
|
||||||
# Additional stuff for the LaTeX preamble.
|
|
||||||
#latex_preamble = ''
|
|
||||||
|
|
||||||
# Documents to append as an appendix to all manuals.
|
|
||||||
#latex_appendices = []
|
|
||||||
|
|
||||||
# If false, no module index is generated.
|
|
||||||
#latex_domain_indices = True
|
|
||||||
|
|
||||||
|
|
||||||
# -- Options for manual page output --------------------------------------------
|
|
||||||
|
|
||||||
# One entry per manual page. List of tuples
|
|
||||||
# (source start file, name, description, authors, manual section).
|
|
||||||
man_pages = [
|
|
||||||
('mydumper_usage', 'mydumper', u'@PROGRAM_DESC@',
|
|
||||||
[u'Andrew Hutchings'], 1),
|
|
||||||
('myloader_usage', 'myloader', u'@PROGRAM_DESC@',
|
|
||||||
[u'Andrew Hutchings'], 1)
|
|
||||||
]
|
|
16
docs/_build/sources.cmake.in
vendored
16
docs/_build/sources.cmake.in
vendored
@ -1,16 +0,0 @@
|
|||||||
# This script recursively copies all ReST documents from the source directory to
|
|
||||||
# the binary directory. CMAKE_CURRENT_SOURCE_DIR and SOURCES_DIR are substituted
|
|
||||||
# upon the cmake stage. The script is executed upon the make stage to ensure
|
|
||||||
# that the binary sources directory is always up to date.
|
|
||||||
|
|
||||||
file(GLOB SOURCES
|
|
||||||
RELATIVE "@CMAKE_CURRENT_SOURCE_DIR@"
|
|
||||||
"@CMAKE_CURRENT_SOURCE_DIR@/*.rst"
|
|
||||||
)
|
|
||||||
foreach(source ${SOURCES})
|
|
||||||
configure_file(
|
|
||||||
"@CMAKE_CURRENT_SOURCE_DIR@/${source}"
|
|
||||||
"@SOURCES_DIR@/${source}"
|
|
||||||
COPYONLY
|
|
||||||
)
|
|
||||||
endforeach(source)
|
|
@ -1,9 +0,0 @@
|
|||||||
Authors
|
|
||||||
=======
|
|
||||||
|
|
||||||
The code for mydumper has been written by the following people:
|
|
||||||
|
|
||||||
* `Domas Mituzas <http://dom.as/>`_, Facebook ( domas at fb dot com )
|
|
||||||
* `Andrew Hutchings <http://www.linuxjedi.co.uk>`_, SkySQL ( andrew at skysql dot com )
|
|
||||||
* `Mark Leith <http://www.markleith.co.uk/>`_, Oracle Corporation ( mark dot leith at oracle dot com )
|
|
||||||
* `Max Bubenick <http://www.bube.com.ar>`_, Percona RDBA ( max dot bubenick at percona dot com )
|
|
@ -1,70 +0,0 @@
|
|||||||
Compiling
|
|
||||||
=========
|
|
||||||
|
|
||||||
Requirements
|
|
||||||
------------
|
|
||||||
|
|
||||||
mydumper requires the following before it can be compiled:
|
|
||||||
|
|
||||||
* `CMake <http://www.cmake.org/>`_
|
|
||||||
* `Glib2 <http://www.gtk.org/index.php>`_ (with development packages)
|
|
||||||
* `PCRE <http://www.pcre.org/>`_ (with development packages)
|
|
||||||
* `MySQL <http://www.mysql.com/>`_ client libraries (with development packages)
|
|
||||||
|
|
||||||
Additionally the following packages are optional:
|
|
||||||
|
|
||||||
* `python-sphinx <http://sphinx.pocoo.org/>`_ (for documentation)
|
|
||||||
|
|
||||||
Ubuntu/Debian
|
|
||||||
^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
apt-get install libglib2.0-dev libmysqlclient15-dev zlib1g-dev libpcre3-dev
|
|
||||||
|
|
||||||
Fedora/Redhat/CentOS
|
|
||||||
^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
yum install glib2-devel mysql-devel zlib-devel pcre-devel
|
|
||||||
|
|
||||||
OpenSUSE
|
|
||||||
^^^^^^^^
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
zypper install glib2-devel libmysqlclient-devel pcre-devel zlib-devel
|
|
||||||
|
|
||||||
Mac OSX
|
|
||||||
^^^^^^^
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
port install glib2 mysql5 pcre
|
|
||||||
|
|
||||||
CMake
|
|
||||||
-----
|
|
||||||
|
|
||||||
CMake is used for mydumper's build system and is executed as follows::
|
|
||||||
|
|
||||||
cmake .
|
|
||||||
make
|
|
||||||
|
|
||||||
You can optionally provide parameters for CMake, the possible options are:
|
|
||||||
|
|
||||||
* ``-DMYSQL_CONFIG=/path/to/mysql_config`` - The path and filename for the mysql_config executable
|
|
||||||
* ``-DCMAKE_INSTALL_PREFIX=/install/path`` - The path where mydumper should be installed
|
|
||||||
|
|
||||||
Documentation
|
|
||||||
-------------
|
|
||||||
|
|
||||||
If you wish to just compile the documentation you can do so with::
|
|
||||||
|
|
||||||
cmake .
|
|
||||||
make doc_html
|
|
||||||
|
|
||||||
or for a man page output::
|
|
||||||
|
|
||||||
cmake .
|
|
||||||
make doc_man
|
|
@ -1,37 +0,0 @@
|
|||||||
Examples
|
|
||||||
========
|
|
||||||
|
|
||||||
Simple Usage
|
|
||||||
------------
|
|
||||||
Just running :program:`mydumper` without any options will try to connect to a
|
|
||||||
server using the default socket path. It will then dump the tables from all
|
|
||||||
databases using 4 worker threads.
|
|
||||||
|
|
||||||
Regex
|
|
||||||
-----
|
|
||||||
To use :program:`mydumper`'s regex feature simply use the
|
|
||||||
:option:`--regex <mydumper --regex>` option. In the following example mydumper
|
|
||||||
will ignore the ``test`` and ``mysql`` databases::
|
|
||||||
|
|
||||||
mydumper --regex '^(?!(mysql\.|test\.))'
|
|
||||||
|
|
||||||
Restoring a dump
|
|
||||||
----------------
|
|
||||||
Mydumper now include myloader which is a multi-threaded restoration tool. To
|
|
||||||
use myloader with a mydumper dump you simply need to pass it the directory of
|
|
||||||
the dump along with a user capable of restoring the schemas and data. As an
|
|
||||||
example the following will restore a dump overwriting any existing tables::
|
|
||||||
|
|
||||||
myloader --directory=export-20110614-094953 --overwrite-tables --user=root
|
|
||||||
|
|
||||||
Daemon mode
|
|
||||||
-----------
|
|
||||||
Mydumper has a daemon mode which will snapshot the dump data every so often
|
|
||||||
whilst continuously retreiving the binary log files. This gives a continuous
|
|
||||||
consistent backup right up to the point where the database server fails. To use
|
|
||||||
this you simply need to use the :option:`--daemon <mydumper --daemon>` option.
|
|
||||||
|
|
||||||
In the following example mydumper will use daemon mode, creating a snapshot
|
|
||||||
every half an hour and log to an output file::
|
|
||||||
|
|
||||||
mydumper --daemon --snapshot-interval=30 --logfile=dump.log
|
|
@ -1,61 +0,0 @@
|
|||||||
Output Files
|
|
||||||
============
|
|
||||||
|
|
||||||
mydumper generates several files during the generation of the dump. Many of
|
|
||||||
these are for the table data itself since every table has at least one file.
|
|
||||||
|
|
||||||
Metadata
|
|
||||||
--------
|
|
||||||
When a dump is executed a file called ``metadata.partial`` is created in the output
|
|
||||||
directory and is renamed to ``metadata`` when mydumper finish without error.
|
|
||||||
This contains the start and end time of the dump as well as the
|
|
||||||
master binary log positions if applicable.
|
|
||||||
|
|
||||||
This is an example of the content of this file::
|
|
||||||
|
|
||||||
Started dump at: 2011-05-05 13:57:17
|
|
||||||
SHOW MASTER STATUS:
|
|
||||||
Log: linuxjedi-laptop-bin.000001
|
|
||||||
Pos: 106
|
|
||||||
|
|
||||||
Finished dump at: 2011-05-05 13:57:17
|
|
||||||
|
|
||||||
Table Data
|
|
||||||
----------
|
|
||||||
The data from every table is written into a separate file, also if the
|
|
||||||
:option:`--rows <mydumper --rows>` option is used then each chunk of table will
|
|
||||||
be in a separate file. The file names for this are in the format::
|
|
||||||
|
|
||||||
database.table.sql(.gz)
|
|
||||||
|
|
||||||
or if chunked::
|
|
||||||
|
|
||||||
database.table.chunk.sql(.gz)
|
|
||||||
|
|
||||||
Where 'chunk' is a number padded with up to 5 zeros.
|
|
||||||
|
|
||||||
Table Schemas
|
|
||||||
-------------
|
|
||||||
When the :option:`--schemas <mydumper --schemas>` option is used mydumper will
|
|
||||||
create a file for the schema of every table it is writing data for. The files
|
|
||||||
for this are in the following format::
|
|
||||||
|
|
||||||
database.table-schema.sql(.gz)
|
|
||||||
|
|
||||||
Binary Logs
|
|
||||||
-----------
|
|
||||||
Binary logs are retrieved when :option:`--binlogs <mydumper --binlogs>` option
|
|
||||||
has been set. This will store them in the ``binlog_snapshot/`` sub-directory
|
|
||||||
inside the dump directory.
|
|
||||||
|
|
||||||
The binary log files have the same filename as the MySQL server that supplies them and will also have a .gz on the end if they are compressed.
|
|
||||||
|
|
||||||
Daemon mode
|
|
||||||
-----------
|
|
||||||
Daemon mode does things a little differently. There are the directories ``0``
|
|
||||||
and ``1`` inside the dump directory. These alternate when dumping so that if
|
|
||||||
mydumper fails for any reason there is still a good snapshot. When a snapshot
|
|
||||||
dump is complete the ``last_dump`` symlink is updated to point to that dump.
|
|
||||||
|
|
||||||
If binary logging is enabled mydumper will connect as if it is a slave server
|
|
||||||
and constantly retreives the binary logs into the ``binlogs`` subdirectory.
|
|
@ -1,25 +0,0 @@
|
|||||||
.. MySQL Data Dumper documentation master file
|
|
||||||
You can adapt this file completely to your liking, but it should at least
|
|
||||||
contain the root `toctree` directive.
|
|
||||||
|
|
||||||
Welcome to MySQL Data Dumper's documentation!
|
|
||||||
=============================================
|
|
||||||
|
|
||||||
Contents:
|
|
||||||
|
|
||||||
.. toctree::
|
|
||||||
:maxdepth: 2
|
|
||||||
|
|
||||||
authors
|
|
||||||
compiling
|
|
||||||
mydumper_usage
|
|
||||||
myloader_usage
|
|
||||||
files
|
|
||||||
examples
|
|
||||||
|
|
||||||
Indices and tables
|
|
||||||
==================
|
|
||||||
|
|
||||||
* :ref:`genindex`
|
|
||||||
* :ref:`search`
|
|
||||||
|
|
@ -1,214 +0,0 @@
|
|||||||
Mydumper Usage
|
|
||||||
==============
|
|
||||||
|
|
||||||
Synopsis
|
|
||||||
--------
|
|
||||||
|
|
||||||
:program:`mydumper` [:ref:`OPTIONS <mydumper-options-label>`]
|
|
||||||
|
|
||||||
Description
|
|
||||||
-----------
|
|
||||||
|
|
||||||
:program:`mydumper` is a tool used for backing up MySQL database servers much
|
|
||||||
faster than the mysqldump tool distributed with MySQL. It also has the
|
|
||||||
capability to retrieve the binary logs from the remote server at the same time
|
|
||||||
as the dump itself. The advantages of mydumper are:
|
|
||||||
|
|
||||||
* Parallelism (hence, speed) and performance (avoids expensive character set conversion routines, efficient code overall)
|
|
||||||
* Easier to manage output (separate files for tables, dump metadata, etc, easy to view/parse data)
|
|
||||||
* Consistency - maintains snapshot across all threads, provides accurate master and slave log positions, etc
|
|
||||||
* Manageability - supports PCRE for specifying database and tables inclusions and exclusions
|
|
||||||
|
|
||||||
.. _mydumper-options-label:
|
|
||||||
|
|
||||||
Options
|
|
||||||
-------
|
|
||||||
|
|
||||||
The :program:`mydumper` tool has several available options:
|
|
||||||
|
|
||||||
.. program:: mydumper
|
|
||||||
|
|
||||||
.. option:: --help, -?
|
|
||||||
|
|
||||||
Show help text
|
|
||||||
|
|
||||||
.. option:: --defaults-file
|
|
||||||
|
|
||||||
Use the given option file. If the file does not exist or is otherwise inaccessible, no failure occurs
|
|
||||||
|
|
||||||
.. option:: --host, -h
|
|
||||||
|
|
||||||
Hostname of MySQL server to connect to (default localhost)
|
|
||||||
|
|
||||||
.. option:: --user, -u
|
|
||||||
|
|
||||||
MySQL username with the correct privileges to execute the dump
|
|
||||||
|
|
||||||
.. option:: --password, -p
|
|
||||||
|
|
||||||
The corresponding password for the MySQL user
|
|
||||||
|
|
||||||
.. option:: --port, -P
|
|
||||||
|
|
||||||
The port for the MySQL connection.
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
For localhost TCP connections use 127.0.0.1 for :option:`--host`.
|
|
||||||
|
|
||||||
.. option:: --socket, -S
|
|
||||||
|
|
||||||
The UNIX domain socket file to use for the connection
|
|
||||||
|
|
||||||
.. option:: --database, -B
|
|
||||||
|
|
||||||
Database to dump
|
|
||||||
|
|
||||||
.. option:: --tables-list, -T
|
|
||||||
|
|
||||||
A comma separated list of tables to dump
|
|
||||||
|
|
||||||
.. option:: --threads, -t
|
|
||||||
|
|
||||||
The number of threads to use for dumping data, default is 4
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
Other threads are used in mydumper, this option does not control these
|
|
||||||
|
|
||||||
.. option:: --outputdir, -o
|
|
||||||
|
|
||||||
Output directory name, default is export-YYYYMMDD-HHMMSS
|
|
||||||
|
|
||||||
.. option:: --statement-size, -s
|
|
||||||
|
|
||||||
The maximum size for an insert statement before breaking into a new
|
|
||||||
statement, default 1,000,000 bytes
|
|
||||||
|
|
||||||
.. option:: --rows, -r
|
|
||||||
|
|
||||||
Split table into chunks of this many rows, default unlimited
|
|
||||||
|
|
||||||
.. option:: --compress, -c
|
|
||||||
|
|
||||||
Compress the output files
|
|
||||||
|
|
||||||
.. option:: --compress-input, -C
|
|
||||||
|
|
||||||
Use client protocol compression for connections to the MySQL server
|
|
||||||
|
|
||||||
.. option:: --build-empty-files, -e
|
|
||||||
|
|
||||||
Create empty dump files if there is no data to dump
|
|
||||||
|
|
||||||
.. option:: --regex, -x
|
|
||||||
|
|
||||||
A regular expression to match against database and table
|
|
||||||
|
|
||||||
.. option:: --omit-from-file, -O
|
|
||||||
|
|
||||||
File containing a list of database.table entries to skip, one per line; the
|
|
||||||
skipped entries have precedence over patterns specified by the regex option
|
|
||||||
|
|
||||||
.. option:: --ignore-engines, -i
|
|
||||||
|
|
||||||
Comma separated list of storage engines to ignore
|
|
||||||
|
|
||||||
.. option:: --no-schemas, -m
|
|
||||||
|
|
||||||
Do not dump schemas with the data
|
|
||||||
|
|
||||||
.. option:: --no-data, -d
|
|
||||||
|
|
||||||
Do not dump table data
|
|
||||||
|
|
||||||
.. option:: --triggers, -G
|
|
||||||
|
|
||||||
Dump triggers
|
|
||||||
|
|
||||||
.. option:: --events, -E
|
|
||||||
|
|
||||||
Dump events
|
|
||||||
|
|
||||||
.. option:: --routines, -R
|
|
||||||
|
|
||||||
Dump stored procedures and functions
|
|
||||||
|
|
||||||
.. option:: --no-views, -W
|
|
||||||
|
|
||||||
Do not dump views
|
|
||||||
|
|
||||||
.. option:: --long-query-guard, -l
|
|
||||||
|
|
||||||
Timeout for long query execution in seconds, default 60
|
|
||||||
|
|
||||||
.. option:: --kill-long-queries, -K
|
|
||||||
|
|
||||||
Kill long running queries instead of aborting the dump
|
|
||||||
|
|
||||||
.. option:: --version, -V
|
|
||||||
|
|
||||||
Show the program version and exit
|
|
||||||
|
|
||||||
.. option:: --verbose, -v
|
|
||||||
|
|
||||||
The verbosity of messages. 0 = silent, 1 = errors, 2 = warnings, 3 = info.
|
|
||||||
Default is 2.
|
|
||||||
|
|
||||||
.. option:: --binlogs, -b
|
|
||||||
|
|
||||||
Get the binlogs from the server as well as the dump files (You need to compile with -DWITH_BINLOG=ON)
|
|
||||||
|
|
||||||
.. option:: --daemon, -D
|
|
||||||
|
|
||||||
Enable daemon mode
|
|
||||||
|
|
||||||
.. option:: --snapshot-interval, -I
|
|
||||||
|
|
||||||
Interval between each dump snapshot (in minutes), requires
|
|
||||||
:option:`--daemon`, default 60 (minutes)
|
|
||||||
|
|
||||||
.. option:: --logfile, -L
|
|
||||||
|
|
||||||
A file to log mydumper output to instead of console output. Useful for
|
|
||||||
daemon mode.
|
|
||||||
|
|
||||||
.. option:: --no-locks, -k
|
|
||||||
|
|
||||||
Do not execute the temporary shared read lock.
|
|
||||||
|
|
||||||
.. warning::
|
|
||||||
|
|
||||||
This will cause inconsistent backups.
|
|
||||||
|
|
||||||
.. option:: --no-backup-locks
|
|
||||||
|
|
||||||
Do not use Percona Backup Locks
|
|
||||||
|
|
||||||
.. option:: --[skip-]tz-utc
|
|
||||||
|
|
||||||
SET TIME_ZONE='+00:00' at top of dump to allow dumping of TIMESTAMP data
|
|
||||||
when a server has data in different time zones or data is being moved
|
|
||||||
between servers with different time zones, defaults to on use --skip-tz-utc
|
|
||||||
to disable.
|
|
||||||
|
|
||||||
.. option:: --less-locking
|
|
||||||
|
|
||||||
Minimize locking time on InnoDB tables grabbing a LOCK TABLE ... READ
|
|
||||||
on all non-innodb tables.
|
|
||||||
|
|
||||||
.. option:: --chunk-filesize -F
|
|
||||||
|
|
||||||
Split tables into chunks of this output file size. This value is in MB
|
|
||||||
|
|
||||||
.. option:: --success-on-1146
|
|
||||||
|
|
||||||
Not increment error count and Warning instead of Critical in case of table doesn't exist
|
|
||||||
|
|
||||||
.. option:: --use-savepoints
|
|
||||||
|
|
||||||
Use savepoints to reduce metadata locking issues, needs SUPER privilege
|
|
||||||
|
|
||||||
.. option:: --complete-insert
|
|
||||||
|
|
||||||
Use complete INSERT statements that include column names.
|
|
@ -1,103 +0,0 @@
|
|||||||
Myloader Usage
|
|
||||||
==============
|
|
||||||
|
|
||||||
Synopsis
|
|
||||||
--------
|
|
||||||
|
|
||||||
:program:`myloader` :option:`--directory <myloader --directory>` = /path/to/mydumper/backup [:ref:`OPTIONS <myloader-options-label>`]
|
|
||||||
|
|
||||||
Description
|
|
||||||
-----------
|
|
||||||
|
|
||||||
:program:`myloader` is a tool used for multi-threaded restoration of mydumper
|
|
||||||
backups.
|
|
||||||
|
|
||||||
.. _myloader-options-label:
|
|
||||||
|
|
||||||
Options
|
|
||||||
-------
|
|
||||||
|
|
||||||
The :program:`myloader` tool has several available options:
|
|
||||||
|
|
||||||
.. program:: myloader
|
|
||||||
|
|
||||||
.. option:: --help, -?
|
|
||||||
|
|
||||||
Show help text
|
|
||||||
|
|
||||||
.. option:: --defaults-file
|
|
||||||
|
|
||||||
Use the given option file. If the file does not exist or is otherwise inaccessible, no failure occurs
|
|
||||||
|
|
||||||
.. option:: --host, -h
|
|
||||||
|
|
||||||
Hostname of MySQL server to connect to (default localhost)
|
|
||||||
|
|
||||||
.. option:: --user, -u
|
|
||||||
|
|
||||||
MySQL username with the correct privileges to execute the restoration
|
|
||||||
|
|
||||||
.. option:: --password, -p
|
|
||||||
|
|
||||||
The corresponding password for the MySQL user
|
|
||||||
|
|
||||||
.. option:: --port, -P
|
|
||||||
|
|
||||||
The port for the MySQL connection.
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
For localhost TCP connections use 127.0.0.1 for :option:`--host`.
|
|
||||||
|
|
||||||
.. option:: --socket, -S
|
|
||||||
|
|
||||||
The UNIX domain socket file to use for the connection
|
|
||||||
|
|
||||||
.. option:: --threads, -t
|
|
||||||
|
|
||||||
The number of threads to use for restoring data, default is 4
|
|
||||||
|
|
||||||
.. option:: --version, -V
|
|
||||||
|
|
||||||
Show the program version and exit
|
|
||||||
|
|
||||||
.. option:: --compress-protocol, -C
|
|
||||||
|
|
||||||
Use client protocol compression for connections to the MySQL server
|
|
||||||
|
|
||||||
.. option:: --directory, -d
|
|
||||||
|
|
||||||
The directory of the mydumper backup to restore
|
|
||||||
|
|
||||||
.. option:: --database, -B
|
|
||||||
|
|
||||||
An alternative database to load the dump into
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
For use with single database dumps. When using with multi-database dumps
|
|
||||||
that have duplicate table names in more than one database it may cause
|
|
||||||
errors. Alternatively this scenario may give unpredictable results with
|
|
||||||
:option:`--overwrite-tables`.
|
|
||||||
|
|
||||||
.. option:: --source-db, -s
|
|
||||||
|
|
||||||
Database to restore, useful in combination with --database
|
|
||||||
|
|
||||||
.. option:: --queries-per-transaction, -q
|
|
||||||
|
|
||||||
Number of INSERT queries to execute per transaction during restore, default
|
|
||||||
is 1000.
|
|
||||||
|
|
||||||
.. option:: --overwrite-tables, -o
|
|
||||||
|
|
||||||
Drop any existing tables when restoring schemas
|
|
||||||
|
|
||||||
.. option:: --enable-binlog, -e
|
|
||||||
|
|
||||||
Log the data loading in the MySQL binary log if enabled (off by default)
|
|
||||||
|
|
||||||
.. option:: --verbose, -v
|
|
||||||
|
|
||||||
The verbosity of messages. 0 = silent, 1 = errors, 2 = warnings, 3 = info.
|
|
||||||
Default is 2.
|
|
128
g_unix_signal.c
128
g_unix_signal.c
@ -1,128 +0,0 @@
|
|||||||
#define _POSIX_SOURCE
|
|
||||||
#include <signal.h>
|
|
||||||
#include <glib.h>
|
|
||||||
|
|
||||||
static GPtrArray *signal_data = NULL;
|
|
||||||
|
|
||||||
typedef struct _GUnixSignalData {
|
|
||||||
guint source_id;
|
|
||||||
GMainContext *context;
|
|
||||||
gboolean triggered;
|
|
||||||
gint signum;
|
|
||||||
} GUnixSignalData;
|
|
||||||
|
|
||||||
typedef struct _GUnixSignalSource {
|
|
||||||
GSource source;
|
|
||||||
GUnixSignalData *data;
|
|
||||||
} GUnixSignalSource;
|
|
||||||
|
|
||||||
static inline GUnixSignalData* get_signal_data(guint index)
|
|
||||||
{
|
|
||||||
return (GUnixSignalData*)g_ptr_array_index(signal_data, index);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void handler(gint signum) {
|
|
||||||
g_assert(signal_data != NULL);
|
|
||||||
guint i;
|
|
||||||
for (i = 0; i < signal_data->len; ++i)
|
|
||||||
if (get_signal_data(i)->signum == signum)
|
|
||||||
get_signal_data(i)->triggered = TRUE;
|
|
||||||
|
|
||||||
struct sigaction action;
|
|
||||||
action.sa_handler= handler;
|
|
||||||
sigemptyset (&action.sa_mask);
|
|
||||||
action.sa_flags = 0;
|
|
||||||
sigaction(signum, &action, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean check(GSource *source)
|
|
||||||
{
|
|
||||||
GUnixSignalSource *signal_source = (GUnixSignalSource*) source;
|
|
||||||
return signal_source->data->triggered;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean prepare(GSource *source, gint *timeout_)
|
|
||||||
{
|
|
||||||
GUnixSignalSource *signal_source = (GUnixSignalSource*) source;
|
|
||||||
if (signal_source->data->context == NULL) {
|
|
||||||
g_main_context_ref(signal_source->data->context = g_source_get_context(source));
|
|
||||||
signal_source->data->source_id = g_source_get_id(source);
|
|
||||||
}
|
|
||||||
|
|
||||||
*timeout_ = -1;
|
|
||||||
return signal_source->data->triggered;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean dispatch(GSource *source, GSourceFunc callback, gpointer user_data)
|
|
||||||
{
|
|
||||||
GUnixSignalSource *signal_source = (GUnixSignalSource*) source;
|
|
||||||
signal_source->data->triggered = FALSE;
|
|
||||||
return callback(user_data) ? TRUE : FALSE;
|
|
||||||
}
|
|
||||||
static void finalize(GSource *source)
|
|
||||||
{
|
|
||||||
GUnixSignalSource *signal_source = (GUnixSignalSource*) source;
|
|
||||||
|
|
||||||
struct sigaction action;
|
|
||||||
action.sa_handler= NULL;
|
|
||||||
sigemptyset (&action.sa_mask);
|
|
||||||
action.sa_flags = 0;
|
|
||||||
|
|
||||||
sigaction(signal_source->data->signum, &action, NULL);
|
|
||||||
g_main_context_unref(signal_source->data->context);
|
|
||||||
g_ptr_array_remove_fast(signal_data, signal_source->data);
|
|
||||||
if (signal_data->len == 0)
|
|
||||||
signal_data = (GPtrArray*) g_ptr_array_free(signal_data, TRUE);
|
|
||||||
g_free(signal_source->data);
|
|
||||||
|
|
||||||
}
|
|
||||||
static GSourceFuncs SourceFuncs =
|
|
||||||
{
|
|
||||||
.prepare = prepare,
|
|
||||||
.check = check,
|
|
||||||
.dispatch = dispatch,
|
|
||||||
.finalize = finalize,
|
|
||||||
.closure_callback = NULL, .closure_marshal = NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
static void g_unix_signal_source_init(GSource *source, gint signum)
|
|
||||||
{
|
|
||||||
GUnixSignalSource *signal_source = (GUnixSignalSource *) source;
|
|
||||||
signal_source->data = g_new(GUnixSignalData, 1);
|
|
||||||
signal_source->data->triggered = FALSE;
|
|
||||||
signal_source->data->signum = signum;
|
|
||||||
signal_source->data->context = NULL;
|
|
||||||
|
|
||||||
if (signal_data == NULL)
|
|
||||||
signal_data = g_ptr_array_new();
|
|
||||||
g_ptr_array_add(signal_data, signal_source->data);
|
|
||||||
}
|
|
||||||
|
|
||||||
GSource *g_unix_signal_source_new(gint signum)
|
|
||||||
{
|
|
||||||
GSource *source = g_source_new(&SourceFuncs, sizeof(GUnixSignalSource));
|
|
||||||
g_unix_signal_source_init(source, signum);
|
|
||||||
struct sigaction action;
|
|
||||||
action.sa_handler= handler;
|
|
||||||
sigemptyset (&action.sa_mask);
|
|
||||||
action.sa_flags = 0;
|
|
||||||
sigaction(signum, &action, NULL);
|
|
||||||
return source;
|
|
||||||
}
|
|
||||||
|
|
||||||
guint g_unix_signal_add_full(gint priority, gint signum, GSourceFunc function, gpointer data, GDestroyNotify notify)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail(function != NULL, 0);
|
|
||||||
GSource *source = g_unix_signal_source_new(signum);
|
|
||||||
if (priority != G_PRIORITY_DEFAULT)
|
|
||||||
g_source_set_priority (source, priority);
|
|
||||||
g_source_set_callback(source, function, data, notify);
|
|
||||||
guint id = g_source_attach(source, NULL);
|
|
||||||
g_source_unref(source);
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
guint g_unix_signal_add(gint signum, GSourceFunc function, gpointer data)
|
|
||||||
{
|
|
||||||
return g_unix_signal_add_full(G_PRIORITY_DEFAULT, signum, function, data, NULL);
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
#ifndef G_UNIX_SIGNAL_H
|
|
||||||
#define G_UNIX_SIGNAL_H
|
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
|
|
||||||
GSource *g_unix_signal_source_new(gint signum);
|
|
||||||
guint g_unix_signal_add(gint signum, GSourceFunc function, gpointer data);
|
|
||||||
guint g_unix_signal_add_full(gint priority, gint signum, GSourceFunc function, gpointer data, GDestroyNotify notify);
|
|
||||||
|
|
||||||
#endif /* G_UNIX_SIGNAL_H */
|
|
@ -1,10 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include "getPassword.h"
|
|
||||||
|
|
||||||
char* passwordPrompt(void) {
|
|
||||||
char *password;
|
|
||||||
password = getpass("Enter MySQL Password: ");
|
|
||||||
|
|
||||||
return password;
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
#ifndef GET_PASSWORD_PROMPT
|
|
||||||
#define GET_PASSWORD_PROMPT
|
|
||||||
char* passwordPrompt(void);
|
|
||||||
#endif
|
|
3153
mydumper.c
3153
mydumper.c
File diff suppressed because it is too large
Load Diff
100
mydumper.h
100
mydumper.h
@ -1,100 +0,0 @@
|
|||||||
/*
|
|
||||||
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, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
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, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Authors: Domas Mituzas, Facebook ( domas at fb dot com )
|
|
||||||
Mark Leith, Oracle Corporation (mark dot leith at oracle dot com)
|
|
||||||
Andrew Hutchings, SkySQL (andrew at skysql dot com)
|
|
||||||
Max Bubenick, Percona RDBA (max dot bubenick at percona dot com)
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _mydumper_h
|
|
||||||
#define _mydumper_h
|
|
||||||
|
|
||||||
enum job_type { JOB_SHUTDOWN, JOB_RESTORE, JOB_DUMP, JOB_DUMP_NON_INNODB, JOB_SCHEMA, JOB_VIEW, JOB_TRIGGERS, JOB_SCHEMA_POST, JOB_BINLOG, JOB_LOCK_DUMP_NON_INNODB };
|
|
||||||
|
|
||||||
struct configuration {
|
|
||||||
char use_any_index;
|
|
||||||
GAsyncQueue* queue;
|
|
||||||
GAsyncQueue* queue_less_locking;
|
|
||||||
GAsyncQueue* ready;
|
|
||||||
GAsyncQueue* ready_less_locking;
|
|
||||||
GAsyncQueue* unlock_tables;
|
|
||||||
GMutex* mutex;
|
|
||||||
int done;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct thread_data {
|
|
||||||
struct configuration *conf;
|
|
||||||
guint thread_id;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct job {
|
|
||||||
enum job_type type;
|
|
||||||
void *job_data;
|
|
||||||
struct configuration *conf;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct table_job {
|
|
||||||
char *database;
|
|
||||||
char *table;
|
|
||||||
char *filename;
|
|
||||||
char *where;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct tables_job {
|
|
||||||
GList* table_job_list;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct schema_job {
|
|
||||||
char *database;
|
|
||||||
char *table;
|
|
||||||
char *filename;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct view_job {
|
|
||||||
char *database;
|
|
||||||
char *table;
|
|
||||||
char *filename;
|
|
||||||
char *filename2;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct schema_post_job {
|
|
||||||
char *database;
|
|
||||||
char *filename;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct restore_job {
|
|
||||||
char *database;
|
|
||||||
char *table;
|
|
||||||
char *filename;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct binlog_job {
|
|
||||||
char *filename;
|
|
||||||
guint64 start_position;
|
|
||||||
guint64 stop_position;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct db_table {
|
|
||||||
char* database;
|
|
||||||
char* table;
|
|
||||||
guint64 datalength;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct schema_post {
|
|
||||||
char* database;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
BIN
mydumper_0.9.1.orig.tar.gz.delta
Normal file
BIN
mydumper_0.9.1.orig.tar.gz.delta
Normal file
Binary file not shown.
1
mydumper_0.9.1.orig.tar.gz.id
Normal file
1
mydumper_0.9.1.orig.tar.gz.id
Normal file
@ -0,0 +1 @@
|
|||||||
|
a9d7dbd013ae57389085202f035ea0d7d309fe0d
|
BIN
mydumper_0.9.5.orig.tar.gz.delta
Normal file
BIN
mydumper_0.9.5.orig.tar.gz.delta
Normal file
Binary file not shown.
1
mydumper_0.9.5.orig.tar.gz.id
Normal file
1
mydumper_0.9.5.orig.tar.gz.id
Normal file
@ -0,0 +1 @@
|
|||||||
|
6094bf22505140f4019b56f70a009ed7d5bb7fee
|
587
myloader.c
587
myloader.c
@ -1,587 +0,0 @@
|
|||||||
/*
|
|
||||||
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, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
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, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Authors: Andrew Hutchings, SkySQL (andrew at skysql dot com)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define _LARGEFILE64_SOURCE
|
|
||||||
#define _FILE_OFFSET_BITS 64
|
|
||||||
|
|
||||||
#include <mysql.h>
|
|
||||||
|
|
||||||
#if defined MARIADB_CLIENT_VERSION_STR && !defined MYSQL_SERVER_VERSION
|
|
||||||
#define MYSQL_SERVER_VERSION MARIADB_CLIENT_VERSION_STR
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <glib.h>
|
|
||||||
#include <glib/gstdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <zlib.h>
|
|
||||||
#include "common.h"
|
|
||||||
#include "myloader.h"
|
|
||||||
#include "connection.h"
|
|
||||||
#include "config.h"
|
|
||||||
#include "getPassword.h"
|
|
||||||
|
|
||||||
guint commit_count= 1000;
|
|
||||||
gchar *directory= NULL;
|
|
||||||
gboolean overwrite_tables= FALSE;
|
|
||||||
gboolean enable_binlog= FALSE;
|
|
||||||
gchar *source_db= NULL;
|
|
||||||
static GMutex *init_mutex= NULL;
|
|
||||||
|
|
||||||
guint errors= 0;
|
|
||||||
|
|
||||||
gboolean read_data(FILE *file, gboolean is_compressed, GString *data, gboolean *eof);
|
|
||||||
void restore_data(MYSQL *conn, char *database, char *table, const char *filename, gboolean is_schema, gboolean need_use);
|
|
||||||
void *process_queue(struct thread_data *td);
|
|
||||||
void add_table(const gchar* filename, struct configuration *conf);
|
|
||||||
void add_schema(const gchar* filename, MYSQL *conn);
|
|
||||||
void restore_databases(struct configuration *conf, MYSQL *conn);
|
|
||||||
void restore_schema_view(MYSQL *conn);
|
|
||||||
void restore_schema_triggers(MYSQL *conn);
|
|
||||||
void restore_schema_post(MYSQL *conn);
|
|
||||||
void no_log(const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data);
|
|
||||||
void set_verbose(guint verbosity);
|
|
||||||
void create_database(MYSQL *conn, gchar *database);
|
|
||||||
|
|
||||||
static GOptionEntry entries[] =
|
|
||||||
{
|
|
||||||
{ "directory", 'd', 0, G_OPTION_ARG_STRING, &directory, "Directory of the dump to import", NULL },
|
|
||||||
{ "queries-per-transaction", 'q', 0, G_OPTION_ARG_INT, &commit_count, "Number of queries per transaction, default 1000", NULL },
|
|
||||||
{ "overwrite-tables", 'o', 0, G_OPTION_ARG_NONE, &overwrite_tables, "Drop tables if they already exist", NULL },
|
|
||||||
{ "database", 'B', 0, G_OPTION_ARG_STRING, &db, "An alternative database to restore into", NULL },
|
|
||||||
{ "source-db", 's', 0, G_OPTION_ARG_STRING, &source_db, "Database to restore", NULL },
|
|
||||||
{ "enable-binlog", 'e', 0, G_OPTION_ARG_NONE, &enable_binlog, "Enable binary logging of the restore data", NULL },
|
|
||||||
{ NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }
|
|
||||||
};
|
|
||||||
|
|
||||||
void no_log(const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data) {
|
|
||||||
(void) log_domain;
|
|
||||||
(void) log_level;
|
|
||||||
(void) message;
|
|
||||||
(void) user_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_verbose(guint verbosity) {
|
|
||||||
switch (verbosity) {
|
|
||||||
case 0:
|
|
||||||
g_log_set_handler(NULL, (GLogLevelFlags)(G_LOG_LEVEL_MASK), no_log, NULL);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
g_log_set_handler(NULL, (GLogLevelFlags)(G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE), no_log, NULL);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
g_log_set_handler(NULL, (GLogLevelFlags)(G_LOG_LEVEL_MESSAGE), no_log, NULL);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
|
||||||
struct configuration conf= { NULL, NULL, NULL, 0 };
|
|
||||||
|
|
||||||
GError *error= NULL;
|
|
||||||
GOptionContext *context;
|
|
||||||
|
|
||||||
g_thread_init(NULL);
|
|
||||||
|
|
||||||
init_mutex= g_mutex_new();
|
|
||||||
|
|
||||||
if(db == NULL && source_db != NULL){
|
|
||||||
db = g_strdup(source_db);
|
|
||||||
}
|
|
||||||
|
|
||||||
context= g_option_context_new("multi-threaded MySQL loader");
|
|
||||||
GOptionGroup *main_group= g_option_group_new("main", "Main Options", "Main Options", NULL, NULL);
|
|
||||||
g_option_group_add_entries(main_group, entries);
|
|
||||||
g_option_group_add_entries(main_group, common_entries);
|
|
||||||
g_option_context_set_main_group(context, main_group);
|
|
||||||
if (!g_option_context_parse(context, &argc, &argv, &error)) {
|
|
||||||
g_print("option parsing failed: %s, try --help\n", error->message);
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
g_option_context_free(context);
|
|
||||||
|
|
||||||
//prompt for password if it's NULL
|
|
||||||
if ( sizeof(password) == 0 || ( password == NULL && askPassword ) ){
|
|
||||||
password = passwordPrompt();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (program_version) {
|
|
||||||
g_print("myloader %s, built against MySQL %s\n", VERSION, MYSQL_VERSION_STR);
|
|
||||||
exit(EXIT_SUCCESS);
|
|
||||||
}
|
|
||||||
|
|
||||||
set_verbose(verbose);
|
|
||||||
|
|
||||||
if (!directory) {
|
|
||||||
g_critical("a directory needs to be specified, see --help\n");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
} else {
|
|
||||||
char *p= g_strdup_printf("%s/metadata", directory);
|
|
||||||
if (!g_file_test(p, G_FILE_TEST_EXISTS)) {
|
|
||||||
g_critical("the specified directory is not a mydumper backup\n");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MYSQL *conn;
|
|
||||||
conn= mysql_init(NULL);
|
|
||||||
|
|
||||||
configure_connection(conn,"myloader");
|
|
||||||
if (!mysql_real_connect(conn, hostname, username, password, NULL, port, socket_path, 0)) {
|
|
||||||
g_critical("Error connection to database: %s", mysql_error(conn));
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mysql_query(conn, "SET SESSION wait_timeout = 2147483")){
|
|
||||||
g_warning("Failed to increase wait_timeout: %s", mysql_error(conn));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!enable_binlog)
|
|
||||||
mysql_query(conn, "SET SQL_LOG_BIN=0");
|
|
||||||
|
|
||||||
mysql_query(conn, "/*!40014 SET FOREIGN_KEY_CHECKS=0*/");
|
|
||||||
conf.queue= g_async_queue_new();
|
|
||||||
conf.ready= g_async_queue_new();
|
|
||||||
|
|
||||||
guint n;
|
|
||||||
GThread **threads= g_new(GThread*, num_threads);
|
|
||||||
struct thread_data *td= g_new(struct thread_data, num_threads);
|
|
||||||
for (n= 0; n < num_threads; n++) {
|
|
||||||
td[n].conf= &conf;
|
|
||||||
td[n].thread_id= n+1;
|
|
||||||
threads[n]= g_thread_create((GThreadFunc)process_queue, &td[n], TRUE, NULL);
|
|
||||||
g_async_queue_pop(conf.ready);
|
|
||||||
}
|
|
||||||
g_async_queue_unref(conf.ready);
|
|
||||||
|
|
||||||
g_message("%d threads created", num_threads);
|
|
||||||
|
|
||||||
restore_databases(&conf, conn);
|
|
||||||
|
|
||||||
for (n= 0; n < num_threads; n++) {
|
|
||||||
struct job *j= g_new0(struct job, 1);
|
|
||||||
j->type = JOB_SHUTDOWN;
|
|
||||||
g_async_queue_push(conf.queue, j);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (n= 0; n < num_threads; n++) {
|
|
||||||
g_thread_join(threads[n]);
|
|
||||||
}
|
|
||||||
|
|
||||||
restore_schema_post(conn);
|
|
||||||
|
|
||||||
restore_schema_view(conn);
|
|
||||||
|
|
||||||
restore_schema_triggers(conn);
|
|
||||||
|
|
||||||
g_async_queue_unref(conf.queue);
|
|
||||||
mysql_close(conn);
|
|
||||||
mysql_thread_end();
|
|
||||||
mysql_library_end();
|
|
||||||
g_free(directory);
|
|
||||||
g_free(td);
|
|
||||||
g_free(threads);
|
|
||||||
|
|
||||||
return errors ? EXIT_FAILURE : EXIT_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
void restore_databases(struct configuration *conf, MYSQL *conn) {
|
|
||||||
GError *error= NULL;
|
|
||||||
GDir* dir= g_dir_open(directory, 0, &error);
|
|
||||||
|
|
||||||
if (error) {
|
|
||||||
g_critical("cannot open directory %s, %s\n", directory, error->message);
|
|
||||||
errors++;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const gchar* filename= NULL;
|
|
||||||
|
|
||||||
while((filename= g_dir_read_name(dir))) {
|
|
||||||
if (!source_db || g_str_has_prefix(filename, g_strdup_printf("%s.", source_db))){
|
|
||||||
if (g_strrstr(filename, "-schema.sql")) {
|
|
||||||
add_schema(filename, conn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_dir_rewind(dir);
|
|
||||||
|
|
||||||
while((filename= g_dir_read_name(dir))) {
|
|
||||||
if (!source_db || g_str_has_prefix(filename, g_strdup_printf("%s.", source_db))){
|
|
||||||
if (!g_strrstr(filename, "-schema.sql")
|
|
||||||
&& !g_strrstr(filename, "-schema-view.sql")
|
|
||||||
&& !g_strrstr(filename, "-schema-triggers.sql")
|
|
||||||
&& !g_strrstr(filename, "-schema-post.sql")
|
|
||||||
&& !g_strrstr(filename, "-schema-create.sql")
|
|
||||||
&& g_strrstr(filename, ".sql")) {
|
|
||||||
add_table(filename, conf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_dir_close(dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void restore_schema_view(MYSQL *conn){
|
|
||||||
GError *error= NULL;
|
|
||||||
GDir* dir= g_dir_open(directory, 0, &error);
|
|
||||||
|
|
||||||
if (error) {
|
|
||||||
g_critical("cannot open directory %s, %s\n", directory, error->message);
|
|
||||||
errors++;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const gchar* filename= NULL;
|
|
||||||
|
|
||||||
while((filename= g_dir_read_name(dir))) {
|
|
||||||
if (!source_db || g_str_has_prefix(filename, source_db)){
|
|
||||||
if (g_strrstr(filename, "-schema-view.sql")) {
|
|
||||||
add_schema(filename, conn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_dir_close(dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
void restore_schema_triggers(MYSQL *conn){
|
|
||||||
GError *error= NULL;
|
|
||||||
GDir* dir= g_dir_open(directory, 0, &error);
|
|
||||||
gchar** split_file= NULL;
|
|
||||||
gchar* database=NULL;
|
|
||||||
gchar** split_table= NULL;
|
|
||||||
gchar* table= NULL;
|
|
||||||
|
|
||||||
if (error) {
|
|
||||||
g_critical("cannot open directory %s, %s\n", directory, error->message);
|
|
||||||
errors++;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const gchar* filename= NULL;
|
|
||||||
|
|
||||||
while((filename= g_dir_read_name(dir))) {
|
|
||||||
if (!source_db || g_str_has_prefix(filename, source_db)){
|
|
||||||
if (g_strrstr(filename, "-schema-triggers.sql")) {
|
|
||||||
split_file= g_strsplit(filename, ".", 0);
|
|
||||||
database= split_file[0];
|
|
||||||
split_table= g_strsplit(split_file[1], "-schema", 0);
|
|
||||||
table= split_table[0];
|
|
||||||
g_message("Restoring triggers for `%s`.`%s`", db ? db : database, table);
|
|
||||||
restore_data(conn, database, table, filename, TRUE, TRUE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_strfreev(split_table);
|
|
||||||
g_strfreev(split_file);
|
|
||||||
g_dir_close(dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
void restore_schema_post(MYSQL *conn){
|
|
||||||
GError *error= NULL;
|
|
||||||
GDir* dir= g_dir_open(directory, 0, &error);
|
|
||||||
gchar** split_file= NULL;
|
|
||||||
gchar* database=NULL;
|
|
||||||
//gchar* table=NULL;
|
|
||||||
|
|
||||||
|
|
||||||
if (error) {
|
|
||||||
g_critical("cannot open directory %s, %s\n", directory, error->message);
|
|
||||||
errors++;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const gchar* filename= NULL;
|
|
||||||
|
|
||||||
while((filename= g_dir_read_name(dir))) {
|
|
||||||
if (!source_db || g_str_has_prefix(filename, source_db)){
|
|
||||||
if (g_strrstr(filename, "-schema-post.sql")) {
|
|
||||||
split_file= g_strsplit(filename, "-schema-post.sql", 0);
|
|
||||||
database= split_file[0];
|
|
||||||
//table= split_file[0]; //NULL
|
|
||||||
g_message("Restoring routines and events for `%s`", db ? db : database);
|
|
||||||
restore_data(conn, database, NULL, filename, TRUE, TRUE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_strfreev(split_file);
|
|
||||||
g_dir_close(dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
void create_database(MYSQL *conn, gchar *database){
|
|
||||||
|
|
||||||
gchar* query = NULL;
|
|
||||||
|
|
||||||
if((db == NULL && source_db == NULL) || (db != NULL && source_db != NULL && !g_ascii_strcasecmp(db, source_db))){
|
|
||||||
const gchar* filename= g_strdup_printf("%s-schema-create.sql", db ? db : database);
|
|
||||||
const gchar* filenamegz= g_strdup_printf("%s-schema-create.sql.gz", db ? db : database);
|
|
||||||
const gchar* filepath= g_strdup_printf("%s/%s-schema-create.sql", directory, db ? db : database);
|
|
||||||
const gchar* filepathgz= g_strdup_printf("%s/%s-schema-create.sql.gz", directory, db ? db : database);
|
|
||||||
|
|
||||||
if (g_file_test (filepath, G_FILE_TEST_EXISTS)){
|
|
||||||
restore_data(conn, database, NULL, filename, TRUE, FALSE);
|
|
||||||
}else if (g_file_test (filepathgz, G_FILE_TEST_EXISTS)){
|
|
||||||
restore_data(conn, database, NULL, filenamegz, TRUE, FALSE);
|
|
||||||
}else{
|
|
||||||
query= g_strdup_printf("CREATE DATABASE `%s`", db ? db : database);
|
|
||||||
mysql_query(conn, query);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
query= g_strdup_printf("CREATE DATABASE `%s`", db ? db : database);
|
|
||||||
mysql_query(conn, query);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_free(query);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void add_schema(const gchar* filename, MYSQL *conn) {
|
|
||||||
// 0 is database, 1 is table with -schema on the end
|
|
||||||
gchar** split_file= g_strsplit(filename, ".", 0);
|
|
||||||
gchar* database= split_file[0];
|
|
||||||
// Remove the -schema from the table name
|
|
||||||
gchar** split_table= g_strsplit(split_file[1], "-schema", 0);
|
|
||||||
gchar* table= split_table[0];
|
|
||||||
|
|
||||||
gchar* query= g_strdup_printf("SHOW CREATE DATABASE `%s`", db ? db : database);
|
|
||||||
if (mysql_query(conn, query)) {
|
|
||||||
g_message("Creating database `%s`", db ? db : database);
|
|
||||||
create_database(conn, database);
|
|
||||||
} else {
|
|
||||||
MYSQL_RES *result= mysql_store_result(conn);
|
|
||||||
// In drizzle the query succeeds with no rows
|
|
||||||
my_ulonglong row_count= mysql_num_rows(result);
|
|
||||||
mysql_free_result(result);
|
|
||||||
if (row_count == 0) {
|
|
||||||
create_database(conn, database);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (overwrite_tables) {
|
|
||||||
g_message("Dropping table or view (if exists) `%s`.`%s`", db ? db : database, table);
|
|
||||||
query= g_strdup_printf("DROP TABLE IF EXISTS `%s`.`%s`", db ? db : database, table);
|
|
||||||
mysql_query(conn, query);
|
|
||||||
query= g_strdup_printf("DROP VIEW IF EXISTS `%s`.`%s`", db ? db : database, table);
|
|
||||||
mysql_query(conn, query);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_free(query);
|
|
||||||
|
|
||||||
g_message("Creating table `%s`.`%s`", db ? db : database, table);
|
|
||||||
restore_data(conn, database, table, filename, TRUE, TRUE);
|
|
||||||
g_strfreev(split_table);
|
|
||||||
g_strfreev(split_file);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void add_table(const gchar* filename, struct configuration *conf) {
|
|
||||||
struct job *j= g_new0(struct job, 1);
|
|
||||||
struct restore_job *rj= g_new(struct restore_job, 1);
|
|
||||||
j->job_data= (void*) rj;
|
|
||||||
rj->filename= g_strdup(filename);
|
|
||||||
j->type= JOB_RESTORE;
|
|
||||||
gchar** split_file= g_strsplit(filename, ".", 0);
|
|
||||||
rj->database= g_strdup(split_file[0]);
|
|
||||||
rj->table= g_strdup(split_file[1]);
|
|
||||||
rj->part= g_ascii_strtoull(split_file[2], NULL, 10);
|
|
||||||
g_async_queue_push(conf->queue, j);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void *process_queue(struct thread_data *td) {
|
|
||||||
struct configuration *conf= td->conf;
|
|
||||||
g_mutex_lock(init_mutex);
|
|
||||||
MYSQL *thrconn= mysql_init(NULL);
|
|
||||||
g_mutex_unlock(init_mutex);
|
|
||||||
|
|
||||||
configure_connection(thrconn,"myloader");
|
|
||||||
|
|
||||||
if (!mysql_real_connect(thrconn, hostname, username, password, NULL, port, socket_path, 0)) {
|
|
||||||
g_critical("Failed to connect to MySQL server: %s", mysql_error(thrconn));
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mysql_query(thrconn, "SET SESSION wait_timeout = 2147483")){
|
|
||||||
g_warning("Failed to increase wait_timeout: %s", mysql_error(thrconn));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!enable_binlog)
|
|
||||||
mysql_query(thrconn, "SET SQL_LOG_BIN=0");
|
|
||||||
|
|
||||||
mysql_query(thrconn, "/*!40101 SET NAMES binary*/");
|
|
||||||
mysql_query(thrconn, "/*!40101 SET SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */");
|
|
||||||
mysql_query(thrconn, "/*!40014 SET UNIQUE_CHECKS=0 */");
|
|
||||||
mysql_query(thrconn, "SET autocommit=0");
|
|
||||||
|
|
||||||
g_async_queue_push(conf->ready, GINT_TO_POINTER(1));
|
|
||||||
|
|
||||||
struct job* job= NULL;
|
|
||||||
struct restore_job* rj= NULL;
|
|
||||||
for(;;) {
|
|
||||||
job= (struct job*)g_async_queue_pop(conf->queue);
|
|
||||||
|
|
||||||
switch (job->type) {
|
|
||||||
case JOB_RESTORE:
|
|
||||||
rj= (struct restore_job *)job->job_data;
|
|
||||||
g_message("Thread %d restoring `%s`.`%s` part %d", td->thread_id, rj->database, rj->table, rj->part);
|
|
||||||
restore_data(thrconn, rj->database, rj->table, rj->filename, FALSE, TRUE);
|
|
||||||
if (rj->database) g_free(rj->database);
|
|
||||||
if (rj->table) g_free(rj->table);
|
|
||||||
if (rj->filename) g_free(rj->filename);
|
|
||||||
g_free(rj);
|
|
||||||
g_free(job);
|
|
||||||
break;
|
|
||||||
case JOB_SHUTDOWN:
|
|
||||||
g_message("Thread %d shutting down", td->thread_id);
|
|
||||||
if (thrconn)
|
|
||||||
mysql_close(thrconn);
|
|
||||||
g_free(job);
|
|
||||||
mysql_thread_end();
|
|
||||||
return NULL;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
g_critical("Something very bad happened!");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (thrconn)
|
|
||||||
mysql_close(thrconn);
|
|
||||||
mysql_thread_end();
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void restore_data(MYSQL *conn, char *database, char *table, const char *filename, gboolean is_schema, gboolean need_use) {
|
|
||||||
void *infile;
|
|
||||||
gboolean is_compressed= FALSE;
|
|
||||||
gboolean eof= FALSE;
|
|
||||||
guint query_counter= 0;
|
|
||||||
GString *data= g_string_sized_new(512);
|
|
||||||
|
|
||||||
gchar* path= g_build_filename(directory, filename, NULL);
|
|
||||||
|
|
||||||
if (!g_str_has_suffix(path, ".gz")) {
|
|
||||||
infile= g_fopen(path, "r");
|
|
||||||
is_compressed= FALSE;
|
|
||||||
} else {
|
|
||||||
infile= (void*) gzopen(path, "r");
|
|
||||||
is_compressed= TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!infile) {
|
|
||||||
g_critical("cannot open file %s (%d)", filename, errno);
|
|
||||||
errors++;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if(need_use){
|
|
||||||
gchar *query= g_strdup_printf("USE `%s`", db ? db : database);
|
|
||||||
|
|
||||||
if (mysql_query(conn, query)) {
|
|
||||||
g_critical("Error switching to database %s whilst restoring table %s", db ? db : database, table);
|
|
||||||
g_free(query);
|
|
||||||
errors++;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_free(query);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (!is_schema)
|
|
||||||
mysql_query(conn, "START TRANSACTION");
|
|
||||||
|
|
||||||
while (eof == FALSE) {
|
|
||||||
if (read_data(infile, is_compressed, data, &eof)) {
|
|
||||||
// Search for ; in last 5 chars of line
|
|
||||||
if (g_strrstr(&data->str[data->len >= 5 ? data->len - 5 : 0], ";\n")) {
|
|
||||||
if (mysql_real_query(conn, data->str, data->len)) {
|
|
||||||
g_critical("Error restoring %s.%s from file %s: %s", db ? db : database, table, filename, mysql_error(conn));
|
|
||||||
errors++;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
query_counter++;
|
|
||||||
if (!is_schema &&(query_counter == commit_count)) {
|
|
||||||
query_counter= 0;
|
|
||||||
if (mysql_query(conn, "COMMIT")) {
|
|
||||||
g_critical("Error committing data for %s.%s: %s", db ? db : database, table, mysql_error(conn));
|
|
||||||
errors++;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
mysql_query(conn, "START TRANSACTION");
|
|
||||||
}
|
|
||||||
|
|
||||||
g_string_set_size(data, 0);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
g_critical("error reading file %s (%d)", filename, errno);
|
|
||||||
errors++;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!is_schema && mysql_query(conn, "COMMIT")) {
|
|
||||||
g_critical("Error committing data for %s.%s from file %s: %s", db ? db : database, table, filename, mysql_error(conn));
|
|
||||||
errors++;
|
|
||||||
}
|
|
||||||
g_string_free(data, TRUE);
|
|
||||||
g_free(path);
|
|
||||||
if (!is_compressed) {
|
|
||||||
fclose(infile);
|
|
||||||
} else {
|
|
||||||
gzclose((gzFile)infile);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean read_data(FILE *file, gboolean is_compressed, GString *data, gboolean *eof) {
|
|
||||||
char buffer[256];
|
|
||||||
|
|
||||||
do {
|
|
||||||
if (!is_compressed) {
|
|
||||||
if (fgets(buffer, 256, file) == NULL) {
|
|
||||||
if (feof(file)) {
|
|
||||||
*eof= TRUE;
|
|
||||||
buffer[0]= '\0';
|
|
||||||
} else {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!gzgets((gzFile)file, buffer, 256)) {
|
|
||||||
if (gzeof((gzFile)file)) {
|
|
||||||
*eof= TRUE;
|
|
||||||
buffer[0]= '\0';
|
|
||||||
} else {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
g_string_append(data, buffer);
|
|
||||||
} while ((buffer[strlen(buffer)] != '\0') && *eof == FALSE);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
51
myloader.h
51
myloader.h
@ -1,51 +0,0 @@
|
|||||||
/*
|
|
||||||
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, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
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, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Authors: Domas Mituzas, Facebook ( domas at fb dot com )
|
|
||||||
Mark Leith, Oracle Corporation (mark dot leith at oracle dot com)
|
|
||||||
Andrew Hutchings, SkySQL (andrew at skysql dot com)
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _myloader_h
|
|
||||||
#define _myloader_h
|
|
||||||
|
|
||||||
enum job_type { JOB_SHUTDOWN, JOB_RESTORE };
|
|
||||||
|
|
||||||
struct configuration {
|
|
||||||
GAsyncQueue* queue;
|
|
||||||
GAsyncQueue* ready;
|
|
||||||
GMutex* mutex;
|
|
||||||
int done;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct thread_data {
|
|
||||||
struct configuration *conf;
|
|
||||||
guint thread_id;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct job {
|
|
||||||
enum job_type type;
|
|
||||||
void *job_data;
|
|
||||||
struct configuration *conf;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct restore_job {
|
|
||||||
char *database;
|
|
||||||
char *table;
|
|
||||||
char *filename;
|
|
||||||
guint part;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,71 +0,0 @@
|
|||||||
/*
|
|
||||||
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, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
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, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Authors: Andrew Hutchings, SkySQL (andrew at skysql dot com)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <pcre.h>
|
|
||||||
#include <glib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include "server_detect.h"
|
|
||||||
|
|
||||||
int detect_server(MYSQL *conn) {
|
|
||||||
pcre *re= NULL;
|
|
||||||
const char *error;
|
|
||||||
int erroroffset;
|
|
||||||
int ovector[9]= {0};
|
|
||||||
int rc;
|
|
||||||
const char* db_version= mysql_get_server_info(conn);
|
|
||||||
|
|
||||||
re= pcre_compile(DETECT_MYSQL_REGEX, 0, &error, &erroroffset, NULL);
|
|
||||||
if (!re) {
|
|
||||||
g_critical("Regular expression fail: %s", error);
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
rc = pcre_exec(re, NULL, db_version, strlen(db_version), 0, 0, ovector, 9);
|
|
||||||
pcre_free(re);
|
|
||||||
|
|
||||||
if (rc > 0) {
|
|
||||||
return SERVER_TYPE_MYSQL;
|
|
||||||
}
|
|
||||||
|
|
||||||
re= pcre_compile(DETECT_DRIZZLE_REGEX, 0, &error, &erroroffset, NULL);
|
|
||||||
if (!re) {
|
|
||||||
g_critical("Regular expression fail: %s", error);
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
rc = pcre_exec(re, NULL, db_version, strlen(db_version), 0, 0, ovector, 9);
|
|
||||||
pcre_free(re);
|
|
||||||
|
|
||||||
if (rc > 0) {
|
|
||||||
return SERVER_TYPE_DRIZZLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
re= pcre_compile(DETECT_MARIADB_REGEX, 0, &error, &erroroffset, NULL);
|
|
||||||
if (!re) {
|
|
||||||
g_critical("Regular expression fail: %s", error);
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
rc = pcre_exec(re, NULL, db_version, strlen(db_version), 0, 0, ovector, 9);
|
|
||||||
pcre_free(re);
|
|
||||||
|
|
||||||
if (rc > 0) {
|
|
||||||
return SERVER_TYPE_MYSQL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return SERVER_TYPE_UNKNOWN;
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
/*
|
|
||||||
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, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
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, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Authors: Andrew Hutchings, SkySQL (andrew at skysql dot com)
|
|
||||||
*/
|
|
||||||
#ifndef _server_detect_h
|
|
||||||
#define _server_detect_h
|
|
||||||
|
|
||||||
#include <mysql.h>
|
|
||||||
|
|
||||||
#define DETECT_MYSQL_REGEX "^([3-9]\\.[0-9]+\\.[0-9]+)"
|
|
||||||
#define DETECT_DRIZZLE_REGEX "^(20[0-9]{2}\\.(0[1-9]|1[012])\\.[0-9]+)"
|
|
||||||
#define DETECT_MARIADB_REGEX "^([0-9]{1,2}\\.[0-9]+\\.[0-9]+)"
|
|
||||||
|
|
||||||
enum server_type { SERVER_TYPE_UNKNOWN, SERVER_TYPE_MYSQL, SERVER_TYPE_DRIZZLE };
|
|
||||||
int detect_server(MYSQL *conn);
|
|
||||||
#endif
|
|
Loading…
Reference in New Issue
Block a user