1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-02 14:22:51 +03:00

Merge pilot.blaudden:/home/msvensson/mysql/my51-m-mysql_upgrade

into  pilot.blaudden:/home/msvensson/mysql/mysql-5.1-maint
This commit is contained in:
msvensson@pilot.blaudden
2007-04-24 11:11:45 +02:00
1197 changed files with 95893 additions and 26567 deletions

View File

@ -352,8 +352,11 @@ client/.libs/mysqltest
client/completion_hash.cpp client/completion_hash.cpp
client/decimal.c client/decimal.c
client/insert_test client/insert_test
client/link_sources
client/log_event.cc client/log_event.cc
client/log_event.h client/log_event.h
client/log_event_old.cc
client/log_event_old.h
client/mf_iocache.c client/mf_iocache.c
client/mf_iocache.cc client/mf_iocache.cc
client/my_decimal.cc client/my_decimal.cc
@ -379,6 +382,9 @@ client/mysqltestmanager-pwgen
client/mysqltestmanagerc client/mysqltestmanagerc
client/mysys_priv.h client/mysys_priv.h
client/readline.cpp client/readline.cpp
client/rpl_constants.h
client/rpl_record_old.cc
client/rpl_record_old.h
client/select_test client/select_test
client/sql_string.cpp client/sql_string.cpp
client/ssl_test client/ssl_test
@ -574,6 +580,7 @@ help
help.c help.c
help.h help.h
include/check_abi include/check_abi
include/link_sources
include/my_config.h include/my_config.h
include/my_global.h include/my_global.h
include/mysql_h.ic include/mysql_h.ic
@ -749,6 +756,7 @@ libmysql/.libs/libmysqlclient.so.15.0.0
libmysql/conf_to_src libmysql/conf_to_src
libmysql/debug/libmysql.exp libmysql/debug/libmysql.exp
libmysql/libmysql.ver libmysql/libmysql.ver
libmysql/link_sources
libmysql/my_static.h libmysql/my_static.h
libmysql/my_time.c libmysql/my_time.c
libmysql/mysys_priv.h libmysql/mysys_priv.h
@ -1084,9 +1092,11 @@ libmysqld/item_uniq.cc
libmysqld/key.cc libmysqld/key.cc
libmysqld/lib_sql.cpp libmysqld/lib_sql.cpp
libmysqld/libmysql.c libmysqld/libmysql.c
libmysqld/link_sources
libmysqld/lock.cc libmysqld/lock.cc
libmysqld/log.cc libmysqld/log.cc
libmysqld/log_event.cc libmysqld/log_event.cc
libmysqld/log_event_old.cc
libmysqld/md5.c libmysqld/md5.c
libmysqld/mf_iocache.cc libmysqld/mf_iocache.cc
libmysqld/mini_client.cc libmysqld/mini_client.cc
@ -1109,6 +1119,8 @@ libmysqld/records.cc
libmysqld/repl_failsafe.cc libmysqld/repl_failsafe.cc
libmysqld/rpl_filter.cc libmysqld/rpl_filter.cc
libmysqld/rpl_injector.cc libmysqld/rpl_injector.cc
libmysqld/rpl_record.cc
libmysqld/rpl_record_old.cc
libmysqld/set_var.cc libmysqld/set_var.cc
libmysqld/simple-test libmysqld/simple-test
libmysqld/slave.cc libmysqld/slave.cc
@ -1347,10 +1359,15 @@ mysql-test/suite/funcs_1/r/myisam_trig_03e.warnings
mysql-test/suite/funcs_1/r/myisam_views.warnings mysql-test/suite/funcs_1/r/myisam_views.warnings
mysql-test/suite/funcs_1/r/ndb_trig_03e.warnings mysql-test/suite/funcs_1/r/ndb_trig_03e.warnings
mysql-test/suite/funcs_1/r/ndb_views.warnings mysql-test/suite/funcs_1/r/ndb_views.warnings
mysql-test/suite/partitions/r/dif
mysql-test/suite/partitions/r/diff mysql-test/suite/partitions/r/diff
mysql-test/suite/partitions/r/partition.result
mysql-test/suite/partitions/r/partition_bit_ndb.warnings mysql-test/suite/partitions/r/partition_bit_ndb.warnings
mysql-test/suite/partitions/r/partition_special_innodb.warnings mysql-test/suite/partitions/r/partition_special_innodb.warnings
mysql-test/suite/partitions/r/partition_special_myisam.warnings mysql-test/suite/partitions/r/partition_special_myisam.warnings
mysql-test/suite/partitions/r/partition_t55.out
mysql-test/suite/partitions/r/partition_t55.refout
mysql-test/suite/partitions/t/partition.test
mysql-test/t/index_merge.load mysql-test/t/index_merge.load
mysql-test/t/tmp.test mysql-test/t/tmp.test
mysql-test/var mysql-test/var
@ -1763,7 +1780,9 @@ netware/.deps/my_manage.Po
netware/.deps/mysql_install_db.Po netware/.deps/mysql_install_db.Po
netware/.deps/mysql_test_run.Po netware/.deps/mysql_test_run.Po
netware/.deps/mysqld_safe.Po netware/.deps/mysqld_safe.Po
netware/init_db.sql
netware/libmysql.imp netware/libmysql.imp
netware/test_db.sql
pack_isam/*.ds? pack_isam/*.ds?
perror/*.ds? perror/*.ds?
perror/*.vcproj perror/*.vcproj
@ -1798,6 +1817,7 @@ repl-tests/test-repl/sum-wlen-slave.master.re
repl-tests/test-repl/sum-wlen-slave.master.reje repl-tests/test-repl/sum-wlen-slave.master.reje
replace/*.ds? replace/*.ds?
replace/*.vcproj replace/*.vcproj
scripts/comp_sql
scripts/fill_func_tables scripts/fill_func_tables
scripts/fill_func_tables.sql scripts/fill_func_tables.sql
scripts/fill_help_tables scripts/fill_help_tables
@ -1815,6 +1835,7 @@ scripts/mysql_find_rows
scripts/mysql_fix_extensions scripts/mysql_fix_extensions
scripts/mysql_fix_privilege_tables scripts/mysql_fix_privilege_tables
scripts/mysql_fix_privilege_tables.sql scripts/mysql_fix_privilege_tables.sql
scripts/mysql_fix_privilege_tables_sql.c
scripts/mysql_install_db scripts/mysql_install_db
scripts/mysql_secure_installation scripts/mysql_secure_installation
scripts/mysql_setpermission scripts/mysql_setpermission

View File

@ -4,7 +4,7 @@ extra_configs="$extra_configs $local_infile_configs"
configure="./configure $base_configs $extra_configs" configure="./configure $base_configs $extra_configs"
commands="\ commands="\
$make -k distclean || true $make -k maintainer-clean || true
/bin/rm -rf */.deps/*.P configure config.cache storage/*/configure storage/*/config.cache autom4te.cache storage/*/autom4te.cache; /bin/rm -rf */.deps/*.P configure config.cache storage/*/configure storage/*/config.cache autom4te.cache storage/*/autom4te.cache;
path=`dirname $0` path=`dirname $0`

View File

@ -64,10 +64,11 @@ check_cpu () {
;; ;;
# Intel ia32 # Intel ia32
*X[eE][oO][nN]*) *Intel*Core*|*X[eE][oO][nN]*)
# a Xeon is just another pentium4 ... # a Xeon is just another pentium4 ...
# ... unless it has the "lm" (long-mode) flag set, # ... unless it has the "lm" (long-mode) flag set,
# in that case it's a Xeon with EM64T support # in that case it's a Xeon with EM64T support
# So is Intel Core.
if [ -z "$cpu_flag_lm" ]; then if [ -z "$cpu_flag_lm" ]; then
cpu_arg="pentium4"; cpu_arg="pentium4";
else else
@ -114,6 +115,10 @@ check_cpu () {
*i386*i486*) *i386*i486*)
cpu_arg="pentium-m"; cpu_arg="pentium-m";
;; ;;
#Core 2 Duo
*Intel*Core\(TM\)2*)
cpu_arg="nocona";
;;
# Intel ia64 # Intel ia64
*Itanium*) *Itanium*)
@ -160,26 +165,34 @@ check_cpu () {
cc_ver=`$cc --version | sed 1q` cc_ver=`$cc --version | sed 1q`
cc_verno=`echo $cc_ver | sed -e 's/^.*gcc/gcc/g; s/[^0-9. ]//g; s/^ *//g; s/ .*//g'` cc_verno=`echo $cc_ver | sed -e 's/^.*gcc/gcc/g; s/[^0-9. ]//g; s/^ *//g; s/ .*//g'`
set -- `echo $cc_verno | tr '.' ' '`
cc_major=$1
cc_minor=$2
cc_patch=$3
cc_comp=`expr $cc_major '*' 100 '+' $cc_minor`
case "$cc_ver--$cc_verno" in case "$cc_ver--$cc_verno" in
*GCC*) *GCC*)
# different gcc backends (and versions) have different CPU flags # different gcc backends (and versions) have different CPU flags
case `gcc -dumpmachine` in case `gcc -dumpmachine` in
i?86-*) i?86-*)
case "$cc_verno" in if test "$cc_comp" -lt 304
3.4*|3.5*|4.*) then
check_cpu_args='-mtune=$cpu_arg -march=$cpu_arg' check_cpu_args='-mcpu=$cpu_arg'
;; else
*) check_cpu_args='-mtune=$cpu_arg'
check_cpu_args='-mcpu=$cpu_arg -march=$cpu_arg' fi
;;
esac
;; ;;
ppc-*) ppc-*)
check_cpu_args='-mcpu=$cpu_arg -mtune=$cpu_arg' check_cpu_args='-mcpu=$cpu_arg -mtune=$cpu_arg'
;; ;;
x86_64-*) x86_64-*)
check_cpu_args='-mtune=$cpu_arg' if test "$cc_comp" -lt 304
then
check_cpu_args='-mcpu=$cpu_arg'
else
check_cpu_args='-mtune=$cpu_arg'
fi
;; ;;
*) *)
check_cpu_cflags="" check_cpu_cflags=""

View File

@ -1,5 +1,7 @@
#! /bin/sh
/bin/rm -f */.deps/*.P */*.o /bin/rm -f */.deps/*.P */*.o
make -k clean make -k maintainer-clean
/bin/rm -f */.deps/*.P */*.o /bin/rm -f */.deps/*.P */*.o
/bin/rm -f config.cache mysql-*.tar.gz /bin/rm -f config.cache mysql-*.tar.gz

View File

@ -1,5 +1,7 @@
#! /bin/sh
/bin/rm -f */.deps/*.P */*.o /bin/rm -f */.deps/*.P */*.o
make -k clean make -k maintainer-clean
/bin/rm -f */.deps/*.P */*.o /bin/rm -f */.deps/*.P */*.o
/bin/rm -f */.deps/*.P config.cache storage/innobase/config.cache mysql-*.tar.gz /bin/rm -f */.deps/*.P config.cache storage/innobase/config.cache mysql-*.tar.gz

View File

@ -1,5 +1,7 @@
#! /bin/sh
/bin/rm -f */.deps/*.P */*.o /bin/rm -f */.deps/*.P */*.o
make -k clean make -k maintainer-clean
/bin/rm -f */.deps/*.P */*.o /bin/rm -f */.deps/*.P */*.o
/bin/rm -f */.deps/*.P config.cache storage/innobase/config.cache mysql-*.tar.gz /bin/rm -f */.deps/*.P config.cache storage/innobase/config.cache mysql-*.tar.gz

View File

@ -6,7 +6,7 @@
# tree can then be picked up by "make dist" to create the "pristine source # tree can then be picked up by "make dist" to create the "pristine source
# package" that is used as the basis for all other binary builds. # package" that is used as the basis for all other binary builds.
# #
test -f Makefile && make distclean test -f Makefile && make maintainer-clean
(cd storage/innobase && aclocal && autoheader && \ (cd storage/innobase && aclocal && autoheader && \
libtoolize --automake --force --copy && \ libtoolize --automake --force --copy && \
automake --force --add-missing --copy && autoconf) automake --force --add-missing --copy && autoconf)

View File

@ -61,7 +61,7 @@ done
set -x set -x
make distclean make maintainer-clean
path=`dirname $0` path=`dirname $0`
. "$path/autorun.sh" . "$path/autorun.sh"

View File

@ -1,4 +1,4 @@
gmake -k clean || true gmake -k maintainer-clean || true
/bin/rm -f */.deps/*.P config.cache storage/innobase/config.cache /bin/rm -f */.deps/*.P config.cache storage/innobase/config.cache
path=`dirname $0` path=`dirname $0`

View File

@ -33,7 +33,7 @@ else
fi fi
set -x set -x
make distclean make maintainer-clean
path=`dirname $0` path=`dirname $0`
. "$path/autorun.sh" . "$path/autorun.sh"

View File

@ -4,6 +4,6 @@ path=`dirname $0`
. "$path/SETUP.sh" "$@" --with-debug=full . "$path/SETUP.sh" "$@" --with-debug=full
extra_flags="$pentium_cflags $debug_cflags" extra_flags="$pentium_cflags $debug_cflags"
extra_configs="$pentium_configs $debug_configs $max_configs $error_inject" extra_configs="$pentium_configs $debug_configs $max_configs $error_inject --with-experimental-collations"
. "$path/FINISH.sh" . "$path/FINISH.sh"

View File

@ -1,5 +1,7 @@
#! /bin/sh
AM_MAKEFLAGS="-j 2" AM_MAKEFLAGS="-j 2"
gmake -k clean || true gmake -k maintainer-clean || true
/bin/rm -f */.deps/*.P config.cache /bin/rm -f */.deps/*.P config.cache
path=`dirname $0` path=`dirname $0`

55
BUILD/compile-solaris-amd64 Executable file
View File

@ -0,0 +1,55 @@
#!/usr/bin/bash
function _find_mysql_root () (
while [ "x$PWD" != "x/" ]; do
# Check if some directories are present
if [ -d BUILD -a -d sql -a -d mysys ]; then
echo "$PWD"
return 0
fi
cd ..
done
return 1
)
make -k clean || true
/bin/rm -f */.deps/*.P config.cache
path=`dirname $0`
. "$path/autorun.sh"
warning_flags="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings -Wunused"
compiler_flags="-g -O3 -fno-omit-frame-pointer"
export CC CXX CFLAGS CXXFLAGS LDFLAGS LIBS
CC="gcc"
CXX="gcc"
CFLAGS="$warning_flags $compiler_flags"
CXXFLAGS=""
LDFLAGS="-O3 -g -static-libgcc"
LIBS=-lmtmalloc
root=$(_find_mysql_root)
$root/configure \
--prefix=/usr/local/mysql \
--localstatedir=/usr/local/mysql/data \
--libexecdir=/usr/local/mysql/bin \
--with-extra-charsets=complex \
--enable-thread-safe-client \
--enable-local-infile \
--with-zlib-dir=bundled \
--with-big-tables \
--with-readline \
--with-archive-storage-engine \
--with-named-curses=-lcurses \
--with-big-tables \
--with-innodb \
--with-berkeley-db \
--with-example-storage-engine \
--with-blackhole-storage-engine \
--with-ndbcluster \
--with-federated-storage-engine \
--with-csv-storage-engine \
--with-ssl \
--with-embedded-server \
--disable-shared

View File

@ -5,7 +5,7 @@
PATH=/opt/SUNWspro/bin/:/usr/ccs/bin:$PATH PATH=/opt/SUNWspro/bin/:/usr/ccs/bin:$PATH
make -k clean || true make -k maintainer-clean || true
/bin/rm -f */.deps/*.P config.cache /bin/rm -f */.deps/*.P config.cache
path=`dirname $0` path=`dirname $0`

View File

@ -31,7 +31,7 @@ do
shift shift
done done
make -k clean || true make -k maintainer-clean || true
/bin/rm -f */.deps/*.P config.cache /bin/rm -f */.deps/*.P config.cache
path=`dirname $0` path=`dirname $0`

View File

@ -72,7 +72,7 @@ X-CSetKey: <$CSETKEY>
$BH $BH
EOF EOF
bk changes -v -r+ bk changes -v -r+
bk cset -r+ -d bk rset -r+ -ah | bk gnupatch -h -dup -T
) > $BKROOT/BitKeeper/tmp/dev_public.txt ) > $BKROOT/BitKeeper/tmp/dev_public.txt
$SENDMAIL -t < $BKROOT/BitKeeper/tmp/dev_public.txt $SENDMAIL -t < $BKROOT/BitKeeper/tmp/dev_public.txt

View File

@ -114,6 +114,14 @@ IF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR
STRING(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG STRING(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG
${CMAKE_CXX_FLAGS_DEBUG}) ${CMAKE_CXX_FLAGS_DEBUG})
STRING(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELWITHDEBINFO
${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
STRING(REPLACE "/MD" "/MT" CMAKE_C_FLAGS_RELWITHDEBINFO
${CMAKE_C_FLAGS_RELWITHDEBINFO})
# generate .map files
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MAP /MAPINFO:EXPORTS")
# remove support for Exception handling # remove support for Exception handling
STRING(REPLACE "/GX" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) STRING(REPLACE "/GX" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
@ -131,10 +139,11 @@ ADD_SUBDIRECTORY(dbug)
ADD_SUBDIRECTORY(strings) ADD_SUBDIRECTORY(strings)
ADD_SUBDIRECTORY(regex) ADD_SUBDIRECTORY(regex)
ADD_SUBDIRECTORY(mysys) ADD_SUBDIRECTORY(mysys)
ADD_SUBDIRECTORY(scripts)
ADD_SUBDIRECTORY(zlib)
ADD_SUBDIRECTORY(extra/yassl) ADD_SUBDIRECTORY(extra/yassl)
ADD_SUBDIRECTORY(extra/yassl/taocrypt) ADD_SUBDIRECTORY(extra/yassl/taocrypt)
ADD_SUBDIRECTORY(extra) ADD_SUBDIRECTORY(extra)
ADD_SUBDIRECTORY(zlib)
ADD_SUBDIRECTORY(storage/heap) ADD_SUBDIRECTORY(storage/heap)
ADD_SUBDIRECTORY(storage/myisam) ADD_SUBDIRECTORY(storage/myisam)
ADD_SUBDIRECTORY(storage/myisammrg) ADD_SUBDIRECTORY(storage/myisammrg)

View File

@ -1,40 +1,5 @@
COPYING INSTALL-SOURCE
COPYING.LIB
INSTALL-BINARY INSTALL-BINARY
Makefile Makefile
Makefile.in Makefile.in
Manual-updates
before-gpl-changes-manual.texi
include.texi
manual-before-gpl.texi
manual-tmp.aux
manual-tmp.cp
manual-tmp.fn
manual-tmp.ky
manual-tmp.log
manual-tmp.pdf
manual-tmp.pg
manual-tmp.texi
manual-tmp.toc
manual-tmp.tp
manual-tmp.vr
manual.aux
manual.cp
manual.cps
manual.fn
manual.fns
manual.html
manual.ky
manual.log
manual.pdf
manual.pg
manual.toc
manual.tp
manual.txt
manual.vr
manual_a4.ps
manual_a4.ps.gz
manual_letter.ps
manual_letter.ps.gz
manual_toc.html
mysql.info mysql.info

View File

@ -1,101 +0,0 @@
\input texinfo @c -*-texinfo-*-
@c
@c *********************************************************
@c
@c This is a dummy placeholder file for internals.texi in the
@c MySQL source trees.
@c
@c Note, that the internals documentation has been moved into a separate
@c BitKeeper source tree named "mysqldoc" - do not attempt to edit this
@c file! All changes to internals.texi should be done in the mysqldoc tree.
@c
@c See http://www.mysql.com/doc/en/Installing_source_tree.html
@c for information about how to work with BitKeeper source trees.
@c
@c This dummy file is being replaced with the actual file from the
@c mysqldoc tree when building the official source distribution.
@c
@c Please e-mail docs@mysql.com for more information or if
@c you are interested in doing a translation.
@c
@c *********************************************************
@c
@c %**start of header
@setfilename internals.info
@c We want the types in the same index
@syncodeindex tp fn
@ifclear tex-debug
@c This removes the black squares in the right margin
@finalout
@end ifclear
@c Set background for HTML
@set _body_tags BGCOLOR=silver TEXT=#000000 LINK=#101090 VLINK=#7030B0
@c Set some style elements for the manual in HTML form. 'suggested'
@c natural language colors: aqua, black, blue, fuchsia, gray, green,
@c lime, maroon, navy, olive, purple, red, silver, teal, white, and
@c yellow. From Steeve Buehler <ahr@YogElements.com>
@set _extra_head <style> code {color:purple} tt {color:green} samp {color:navy} pre {color:maroon} </style>
@settitle Dummy MySQL internals documentation for version @value{mysql_version}.
@c We want single-sided heading format, with chapters on new pages. To
@c get double-sided format change 'on' below to 'odd'
@setchapternewpage on
@paragraphindent 0
@c %**end of header
@ifinfo
@format
START-INFO-DIR-ENTRY
* mysql: (mysql). MySQL documentation.
END-INFO-DIR-ENTRY
@end format
@end ifinfo
@titlepage
@sp 10
@center @titlefont{Empty placeholder for the MySQL Internals Documentation}
@sp 10
@center Copyright @copyright{} 1995-2003 MySQL AB
@c blank page after title page makes page 1 be a page front.
@c also makes the back of the title page blank.
@page
@end titlepage
@c This should be added. The HTML conversion also needs a MySQL version
@c number somewhere.
@iftex
@c change this to double if you want formatting for double-sided
@c printing
@headings single
@oddheading @thischapter @| @| @thispage
@evenheading @thispage @| @| MySQL Internal Reference for Version @value{mysql_version}
@end iftex
@node Top, (dir), (dir), (dir)
@ifinfo
This is an empty placeholder file for the MySQL internals documentation.
The real version of this file is now maintained in a separate BitKeeper
source tree! Please see
@url{http://www.mysql.com/doc/en/Installing_source_tree.html} for more info
on how to work with BitKeeper.
Please do not attempt to edit this file directly - use the one in the
@code{mysqldoc} BK tree instead.
This file will be replaced with the current @code{internals.texi} when
building the official source distribution.
@end ifinfo
@bye

View File

@ -1,3 +1,5 @@
[Note this information is obsolete]
Notes on compiling glibc for the standard MySQL binary: Notes on compiling glibc for the standard MySQL binary:
- make sure you have gcc 2.95 and gmake 3.79 or newer - make sure you have gcc 2.95 and gmake 3.79 or newer

View File

@ -1,140 +0,0 @@
Functions i mysys: (For flags se my_sys.h)
int my_copy _A((const char *from,const char *to,myf MyFlags));
- Copy file
int my_delete _A((const char *name,myf MyFlags));
- Delete file
int my_getwd _A((string buf,uint size,myf MyFlags));
int my_setwd _A((const char *dir,myf MyFlags));
- Get and set working directory
string my_tempnam _A((const char *pfx,myf MyFlags));
- Make a uniq temp file name by using dir and adding something after
pfx to make name uniq. Name is made by adding a uniq 6 length-string
and TMP_EXT after pfx.
Returns pointer to malloced area for filename. Should be freed by
free().
File my_open _A((const char *FileName,int Flags,myf MyFlags));
File my_create _A((const char *FileName,int CreateFlags,
int AccsesFlags, myf MyFlags));
int my_close _A((File Filedes,myf MyFlags));
uint my_read _A((File Filedes,byte *Buffer,uint Count,myf MyFlags));
uint my_write _A((File Filedes,const byte *Buffer,uint Count,
myf MyFlags));
ulong my_seek _A((File fd,ulong pos,int whence,myf MyFlags));
ulong my_tell _A((File fd,myf MyFlags));
- Use instead of open,open-with-create-flag, close read and write
to get automatic error-messages (flag: MYF_WME) and only have
to test for != 0 if error (flag: MY_NABP).
int my_rename _A((const char *from,const char *to,myf MyFlags));
- Rename file
FILE *my_fopen _A((const char *FileName,int Flags,myf MyFlags));
FILE *my_fdopen _A((File Filedes,int Flags,myf MyFlags));
int my_fclose _A((FILE *fd,myf MyFlags));
uint my_fread _A((FILE *stream,byte *Buffer,uint Count,myf MyFlags));
uint my_fwrite _A((FILE *stream,const byte *Buffer,uint Count,
myf MyFlags));
ulong my_fseek _A((FILE *stream,ulong pos,int whence,myf MyFlags));
ulong my_ftell _A((FILE *stream,myf MyFlags));
- Same read-interface for streams as for files
gptr _mymalloc _A((uint uSize,const char *sFile,
uint uLine, myf MyFlag));
gptr _myrealloc _A((string pPtr,uint uSize,const char *sFile,
uint uLine, myf MyFlag));
void _myfree _A((gptr pPtr,const char *sFile,uint uLine));
int _sanity _A((const char *sFile,unsigned int uLine));
gptr _myget_copy_of_memory _A((const byte *from,uint length,
const char *sFile, uint uLine,
myf MyFlag));
- malloc(size,myflag) is mapped to this functions if not compiled
with -DSAFEMALLOC
void TERMINATE _A((void));
- Writes malloc-info on stdout if compiled with -DSAFEMALLOC.
int my_chsize _A((File fd,ulong newlength,myf MyFlags));
- Change size of file
void my_error _D((int nr,myf MyFlags, ...));
- Writes message using error number (se mysys/errors.h) on
stdout or curses if MYSYS_PROGRAM_USES_CURSES() is called.
void my_message _A((const char *str,myf MyFlags));
- Writes message-string on
stdout or curses if MYSYS_PROGRAM_USES_CURSES() is called.
void my_init _A((void ));
- Start each program (in main) with this.
void my_end _A((int infoflag));
- Gives info about program.
- If infoflag & MY_CHECK_ERROR prints if some files are left open
- If infoflag & MY_GIVE_INFO prints timing info and malloc info
about prog.
int my_redel _A((const char *from, const char *to, int MyFlags));
- Delete from before rename of to to from. Copyes state from old
file to new file. If MY_COPY_TIME is set sets old time.
int my_copystat _A((const char *from, const char *to, int MyFlags));
- Copye state from old file to new file.
If MY_COPY_TIME is set sets copy also time.
string my_filename _A((File fd));
- Give filename of open file.
int dirname _A((string to,const char *name));
- Copy name of directory from filename.
int test_if_hard_path _A((const char *dir_name));
- Test if dirname is a hard path (Starts from root)
void convert_dirname _A((string name));
- Convert dirname acording to system.
- In MSDOS changes all caracters to capitals and changes '/' to
'\'
string fn_ext _A((const char *name));
- Returns pointer to extension in filename
string fn_format _A((string to,const char *name,const char *dsk,
const char *form,int flag));
format a filename with replace of library and extension and
converts between different systems.
params to and name may be identicall
function dosn't change name if name != to
Flag may be: 1 force replace filnames library with 'dsk'
2 force replace extension with 'form' */
4 force Unpack filename (replace ~ with home)
8 Pack filename as short as possibly for output to
user.
All open requests should allways use at least:
"open(fn_format(temp_buffe,name,"","",4),...)" to unpack home and
convert filename to system-form.
string fn_same _A((string toname,const char *name,int flag));
- Copys directory and extension from name to toname if neaded.
copy can be forced by same flags that in fn_format.
int wild_compare _A((const char *str,const char *wildstr));
- Compare if str matches wildstr. Wildstr can contain "*" and "?"
as match-characters.
Returns 0 if match.
void get_date _A((string to,int timeflag));
- Get current date in a form ready for printing.
void soundex _A((string out_pntr, string in_pntr))
- Makes in_pntr to a 5 chars long string. All words that sounds
alike have the same string.
int init_key_cache _A((ulong use_mem,ulong leave_this_much_mem));
- Use cacheing of keys in MISAM, PISAM, and ISAM.
KEY_CACHE_SIZE is a good size.
- Remember to lock databases for optimal cacheing
void end_key_cache _A((void));
- End key-cacheing.

View File

@ -1,943 +0,0 @@
MySQL Client/Server Protocol Documentation
Introduction
------------
This paper has the objective of presenting a through description
of the client/server protocol that is embodied in MySQL. Particularly,
this paper aims to document and describe:
- manner in which MySQL server detects client connection requests and
creates connection
- manner in which MySQL client C API call connects to server - the
entire protocol of sending/receiving data by MySQL server and C API
code
- manner in which queries are sent by client C API calls to server
- manner in which query results are sent by server
- manner in which query results are resolved by server
- sending and receiving of error messages
This paper does not have the goal or describing nor documenting other
related MySQL issues, like usage of thread libraries, MySQL standard
library set, MySQL strings library and other MySQL specific libraries,
type definitions and utilities.
Issues that are covered by this paper are contained in the following
source code files:
- libmysql/net.c and sql/net_serv.cc, the two being identical
- client/libmysql.c (not entire file is covered)
- include/mysql_com.h
- include/mysql.h
- sql/mysqld.cc (not entire file is covered)
- sql/net_pkg.cc
- sql/sql_base.cc (not entire file is covered)
- sql/sql_select.cc (not entire file is covered)
- sql/sql_parse.cc (not entire file is covered)
Note: libmysql/net.c was client/net.c prior to MySQL 3.23.11.
sql/net_serv.cc was sql/net_serv.c prior to MySQL 3.23.16.
Beside this introduction this paper presents basic definitions,
constants, structures and global variables, all related functions in
server and in C API. Textual description of the entire protocol
functioning is described in the last chapter of this paper.
Constants, structures and global variables
------------------------------------------
This chapter will describe all constants, structures and
global variables relevant to client/server protocol.
Constants
They are important as they contain default values, the ones
that are valid if options are not set in any other way. Beside that
MySQL source code does not contain a single non-defined constant in
its code. This description of constants does not include
configuration and conditional compilation #defines.
NAME_LEN - field and table name length, current value 64
HOSTNAME_LENGTH - length of the hostname, current value 64
USERNAME_LENGTH - username length, current value 16
MYSQL_PORT - default TCP/IP port number, current value 3306
MYSQL_UNIX_ADDR - full path of the default Unix socket file, current value
"/tmp/mysql.sock"
MYSQL_NAMEDPIPE - full path of the default NT pipe file, current value
"MySQL"
MYSQL_SERVICENAME - name of the MySQL Service on NT, current value "MySQL"
NET_HEADER_SIZE - size of the network header, when no
compression is used, current value 4
COMP_HEADER_SIZE - additional size of network header when
compression is used, current value 3
What follows are set of constants, defined in source only, which
define capabilities of the client built with that version of C
API. Simply, when some new feature is added in client, that client
feature is defined, so that server can detect what capabilities a
client program has.
CLIENT_LONG_PASSWORD - client supports new more secure passwords
CLIENT_LONG_FLAG - client uses longer flags
CLIENT_CONNECT_WITH_DB - client can specify db on connect
CLIENT_COMPRESS - client can use compression protocol
CLIENT_ODBC - ODBC client
CLIENT_LOCAL_FILES - client can use LOAD DATA INFILE LOCAL
CLIENT_IGNORE_SPACE - client can ignore spaces before '('
CLIENT_CHANGE_USER - client supports the mysql_change_user()
What follows are other constants, pertaining to timeouts and sizes
MYSQL_ERRMSG_SIZE - maximum size of error message string, current value 200
NET_READ_TIMEOUT - read timeout, current value 30 seconds
NET_WRITE_TIMEOUT - write timeout, current value 60 seconds
NET_WAIT_TIMEOUT - wait for new query timeout, current value 8*60*60
seconds, that is, 8 hours
packet_error - value returned in case of socket errors, current
value -1
TES_BLOCKING - used in debug mode for setting up blocking testing
RETRY COUNT - number of times network read and write will be
retried, current value 1
There are also error messages for last_errno, which depict system
errors, and are used on the server only.
ER_NET_PACKAGE_TOO_LARGE - packet is larger than max_allowed_packet
ER_OUT_OF_RESOURCES - practically no more memory
ER_NET_ERROR_ON_WRITE - error in writing to NT Named Pipe
ER_NET_WRITE_INTERRUPTED - some signal or interrupt happened
during write
ER_NET_READ_ERROR_FROM_PIPE - error in reading from NT Named Pipe
ER_NET_FCNTL_ERROR - error in trying to set fcntl on socket
descriptor
ER_NET_PACKETS_OUT_OF_ORDER - packet numbers on client and
server side differ
ER_NET_UNCOMPRESS_ERROR - error in uncompress of compressed packet
Structs and enums
struct NET
This is MySQL's network handle structure, used in all client/server
read/write functions. On the server, it is initialized and preserved
in each thread. On the client, it is a part of the MYSQL struct,
which is the MySQL handle used in all C API functions. This structure
uniquely identifies a connection, either on the server or client
side. It consists of the following fields:
Vio* vio - explained above
HANDLE hPipe - Handle for NT Named Pipe file
my_socket fd - file descriptor used for both TCP/IP socket and
Unix socket file
int fcntl - contains info on fcntl options used on fd. Mostly
used for saving info if blocking is used or not
unsigned char *buff - network buffer used for storing data for
reading from/writing to socket
unsigned char,*buff_end - points to the end of buff
unsigned char *write_pos - present writing position in buff
unsigned char *read_pos - present reading position in buff. This
pointer is used for reading data after
calling my_net_read function and function
that are just its wrappers
char last_error[MYSQL_ERRMSG_SIZE] - holds last error message
unsigned int last_errno - holds last error code of the network
protocol. Its possible values are listed
in above constants. It is used only on
the server side
unsigned int max_packet - holds current value of buff size
unsigned int timeout - stores read timeout value for that connection
unsigned int pkt_nr - stores the value of the current packet number in
a batch of packets. Used primarily for
detection of protocol errors resulting in a
mismatch
my_bool error - holds either 1 or 0 depending on the error condition
my_bool return_errno - if its value != 0 then there is an error in
protocol mismatch between client and server
my_bool compress - if true compression is used in the protocol
unsigned long remain_in_buf - used only in reading compressed packets.
Explained in my_net_read
unsigned long length - used only for storing the length of the read
packet. Explained in my_net_read
unsigned long buf_length - used only in reading compressed packets.
Explained in my_net_read
unsigned long where_b - used only in reading compressed packets.
Explained in my_net_read
short int more - used for reporting in mysql_list_processes
char save_char - used in reading compressed packets for saving chars
in order to make zero-delimited strings. Explained
in my_net_read
A few typedefs will be defined for easier understanding of the text that
follows.
typedef char **MYSQL_ROW - data containing one row of values
typedef unsigned int MYSQL_FIELD_OFFSET - offset in bytes of the current field
typedef MYSQL_ROWS *MYSQL_ROW_OFFSET - offset in bytes of the current row
struct MYSQL_FIELD - contains all info on the attributes of a
specific column in a result set, plus info on lengths of the column in
a result set. This struct is tagged as st_mysql_field. This structure
consists of the following fields:
char *name - name of column
char *table - table of column if column was a field and not
an expression or constant
char *def - default value (set by mysql_list_fields)
enum enum_field_types type - see above
unsigned int length - width of column in the current row
unsigned int max_length - maximum width of that column in entire
result set
unsigned int flags - corresponding to Extra in DESCRIBE
unsigned int decimals - number of decimals in field
struct MYSQL_ROWS - a node for each row in the single linked
list forming entire result set. This struct is tagged as
st_mysql_rows, and has two fields:
struct st_mysql_rows *next - pointer to the next one
MYSQL_ROW data - see above
struct MYSQL_DATA - contains all rows from result set. It is
tagged as st_mysql_data and has following fields:
my_ulonglong rows - how many rows
unsigned int fields - how many columns
MYSQL_ROWS *data - see above. This is the first node of the linked list
MEM_ROOT alloc - MEM_ROOT is MySQL memory allocation structure, and
this field is used to store all fields and rows.
struct st_mysql_options - holds various client options, and
contains following fields:
unsigned int connect_timeout - time in seconds for connection
unsigned int client_flag - used to hold client capabilities
my_bool compress - boolean for compression
my_bool named_pipe - is Named Pipe used? (on NT)
unsigned int port - what TCP port is used
char *host - host to connect to
char *init_command - command to be executed upon connection
char *user - account name on MySQL server
char *password - password for the above
char *unix_socket - full path for Unix socket file
char *db - default database
char *my_cnf_file - optional configuration file
char *my_cnf_group - optional header for options
struct MYSQL - MySQL client's handle. Required for any
operation issued from client to server. Tagged as st_mysql and having
following fields:
NET net - see above
char *host - host on which MySQL server is running
char *user - MySQL username
char *passwd - password for above
char *unix_socket- full path of Unix socket file
char *server_version - version of the server
char *host_info - contains info on how has connection been
established, TCP port, socket or Named Pipe
char *info - used to store information on the query results,
like number of rows affected etc.
char *db - current database
unsigned int port - TCP port in use
unsigned int client_flag - client capabilities
unsigned int server_capabilities - server capabilities
unsigned int protocol_version - version of the protocol
unsigned int field_count - used for storing number of fields
immediately upon execution of a query,
but before fetching rows
unsigned long thread_id - server thread to which this connection
is attached
my_ulonglong affected_rows - used for storing number of rows
immediately upon execution of a query,
but before fetching rows
my_ulonglong insert_id - fetching LAST_INSERT_ID() through client C API
my_ulonglong extra_info - used by mysqlshow
unsigned long packet_length - saving size of the first packet upon
execution of a query
enum mysql_status status - see above
MYSQL_FIELD *fields - see above
MEM_ROOT field_alloc - memory used for storing previous field (fields)
my_bool free_me - boolean that flags if MYSQL was allocated in mysql_init
my_bool reconnect - used to automatically reconnect
struct st_mysql_options options - see above
char scramble_buff[9] - key for scrambling password before sending it
to server
struct MYSQL_RES - tagged as st_mysql_res and used to store
entire result set from a single query. Contains following fields:
my_ulonglong row_count - number of rows
unsigned int field_count - number of columns
unsigned int current_field - cursor for fetching fields
MYSQL_FIELD *fields - see above
MYSQL_DATA *data - see above, and used in buffered reads, that is,
mysql_store_result only
MYSQL_ROWS *data_cursor - pointing to the field of above "data"
MEM_ROOT field_alloc - memory allocation for above "fields"
MYSQL_ROW row - used for storing row by row in unbuffered reads,
that is, in mysql_use_result
MYSQL_ROW current_row - cursor to the current row for buffered reads
unsigned long *lengths - column lengths of current row
MYSQL *handle - see above, used in unbuffered reads, that is, in
mysql_use_result
my_bool eof - used by mysql_fetch_row as a marker for end of data
Global variables
unsigned long max_allowed_packet - maximum allowable value of network
buffer. Default value - 1MB
unsigned long net_buffer_length - default, starting value of network
buffer - 8KB
unsigned long bytes_sent - total number of bytes written since startup
of the server
unsigned long bytes_received - total number of bytes read since startup
of the server
Synopsis of the basic client/server protocol
--------------------------------------------
Purpose of this chapter is to provide a complete picture of
the basic client/server protocol implemented in MySQL. It was felt
it is necessary after writing descriptions for all of the functions
involved in basic protocol. There are at present 11 functions
involved, with several structures, many constants etc, which are all
described in detail. But as a forest could not be seen from the trees,
so the concept of the protocol could not be deciphered easily from a
thorough documentation of minutiae.
Although the concept of the protocol was not changed with the
introduction of vio system, embodied in violate.cc source file and VIO
system, the introduction of these has changed the code substantially. Before
VIO was introduced, functions for reading from/writing to network
connection had to deal with various network standards. So, these functions
depended on whether TCP port or Unix socket file or NT Named Pipe file is
used. This is all changed now and single vio_ functions are called, while
all this diversity is covered by vio_ functions.
In MySQL a specific buffered network input/output transport model
has been implemented. Although each operating system may have its
own buffering for network connections, MySQL has added its own
buffering model. This same for each of the three transport protocol
types that are used in MySQL client/server communications, which
are TCP/IP sockets (on all systems), Unix socket files on Unix and
Unix-like operating systems and Named Pipe files on NT. Although
TCP/IP sockets are omnipresent, the latter two types have been added
for local connections. Those two connection types can be used in
local mode only, that is, when both client and server reside on the
same host, and are introduced because they enable better speeds for
local connections. This is especially useful for WWW type of
applications. Startup options of MySQL server allow that either
TCP/IP sockets or local connection (OS dependent) can be disallowed.
In order to implement buffered input/output, MySQL allocates a
buffer. The starting size of this buffer is determined by the value
of the global variable net_buffer_length, which can be changed at
MySQL server startup. This is, as explained, only the startup length
of MySQL network buffer. Because a single item that has to be read
or written can be larger than that value, MySQL will increase buffer
size as long as that size reaches value of the global variable
max_allowed_packet, which is also settable at server startup. Maximum
value of this variable is limited by the way MySQL stores/reads
sizes of packets to be sent/read, which means by the way MySQL
formats packages.
Basically each packet consists of two parts, a header and data. In
the case when compression is not used, header consists of 4 bytes
of which 3 contain the length of the packet to be sent and one holds
the packet number. When compression is used there are onother 3
bytes which store the size of uncompressed data. Because of the way
MySQL packs length into 3 bytes, plus due to the usage of some
special values in the most significant byte, maximum size of
max_allowed_packet is limited to 24MB at present. So, if compression
is not used, at first 4 bytes are written to the buffer and then
data itself. As MySQL buffers I/O logical packets are packet together
until packets fill up entire size of the buffer. That size no less
than net_buffer_size, but no greater than max_allowed_packet. So,
actual writing to the network is done when this buffer is filled
up. As frequently sequence of buffers make a logical unit, like a
result set, then at the end of sending data, even if buffer is not
full, data is written (flushed to the connection) with a call of
the net_flush function. So that no single packet can be larger than
this value, checks are made throughout the code to make sure that
no single field or command could exceed that value.
In order to maintain coherency in consecutive packets, each packet
is numbered and their number stored as a part of a header, as
explained above. Packets start with 0, so whenever a logical packet
is written, that number is incremented. On the other side when
packets are read, value that is fetched is compared with the value
stored and if there is no mismatch that value is incremented, too.
Packet number is reset on the client side when unwanted connections
are removed from the connection and on the server side when a new
command has been started.
So, before writing, the buffer contains a sequence of logical
packets, consisting of header plus data consecutively. If compression
is used, packet numbers are not stored in each header of the logical
packets, but a whole buffer, or a part of it if flushing is done,
containing one or more logical packets are compressed. In that case
a new larger header, is formed, and all logical packets contained
in the buffer are compressed together. This way only one packet is
formed which makes several logical packets, which improves both
speed and compression ratio. On the other side, when this large
compressed packet is read, it is first uncompressed, and then logical
packets are sent, one by one, to the calling functions.
All this functionality is described in detail in the following
chapter. It does not contain functions that form logical packets, or
that read and write to connections but also functions that are used
for initialization, clearing of connections. There are functions at
higher level dealing with sending fields, rows, establishing
connections, sending commands, but those are not explained in the
following chapter.
Functions utilized in client/server protocol
--------------------------------------------
First of all, functions are described that are involved in preparing,
reading, or writing data over TCP port, Unix socket file, or named
pipe, and functions directly related to those. All of these functions
are used both in server and client. Server and client specific code
segments are documented in each function description.
Each MySQL function checks for errors in memory allocation and
freeing, as well as in every OS call, like the one dealing with
files and sockets, and for errors in indigenous MySQL function
calls. This is expected, but has to be said here so as not to repeat
it in every function description.
Older versions of MySQL have utilized the following macros for
reading from or writing to a socket.
raw_net_read - calls OS function recv function that reads N bytes
from a socket into a buffer. Number of bytes read is returned.
raw_net_write - calls OS function send to write N bytes from a
buffer to socket. Number of bytes written is returned.
These macros are replaced with VIO (Virtual I/O) functions.
Function name: my_net_init
Parameters: struct NET *, enum_net_type, struct Vio
Return value: 1 for error, 0 for success
Function purpose: To initialize properly all NET fields,
allocate memory and set socket options
Function description
First of all, buff field of NET struct is allocated to the size of
net_buffer_length, and on failure function exits with 0. All fields
in NET are set to their default or starting values. As net_buffer_length
and max_allowed_packet are configurable, max_allowed_packet is set
equal to net_buffer_length if the latter one is greater. max_packet
is set for that NET to net_buffer_length, and buff_end points to
buff end. vio field is set to the second parameter. If it is a
real connection, which is the case when second parameter is not
null, then fd field is set by calling vio_fd function. read_pos and
write_pos to buff, while remaining integers are set to 0. If function
is run on the MySQL server on Unix and server is started in a test
mode that would require testing of blocking, then vio_blocking
function is called. Last, fast throughput mode is set by a call to
vio_fastsend function.
Function name: net_end
Parameters: struct NET *
Return value: void
Function purpose: To release memory allocated to buff
Function name: net_realloc (private, static function)
Parameters: struct NET, ulong (unsigned long)
Return value: 1 for error, 0 for success
Function purpose: To change memory allocated to buff
Function description
New length of buff field of NET struct is passed as second parameter.
It is first checked versus max_allowed_packet and if greater, an
error is returned. New length is aligned to 4096-byte boundary. Then,
buff is reallocated, buff_end, max_packet, and write_pas reset to
the same values as in my_net_init.
Function name: net_clear (used on client side only)
Parameters: struct NET *
Return value: void
Function purpose: To read unread packets
Function description
This function is used on client side only, and is executed
only if a program is not started in test mode. This function reads
unread packets without processing them. First, non-blocking mode is
set on systems that do not have non-blocking mode defined. This is
performed by checking the mode with vio_is_blocking function. and
setting non-blocking mode by vio_blocking function. If this operation
was successful, then packets are read by vio_read function, to which
vio field of NET is passed together with buff and max_packet field
values. field of the same struct at a length of max_packet. If
blocking was active before reading is performed, blocking is set with
vio_blocking function. After reading has been performed, pkt_nr is
reset to 0 and write_pos reset to buff. In order to clarify some
matters non-blocking mode enables executing program to dissociate from
a connection, so that error in connection would not hang entire
program or its thread.
Function name: net_flush
Parameters: struct NET *
Return value: 1 for error, 0 for success
Function purpose: To write remaining bytes in buff to socket
Function description
net_real_write (described below) is performed is write_pos
differs from buff, both being fields of the only parameter. write_pos
is reset to buff. This function has to be used, as MySQL uses buffered
writes (as will be explained more in the function net_write_buff).
Function name: my_net_write
Parameters: struct NET *, const char *, ulong
Return value: 1 for error, 0 for success
Function purpose: Write a logical packet in the second parameter
of third parameter length
Function description
The purpose of this function is to prepare a logical packet such
that entire content of data, pointed to by second parameter and in
length of third parameter is sent to the other side. In case of
server, it is used for sending result sets, and in case of client
it is used for sending local data. This function foremost prepares
a header for the packet. Normally, the header consists of 4 bytes,
of which the first 3 bytes contain the length of the packet, thereby
limiting a maximum allowable length of a packet to 16MB, while the
fourth byte contains the packet number, which is used when one large
packet has to be divided into sequence of packets. This way each
sub-packet gets its number which should be matched on the other
side. When compression is used another three bytes are added to
packet header, thus packet header is in that case increased to 7
bytes. Additional three bytes are used to save the length of
compressed data. As in connection that uses compression option,
code packs packets together,, a header prepared by this function
is later not used in writing to / reading from network, but only
to distinguish logical packets within a buffered read operation.
This function, first stores the value of the third parameter into the
first 3 bytes of local char variable of NET_HEADER_SIZE size by usage
of function int3store. Then, at this point, if compression is not
used, pkt_nr is increased, and its value stored in the last byte of
the said local char[] variable. If compression is used, 0 is stored in
both values. Then those four bytes are sent to other side by the usage
of the function net_write_buff(to be explained later on), and if
successful, entire packet in second parameter of the length described
in third parameter is sent by the usage of the same function.
Function name: net_write_command
Parameters: struct NET *, char, const char *, ulong
Return value: 1 for error, 0 for success
Function purpose: Send a command with a packet as in previous function
Function description
This function is very similar to the previous one. The only
difference is that first packet is enlarged by one byte, so that the
command precedes the packet to be sent. This is implemented by
increasing first packet by one byte, which contains a command code. As
command codes do not use the range of values that are used by character
sets, so when the other side receives a packet, first byte after
header contains a command code. This function is used by client for
sending all commands and queries, and by server in connection process
and for sending errors.
Function name: net_write_buff (private, static function)
Parameters: struct NET *, const char *, uint
Return value: 1 for error, 0 for success
Function purpose: To write a packet of any size by cutting it
and using next function for writing it
Function description
This function was created after compression feature has been
added to MySQL. This function supposes that packets have already been
properly formatted, regarding packet header etc. The principal reason for
this function to exist is because a packet that is sent by client or
server does not have to be less than max_packet. So this function
first calculates how much data has been left in a buff, by getting a
difference between buff_end and write_pos and storing it to local
variable left_length. Then a loop is run as long as the length to be
sent is greater than length of left bytes (left_length). In a loop
data from second parameter is copied to buff at write_pos, as much as
it can be, that is, by left_length. Then net_real_write function is called
(see below) with NET, buff, and max_packet parameters. This function
is the lowest level function that writes data over established
connection. In the loop, write_pos is reset to buff, the pointer to data
(second parameter) is moved by the amount of data sent (left_length),
length of data to be sent (third parameter) is decreased by the amount
sent (left_length) and left_length is reset to max_packet value, which
ends the loop. This logic was necessary, as there could have been some
data yet unsent (write_pos != buf), while data to be sent could be as
large as necessary, thus requiring many loops. At the end of function,
remaining data in second parameter are copied to buff at write_pos, by
the remaining length of data to be sent (third parameter). So, in the
next call of this function remaining data will be sent, as buff is
used in the call to net_real_write. It is very important to note that if
a packet to be sent is less than the number of bytes that are still
available in buff, then there will be no writing over network, but
only logical packets will be added one after another. This will
accelerate network traffic, plus if compression is used, the
expected compression rate would be higher. That is why server or
client functions that sends data uses at the end of data net_flush
function described above.
Function name: net_real_write
Parameters: struct NET *, const char *, ulong
Return value: 1 for error, 0 for success
Function purpose: To write data to a socket or pipe, with
compression if used
Function description
First, more field is set to 2, to enable reporting in
mysql_list_processes. Then if compression is enabled on that
connection, a new local buffer (variable b) is initialized to the
length of total header (normal header + compression header) and if no
memory is available, an error is returned. This buffer (b) is used for
holding the final, compressed packet to be written over the
connection. Furthermore in compression initialization, second
parameter at length of third parameter is copied to the local buffer
b, and MySQL's wrapped zlib's compression function is run at total
header offset of the local buffer. Please, do note that this function
does not test effectiveness of compression. If compression is turned
on in some connection, it is used all of the time. Also, it is very
important to be cognizant of the fact that this algorithm makes
possible that a single compressed packet contains several logical
packets. In this way compression rate is increased and network
throughput is increased as well. However, this algorithm has
consequences on the other side, that reads compressed packet, which
is covered in my_net_read function. After compression is done, the full
compression header is properly formed with the packet number,
compressed and uncompressed lengths. At the end of compression code,
third parameter is increased by total header length, as the original
header is not used (see above), and second parameter, pointer to data,
is set to point to local buffer b, in order that the further flow of
function is independent of compression. If a function is executed
on server side, a thread alarm initialized and if non-blocking is
active set at NET_WRITE_TIMEOUT. Two local (char *) pointers are
initialized, pos at beginning of second parameter, and end at end of
data. Then the loop is run as long as all data is written, which means
as long as pos != end. First vio_write function is called, with
parameters of vio field, pos and size of data (end - pos). Number of
bytes written over connection is saved in local variable (length). If
error is returned local bool variable (interrupted) is set according
to the return value of the vio_should_retry called with vio field as
parameter. This bool variable indicates whether writing was
interrupted in some way or not.
Further, error from vio_write is treated differently on Unix versus
other OS's (Win32 or OS/2). On Unix an alarm is set if one is not
in use, no bytes have been written and there has been no interruption.
Also, in that case, if connection is not in blocking mode, a sub-loop
is run as long as blocking is not set with vio_blocking function.
Within the loop another run of above vio_write is run based on
return value of vio_is_retry function, provided number of repeated
writes is less than RETRY_COUNT. If that is not the case, error
field of struct NET is set to 1 and function exits. At the exit
of sub-loop number of reruns already executed is reset to zero and
another run of above vio_write function is attempted. If the function
is run on Win32 and OS/2, and in the case that function flow was
not interrupted and thread alarm is not in use, again the main loop
is continued until pos != end. In the case that this function is
executed on thread safe client program, a communication flow is
tested on EINTR, caused by context switching, by use of vio_errno
function, in which case the loop is continued. At the end of
processing of the error from vio_write, error field of struct NET
is set, and if on server last_errno field is set to
ER_NET_WRITE_INTERRUPTED in the case that local bool variable
(interrupted) is true or to ER_NET_ERROR_ON_WRITE. Before the end
of loop, in order to make possible evaluation of the loop condition,
pos is increased by the value written in last iteration (length).
Also global variable bytes_sent is increased by the same value, for
status purposes. At the end of the functions more fields is reset,
in case of compression, compression buffer (b) memory is released
and if thread is still in use, it is ended and blocking state is
reset to its original state, and function returns error is all bytes
are not written.
Function name: my_real_read (private, static function)
Parameters: struct NET *, ulong *
Return value: length of bytes read
Function purpose: low level network connection read function
Function description
This function has made as a separate one when compression was
introduced in MySQL client/server protocol . It contains basic, low
level network reading functionality, while all dealings with
compressed packets are handled in next function. Compression in this
function is only handled in as much to unfold the length of uncompressed
data. First blocking state of connection is saved in local bool
variable net_blocking, and field more is set 1 for detailed reporting
in mysqld_list_processes. A new thread alarm is initialized, in order
to enable read timeout handling, and if on server and a connection can
block a program, the alarm is set at a value of timeout field. Local
pointer is set to the position of the next logical packet, with its
header skipped, which is at field where_b offset from buff. Next, a
two time run code is entered. A loop is run exactly two times because
first time number of bytes to be fetched (remain) are set to the
header size, which is different when compression is used or not used
on the connection. After first fetch has been done, number of packets
that will be received in second iteration is well known, as fetched
header contains the size of packet, packet number, and in the case of
compression, the size of the uncompressed packet. Then, as long as there are
bytes to read the loop is entered with first reading data from network
connection with vio_read function, called with parameters of field
vio, current position and remaining number of bytes, which value is
hold by local variable (remain) initialized at the value of header size,
which differs if compression is used. Number of bytes read are
returned in local length variable. If error is returned local bool
variable (interrupted) is set according to the return value of the
vio_should_retry called with vio field as parameter. This bool
variable indicates whether reading was interrupted in some way or not.
Further, error from vio_read is treated differently on Unix versus
other OS's (Win32 or OS/2). On Unix an alarm is set if one is not
in use, no bytes have been read and there has been no interruption.
Also, in that case, if connection is not in blocking mode, a sub-loop
is run as long as blocking is not set with vio_blocking function.
Within the loop another run of above vio_read is run based on return
value of vio_is_retry function, provided number of repeated writes
is less than RETRY_COUNT. If that is not the case, error field of
struct NET is set to 1 and function exits. At the exit of sub-loop
number of reruns already executed is reset to zero and another run
of above vio_read function is attempted. If the function is run on
Win32 and OS/2, and in the case that function flow was not interrupted
and thread alarm is not in use, again the main loop is continued
as long as there are bytes remaining. In the case that this function
is executed on thread safe client program, then if another run
should be made, which is decided by the output of vio_should_retry
function, in which case the loop is continued. At the end of
processing of the error from vio_read, error field of struct NET
is set, and if on server last_errno field is set to ER_NET_READ_INTERRUPTED
in the case that local bool variable (interrupted) is true or to
ER_NET_ERROR_ON_READ. In case of such an error this function exits
and returns error. In the case when there is no error, number of
remaining bytes (remain) is decreased by the number of bytes read,
which should be zero, but in case it is not the entire code is still
in while (remain > 0) loop, which will be exited immediately if it
is. This has been done to accommodate errors in the traffic level
and for the very slow connections. Current position in field buff
is also moved by the amount of bytes read by vio_read function, and
global variable bytes_received is increased by the same value in a
thread safe manner. When the loop that is run until necessary bytes
are read (remain) is finished, then if external loop is in its first
run, of the two, packet sequencing is tested for consistency by
comparing the number contained at 4th byte in header with pkt_nr
field. Header location is found at where_b offset to field_b. Usage
of where_b is obligatory due to the possible compression usage. If
there is no compression on a connection, then where_b is always 0.
If there is a discrepancy, then first byte of the header is checked
whether it is equal to 255, because when error is sent by the server,
or by a client if it is sending data (like in LOAD DATA INFILE
LOCAL...), then first byte in header is set to 255. If it is not
255, then an error on packets being out of order is printed. In any
case, on server, last_errno field is set to ER_NET_PACKETS_OUT_OF_ORDER
and the function returns with an error, that is, the value returned is
packet_error. If a check on serial number of packet is successful,
pkt_nr field is incremented in order to enable checking packet order
with next packet and if compression is used, uncompressed length
is extracted from a proper position in header and returned in the
second parameter of this function. Length of the packet is saved,
for the purpose of a proper return value from this function. Still
in the first iteration of the main loop, a check must be made if
field buff could accommodate entire package that comes, in its
compressed or uncompressed form. This is done in such a way, because
zlib's compress and uncompress functions use the same memory area
for compression and uncompression. Necessary field buff length is
equal to current offset where data are (where_b which is zero for
non-compression), plus the larger value of compressed or uncompressed
package to be read in a second run. If this value is larger than
the current length of field buff, which is read from field max_packet,
then field buff has to be reallocated. If reallocation with net_realloc
function fails, the function returns an error. Before a second
loop is started, length to be read is set to the length of expected
data and current position (pos) is set at where_b offset from field
buff. At the end of function, if alarm is set, which is the case
if it is run on server or on a client if a function is interrupted
and another run of vio_read is attempted, alarm is ended and blocking
state is restored from the saved local bool variable net_blocking.
Function returns number of bytes read or the error (packet_error).
Function name: my_net_read
Parameters: struct NET *
Return value: length of bytes read
Function purpose: Highest level general purpose reading function
Function description
First, if compression is not used, my_real_read is called, with
struct NET * a first parameter, and pointer to local ulong complen
as a second parameter, but its value is not used here. Number of
bytes read is returned in local ulong variable len. read_pos field
is set to an offset of value of where_b field from field buff.
where_b field actually denotes where in field buff is the current
packet. If returned number of bytes read (local variable len) does
not signal that an error in packet transmission occurred (that is,
it is not set to packet_error), then the string contained in read_pos
is zero terminated. Simply, the end of the string starting at
read_pos, and ending at read_pos + len, is set to zero. This is
done in that way, because mysql_use_result expects a zero terminated
string, and function returns with a value local variable len. This
ends this function in the case that compression is not used and the
remaining code is executed only if compression is enabled on the
connection.
In order to explain how a compressed packet logically is cut into
meningful packets, the full meaning of several NET fields should
be explained. First of all, fields in NET are used and not local
variables, as all values should be saved between consecutive calls
of this function. Simply, this function is called in order to return
logical packets, but this function does not need to call my_real_read
function everytime, because when a large packet is uncompressed,
it may, but not necessarily so, contain several logical packets.
Therefore, in order to preserve data on logical packets local
variables are not used. Instead fields in NET struct are used. Field
remain_in_buf denotes how many bytes of entire uncompressed packets
is still contained within buff. field buf_length saves the value
of the length of entire uncompressed packet. field save_char is
used to save the character at the position where the packet ends,
which character has to be replaced with a zero, '\0', in order to
make a logical packet zero delimited, for mysql_use_result. Field
length stores the value of the length of compressed packet. Field
read_pos as usual, points to the current reading position. This
char * pointer is used by all functions that call this function in
order to fetch their data. Field buff is not used for that purpose,
but read_pos is used instead. This change was introduced with
compression, when algorithm accommodated grouping of several packets
together.
Now that meanings of all relevant NET fields are explained,
we can proceed with the flow of this function for the case when
compression is active. First, if there are remaining portions of
compressed packet in a field buff, saved character value is set at
the position where zero char '\0' was inserted to enable the string
to be zero delimited for mysql_use_result. Then a loop is started.
In the first part of the loop, if there are remaining bytes, local
uchar *pos variable is set at the current position in field buff
where a new packet starts. This position is an (buf_length -
remain_in_buf) offset in field buff. As it is possible that next
logical packet is not read to the full length in the remaining of
the field buf, several things had to be inspected. It should be
noted that data that is read from net_real_read contains only logical
packets containing 4 byte headers only, being 4 byte headers prepared
by my_net_write or net_write_command. But, when written, logical
packet could be so divided that only a part of header is read in.
Therefore after pointer to the start of the next packet has been
saved, a check is made whether number of remaining bytes in buffer
is less than 4, being 3 bytes for length and one byte for packet
number. If it is greater, then the length of the logical packet is
extracted and saved a length field. Then a check is made whether
entire packet is contained within a buf, that is, a check is made
that the logical packet is fully contained in the buffer. In that
case, number of bytes remaining in buffer is decreased by the full
length of logical packet (4 + length field), read_pos is moved
forward by 4 bytes to skip header and be set at a beginning of data
in logical packet, length field is saved for the value to be returned
in function and the loop is exited. In the case that the entire
logical packet is not contained within the buffer, then if length of
the entire buffer differs from remaining length of logical packet,
it (logical packet) is moved to the beginning of the field buff.
If length of the entire buffer equals the remaining length of logical
packet, where_b and buf_length fields are set to 0. This is done
so that in both cases buffer is ready to accept next part of packet.
In order to get a next part of a packet, still within a loop,
my_real_read function is called and length of compressed packet is
returned to a local len variable, and length of compressed data is
returned in complen variable. In the case of non-compression value
of complen is zero. If packet_error is from my_real_read function,
this function returns also with packet_error. If it is not a
packet_error, my_uncompress function is called to uncompress data.
It is called with offset of where_b data from field buff, as it is
the position where compressed packet starts, and with len and complen
values, being lengths of compressed and uncompressed data. If there
is no compression, 0 is returned for uncompressed size from
my_real_read function, and my_uncompress wrapper function is made
to skip zlib uncompress in that case. If error is returned from
my_uncompress, error field is set to 1, if on server last_errno is
set to ER_NET_UNCOMPRESS_ERROR and loop is exited and function
returns with packet_error. If not, buf_length and remain_in_buf
fields are set to the uncompressed size of buffer and the loop is
continued. When the loop is exited save_char field is used to save
the char at end of a logical packet, which is an offset of field
len from position in field buff pointed by field read_pos, in order
that zero char is set at the same position, for mysql_use_result.
Function returns the length of the logical packet without its header.

View File

@ -4,7 +4,7 @@ The MySQL AB Exception for Free/Libre and Open Source
Software-only Applications Using MySQL Client Libraries (the Software-only Applications Using MySQL Client Libraries (the
"FLOSS Exception"). "FLOSS Exception").
Version 0.5, 30 August 2006 Version 0.6, 7 March 2007
Exception Intent Exception Intent
@ -59,10 +59,12 @@ Apache Software License 1.0/1.1/2.0
Apple Public Source License 2.0 Apple Public Source License 2.0
Artistic license From Perl 5.8.0 Artistic license From Perl 5.8.0
BSD license "July 22 1999" BSD license "July 22 1999"
Common Development and Distribution License (CDDL) 1.0
Common Public License 1.0 Common Public License 1.0
Eclipse Public License 1.0
GNU Library or "Lesser" General Public License (LGPL) 2.0/2.1 GNU Library or "Lesser" General Public License (LGPL) 2.0/2.1
Jabber Open Source License 1.0 Jabber Open Source License 1.0
MIT license --- MIT license (As listed in file MIT-License.txt) ---
Mozilla Public License (MPL) 1.0/1.1 Mozilla Public License (MPL) 1.0/1.1
Open Software License 2.0 Open Software License 2.0
OpenSSL license (with original SSLeay license) "2003" ("1998") OpenSSL license (with original SSLeay license) "2003" ("1998")

View File

@ -21,58 +21,18 @@ AUTOMAKE_OPTIONS = foreign
EXTRA_DIST = INSTALL-SOURCE INSTALL-WIN-SOURCE \ EXTRA_DIST = INSTALL-SOURCE INSTALL-WIN-SOURCE \
README COPYING EXCEPTIONS-CLIENT CMakeLists.txt README COPYING EXCEPTIONS-CLIENT CMakeLists.txt
SUBDIRS = . include @docs_dirs@ @zlib_dir@ \ SUBDIRS = . include @docs_dirs@ @zlib_dir@ \
@readline_topdir@ sql-common \ @readline_topdir@ sql-common scripts \
@thread_dirs@ pstack \ @thread_dirs@ pstack \
@sql_union_dirs@ unittest storage plugin \ @sql_union_dirs@ unittest storage plugin \
@sql_server@ scripts @man_dirs@ tests \ @sql_server@ @man_dirs@ tests \
netware @libmysqld_dirs@ \ netware @libmysqld_dirs@ \
mysql-test support-files sql-bench @tools_dirs@ \ mysql-test support-files sql-bench @tools_dirs@ \
win win
DIST_SUBDIRS = $(SUBDIRS) BUILD DIST_SUBDIRS = $(SUBDIRS) BUILD debian
# Run these targets before any others, also make part of clean target,
# to make sure we create new links after a clean.
BUILT_SOURCES = linked_client_sources linked_server_sources \
@linked_client_targets@ \
@linked_libmysqld_targets@ \
linked_include_sources @linked_netware_sources@
CLEANFILES = $(BUILT_SOURCES)
DISTCLEANFILES = ac_available_languages_fragment DISTCLEANFILES = ac_available_languages_fragment
linked_include_sources:
cd include; $(MAKE) link_sources
echo timestamp > linked_include_sources
linked_client_sources: @linked_client_targets@
cd client; $(MAKE) link_sources
echo timestamp > linked_client_sources
linked_libmysql_sources:
cd libmysql; $(MAKE) link_sources
echo timestamp > linked_libmysql_sources
linked_libmysql_r_sources: linked_libmysql_sources
cd libmysql_r; $(MAKE) link_sources
echo timestamp > linked_libmysql_r_sources
linked_libmysqld_sources:
cd libmysqld; $(MAKE) link_sources
echo timestamp > linked_libmysqld_sources
linked_libmysqldex_sources:
cd libmysqld/examples; $(MAKE) link_sources
echo timestamp > linked_libmysqldex_sources
linked_netware_sources:
cd @netware_dir@; $(MAKE) link_sources
echo timestamp > linked_netware_sources
linked_server_sources:
cd sql; $(MAKE) link_sources
echo timestamp > linked_server_sources
# Create permission databases # Create permission databases
init-db: all init-db: all
$(top_builddir)/scripts/mysql_install_db $(top_builddir)/scripts/mysql_install_db
@ -97,7 +57,10 @@ tags:
.PHONY: init-db bin-dist \ .PHONY: init-db bin-dist \
test test-force test-full test-force-full test-force-mem \ test test-force test-full test-force-full test-force-mem \
test-pl test-force-pl test-full-pl test-force-full-pl test-force-pl-mem \ test-pl test-force-pl test-full-pl test-force-full-pl test-force-pl-mem \
test-unit test-ps test-nr test-pr test-ns test-binlog-statement test-unit test-ps test-nr test-pr test-ns test-binlog-statement \
test-ext-funcs test-ext-rpl test-ext-partitions test-ext \
test-fast test-fast-cursor test-fast-view test-fast-prepare \
test-full-qa
# Target 'test' will run the regression test suite using the built server. # Target 'test' will run the regression test suite using the built server.
# #
@ -120,11 +83,11 @@ test-nr:
test-pr: test-pr:
cd mysql-test ; \ cd mysql-test ; \
@PERL@ ./mysql-test-run.pl $(force) --ps-protocol --mysqld=--binlog-format=row @PERL@ ./mysql-test-run.pl $(force) $(mem) --ps-protocol --mysqld=--binlog-format=row
test-ns: test-ns:
cd mysql-test ; \ cd mysql-test ; \
@PERL@ ./mysql-test-run.pl $(force) --mysqld=--binlog-format=mixed @PERL@ ./mysql-test-run.pl $(force) $(mem) --mysqld=--binlog-format=mixed
test-binlog-statement: test-binlog-statement:
cd mysql-test ; \ cd mysql-test ; \
@ -142,7 +105,29 @@ test-force-full:
#used by autopush.pl to run memory based tests #used by autopush.pl to run memory based tests
test-force-mem: test-force-mem:
$(MAKE) 'force=--force --mem' test $(MAKE) force=--force mem=--mem test
test-bt:
-cd mysql-test ; MTR_BUILD_THREAD=auto \
@PERL@ ./mysql-test-run.pl --comment=normal --force --timer \
--skip-ndbcluster --report-features
-cd mysql-test ; MTR_BUILD_THREAD=auto \
@PERL@ ./mysql-test-run.pl --comment=ps --force --timer \
--skip-ndbcluster --ps-protocol
-cd mysql-test ; MTR_BUILD_THREAD=auto \
@PERL@ ./mysql-test-run.pl --comment=normal+rowrepl --force --timer \
--skip-ndbcluster --mysqld=--binlog-format=row
-cd mysql-test ; MTR_BUILD_THREAD=auto \
@PERL@ ./mysql-test-run.pl --comment=ps+rowrepl+NDB --force --timer \
--ps-protocol --mysqld=--binlog-format=row
-cd mysql-test ; MTR_BUILD_THREAD=auto \
@PERL@ ./mysql-test-run.pl --comment=NDB --force --timer \
--with-ndbcluster-only
test-bt-debug:
-cd mysql-test ; MTR_BUILD_THREAD=auto \
@PERL@ ./mysql-test-run.pl --comment=debug --force --timer \
--skip-ndbcluster --skip-rpl --report-features
# Keep these for a while # Keep these for a while
test-pl: test test-pl: test
@ -151,5 +136,43 @@ test-force-pl: test-force
test-force-pl-mem: test-force-mem test-force-pl-mem: test-force-mem
test-force-full-pl: test-force-full test-force-full-pl: test-force-full
test-ext-funcs:
cd mysql-test ; \
@PERL@ ./mysql-test-run.pl --force --suite=funcs_1 ; \
@PERL@ ./mysql-test-run.pl --force --suite=funcs_2
test-ext-rpl:
cd mysql-test ; \
@PERL@ ./mysql-test-run.pl --force --suite=rpl
test-ext-partitions:
cd mysql-test ; \
@PERL@ ./mysql-test-run.pl --force --suite=partitions
test-ext-jp:
cd mysql-test ; \
@PERL@ ./mysql-test-run.pl --force --suite=jp
test-ext: test-ext-funcs test-ext-rpl test-ext-partitions test-ext-jp
test-fast:
cd mysql-test ; \
@PERL@ ./mysql-test-run.pl $(subset) --force --skip-ndb --skip-innodb --skip-im --skip-rpl ; \
@PERL@ ./mysql-test-run.pl $(subset) --force --suite=funcs_1 --do-test=myisam
test-fast-view:
$(MAKE) subset=--view-protocol test-fast
test-fast-cursor:
$(MAKE) subset=--cursor-protocol test-fast
test-fast-prepare:
$(MAKE) subset=--ps-protocol test-fast
test-full-qa:
$(MAKE) force=--force test-pr \
test-binlog-statement test-ext test-fast-view \
test-fast-cursor test-unit
# Don't update the files from bitkeeper # Don't update the files from bitkeeper
%::SCCS/s.% %::SCCS/s.%

View File

@ -82,6 +82,7 @@ TARGET_LINK_LIBRARIES(mysqlimport mysqlclient mysys dbug yassl taocrypt zlib wso
ADD_EXECUTABLE(mysql_upgrade mysql_upgrade.c ../mysys/my_getpagesize.c) ADD_EXECUTABLE(mysql_upgrade mysql_upgrade.c ../mysys/my_getpagesize.c)
TARGET_LINK_LIBRARIES(mysql_upgrade mysqlclient dbug yassl taocrypt zlib wsock32) TARGET_LINK_LIBRARIES(mysql_upgrade mysqlclient dbug yassl taocrypt zlib wsock32)
ADD_DEPENDENCIES(mysql_upgrade GenFixPrivs)
ADD_EXECUTABLE(mysqlshow mysqlshow.c) ADD_EXECUTABLE(mysqlshow mysqlshow.c)
TARGET_LINK_LIBRARIES(mysqlshow mysqlclient mysys dbug yassl taocrypt zlib wsock32) TARGET_LINK_LIBRARIES(mysqlshow mysqlclient mysys dbug yassl taocrypt zlib wsock32)
@ -95,6 +96,7 @@ ADD_EXECUTABLE(mysqladmin mysqladmin.cc)
TARGET_LINK_LIBRARIES(mysqladmin mysqlclient mysys dbug yassl taocrypt zlib wsock32) TARGET_LINK_LIBRARIES(mysqladmin mysqlclient mysys dbug yassl taocrypt zlib wsock32)
ADD_EXECUTABLE(mysqlslap mysqlslap.c) ADD_EXECUTABLE(mysqlslap mysqlslap.c)
SET_SOURCE_FILES_PROPERTIES(mysqlslap.c PROPERTIES COMPILE_FLAGS "-DTHREADS")
TARGET_LINK_LIBRARIES(mysqlslap mysqlclient mysys yassl taocrypt zlib wsock32 dbug) TARGET_LINK_LIBRARIES(mysqlslap mysqlclient mysys yassl taocrypt zlib wsock32 dbug)
ADD_EXECUTABLE(echo echo.c) ADD_EXECUTABLE(echo echo.c)

View File

@ -34,7 +34,11 @@ LDADD= @CLIENT_EXTRA_LDFLAGS@ $(CLIENT_THREAD_LIBS) \
noinst_HEADERS = sql_string.h completion_hash.h my_readline.h \ noinst_HEADERS = sql_string.h completion_hash.h my_readline.h \
client_priv.h client_priv.h
EXTRA_DIST = get_password.c CMakeLists.txt EXTRA_DIST = get_password.c CMakeLists.txt echo.c
BUILT_SOURCES = link_sources
CLEANFILES = $(BUILT_SOURCES)
bin_PROGRAMS = mysql \ bin_PROGRAMS = mysql \
mysqladmin \ mysqladmin \
@ -76,6 +80,7 @@ mysqlimport_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
mysqlshow_SOURCES= mysqlshow.c mysqlshow_SOURCES= mysqlshow.c
mysqlslap_SOURCES= mysqlslap.c mysqlslap_SOURCES= mysqlslap.c
mysqlslap_CFLAGS= -DTHREAD -UUNDEF_THREADS_HACK
mysqlslap_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \ mysqlslap_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
@CLIENT_EXTRA_LDFLAGS@ \ @CLIENT_EXTRA_LDFLAGS@ \
$(LIBMYSQLCLIENT_LA) \ $(LIBMYSQLCLIENT_LA) \
@ -94,9 +99,11 @@ DEFS = -DUNDEF_THREADS_HACK \
-DDEFAULT_MYSQL_HOME="\"$(prefix)\"" \ -DDEFAULT_MYSQL_HOME="\"$(prefix)\"" \
-DDATADIR="\"$(localstatedir)\"" -DDATADIR="\"$(localstatedir)\""
sql_src=log_event.h mysql_priv.h log_event.cc my_decimal.h my_decimal.cc sql_src=log_event.h mysql_priv.h rpl_constants.h \
log_event.cc my_decimal.h my_decimal.cc \
log_event_old.h log_event_old.cc \
rpl_record_old.h rpl_record_old.cc
strings_src=decimal.c strings_src=decimal.c
EXTRA_DIST = get_password.c CMakeLists.txt echo.c
link_sources: link_sources:
for f in $(sql_src) ; do \ for f in $(sql_src) ; do \
@ -109,6 +116,7 @@ link_sources:
done; \ done; \
rm -f $(srcdir)/my_user.c; \ rm -f $(srcdir)/my_user.c; \
@LN_CP_F@ $(top_srcdir)/sql-common/my_user.c my_user.c; @LN_CP_F@ $(top_srcdir)/sql-common/my_user.c my_user.c;
echo timestamp > link_sources;
# Don't update the files from bitkeeper # Don't update the files from bitkeeper
%::SCCS/s.% %::SCCS/s.%

View File

@ -23,6 +23,14 @@
#include <errmsg.h> #include <errmsg.h>
#include <my_getopt.h> #include <my_getopt.h>
#ifndef WEXITSTATUS
# ifdef __WIN__
# define WEXITSTATUS(stat_val) (stat_val)
# else
# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
# endif
#endif
enum options_client enum options_client
{ {
OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET, OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET,
@ -49,7 +57,6 @@ enum options_client
OPT_TRIGGERS, OPT_TRIGGERS,
OPT_MYSQL_ONLY_PRINT, OPT_MYSQL_ONLY_PRINT,
OPT_MYSQL_LOCK_DIRECTORY, OPT_MYSQL_LOCK_DIRECTORY,
OPT_MYSQL_SLAP_SLAVE,
OPT_USE_THREADS, OPT_USE_THREADS,
OPT_IMPORT_USE_THREADS, OPT_IMPORT_USE_THREADS,
OPT_MYSQL_NUMBER_OF_QUERY, OPT_MYSQL_NUMBER_OF_QUERY,
@ -58,7 +65,16 @@ enum options_client
OPT_TZ_UTC, OPT_AUTO_CLOSE, OPT_CREATE_SLAP_SCHEMA, OPT_TZ_UTC, OPT_AUTO_CLOSE, OPT_CREATE_SLAP_SCHEMA,
OPT_SLAP_CSV, OPT_SLAP_CREATE_STRING, OPT_SLAP_CSV, OPT_SLAP_CREATE_STRING,
OPT_SLAP_AUTO_GENERATE_SQL_LOAD_TYPE, OPT_SLAP_AUTO_GENERATE_WRITE_NUM, OPT_SLAP_AUTO_GENERATE_SQL_LOAD_TYPE, OPT_SLAP_AUTO_GENERATE_WRITE_NUM,
OPT_SLAP_AUTO_GENERATE_ADD_AUTO,
OPT_SLAP_AUTO_GENERATE_GUID_PRIMARY,
OPT_SLAP_AUTO_GENERATE_EXECUTE_QUERIES,
OPT_SLAP_AUTO_GENERATE_SECONDARY_INDEXES,
OPT_SLAP_AUTO_GENERATE_UNIQUE_WRITE_NUM,
OPT_SLAP_AUTO_GENERATE_UNIQUE_QUERY_NUM,
OPT_SLAP_PRE_QUERY,
OPT_SLAP_POST_QUERY,
OPT_MYSQL_REPLACE_INTO, OPT_BASE64_OUTPUT, OPT_SERVER_ID, OPT_MYSQL_REPLACE_INTO, OPT_BASE64_OUTPUT, OPT_SERVER_ID,
OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES, OPT_SSL_VERIFY_SERVER_CERT, OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES, OPT_SSL_VERIFY_SERVER_CERT,
OPT_DEBUG_INFO, OPT_COLUMN_TYPES OPT_DEBUG_INFO, OPT_COLUMN_TYPES, OPT_ERROR_LOG_FILE, OPT_WRITE_BINLOG,
OPT_MAX_CLIENT_OPTION
}; };

View File

@ -2,8 +2,7 @@
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; version 2 of the License.
(at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of

View File

@ -818,7 +818,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break; break;
#endif #endif
case OPT_CHARSETS_DIR: case OPT_CHARSETS_DIR:
strmov(mysql_charsets_dir, argument); strmake(mysql_charsets_dir, argument, sizeof(mysql_charsets_dir) - 1);
charsets_dir = mysql_charsets_dir; charsets_dir = mysql_charsets_dir;
break; break;
case OPT_DEFAULT_CHARSET: case OPT_DEFAULT_CHARSET:
@ -871,7 +871,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
if (argument && strlen(argument)) if (argument && strlen(argument))
{ {
default_pager_set= 1; default_pager_set= 1;
strmov(pager, argument); strmake(pager, argument, sizeof(pager) - 1);
strmov(default_pager, pager); strmov(default_pager, pager);
} }
else if (default_pager_set) else if (default_pager_set)
@ -885,14 +885,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt_nopager= 1; opt_nopager= 1;
break; break;
case OPT_MYSQL_PROTOCOL: case OPT_MYSQL_PROTOCOL:
{ opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0) opt->name);
{
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
exit(1);
}
break; break;
}
break; break;
case 'A': case 'A':
opt_rehash= 0; opt_rehash= 0;
@ -2104,6 +2099,17 @@ com_go(String *buffer,char *line __attribute__((unused)))
if (!mysql_num_rows(result) && ! quick && !column_types_flag) if (!mysql_num_rows(result) && ! quick && !column_types_flag)
{ {
strmov(buff, "Empty set"); strmov(buff, "Empty set");
if (opt_xml)
{
/*
We must print XML header and footer
to produce a well-formed XML even if
the result set is empty (Bug#27608).
*/
init_pager();
print_table_data_xml(result);
end_pager();
}
} }
else else
{ {
@ -2517,7 +2523,8 @@ print_table_data_xml(MYSQL_RES *result)
tee_fputs("<?xml version=\"1.0\"?>\n\n<resultset statement=\"", PAGER); tee_fputs("<?xml version=\"1.0\"?>\n\n<resultset statement=\"", PAGER);
xmlencode_print(glob_buffer.ptr(), (int)strlen(glob_buffer.ptr())); xmlencode_print(glob_buffer.ptr(), (int)strlen(glob_buffer.ptr()));
tee_fputs("\">", PAGER); tee_fputs("\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">",
PAGER);
fields = mysql_fetch_fields(result); fields = mysql_fetch_fields(result);
while ((cur = mysql_fetch_row(result))) while ((cur = mysql_fetch_row(result)))

File diff suppressed because it is too large Load Diff

View File

@ -40,7 +40,7 @@ ulonglong last_values[MAX_MYSQL_VAR];
static int interval=0; static int interval=0;
static my_bool option_force=0,interrupted=0,new_line=0, static my_bool option_force=0,interrupted=0,new_line=0,
opt_compress=0, opt_relative=0, opt_verbose=0, opt_vertical=0, opt_compress=0, opt_relative=0, opt_verbose=0, opt_vertical=0,
tty_password= 0, info_flag= 0; tty_password= 0, info_flag= 0, opt_nobeep;
static uint tcp_port = 0, option_wait = 0, option_silent=0, nr_iterations, static uint tcp_port = 0, option_wait = 0, option_silent=0, nr_iterations,
opt_count_iterations= 0; opt_count_iterations= 0;
static ulong opt_connect_timeout, opt_shutdown_timeout; static ulong opt_connect_timeout, opt_shutdown_timeout;
@ -54,6 +54,7 @@ static char *opt_ndb_connectstring=0;
static char *shared_memory_base_name=0; static char *shared_memory_base_name=0;
#endif #endif
static uint opt_protocol=0; static uint opt_protocol=0;
static myf error_flags; /* flags to pass to my_printf_error, like ME_BELL */
/* /*
When using extended-status relatively, ex_val_max_len is the estimated When using extended-status relatively, ex_val_max_len is the estimated
@ -154,6 +155,8 @@ static struct my_option my_long_options[] =
NO_ARG, 0, 0, 0, 0, 0, 0}, NO_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", (gptr*) &host, (gptr*) &host, 0, GET_STR, {"host", 'h', "Connect to host.", (gptr*) &host, (gptr*) &host, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"no-beep", 'b', "Turn off beep on error.", (gptr*) &opt_nobeep,
(gptr*) &opt_nobeep, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p', {"password", 'p',
"Password to use when connecting to server. If password is not given it's asked from the tty.", "Password to use when connecting to server. If password is not given it's asked from the tty.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
@ -284,15 +287,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
#endif #endif
break; break;
case OPT_MYSQL_PROTOCOL: case OPT_MYSQL_PROTOCOL:
{ opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0) opt->name);
{
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
exit(1);
}
break; break;
} }
}
if (error) if (error)
{ {
usage(); usage();
@ -352,6 +350,8 @@ int main(int argc,char *argv[])
#endif #endif
if (default_charset) if (default_charset)
mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset); mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset);
error_flags= (myf)(opt_nobeep ? 0 : ME_BELL);
if (sql_connect(&mysql, option_wait)) if (sql_connect(&mysql, option_wait))
{ {
unsigned int err= mysql_errno(&mysql); unsigned int err= mysql_errno(&mysql);
@ -450,7 +450,7 @@ static my_bool sql_connect(MYSQL *mysql, uint wait)
if (!host) if (!host)
host= (char*) LOCAL_HOST; host= (char*) LOCAL_HOST;
my_printf_error(0,"connect to server at '%s' failed\nerror: '%s'", my_printf_error(0,"connect to server at '%s' failed\nerror: '%s'",
MYF(ME_BELL), host, mysql_error(mysql)); error_flags, host, mysql_error(mysql));
if (mysql_errno(mysql) == CR_CONNECTION_ERROR) if (mysql_errno(mysql) == CR_CONNECTION_ERROR)
{ {
fprintf(stderr, fprintf(stderr,
@ -525,14 +525,14 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
char buff[FN_REFLEN+20]; char buff[FN_REFLEN+20];
if (argc < 2) if (argc < 2)
{ {
my_printf_error(0,"Too few arguments to create",MYF(ME_BELL)); my_printf_error(0, "Too few arguments to create", error_flags);
return 1; return 1;
} }
sprintf(buff,"create database `%.*s`",FN_REFLEN,argv[1]); sprintf(buff,"create database `%.*s`",FN_REFLEN,argv[1]);
if (mysql_query(mysql,buff)) if (mysql_query(mysql,buff))
{ {
my_printf_error(0,"CREATE DATABASE failed; error: '%-.200s'", my_printf_error(0,"CREATE DATABASE failed; error: '%-.200s'",
MYF(ME_BELL), mysql_error(mysql)); error_flags, mysql_error(mysql));
return -1; return -1;
} }
argc--; argv++; argc--; argv++;
@ -542,7 +542,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
{ {
if (argc < 2) if (argc < 2)
{ {
my_printf_error(0,"Too few arguments to drop",MYF(ME_BELL)); my_printf_error(0, "Too few arguments to drop", error_flags);
return 1; return 1;
} }
if (drop_db(mysql,argv[1])) if (drop_db(mysql,argv[1]))
@ -567,7 +567,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
if (mysql_shutdown(mysql, SHUTDOWN_DEFAULT)) if (mysql_shutdown(mysql, SHUTDOWN_DEFAULT))
{ {
my_printf_error(0,"shutdown failed; error: '%s'",MYF(ME_BELL), my_printf_error(0, "shutdown failed; error: '%s'", error_flags,
mysql_error(mysql)); mysql_error(mysql));
return -1; return -1;
} }
@ -588,7 +588,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
case ADMIN_RELOAD: case ADMIN_RELOAD:
if (mysql_query(mysql,"flush privileges")) if (mysql_query(mysql,"flush privileges"))
{ {
my_printf_error(0,"reload failed; error: '%s'",MYF(ME_BELL), my_printf_error(0, "reload failed; error: '%s'", error_flags,
mysql_error(mysql)); mysql_error(mysql));
return -1; return -1;
} }
@ -599,7 +599,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
REFRESH_READ_LOCK | REFRESH_SLAVE | REFRESH_READ_LOCK | REFRESH_SLAVE |
REFRESH_MASTER))) REFRESH_MASTER)))
{ {
my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL), my_printf_error(0, "refresh failed; error: '%s'", error_flags,
mysql_error(mysql)); mysql_error(mysql));
return -1; return -1;
} }
@ -607,7 +607,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
case ADMIN_FLUSH_THREADS: case ADMIN_FLUSH_THREADS:
if (mysql_refresh(mysql,(uint) REFRESH_THREADS)) if (mysql_refresh(mysql,(uint) REFRESH_THREADS))
{ {
my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL), my_printf_error(0, "refresh failed; error: '%s'", error_flags,
mysql_error(mysql)); mysql_error(mysql));
return -1; return -1;
} }
@ -651,7 +651,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
"show processlist")) || "show processlist")) ||
!(result = mysql_store_result(mysql))) !(result = mysql_store_result(mysql)))
{ {
my_printf_error(0,"process list failed; error: '%s'",MYF(ME_BELL), my_printf_error(0, "process list failed; error: '%s'", error_flags,
mysql_error(mysql)); mysql_error(mysql));
return -1; return -1;
} }
@ -674,7 +674,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
char *pos; char *pos;
if (argc < 2) if (argc < 2)
{ {
my_printf_error(0,"Too few arguments to 'kill'",MYF(ME_BELL)); my_printf_error(0, "Too few arguments to 'kill'", error_flags);
return 1; return 1;
} }
pos=argv[1]; pos=argv[1];
@ -682,7 +682,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
{ {
if (mysql_kill(mysql,(ulong) atol(pos))) if (mysql_kill(mysql,(ulong) atol(pos)))
{ {
my_printf_error(0,"kill failed on %ld; error: '%s'",MYF(ME_BELL), my_printf_error(0, "kill failed on %ld; error: '%s'", error_flags,
atol(pos), mysql_error(mysql)); atol(pos), mysql_error(mysql));
error=1; error=1;
} }
@ -698,7 +698,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
case ADMIN_DEBUG: case ADMIN_DEBUG:
if (mysql_dump_debug_info(mysql)) if (mysql_dump_debug_info(mysql))
{ {
my_printf_error(0,"debug failed; error: '%s'",MYF(ME_BELL), my_printf_error(0, "debug failed; error: '%s'", error_flags,
mysql_error(mysql)); mysql_error(mysql));
return -1; return -1;
} }
@ -712,7 +712,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
if (mysql_query(mysql,"show /*!40003 GLOBAL */ variables") || if (mysql_query(mysql,"show /*!40003 GLOBAL */ variables") ||
!(res=mysql_store_result(mysql))) !(res=mysql_store_result(mysql)))
{ {
my_printf_error(0,"unable to show variables; error: '%s'",MYF(ME_BELL), my_printf_error(0, "unable to show variables; error: '%s'", error_flags,
mysql_error(mysql)); mysql_error(mysql));
return -1; return -1;
} }
@ -734,7 +734,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
if (mysql_query(mysql, "show /*!50002 GLOBAL */ status") || if (mysql_query(mysql, "show /*!50002 GLOBAL */ status") ||
!(res = mysql_store_result(mysql))) !(res = mysql_store_result(mysql)))
{ {
my_printf_error(0, "unable to show status; error: '%s'", MYF(ME_BELL), my_printf_error(0, "unable to show status; error: '%s'", error_flags,
mysql_error(mysql)); mysql_error(mysql));
return -1; return -1;
} }
@ -784,7 +784,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
{ {
if (mysql_refresh(mysql,REFRESH_LOG)) if (mysql_refresh(mysql,REFRESH_LOG))
{ {
my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL), my_printf_error(0, "refresh failed; error: '%s'", error_flags,
mysql_error(mysql)); mysql_error(mysql));
return -1; return -1;
} }
@ -794,7 +794,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
{ {
if (mysql_query(mysql,"flush hosts")) if (mysql_query(mysql,"flush hosts"))
{ {
my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL), my_printf_error(0, "refresh failed; error: '%s'", error_flags,
mysql_error(mysql)); mysql_error(mysql));
return -1; return -1;
} }
@ -804,7 +804,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
{ {
if (mysql_query(mysql,"flush tables")) if (mysql_query(mysql,"flush tables"))
{ {
my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL), my_printf_error(0, "refresh failed; error: '%s'", error_flags,
mysql_error(mysql)); mysql_error(mysql));
return -1; return -1;
} }
@ -814,7 +814,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
{ {
if (mysql_query(mysql,"flush status")) if (mysql_query(mysql,"flush status"))
{ {
my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL), my_printf_error(0, "refresh failed; error: '%s'", error_flags,
mysql_error(mysql)); mysql_error(mysql));
return -1; return -1;
} }
@ -831,7 +831,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
if (argc < 2) if (argc < 2)
{ {
my_printf_error(0,"Too few arguments to change password",MYF(ME_BELL)); my_printf_error(0, "Too few arguments to change password", error_flags);
return 1; return 1;
} }
if (argv[1][0]) if (argv[1][0])
@ -854,7 +854,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
if (mysql_query(mysql, "SHOW VARIABLES LIKE 'old_passwords'")) if (mysql_query(mysql, "SHOW VARIABLES LIKE 'old_passwords'"))
{ {
my_printf_error(0, "Could not determine old_passwords setting from server; error: '%s'", my_printf_error(0, "Could not determine old_passwords setting from server; error: '%s'",
MYF(ME_BELL),mysql_error(mysql)); error_flags, mysql_error(mysql));
return -1; return -1;
} }
else else
@ -865,7 +865,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
my_printf_error(0, my_printf_error(0,
"Could not get old_passwords setting from " "Could not get old_passwords setting from "
"server; error: '%s'", "server; error: '%s'",
MYF(ME_BELL),mysql_error(mysql)); error_flags, mysql_error(mysql));
return -1; return -1;
} }
if (!mysql_num_rows(res)) if (!mysql_num_rows(res))
@ -890,7 +890,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
if (mysql_query(mysql,"set sql_log_off=1")) if (mysql_query(mysql,"set sql_log_off=1"))
{ {
my_printf_error(0, "Can't turn off logging; error: '%s'", my_printf_error(0, "Can't turn off logging; error: '%s'",
MYF(ME_BELL),mysql_error(mysql)); error_flags, mysql_error(mysql));
return -1; return -1;
} }
if (mysql_query(mysql,buff)) if (mysql_query(mysql,buff))
@ -898,7 +898,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
if (mysql_errno(mysql)!=1290) if (mysql_errno(mysql)!=1290)
{ {
my_printf_error(0,"unable to change password; error: '%s'", my_printf_error(0,"unable to change password; error: '%s'",
MYF(ME_BELL),mysql_error(mysql)); error_flags, mysql_error(mysql));
return -1; return -1;
} }
else else
@ -912,7 +912,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
" with grant tables disabled (was started with" " with grant tables disabled (was started with"
" --skip-grant-tables).\n" " --skip-grant-tables).\n"
"Use: \"mysqladmin flush-privileges password '*'\"" "Use: \"mysqladmin flush-privileges password '*'\""
" instead", MYF(ME_BELL)); " instead", error_flags);
return -1; return -1;
} }
} }
@ -923,7 +923,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
case ADMIN_START_SLAVE: case ADMIN_START_SLAVE:
if (mysql_query(mysql, "START SLAVE")) if (mysql_query(mysql, "START SLAVE"))
{ {
my_printf_error(0, "Error starting slave: %s", MYF(ME_BELL), my_printf_error(0, "Error starting slave: %s", error_flags,
mysql_error(mysql)); mysql_error(mysql));
return -1; return -1;
} }
@ -933,7 +933,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
case ADMIN_STOP_SLAVE: case ADMIN_STOP_SLAVE:
if (mysql_query(mysql, "STOP SLAVE")) if (mysql_query(mysql, "STOP SLAVE"))
{ {
my_printf_error(0, "Error stopping slave: %s", MYF(ME_BELL), my_printf_error(0, "Error stopping slave: %s", error_flags,
mysql_error(mysql)); mysql_error(mysql));
return -1; return -1;
} }
@ -959,7 +959,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
else else
{ {
my_printf_error(0,"mysqld doesn't answer to ping, error: '%s'", my_printf_error(0,"mysqld doesn't answer to ping, error: '%s'",
MYF(ME_BELL),mysql_error(mysql)); error_flags, mysql_error(mysql));
return -1; return -1;
} }
} }
@ -970,7 +970,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
{ {
if (argc < 2) if (argc < 2)
{ {
my_printf_error(0,"Too few arguments to ndb-mgm",MYF(ME_BELL)); my_printf_error(0, "Too few arguments to ndb-mgm", error_flags);
return 1; return 1;
} }
{ {
@ -984,7 +984,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
break; break;
#endif #endif
default: default:
my_printf_error(0,"Unknown command: '%-.60s'",MYF(ME_BELL),argv[0]); my_printf_error(0, "Unknown command: '%-.60s'", error_flags, argv[0]);
return 1; return 1;
} }
} }
@ -1062,7 +1062,7 @@ static int drop_db(MYSQL *mysql, const char *db)
sprintf(name_buff,"drop database `%.*s`",FN_REFLEN,db); sprintf(name_buff,"drop database `%.*s`",FN_REFLEN,db);
if (mysql_query(mysql,name_buff)) if (mysql_query(mysql,name_buff))
{ {
my_printf_error(0,"DROP DATABASE %s failed;\nerror: '%s'",MYF(ME_BELL), my_printf_error(0, "DROP DATABASE %s failed;\nerror: '%s'", error_flags,
db,mysql_error(mysql)); db,mysql_error(mysql));
return 1; return 1;
} }
@ -1287,7 +1287,7 @@ static my_bool get_pidfile(MYSQL *mysql, char *pidfile)
if (mysql_query(mysql, "SHOW VARIABLES LIKE 'pid_file'")) if (mysql_query(mysql, "SHOW VARIABLES LIKE 'pid_file'"))
{ {
my_printf_error(0,"query failed; error: '%s'",MYF(ME_BELL), my_printf_error(0, "query failed; error: '%s'", error_flags,
mysql_error(mysql)); mysql_error(mysql));
} }
result = mysql_store_result(mysql); result = mysql_store_result(mysql);

View File

@ -158,11 +158,7 @@ class Load_log_processor
public: public:
Load_log_processor() {} Load_log_processor() {}
~Load_log_processor() ~Load_log_processor() {}
{
destroy();
delete_dynamic(&file_names);
}
int init() int init()
{ {
@ -182,20 +178,22 @@ public:
target_dir_name_len= strlen(target_dir_name); target_dir_name_len= strlen(target_dir_name);
} }
void destroy() void destroy()
{
File_name_record *ptr= (File_name_record *)file_names.buffer;
File_name_record *end= ptr + file_names.elements;
for (; ptr < end; ptr++)
{ {
File_name_record *ptr= (File_name_record *)file_names.buffer; if (ptr->fname)
File_name_record *end= ptr + file_names.elements;
for (; ptr<end; ptr++)
{ {
if (ptr->fname) my_free(ptr->fname, MYF(MY_WME));
{ delete ptr->event;
my_free(ptr->fname, MYF(MY_WME)); bzero((char *)ptr, sizeof(File_name_record));
delete ptr->event;
bzero((char *)ptr, sizeof(File_name_record));
}
} }
} }
delete_dynamic(&file_names);
}
/* /*
Obtain Create_file event for LOAD DATA statement by its file_id. Obtain Create_file event for LOAD DATA statement by its file_id.
@ -483,19 +481,17 @@ static int
write_event_header_and_base64(Log_event *ev, FILE *result_file, write_event_header_and_base64(Log_event *ev, FILE *result_file,
PRINT_EVENT_INFO *print_event_info) PRINT_EVENT_INFO *print_event_info)
{ {
IO_CACHE *head= &print_event_info->head_cache;
IO_CACHE *body= &print_event_info->body_cache;
DBUG_ENTER("write_event_header_and_base64"); DBUG_ENTER("write_event_header_and_base64");
/* Write header and base64 output to cache */
IO_CACHE result_cache;
if (open_cached_file(&result_cache, NULL, NULL, 0, MYF(MY_WME | MY_NABP)))
return 1;
ev->print_header(&result_cache, print_event_info, FALSE); /* Write header and base64 output to cache */
ev->print_base64(&result_cache, print_event_info, FALSE); ev->print_header(head, print_event_info, FALSE);
ev->print_base64(body, print_event_info, FALSE);
/* Read data from cache and write to result file */ /* Read data from cache and write to result file */
my_b_copy_to_file(&result_cache, result_file); DBUG_RETURN(copy_event_cache_to_file_and_reinit(head, result_file) ||
close_cached_file(&result_cache); copy_event_cache_to_file_and_reinit(body, result_file));
DBUG_RETURN(0);
} }
@ -948,14 +944,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
remote_opt= 1; remote_opt= 1;
break; break;
case OPT_MYSQL_PROTOCOL: case OPT_MYSQL_PROTOCOL:
{ opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0) opt->name);
{
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
exit(1);
}
break; break;
}
case OPT_START_DATETIME: case OPT_START_DATETIME:
start_datetime= convert_str_to_timestamp(start_datetime_str); start_datetime= convert_str_to_timestamp(start_datetime_str);
break; break;
@ -1171,7 +1162,7 @@ could be out of memory");
} }
if (len < 8 && net->read_pos[0] == 254) if (len < 8 && net->read_pos[0] == 254)
break; // end of data break; // end of data
DBUG_PRINT("info",( "len: %lu, net->read_pos[5]: %d\n", DBUG_PRINT("info",( "len: %lu net->read_pos[5]: %d\n",
len, net->read_pos[5])); len, net->read_pos[5]));
if (!(ev= Log_event::read_log_event((const char*) net->read_pos + 1 , if (!(ev= Log_event::read_log_event((const char*) net->read_pos + 1 ,
len - 1, &error_msg, len - 1, &error_msg,
@ -1226,6 +1217,18 @@ could be out of memory");
len= 1; // fake Rotate, so don't increment old_off len= 1; // fake Rotate, so don't increment old_off
} }
} }
else if (type == FORMAT_DESCRIPTION_EVENT)
{
/*
This could be an fake Format_description_log_event that server
(5.0+) automatically sends to a slave on connect, before sending
a first event at the requested position. If this is the case,
don't increment old_off. Real Format_description_log_event always
starts from BIN_LOG_HEADER_SIZE position.
*/
if (old_off != BIN_LOG_HEADER_SIZE)
len= 1; // fake event, don't increment old_off
}
if ((error= process_event(print_event_info, ev, old_off))) if ((error= process_event(print_event_info, ev, old_off)))
{ {
error= ((error < 0) ? 0 : 1); error= ((error < 0) ? 0 : 1);
@ -1238,16 +1241,16 @@ could be out of memory");
const char *old_fname= le->fname; const char *old_fname= le->fname;
uint old_len= le->fname_len; uint old_len= le->fname_len;
File file; File file;
if ((file= load_processor.prepare_new_file_for_old_format(le,fname)) < 0) if ((file= load_processor.prepare_new_file_for_old_format(le,fname)) < 0)
{ {
error= 1; error= 1;
goto err; goto err;
} }
if ((error= process_event(print_event_info, ev, old_off))) if ((error= process_event(print_event_info, ev, old_off)))
{ {
my_close(file,MYF(MY_WME)); my_close(file,MYF(MY_WME));
error= ((error < 0) ? 0 : 1); error= ((error < 0) ? 0 : 1);
goto err; goto err;
} }
@ -1260,8 +1263,8 @@ could be out of memory");
} }
} }
/* /*
Let's adjust offset for remote log as for local log to produce Let's adjust offset for remote log as for local log to produce
similar text. similar text and to have --stop-position to work identically.
*/ */
old_off+= len-1; old_off+= len-1;
} }
@ -1577,6 +1580,7 @@ int main(int argc, char** argv)
cleanup(); cleanup();
free_defaults(defaults_argv); free_defaults(defaults_argv);
my_free_open_file_info(); my_free_open_file_info();
load_processor.destroy();
/* We cannot free DBUG, it is used in global destructors after exit(). */ /* We cannot free DBUG, it is used in global destructors after exit(). */
my_end((info_flag ? MY_CHECK_ERROR : 0) | MY_DONT_FREE_DBUG); my_end((info_flag ? MY_CHECK_ERROR : 0) | MY_DONT_FREE_DBUG);
@ -1603,10 +1607,12 @@ int main(int argc, char** argv)
#include "decimal.c" #include "decimal.c"
#include "my_decimal.cpp" #include "my_decimal.cpp"
#include "log_event.cpp" #include "log_event.cpp"
#include "log_event_old.cpp"
#else #else
#include "my_decimal.h" #include "my_decimal.h"
#include "decimal.c" #include "decimal.c"
#include "my_decimal.cc" #include "my_decimal.cc"
#include "log_event.cc" #include "log_event.cc"
#include "log_event_old.cc"
#endif #endif

View File

@ -34,7 +34,8 @@ static my_bool opt_alldbs = 0, opt_check_only_changed = 0, opt_extended = 0,
opt_medium_check = 0, opt_quick = 0, opt_all_in_1 = 0, opt_medium_check = 0, opt_quick = 0, opt_all_in_1 = 0,
opt_silent = 0, opt_auto_repair = 0, ignore_errors = 0, opt_silent = 0, opt_auto_repair = 0, ignore_errors = 0,
tty_password= 0, opt_frm= 0, info_flag= 0, tty_password= 0, opt_frm= 0, info_flag= 0,
opt_fix_table_names= 0, opt_fix_db_names= 0, opt_upgrade= 0; opt_fix_table_names= 0, opt_fix_db_names= 0, opt_upgrade= 0,
opt_write_binlog= 1;
static uint verbose = 0, opt_mysql_port=0; static uint verbose = 0, opt_mysql_port=0;
static my_string opt_mysql_unix_port = 0; static my_string opt_mysql_unix_port = 0;
static char *opt_password = 0, *current_user = 0, static char *opt_password = 0, *current_user = 0,
@ -123,6 +124,10 @@ static struct my_option my_long_options[] =
{"medium-check", 'm', {"medium-check", 'm',
"Faster than extended-check, but only finds 99.99 percent of all errors. Should be good enough for most cases.", "Faster than extended-check, but only finds 99.99 percent of all errors. Should be good enough for most cases.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"write-binlog", OPT_WRITE_BINLOG,
"Log ANALYZE, OPTIMIZE and REPAIR TABLE commands. Enabled by default; use --skip-write-binlog when commands should not be sent to replication slaves.",
(gptr*) &opt_write_binlog, (gptr*) &opt_write_binlog, 0, GET_BOOL, NO_ARG,
1, 0, 0, 0, 0, 0},
{"optimize", 'o', "Optimize table.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, {"optimize", 'o', "Optimize table.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0,
0, 0}, 0, 0},
{"password", 'p', {"password", 'p',
@ -310,15 +315,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break; break;
case 'V': print_version(); exit(0); case 'V': print_version(); exit(0);
case OPT_MYSQL_PROTOCOL: case OPT_MYSQL_PROTOCOL:
{ opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0) opt->name);
{
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
exit(1);
}
break; break;
} }
}
return 0; return 0;
} }
@ -598,16 +598,16 @@ static int handle_request_for_tables(char *tables, uint length)
if (opt_upgrade) end = strmov(end, " FOR UPGRADE"); if (opt_upgrade) end = strmov(end, " FOR UPGRADE");
break; break;
case DO_REPAIR: case DO_REPAIR:
op = "REPAIR"; op= (opt_write_binlog) ? "REPAIR" : "REPAIR NO_WRITE_TO_BINLOG";
if (opt_quick) end = strmov(end, " QUICK"); if (opt_quick) end = strmov(end, " QUICK");
if (opt_extended) end = strmov(end, " EXTENDED"); if (opt_extended) end = strmov(end, " EXTENDED");
if (opt_frm) end = strmov(end, " USE_FRM"); if (opt_frm) end = strmov(end, " USE_FRM");
break; break;
case DO_ANALYZE: case DO_ANALYZE:
op = "ANALYZE"; op= (opt_write_binlog) ? "ANALYZE" : "ANALYZE NO_WRITE_TO_BINLOG";
break; break;
case DO_OPTIMIZE: case DO_OPTIMIZE:
op = "OPTIMIZE"; op= (opt_write_binlog) ? "OPTIMIZE" : "OPTIMIZE NO_WRITE_TO_BINLOG";
break; break;
case DO_UPGRADE: case DO_UPGRADE:
return fix_object_name("TABLE", tables); return fix_object_name("TABLE", tables);

File diff suppressed because it is too large Load Diff

View File

@ -231,14 +231,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break; break;
#endif #endif
case OPT_MYSQL_PROTOCOL: case OPT_MYSQL_PROTOCOL:
{ opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0) opt->name);
{
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
exit(1);
}
break; break;
}
case '#': case '#':
DBUG_PUSH(argument ? argument : "d:t:o"); DBUG_PUSH(argument ? argument : "d:t:o");
break; break;

View File

@ -287,14 +287,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
#endif #endif
break; break;
case OPT_MYSQL_PROTOCOL: case OPT_MYSQL_PROTOCOL:
{ opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0) opt->name);
{
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
exit(1);
}
break; break;
}
case '#': case '#':
DBUG_PUSH(argument ? argument : "d:t:o"); DBUG_PUSH(argument ? argument : "d:t:o");
break; break;

File diff suppressed because it is too large Load Diff

View File

@ -33,18 +33,12 @@
#define MTEST_VERSION "3.2" #define MTEST_VERSION "3.2"
#include <my_global.h> #include "client_priv.h"
#include <mysql_embed.h>
#include <my_sys.h>
#include <m_string.h>
#include <mysql.h>
#include <mysql_version.h> #include <mysql_version.h>
#include <mysqld_error.h> #include <mysqld_error.h>
#include <errmsg.h>
#include <m_ctype.h> #include <m_ctype.h>
#include <my_dir.h> #include <my_dir.h>
#include <hash.h> #include <hash.h>
#include <my_getopt.h>
#include <stdarg.h> #include <stdarg.h>
#include <violite.h> #include <violite.h>
#include "my_regex.h" /* Our own version of regex */ #include "my_regex.h" /* Our own version of regex */
@ -52,14 +46,6 @@
#include <sys/wait.h> #include <sys/wait.h>
#endif #endif
#ifndef WEXITSTATUS
# ifdef __WIN__
# define WEXITSTATUS(stat_val) (stat_val)
# else
# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
# endif
#endif
/* Use cygwin for --exec and --system before 5.0 */ /* Use cygwin for --exec and --system before 5.0 */
#if MYSQL_VERSION_ID < 50000 #if MYSQL_VERSION_ID < 50000
#define USE_CYGWIN #define USE_CYGWIN
@ -81,11 +67,9 @@
}; };
enum { enum {
OPT_SKIP_SAFEMALLOC=256, OPT_SSL_SSL, OPT_SSL_KEY, OPT_SSL_CERT, OPT_SKIP_SAFEMALLOC=OPT_MAX_CLIENT_OPTION,
OPT_SSL_CA, OPT_SSL_CAPATH, OPT_SSL_CIPHER, OPT_PS_PROTOCOL, OPT_PS_PROTOCOL, OPT_SP_PROTOCOL, OPT_CURSOR_PROTOCOL, OPT_VIEW_PROTOCOL,
OPT_SP_PROTOCOL, OPT_CURSOR_PROTOCOL, OPT_VIEW_PROTOCOL, OPT_MAX_CONNECT_RETRIES, OPT_MARK_PROGRESS, OPT_LOG_DIR
OPT_SSL_VERIFY_SERVER_CERT, OPT_MAX_CONNECT_RETRIES,
OPT_MARK_PROGRESS, OPT_CHARSETS_DIR, OPT_LOG_DIR, OPT_DEBUG_INFO
}; };
static int record= 0, opt_sleep= -1; static int record= 0, opt_sleep= -1;
@ -103,10 +87,10 @@ static my_bool sp_protocol= 0, sp_protocol_enabled= 0;
static my_bool view_protocol= 0, view_protocol_enabled= 0; static my_bool view_protocol= 0, view_protocol_enabled= 0;
static my_bool cursor_protocol= 0, cursor_protocol_enabled= 0; static my_bool cursor_protocol= 0, cursor_protocol_enabled= 0;
static my_bool parsing_disabled= 0; static my_bool parsing_disabled= 0;
static my_bool info_flag; static my_bool display_result_vertically= FALSE,
static my_bool display_result_vertically= FALSE, display_metadata= FALSE; display_metadata= FALSE, display_result_sorted= FALSE;
static my_bool disable_query_log= 0, disable_result_log= 0; static my_bool disable_query_log= 0, disable_result_log= 0;
static my_bool disable_warnings= 0, disable_ps_warnings= 0; static my_bool disable_warnings= 0;
static my_bool disable_info= 1; static my_bool disable_info= 1;
static my_bool abort_on_error= 1; static my_bool abort_on_error= 1;
static my_bool server_initialized= 0; static my_bool server_initialized= 0;
@ -266,20 +250,19 @@ enum enum_commands {
Q_ENABLE_RESULT_LOG, Q_DISABLE_RESULT_LOG, Q_ENABLE_RESULT_LOG, Q_DISABLE_RESULT_LOG,
Q_WAIT_FOR_SLAVE_TO_STOP, Q_WAIT_FOR_SLAVE_TO_STOP,
Q_ENABLE_WARNINGS, Q_DISABLE_WARNINGS, Q_ENABLE_WARNINGS, Q_DISABLE_WARNINGS,
Q_ENABLE_PS_WARNINGS, Q_DISABLE_PS_WARNINGS,
Q_ENABLE_INFO, Q_DISABLE_INFO, Q_ENABLE_INFO, Q_DISABLE_INFO,
Q_ENABLE_METADATA, Q_DISABLE_METADATA, Q_ENABLE_METADATA, Q_DISABLE_METADATA,
Q_EXEC, Q_DELIMITER, Q_EXEC, Q_DELIMITER,
Q_DISABLE_ABORT_ON_ERROR, Q_ENABLE_ABORT_ON_ERROR, Q_DISABLE_ABORT_ON_ERROR, Q_ENABLE_ABORT_ON_ERROR,
Q_DISPLAY_VERTICAL_RESULTS, Q_DISPLAY_HORIZONTAL_RESULTS, Q_DISPLAY_VERTICAL_RESULTS, Q_DISPLAY_HORIZONTAL_RESULTS,
Q_QUERY_VERTICAL, Q_QUERY_HORIZONTAL, Q_QUERY_VERTICAL, Q_QUERY_HORIZONTAL, Q_QUERY_SORTED,
Q_START_TIMER, Q_END_TIMER, Q_START_TIMER, Q_END_TIMER,
Q_CHARACTER_SET, Q_DISABLE_PS_PROTOCOL, Q_ENABLE_PS_PROTOCOL, Q_CHARACTER_SET, Q_DISABLE_PS_PROTOCOL, Q_ENABLE_PS_PROTOCOL,
Q_DISABLE_RECONNECT, Q_ENABLE_RECONNECT, Q_DISABLE_RECONNECT, Q_ENABLE_RECONNECT,
Q_IF, Q_IF,
Q_DISABLE_PARSING, Q_ENABLE_PARSING, Q_DISABLE_PARSING, Q_ENABLE_PARSING,
Q_REPLACE_REGEX, Q_REMOVE_FILE, Q_FILE_EXIST, Q_REPLACE_REGEX, Q_REMOVE_FILE, Q_FILE_EXIST,
Q_WRITE_FILE, Q_COPY_FILE, Q_PERL, Q_DIE, Q_EXIT, Q_WRITE_FILE, Q_COPY_FILE, Q_PERL, Q_DIE, Q_EXIT, Q_SKIP,
Q_CHMOD_FILE, Q_APPEND_FILE, Q_CAT_FILE, Q_DIFF_FILES, Q_CHMOD_FILE, Q_APPEND_FILE, Q_CAT_FILE, Q_DIFF_FILES,
Q_UNKNOWN, /* Unknown command. */ Q_UNKNOWN, /* Unknown command. */
@ -330,8 +313,6 @@ const char *command_names[]=
"wait_for_slave_to_stop", "wait_for_slave_to_stop",
"enable_warnings", "enable_warnings",
"disable_warnings", "disable_warnings",
"enable_ps_warnings",
"disable_ps_warnings",
"enable_info", "enable_info",
"disable_info", "disable_info",
"enable_metadata", "enable_metadata",
@ -344,6 +325,7 @@ const char *command_names[]=
"horizontal_results", "horizontal_results",
"query_vertical", "query_vertical",
"query_horizontal", "query_horizontal",
"query_sorted",
"start_timer", "start_timer",
"end_timer", "end_timer",
"character_set", "character_set",
@ -361,8 +343,10 @@ const char *command_names[]=
"copy_file", "copy_file",
"perl", "perl",
"die", "die",
/* Don't execute any more commands, compare result */ /* Don't execute any more commands, compare result */
"exit", "exit",
"skip",
"chmod", "chmod",
"append_file", "append_file",
"cat_file", "cat_file",
@ -415,12 +399,10 @@ struct st_command
TYPELIB command_typelib= {array_elements(command_names),"", TYPELIB command_typelib= {array_elements(command_names),"",
command_names, 0}; command_names, 0};
static DYNAMIC_STRING ds_res, ds_progress, ds_warning_messages; DYNAMIC_STRING ds_res, ds_progress, ds_warning_messages;
static DYNAMIC_STRING global_ds_warnings, global_eval_query;
char builtin_echo[FN_REFLEN]; char builtin_echo[FN_REFLEN];
void die(const char *fmt, ...) void die(const char *fmt, ...)
ATTRIBUTE_FORMAT(printf, 1, 2); ATTRIBUTE_FORMAT(printf, 1, 2);
void abort_not_supported_test(const char *fmt, ...) void abort_not_supported_test(const char *fmt, ...)
@ -490,6 +472,7 @@ void replace_dynstr_append_mem(DYNAMIC_STRING *ds, const char *val,
int len); int len);
void replace_dynstr_append(DYNAMIC_STRING *ds, const char *val); void replace_dynstr_append(DYNAMIC_STRING *ds, const char *val);
void replace_dynstr_append_uint(DYNAMIC_STRING *ds, uint val); void replace_dynstr_append_uint(DYNAMIC_STRING *ds, uint val);
void dynstr_append_sorted(DYNAMIC_STRING* ds, DYNAMIC_STRING* ds_input);
void handle_error(struct st_command*, void handle_error(struct st_command*,
unsigned int err_errno, const char *err_error, unsigned int err_errno, const char *err_error,
@ -797,9 +780,6 @@ void free_used_memory()
dynstr_free(&ds_res); dynstr_free(&ds_res);
dynstr_free(&ds_progress); dynstr_free(&ds_progress);
dynstr_free(&ds_warning_messages); dynstr_free(&ds_warning_messages);
dynstr_free(&global_ds_warnings);
dynstr_free(&global_eval_query);
free_all_replace(); free_all_replace();
my_free(opt_pass,MYF(MY_ALLOW_ZERO_PTR)); my_free(opt_pass,MYF(MY_ALLOW_ZERO_PTR));
free_defaults(default_argv); free_defaults(default_argv);
@ -818,27 +798,66 @@ void free_used_memory()
} }
static void cleanup_and_exit(int exit_code)
{
free_used_memory();
my_end(MY_CHECK_ERROR);
if (!silent)
{
switch (exit_code)
{
case 1:
printf("not ok\n");
break;
case 0:
printf("ok\n");
break;
case 62:
printf("skipped\n");
break;
default:
printf("unknown exit code: %d\n", exit_code);
DBUG_ASSERT(0);
}
}
exit(exit_code);
}
void die(const char *fmt, ...) void die(const char *fmt, ...)
{ {
static int dying= 0;
va_list args; va_list args;
DBUG_ENTER("die"); DBUG_ENTER("die");
DBUG_PRINT("enter", ("start_lineno: %d", start_lineno)); DBUG_PRINT("enter", ("start_lineno: %d", start_lineno));
/*
Protect against dying twice
first time 'die' is called, try to write log files
second time, just exit
*/
if (dying)
cleanup_and_exit(1);
dying= 1;
/* Print the error message */ /* Print the error message */
va_start(args, fmt); fprintf(stderr, "mysqltest: ");
if (cur_file && cur_file != file_stack)
fprintf(stderr, "In included file \"%s\": ",
cur_file->file_name);
if (start_lineno > 0)
fprintf(stderr, "At line %u: ", start_lineno);
if (fmt) if (fmt)
{ {
fprintf(stderr, "mysqltest: "); va_start(args, fmt);
if (cur_file && cur_file != file_stack)
fprintf(stderr, "In included file \"%s\": ",
cur_file->file_name);
if (start_lineno > 0)
fprintf(stderr, "At line %u: ", start_lineno);
vfprintf(stderr, fmt, args); vfprintf(stderr, fmt, args);
fprintf(stderr, "\n"); va_end(args);
fflush(stderr);
} }
va_end(args); else
fprintf(stderr, "unknown error");
fprintf(stderr, "\n");
fflush(stderr);
/* Dump the result that has been accumulated so far to .log file */ /* Dump the result that has been accumulated so far to .log file */
if (result_file_name && ds_res.length) if (result_file_name && ds_res.length)
@ -848,14 +867,7 @@ void die(const char *fmt, ...)
if (result_file_name && ds_warning_messages.length) if (result_file_name && ds_warning_messages.length)
dump_warning_messages(); dump_warning_messages();
/* Clean up and exit */ cleanup_and_exit(1);
free_used_memory();
my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : MY_CHECK_ERROR);
if (!silent)
printf("not ok\n");
exit(1);
} }
@ -888,14 +900,7 @@ void abort_not_supported_test(const char *fmt, ...)
} }
va_end(args); va_end(args);
/* Clean up and exit */ cleanup_and_exit(62);
free_used_memory();
my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : MY_CHECK_ERROR);
if (!silent)
printf("skipped\n");
exit(62);
} }
@ -1308,23 +1313,31 @@ void var_set(const char *var_name, const char *var_name_end,
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
void var_set_string(const char* name, const char* value)
{
var_set(name, name + strlen(name), value, value + strlen(value));
}
void var_set_int(const char* name, int value)
{
char buf[21];
my_snprintf(buf, sizeof(buf), "%d", value);
var_set_string(name, buf);
}
/* /*
Store an integer (typically the returncode of the last SQL) Store an integer (typically the returncode of the last SQL)
statement in the mysqltest builtin variable $mysql_errno, by statement in the mysqltest builtin variable $mysql_errno
simulating of a user statement "let $mysql_errno= <integer>"
*/ */
void var_set_errno(int sql_errno) void var_set_errno(int sql_errno)
{ {
/* TODO MASV make easier */ var_set_int("$mysql_errno", sql_errno);
const char *var_name= "$mysql_errno";
char var_val[21];
uint length= my_sprintf(var_val, (var_val, "%d", sql_errno));
var_set(var_name, var_name + 12, var_val, var_val + length);
return;
} }
/* /*
Set variable from the result of a query Set variable from the result of a query
@ -1355,6 +1368,7 @@ void var_query_set(VAR *var, const char *query, const char** query_end)
MYSQL_RES *res; MYSQL_RES *res;
MYSQL_ROW row; MYSQL_ROW row;
MYSQL* mysql = &cur_con->mysql; MYSQL* mysql = &cur_con->mysql;
DYNAMIC_STRING ds_query;
DBUG_ENTER("var_query_set"); DBUG_ENTER("var_query_set");
LINT_INIT(res); LINT_INIT(res);
@ -1364,13 +1378,17 @@ void var_query_set(VAR *var, const char *query, const char** query_end)
die("Syntax error in query, missing '`'"); die("Syntax error in query, missing '`'");
++query; ++query;
if (mysql_real_query(mysql, query, (int)(end - query)) || /* Eval the query, thus replacing all environment variables */
init_dynamic_string(&ds_query, 0, (end - query) + 32, 256);
do_eval(&ds_query, query, end, FALSE);
if (mysql_real_query(mysql, ds_query.str, ds_query.length) ||
!(res = mysql_store_result(mysql))) !(res = mysql_store_result(mysql)))
{ {
*end = 0; die("Error running query '%s': %d %s", ds_query.str,
die("Error running query '%s': %d %s", query,
mysql_errno(mysql), mysql_error(mysql)); mysql_errno(mysql), mysql_error(mysql));
} }
dynstr_free(&ds_query);
if ((row = mysql_fetch_row(res)) && row[0]) if ((row = mysql_fetch_row(res)) && row[0])
{ {
@ -2501,17 +2519,20 @@ wait_for_position:
if (!(res= mysql_store_result(mysql))) if (!(res= mysql_store_result(mysql)))
die("mysql_store_result() returned NULL for '%s'", query_buf); die("mysql_store_result() returned NULL for '%s'", query_buf);
if (!(row= mysql_fetch_row(res))) if (!(row= mysql_fetch_row(res)))
{
mysql_free_result(res);
die("empty result in %s", query_buf); die("empty result in %s", query_buf);
}
if (!row[0]) if (!row[0])
{ {
/* /*
It may be that the slave SQL thread has not started yet, though START It may be that the slave SQL thread has not started yet, though START
SLAVE has been issued ? SLAVE has been issued ?
*/ */
mysql_free_result(res);
if (tries++ == 30) if (tries++ == 30)
die("could not sync with master ('%s' returned NULL)", query_buf); die("could not sync with master ('%s' returned NULL)", query_buf);
sleep(1); /* So at most we will wait 30 seconds and make 31 tries */ sleep(1); /* So at most we will wait 30 seconds and make 31 tries */
mysql_free_result(res);
goto wait_for_position; goto wait_for_position;
} }
mysql_free_result(res); mysql_free_result(res);
@ -2552,6 +2573,7 @@ int do_save_master_pos()
MYSQL *mysql = &cur_con->mysql; MYSQL *mysql = &cur_con->mysql;
const char *query; const char *query;
int rpl_parse; int rpl_parse;
DBUG_ENTER("do_save_master_pos");
rpl_parse = mysql_rpl_parse_enabled(mysql); rpl_parse = mysql_rpl_parse_enabled(mysql);
mysql_disable_rpl_parse(mysql); mysql_disable_rpl_parse(mysql);
@ -2576,7 +2598,7 @@ int do_save_master_pos()
if (have_ndbcluster) if (have_ndbcluster)
{ {
ulonglong start_epoch= 0, applied_epoch= 0, ulonglong start_epoch= 0, handled_epoch= 0,
latest_epoch=0, latest_trans_epoch=0, latest_epoch=0, latest_trans_epoch=0,
latest_handled_binlog_epoch= 0, latest_received_binlog_epoch= 0, latest_handled_binlog_epoch= 0, latest_received_binlog_epoch= 0,
latest_applied_binlog_epoch= 0; latest_applied_binlog_epoch= 0;
@ -2679,9 +2701,9 @@ int do_save_master_pos()
if (!row) if (!row)
die("result does not contain '%s' in '%s'", die("result does not contain '%s' in '%s'",
binlog, query); binlog, query);
if (latest_applied_binlog_epoch > applied_epoch) if (latest_handled_binlog_epoch > handled_epoch)
count= 0; count= 0;
applied_epoch= latest_applied_binlog_epoch; handled_epoch= latest_handled_binlog_epoch;
count++; count++;
if (latest_handled_binlog_epoch >= start_epoch) if (latest_handled_binlog_epoch >= start_epoch)
do_continue= 0; do_continue= 0;
@ -2709,7 +2731,7 @@ int do_save_master_pos()
if (rpl_parse) if (rpl_parse)
mysql_enable_rpl_parse(mysql); mysql_enable_rpl_parse(mysql);
return 0; DBUG_RETURN(0);
} }
@ -3164,7 +3186,7 @@ struct st_connection * find_connection_by_name(const char *name)
int select_connection_name(const char *name) int select_connection_name(const char *name)
{ {
DBUG_ENTER("select_connection2"); DBUG_ENTER("select_connection_name");
DBUG_PRINT("enter",("name: '%s'", name)); DBUG_PRINT("enter",("name: '%s'", name));
if (!(cur_con= find_connection_by_name(name))) if (!(cur_con= find_connection_by_name(name)))
@ -3187,7 +3209,7 @@ int select_connection(struct st_command *command)
if (*p) if (*p)
*p++= 0; *p++= 0;
command->last_argument= p; command->last_argument= p;
return select_connection_name(name); DBUG_RETURN(select_connection_name(name));
} }
@ -3543,7 +3565,7 @@ void do_connect(struct st_command *command)
opt_ssl_capath, opt_ssl_cipher); opt_ssl_capath, opt_ssl_cipher);
#if MYSQL_VERSION_ID >= 50000 #if MYSQL_VERSION_ID >= 50000
/* Turn on ssl_verify_server_cert only if host is "localhost" */ /* Turn on ssl_verify_server_cert only if host is "localhost" */
opt_ssl_verify_server_cert= !strcmp(ds_connection_name.str, "localhost"); opt_ssl_verify_server_cert= !strcmp(ds_host.str, "localhost");
mysql_options(&next_con->mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, mysql_options(&next_con->mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
&opt_ssl_verify_server_cert); &opt_ssl_verify_server_cert);
#endif #endif
@ -4235,8 +4257,6 @@ static struct my_option my_long_options[] =
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif #endif
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (gptr*) &info_flag,
(gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", (gptr*) &opt_host, (gptr*) &opt_host, 0, {"host", 'h', "Connect to host.", (gptr*) &opt_host, (gptr*) &opt_host, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"include", 'i', "Include SQL before each test case.", (gptr*) &opt_include, {"include", 'i', "Include SQL before each test case.", (gptr*) &opt_include,
@ -4244,7 +4264,7 @@ static struct my_option my_long_options[] =
{"logdir", OPT_LOG_DIR, "Directory for log files", (gptr*) &opt_logdir, {"logdir", OPT_LOG_DIR, "Directory for log files", (gptr*) &opt_logdir,
(gptr*) &opt_logdir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, (gptr*) &opt_logdir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"mark-progress", OPT_MARK_PROGRESS, {"mark-progress", OPT_MARK_PROGRESS,
"Write linenumber and elapsed time to <testname>.progress", "Write linenumber and elapsed time to <testname>.progress ",
(gptr*) &opt_mark_progress, (gptr*) &opt_mark_progress, 0, (gptr*) &opt_mark_progress, (gptr*) &opt_mark_progress, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"max-connect-retries", OPT_MAX_CONNECT_RETRIES, {"max-connect-retries", OPT_MAX_CONNECT_RETRIES,
@ -4546,17 +4566,18 @@ void dump_result_to_log_file(char *buf, int size)
{ {
char log_file[FN_REFLEN]; char log_file[FN_REFLEN];
str_to_file(fn_format(log_file, result_file_name, opt_logdir, ".log", str_to_file(fn_format(log_file, result_file_name, opt_logdir, ".log",
*opt_logdir ? MY_REPLACE_DIR | MY_REPLACE_EXT: *opt_logdir ? MY_REPLACE_DIR | MY_REPLACE_EXT :
MY_REPLACE_EXT), MY_REPLACE_EXT),
buf, size); buf, size);
} }
void dump_progress(void) void dump_progress(void)
{ {
char log_file[FN_REFLEN]; char progress_file[FN_REFLEN];
str_to_file(fn_format(log_file, result_file_name, opt_logdir, ".progress", str_to_file(fn_format(progress_file, result_file_name,
*opt_logdir ? MY_REPLACE_DIR | MY_REPLACE_EXT: opt_logdir, ".progress",
MY_REPLACE_EXT), *opt_logdir ? MY_REPLACE_DIR | MY_REPLACE_EXT :
MY_REPLACE_EXT),
ds_progress.str, ds_progress.length); ds_progress.str, ds_progress.length);
} }
@ -4564,7 +4585,8 @@ void dump_warning_messages(void)
{ {
char warn_file[FN_REFLEN]; char warn_file[FN_REFLEN];
str_to_file(fn_format(warn_file, result_file_name, "", ".warnings", str_to_file(fn_format(warn_file, result_file_name, opt_logdir, ".warnings",
*opt_logdir ? MY_REPLACE_DIR | MY_REPLACE_EXT :
MY_REPLACE_EXT), MY_REPLACE_EXT),
ds_warning_messages.str, ds_warning_messages.length); ds_warning_messages.str, ds_warning_messages.length);
} }
@ -5517,7 +5539,11 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
{ {
MYSQL *mysql= &cn->mysql; MYSQL *mysql= &cn->mysql;
DYNAMIC_STRING *ds; DYNAMIC_STRING *ds;
DYNAMIC_STRING *save_ds= NULL;
DYNAMIC_STRING ds_result; DYNAMIC_STRING ds_result;
DYNAMIC_STRING ds_sorted;
DYNAMIC_STRING ds_warnings;
DYNAMIC_STRING eval_query;
char *query; char *query;
int query_len; int query_len;
my_bool view_created= 0, sp_created= 0; my_bool view_created= 0, sp_created= 0;
@ -5525,7 +5551,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
(flags & QUERY_REAP_FLAG)); (flags & QUERY_REAP_FLAG));
DBUG_ENTER("run_query"); DBUG_ENTER("run_query");
init_dynamic_string(&global_ds_warnings, NULL, 0, 256); init_dynamic_string(&ds_warnings, NULL, 0, 256);
/* Scan for warning before sendign to server */ /* Scan for warning before sendign to server */
scan_command_for_warnings(command); scan_command_for_warnings(command);
@ -5535,10 +5561,10 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
*/ */
if (command->type == Q_EVAL) if (command->type == Q_EVAL)
{ {
init_dynamic_string(&global_eval_query, "", command->query_len+256, 1024); init_dynamic_string(&eval_query, "", command->query_len+256, 1024);
do_eval(&global_eval_query, command->query, command->end, FALSE); do_eval(&eval_query, command->query, command->end, FALSE);
query = global_eval_query.str; query = eval_query.str;
query_len = global_eval_query.length; query_len = eval_query.length;
} }
else else
{ {
@ -5610,7 +5636,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
Collect warnings from create of the view that should otherwise Collect warnings from create of the view that should otherwise
have been produced when the SELECT was executed have been produced when the SELECT was executed
*/ */
append_warnings(&global_ds_warnings, cur_con->util_mysql); append_warnings(&ds_warnings, cur_con->util_mysql);
} }
dynstr_free(&query_str); dynstr_free(&query_str);
@ -5657,6 +5683,18 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
dynstr_free(&query_str); dynstr_free(&query_str);
} }
if (display_result_sorted)
{
/*
Collect the query output in a separate string
that can be sorted before it's added to the
global result string
*/
init_dynamic_string(&ds_sorted, "", 1024, 1024);
save_ds= ds; /* Remember original ds */
ds= &ds_sorted;
}
/* /*
Find out how to run this query Find out how to run this query
@ -5669,10 +5707,18 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
if (ps_protocol_enabled && if (ps_protocol_enabled &&
complete_query && complete_query &&
match_re(&ps_re, query)) match_re(&ps_re, query))
run_query_stmt(mysql, command, query, query_len, ds, &global_ds_warnings); run_query_stmt(mysql, command, query, query_len, ds, &ds_warnings);
else else
run_query_normal(cn, command, flags, query, query_len, run_query_normal(cn, command, flags, query, query_len,
ds, &global_ds_warnings); ds, &ds_warnings);
if (display_result_sorted)
{
/* Sort the result set and append it to result */
dynstr_append_sorted(save_ds, &ds_sorted);
ds= save_ds;
dynstr_free(&ds_sorted);
}
if (sp_created) if (sp_created)
{ {
@ -5696,11 +5742,11 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
check_require(ds, command->require_file); check_require(ds, command->require_file);
} }
dynstr_free(&global_ds_warnings); dynstr_free(&ds_warnings);
if (ds == &ds_result) if (ds == &ds_result)
dynstr_free(&ds_result); dynstr_free(&ds_result);
if (command->type == Q_EVAL) if (command->type == Q_EVAL)
dynstr_free(&global_eval_query); dynstr_free(&eval_query);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
@ -5961,6 +6007,8 @@ int main(int argc, char **argv)
1024, 0, 0, get_var_key, var_free, MYF(0))) 1024, 0, 0, get_var_key, var_free, MYF(0)))
die("Variable hash initialization failed"); die("Variable hash initialization failed");
var_set_string("$MYSQL_SERVER_VERSION", MYSQL_SERVER_VERSION);
memset(&master_pos, 0, sizeof(master_pos)); memset(&master_pos, 0, sizeof(master_pos));
parser.current_line= parser.read_lines= 0; parser.current_line= parser.read_lines= 0;
@ -6015,15 +6063,13 @@ int main(int argc, char **argv)
#ifdef HAVE_OPENSSL #ifdef HAVE_OPENSSL
#if MYSQL_VERSION_ID >= 50000
opt_ssl_verify_server_cert= TRUE; /* Always on in mysqltest */
#endif
if (opt_use_ssl) if (opt_use_ssl)
{ {
mysql_ssl_set(&cur_con->mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca, mysql_ssl_set(&cur_con->mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
opt_ssl_capath, opt_ssl_cipher); opt_ssl_capath, opt_ssl_cipher);
#if MYSQL_VERSION_ID >= 50000 #if MYSQL_VERSION_ID >= 50000
/* Turn on ssl_verify_server_cert only if host is "localhost" */
opt_ssl_verify_server_cert= opt_host && !strcmp(opt_host, "localhost");
mysql_options(&cur_con->mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, mysql_options(&cur_con->mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
&opt_ssl_verify_server_cert); &opt_ssl_verify_server_cert);
#endif #endif
@ -6088,8 +6134,6 @@ int main(int argc, char **argv)
case Q_DISABLE_RESULT_LOG: disable_result_log=1; break; case Q_DISABLE_RESULT_LOG: disable_result_log=1; break;
case Q_ENABLE_WARNINGS: disable_warnings=0; break; case Q_ENABLE_WARNINGS: disable_warnings=0; break;
case Q_DISABLE_WARNINGS: disable_warnings=1; break; case Q_DISABLE_WARNINGS: disable_warnings=1; break;
case Q_ENABLE_PS_WARNINGS: disable_ps_warnings=0; break;
case Q_DISABLE_PS_WARNINGS: disable_ps_warnings=1; break;
case Q_ENABLE_INFO: disable_info=0; break; case Q_ENABLE_INFO: disable_info=0; break;
case Q_DISABLE_INFO: disable_info=1; break; case Q_DISABLE_INFO: disable_info=1; break;
case Q_ENABLE_METADATA: display_metadata=1; break; case Q_ENABLE_METADATA: display_metadata=1; break;
@ -6124,37 +6168,24 @@ int main(int argc, char **argv)
case Q_EVAL_RESULT: case Q_EVAL_RESULT:
eval_result = 1; break; eval_result = 1; break;
case Q_EVAL: case Q_EVAL:
case Q_QUERY_VERTICAL:
case Q_QUERY_HORIZONTAL:
case Q_QUERY_SORTED:
if (command->query == command->query_buf) if (command->query == command->query_buf)
{ {
/* Skip the first part of command, i.e query_xxx */
command->query= command->first_argument; command->query= command->first_argument;
command->first_word_len= 0; command->first_word_len= 0;
} }
/* fall through */ /* fall through */
case Q_QUERY_VERTICAL:
case Q_QUERY_HORIZONTAL:
{
my_bool old_display_result_vertically= display_result_vertically;
/* Remove "query_*" if this is first iteration */
if (command->query == command->query_buf)
command->query= command->first_argument;
display_result_vertically= (command->type == Q_QUERY_VERTICAL);
if (save_file[0])
{
strmake(command->require_file, save_file, sizeof(save_file));
save_file[0]= 0;
}
run_query(cur_con, command, QUERY_REAP_FLAG|QUERY_SEND_FLAG);
display_result_vertically= old_display_result_vertically;
command->last_argument= command->end;
command_executed++;
break;
}
case Q_QUERY: case Q_QUERY:
case Q_REAP: case Q_REAP:
{ {
int flags; my_bool old_display_result_vertically= display_result_vertically;
my_bool old_display_result_sorted= display_result_sorted;
/* Default is full query, both reap and send */
int flags= QUERY_REAP_FLAG | QUERY_SEND_FLAG;
if (q_send_flag) if (q_send_flag)
{ {
/* Last command was an empty 'send' */ /* Last command was an empty 'send' */
@ -6165,11 +6196,10 @@ int main(int argc, char **argv)
{ {
flags= QUERY_REAP_FLAG; flags= QUERY_REAP_FLAG;
} }
else
{ /* Check for special property for this query */
/* full query, both reap and send */ display_result_vertically|= (command->type == Q_QUERY_VERTICAL);
flags= QUERY_REAP_FLAG | QUERY_SEND_FLAG; display_result_sorted= (command->type == Q_QUERY_SORTED);
}
if (save_file[0]) if (save_file[0])
{ {
@ -6179,6 +6209,11 @@ int main(int argc, char **argv)
run_query(cur_con, command, flags); run_query(cur_con, command, flags);
command_executed++; command_executed++;
command->last_argument= command->end; command->last_argument= command->end;
/* Restore settings */
display_result_vertically= old_display_result_vertically;
display_result_sorted= old_display_result_sorted;
break; break;
} }
case Q_SEND: case Q_SEND:
@ -6294,6 +6329,9 @@ int main(int argc, char **argv)
/* Stop processing any more commands */ /* Stop processing any more commands */
abort_flag= 1; abort_flag= 1;
break; break;
case Q_SKIP:
abort_not_supported_test("%s", command->first_argument);
break;
case Q_RESULT: case Q_RESULT:
die("result, deprecated command"); die("result, deprecated command");
@ -6405,14 +6443,9 @@ int main(int argc, char **argv)
dump_warning_messages(); dump_warning_messages();
timer_output(); timer_output();
free_used_memory();
my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : MY_CHECK_ERROR);
/* Yes, if we got this far the test has suceeded! Sakila smiles */ /* Yes, if we got this far the test has suceeded! Sakila smiles */
if (!silent) cleanup_and_exit(0);
printf("ok\n"); return 0; /* Keep compiler happy too */
exit(0);
return 0; /* Keep compiler happy */
} }
@ -7066,7 +7099,7 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern,
if (back_ref_num >= 0 && back_ref_num <= (int)r.re_nsub) if (back_ref_num >= 0 && back_ref_num <= (int)r.re_nsub)
{ {
regoff_t start_off, end_off; regoff_t start_off, end_off;
if ((start_off= subs[back_ref_num].rm_so) > -1 && if ((start_off=subs[back_ref_num].rm_so) > -1 &&
(end_off=subs[back_ref_num].rm_eo) > -1) (end_off=subs[back_ref_num].rm_eo) > -1)
{ {
int block_len= (int) (end_off - start_off); int block_len= (int) (end_off - start_off);
@ -7791,3 +7824,73 @@ void replace_dynstr_append_uint(DYNAMIC_STRING *ds, uint val)
char *end= longlong10_to_str(val, buff, 10); char *end= longlong10_to_str(val, buff, 10);
replace_dynstr_append_mem(ds, buff, end - buff); replace_dynstr_append_mem(ds, buff, end - buff);
} }
/*
Build a list of pointer to each line in ds_input, sort
the list and use the sorted list to append the strings
sorted to the output ds
SYNOPSIS
dynstr_append_sorted
ds - string where the sorted output will be appended
ds_input - string to be sorted
*/
static int comp_lines(const char **a, const char **b)
{
return (strcmp(*a,*b));
}
void dynstr_append_sorted(DYNAMIC_STRING* ds, DYNAMIC_STRING *ds_input)
{
unsigned i;
char *start= ds_input->str;
DYNAMIC_ARRAY lines;
DBUG_ENTER("dynstr_append_sorted");
if (!*start)
DBUG_VOID_RETURN; /* No input */
my_init_dynamic_array(&lines, sizeof(const char*), 32, 32);
/* First line is result header, skip past it */
while (*start && *start != '\n')
start++;
start++; /* Skip past \n */
dynstr_append_mem(ds, ds_input->str, start - ds_input->str);
/* Insert line(s) in array */
while (*start)
{
char* line_end= (char*)start;
/* Find end of line */
while (*line_end && *line_end != '\n')
line_end++;
*line_end= 0;
/* Insert pointer to the line in array */
if (insert_dynamic(&lines, (gptr) &start))
die("Out of memory inserting lines to sort");
start= line_end+1;
}
/* Sort array */
qsort(lines.buffer, lines.elements,
sizeof(char**), (qsort_cmp)comp_lines);
/* Create new result */
for (i= 0; i < lines.elements ; i++)
{
const char **line= dynamic_element(&lines, i, const char**);
dynstr_append(ds, *line);
dynstr_append(ds, "\n");
}
delete_dynamic(&lines);
DBUG_VOID_RETURN;
}

View File

@ -429,3 +429,16 @@ then
else else
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
fi fi
# Shall we build experimental collations
AC_ARG_WITH(experimental-collations,
[],
[with_exp_coll=$withval],
[with_exp_coll=no]
)
if test "$with_exp_coll" = "yes"
then
AC_DEFINE([HAVE_UTF8_GENERAL_CS], [1], [certain Japanese customer])
fi

View File

@ -663,3 +663,27 @@ esac
AC_SUBST(AR) AC_SUBST(AR)
AC_SUBST(ARFLAGS) AC_SUBST(ARFLAGS)
]) ])
dnl
dnl Macro to check time_t range: according to C standard
dnl array index must be greater than 0 => if time_t is signed,
dnl the code in the macros below won't compile.
dnl
AC_DEFUN([MYSQL_CHECK_TIME_T],[
AC_MSG_CHECKING(if time_t is unsigned)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[
#include <time.h>
]],
[[
int array[(((time_t)-1) > 0) ? 1 : -1];
]] )
], [
AC_DEFINE([TIME_T_UNSIGNED], 1, [Define to 1 if time_t is unsigned])
AC_MSG_RESULT(yes)
],
[AC_MSG_RESULT(no)]
)
])

View File

@ -2,7 +2,7 @@ dnl Define zlib paths to point at bundled zlib
AC_DEFUN([MYSQL_USE_BUNDLED_ZLIB], [ AC_DEFUN([MYSQL_USE_BUNDLED_ZLIB], [
ZLIB_INCLUDES="-I\$(top_srcdir)/zlib" ZLIB_INCLUDES="-I\$(top_srcdir)/zlib"
ZLIB_LIBS="\$(top_builddir)/zlib/libz.la" ZLIB_LIBS="\$(top_builddir)/zlib/libzlt.la"
dnl Omit -L$pkglibdir as it's always in the list of mysql_config deps. dnl Omit -L$pkglibdir as it's always in the list of mysql_config deps.
ZLIB_DEPS="-lz" ZLIB_DEPS="-lz"
zlib_dir="zlib" zlib_dir="zlib"
@ -10,16 +10,25 @@ AC_SUBST([zlib_dir])
mysql_cv_compress="yes" mysql_cv_compress="yes"
]) ])
dnl Auxiliary macro to check for zlib at given path dnl Auxiliary macro to check for zlib at given path.
dnl We are strict with the server, as "archive" engine
dnl needs zlibCompileFlags(), but for client only we
dnl are less strict, and take the zlib we find.
AC_DEFUN([MYSQL_CHECK_ZLIB_DIR], [ AC_DEFUN([MYSQL_CHECK_ZLIB_DIR], [
save_CPPFLAGS="$CPPFLAGS" save_CPPFLAGS="$CPPFLAGS"
save_LIBS="$LIBS" save_LIBS="$LIBS"
CPPFLAGS="$ZLIB_INCLUDES $CPPFLAGS" CPPFLAGS="$ZLIB_INCLUDES $CPPFLAGS"
LIBS="$LIBS $ZLIB_LIBS" LIBS="$LIBS $ZLIB_LIBS"
if test X"$with_server" = Xno
then
zlibsym=zlibVersion
else
zlibsym=zlibCompileFlags
fi
AC_CACHE_VAL([mysql_cv_compress], AC_CACHE_VAL([mysql_cv_compress],
[AC_TRY_LINK([#include <zlib.h>], [AC_TRY_LINK([#include <zlib.h>],
[return zlibCompileFlags();], [return $zlibsym();],
[mysql_cv_compress="yes" [mysql_cv_compress="yes"
AC_MSG_RESULT([ok])], AC_MSG_RESULT([ok])],
[mysql_cv_compress="no"]) [mysql_cv_compress="no"])

View File

@ -7,7 +7,10 @@ AC_INIT(sql/mysqld.cc)
AC_CANONICAL_SYSTEM AC_CANONICAL_SYSTEM
# The Docs Makefile.am parses this line! # The Docs Makefile.am parses this line!
# remember to also update version.c in ndb # remember to also update version.c in ndb
AM_INIT_AUTOMAKE(mysql, 5.1.17-beta) #
# When changing major version number please also check switch statement
# in mysqlbinlog::check_master_version().
AM_INIT_AUTOMAKE(mysql, 5.1.18-beta)
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
PROTOCOL_VERSION=10 PROTOCOL_VERSION=10
@ -21,7 +24,10 @@ NDB_SHARED_LIB_VERSION=$NDB_SHARED_LIB_MAJOR_VERSION:0:0
# Remember that regexps needs to quote [ and ] since this is run through m4 # Remember that regexps needs to quote [ and ] since this is run through m4
MYSQL_NO_DASH_VERSION=`echo $VERSION | sed -e "s|[[a-z]]*-.*$||"` MYSQL_NO_DASH_VERSION=`echo $VERSION | sed -e "s|[[a-z]]*-.*$||"`
MYSQL_BASE_VERSION=`echo $MYSQL_NO_DASH_VERSION | sed -e "s|\.[[^.]]*$||"` MYSQL_BASE_VERSION=`echo $MYSQL_NO_DASH_VERSION | sed -e "s|\.[[^.]]*$||"`
MYSQL_VERSION_ID=`echo $MYSQL_NO_DASH_VERSION. | sed -e 's/[[^0-9.]]//g; s/\./ /g; s/ \([[0-9]]\) / 0\\1 /g; s/ //g'` MYSQL_VERSION_ID=`echo $MYSQL_NO_DASH_VERSION | sed -e 's|[[^0-9.]].*$||;s|$|.|' | sed -e 's/[[^0-9.]]//g; s/\./ /g; s/ \([[0-9]]\) / 0\\1 /g; s/ //g'`
# Add previous major version for debian package upgrade path
MYSQL_PREVIOUS_BASE_VERSION=5.0
# The port should be constant for a LONG time # The port should be constant for a LONG time
MYSQL_TCP_PORT_DEFAULT=3306 MYSQL_TCP_PORT_DEFAULT=3306
@ -52,6 +58,7 @@ romanian russian serbian slovak spanish swedish ukrainian"
AC_SUBST(MYSQL_NO_DASH_VERSION) AC_SUBST(MYSQL_NO_DASH_VERSION)
AC_SUBST(MYSQL_BASE_VERSION) AC_SUBST(MYSQL_BASE_VERSION)
AC_SUBST(MYSQL_VERSION_ID) AC_SUBST(MYSQL_VERSION_ID)
AC_SUBST(MYSQL_PREVIOUS_BASE_VERSION)
AC_SUBST(PROTOCOL_VERSION) AC_SUBST(PROTOCOL_VERSION)
AC_DEFINE_UNQUOTED([PROTOCOL_VERSION], [$PROTOCOL_VERSION], AC_DEFINE_UNQUOTED([PROTOCOL_VERSION], [$PROTOCOL_VERSION],
[mysql client protocol version]) [mysql client protocol version])
@ -739,8 +746,9 @@ AC_CHECK_FUNC(bind, , AC_CHECK_LIB(bind, bind))
# Check if crypt() exists in libc or libcrypt, sets LIBS if needed # Check if crypt() exists in libc or libcrypt, sets LIBS if needed
AC_SEARCH_LIBS(crypt, crypt, AC_DEFINE(HAVE_CRYPT, 1, [crypt])) AC_SEARCH_LIBS(crypt, crypt, AC_DEFINE(HAVE_CRYPT, 1, [crypt]))
# For sem_xxx functions on Solaris 2.6 # For the sched_yield() function on Solaris
AC_CHECK_FUNC(sem_init, , AC_CHECK_LIB(posix4, sem_init)) AC_CHECK_FUNC(sched_yield, , AC_CHECK_LIB(posix4, sched_yield))
MYSQL_CHECK_ZLIB_WITH_COMPRESS MYSQL_CHECK_ZLIB_WITH_COMPRESS
# For large pages support # For large pages support
@ -2257,11 +2265,10 @@ AC_SUBST(tools_dirs)
#MYSQL_CHECK_CPU #MYSQL_CHECK_CPU
libmysqld_dirs= libmysqld_dirs=
linked_libmysqld_targets=
if test "$with_embedded_server" = "yes" if test "$with_embedded_server" = "yes"
then then
libmysqld_dirs=libmysqld libmysqld_dirs=libmysqld
linked_libmysqld_targets="linked_libmysqld_sources linked_libmysqldex_sources"
AC_CONFIG_FILES(libmysqld/Makefile libmysqld/examples/Makefile) AC_CONFIG_FILES(libmysqld/Makefile libmysqld/examples/Makefile)
# We can't build embedded library without building the server, because # We can't build embedded library without building the server, because
# we depend on libmysys, libmystrings, libmyisam, etc. # we depend on libmysys, libmystrings, libmyisam, etc.
@ -2271,7 +2278,6 @@ fi
# mysql_config --libmysqld-libs will print out something like # mysql_config --libmysqld-libs will print out something like
# -L/path/to/lib/mysql -lmysqld -lmyisam -lmysys -lmystrings -ldbug ... # -L/path/to/lib/mysql -lmysqld -lmyisam -lmysys -lmystrings -ldbug ...
AC_SUBST([libmysqld_dirs]) AC_SUBST([libmysqld_dirs])
AC_SUBST([linked_libmysqld_targets])
# Shall we build the docs? # Shall we build the docs?
AC_ARG_WITH(docs, AC_ARG_WITH(docs,
@ -2295,12 +2301,18 @@ AC_ARG_WITH(man,
[with_man=yes] [with_man=yes]
) )
if test "$with_man" = "yes" if test X"$with_man" = Xyes
then then
man_dirs="man" man_dirs="man"
man1_files=`ls -1 $srcdir/man/*.1 | sed -e 's;^.*man/;;'` if test X"$have_ndbcluster" = Xyes
then
man1_files=`ls $srcdir/man/*.1 | sed -e 's;^.*man/;;'`
man8_files=`ls $srcdir/man/*.8 | sed -e 's;^.*man/;;'`
else
man1_files=`ls $srcdir/man/*.1 | grep -v '/ndb' | sed -e 's;^.*man/;;'`
man8_files=`ls $srcdir/man/*.8 | grep -v '/ndb' | sed -e 's;^.*man/;;'`
fi
man1_files=`echo $man1_files` man1_files=`echo $man1_files`
man8_files=`ls -1 $srcdir/man/*.8 | sed -e 's;^.*man/;;'`
man8_files=`echo $man8_files` man8_files=`echo $man8_files`
else else
man_dirs="" man_dirs=""
@ -2446,7 +2458,6 @@ thread_dirs=
dnl This probably should be cleaned up more - for now the threaded dnl This probably should be cleaned up more - for now the threaded
dnl client is just using plain-old libs. dnl client is just using plain-old libs.
sql_client_dirs= sql_client_dirs=
linked_client_targets="linked_libmysql_sources"
AM_CONDITIONAL(THREAD_SAFE_CLIENT, test "$THREAD_SAFE_CLIENT" != "no") AM_CONDITIONAL(THREAD_SAFE_CLIENT, test "$THREAD_SAFE_CLIENT" != "no")
@ -2455,7 +2466,6 @@ then
sql_client_dirs="strings regex mysys dbug extra libmysql client" sql_client_dirs="strings regex mysys dbug extra libmysql client"
else else
sql_client_dirs="strings regex mysys dbug extra libmysql libmysql_r client" sql_client_dirs="strings regex mysys dbug extra libmysql libmysql_r client"
linked_client_targets="$linked_client_targets linked_libmysql_r_sources"
AC_CONFIG_FILES(libmysql_r/Makefile) AC_CONFIG_FILES(libmysql_r/Makefile)
AC_DEFINE([THREAD_SAFE_CLIENT], [1], [Should the client be thread safe]) AC_DEFINE([THREAD_SAFE_CLIENT], [1], [Should the client be thread safe])
fi fi
@ -2467,18 +2477,14 @@ AC_SUBST(CLIENT_THREAD_LIBS)
AC_SUBST(NON_THREADED_LIBS) AC_SUBST(NON_THREADED_LIBS)
AC_SUBST(STATIC_NSS_FLAGS) AC_SUBST(STATIC_NSS_FLAGS)
AC_SUBST(sql_client_dirs) AC_SUBST(sql_client_dirs)
AC_SUBST(linked_client_targets)
# If configuring for NetWare, set up to link sources from and build the netware directory # If configuring for NetWare, build the netware directory
netware_dir= netware_dir=
linked_netware_sources=
if expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null if expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null
then then
netware_dir="netware" netware_dir="netware"
linked_netware_sources="linked_netware_sources"
fi fi
AC_SUBST(netware_dir) AC_SUBST(netware_dir)
AC_SUBST(linked_netware_sources)
AM_CONDITIONAL(HAVE_NETWARE, test "$netware_dir" = "netware") AM_CONDITIONAL(HAVE_NETWARE, test "$netware_dir" = "netware")
if test "$with_server" != "no" -o "$THREAD_SAFE_CLIENT" != "no" if test "$with_server" != "no" -o "$THREAD_SAFE_CLIENT" != "no"
@ -2549,6 +2555,7 @@ AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl
tests/Makefile Docs/Makefile support-files/Makefile dnl tests/Makefile Docs/Makefile support-files/Makefile dnl
support-files/MacOSX/Makefile support-files/RHEL4-SElinux/Makefile dnl support-files/MacOSX/Makefile support-files/RHEL4-SElinux/Makefile dnl
mysql-test/Makefile dnl mysql-test/Makefile dnl
debian/Makefile debian/defs.mk debian/control dnl
mysql-test/ndb/Makefile netware/Makefile sql-bench/Makefile dnl mysql-test/ndb/Makefile netware/Makefile sql-bench/Makefile dnl
include/mysql_version.h plugin/Makefile win/Makefile) include/mysql_version.h plugin/Makefile win/Makefile)

View File

@ -1995,12 +1995,13 @@ static char *DbugMalloc(size_t size)
/* /*
* strtok lookalike - splits on ':', magically handles :\ and :/ * strtok lookalike - splits on ':', magically handles ::, :\ and :/
*/ */
static const char *DbugStrTok(const char *s) static const char *DbugStrTok(const char *s)
{ {
while (s[0] && (s[0] != ':' || (s[1] == '\\' || s[1] == '/'))) while (s[0] && (s[0] != ':' ||
(s[1] == '\\' || s[1] == '/' || (s[1] == ':' && s++))))
s++; s++;
return s; return s;
} }

View File

@ -908,9 +908,10 @@ via the
.B DBUG_PUSH .B DBUG_PUSH
or or
.B DBUG_SET .B DBUG_SET
macros. Control string consists of colon separate flags. A flag macros. Control string consists of colon separate flags. Colons
may take an argument or a list of arguments. If a control string that are part of ':\\', ':/', or '::' are not considered flag
starts from a '+' sign it works separators. A flag may take an argument or a list of arguments.
If a control string starts from a '+' sign it works
.I incrementally, .I incrementally,
that is, it can modify existing state without overriding it. In such a that is, it can modify existing state without overriding it. In such a
string every flag may be preceded by a '+' or '-' to enable or disable string every flag may be preceded by a '+' or '-' to enable or disable
@ -923,9 +924,7 @@ optional.
.LI a[,file] .LI a[,file]
Redirect the debugger output stream and append it to the specified Redirect the debugger output stream and append it to the specified
file. The default output stream is stderr. A null argument list file. The default output stream is stderr. A null argument list
causes output to be redirected to stdout. A colon that is followed by causes output to be redirected to stdout.
the '\\' or '/' is cosidered a part of the path and not a flag
separator.
.SP 1 .SP 1
EX: \fCa,C:\\tmp\\log\fR EX: \fCa,C:\\tmp\\log\fR
.LI A[,file] .LI A[,file]

118
debian/Makefile.am vendored Normal file
View File

@ -0,0 +1,118 @@
# Copyright (C) 2006 MySQL AB
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
## Process this file with automake to create Makefile.in
EXTRA_DIST = \
mysql-test-BASE.files.in \
libndbclientNLIB-dev.files.in \
mysql-server-BASE.config.in \
libndbclientNLIB.README.Debian.in \
mysql-server-BASE.postrm.in \
mysql-server-BASE.NEWS.in \
libndbclientNLIB.postinst.in \
mysql-server-BASE.links.in \
libndbclientNLIB.files.in \
source.lintian-overrides.in \
mysql-server-BASE.docs.in \
libmysqlclientSLIBoff.files.in \
mysql-server-BASE.files.in \
libndbclientNLIB-dev.links.in \
libmysqlclientSLIBoff.postinst.in \
mysql-extra-BASE.dirs.in \
libmysqlclientSLIB-dev.links.in \
mysql-server-BASE.dirs.in \
libmysqlclientSLIB-dev.examples.in \
mysql-client-BASE.lintian-overrides.in \
copyright.more \
libndbclientNLIB-dev.dirs.in \
mysql-server-BASE.README.Debian.in \
libmysqlclientSLIBoff.docs.in \
compat \
mysql-test-BASE.dirs.in \
libmysqlclientSLIB-dev.files.in \
libmysqlclientSLIBoff.dirs.in \
mysql-server-BASE.logcheck.ignore.server.in \
mysql-storage-BASE.mysql-storage.init.in \
libmysqlclientSLIBoff.README.Debian.in \
mysql-client-BASE.README.Debian.in \
Makefile.am \
mysql-server-BASE.prerm.in \
mysql-common.dirs.in \
defs.mk \
defs.mk.in \
mysql-server-BASE.mysql-server.logrotate.in \
mysql-common.README.Debian.in \
copyright \
mysql-storage-BASE.dirs.in \
mysql-common.preinst.in \
mysql-client-BASE.files.in \
mysql-server-BASE.templates.in \
mysql-tools-BASE.dirs.in \
mysql-management-BASE.mysql-management.init.in \
watch \
mysql-common.postrm.in \
mysql-server-BASE.preinst.in \
README.Maintainer \
mysql-tools-BASE.files.in \
mysql-client-BASE.NEWS.in \
mysql-server-BASE.lintian-overrides.in \
changelog \
mysql-server-BASE.logcheck.ignore.paranoid.in \
mysql-common.files.in \
mysql-server-BASE.logcheck.ignore.workstation.in \
mysql-extra-BASE.files.in \
mysql-management-BASE.files.in \
mysql-client-BASE.docs.in \
libmysqlclientSLIB-dev.README.Maintainer.in \
mysql-storage-BASE.files.in \
additions \
additions/ndb_mgmd.cnf \
additions/mysql-server.lintian-overrides \
additions/my.cnf \
mysql-server-BASE.postinst.in \
libndbclientNLIB.dirs.in \
po \
po/fr.po \
po/sv.po \
po/da.po \
po/es.po \
po/ja.po \
po/tr.po \
po/nb.po \
po/POTFILES.in.in \
po/cs.po \
po/pt.po \
po/gl.po \
po/pt_BR.po \
po/nl.po \
po/templates.pot \
po/de.po \
po/eu.po \
po/ro.po \
po/ru.po \
po/it.po \
po/ca.po \
mysql-client-BASE.dirs.in \
control.in \
libmysqlclientSLIB-dev.dirs.in \
mysql-server-PREV.preinst.in \
mysql-server.preinst.in \
mysql-management-BASE.dirs.in \
rules \
libmysqlclientSLIB-dev.docs.in
# Don't update the files from bitkeeper
%::SCCS/s.%

99
debian/README.Maintainer vendored Normal file
View File

@ -0,0 +1,99 @@
###########################################################################
# Here are some information that are only of interest to the Debiani #
# maintainers of MySQL. #
###########################################################################
#
# Remarks to dependencies
#
libwrap0-dev (>= 7.6-8.3)
According to bug report 114582 where where build problems on
IA-64/sid with at least two prior versions.
psmisc
/usr/bin/killall in the initscript
zlib1g in libmysqlclient-dev:
"mysql_config --libs" adds "-lz"
Build-Dep:
debhelper (>=4.1.16):
See po-debconf(7).
autoconf (>= 2.13-20), automake1.7
Try to get rid of them.
doxygen, tetex-bin, tetex-extra, gs
for ndb/docs/*tex
mysql-server-5.0: Pre-Depends: mysql-common
This was necessary as mysql-server-5.0.preinst checks for unmodified
conffiles from mysql-server-4.1 and copies 5.0 ones over them to avoid
unnecessary dpkg questions. As mysql-server-5.0 is not unpacked at its
pre-inst stage, it had to copy those files from a package that is
definetly already unpacked which does not have to be the case with Depends.
#
# Remarks to the start scripts
#
## initscripts rely on mysqladmin from a different package
We have the problem that "/etc/init.d/mysql stop" relies on mysqladmin which
is in another package (mysql-client) and a passwordless access that's maybe
only available if the user configured his /root/.my.cnf. Can this be a problem?
* normal mode: not because the user is required to have it. Else:
* purge/remove: not, same as normal mode
* upgrade: not, same as normal mode
* first install: not, it depends on mysql-client which at least is unpacked
so mysqladmin is there (to ping). It is not yet configured
passwordles but if there's a server running then there's a
/root/.my.cnf. Anyways, we simply kill anything that's mysqld.
## Passwordless access for the maintainer scripts
Another issue is that the scripts needs passwordless access. To ensure this
a debian-sys-maint user is configured which has process and shutdown privs.
The file with the randomly (that's important!) generated password must be
present as long as the databases remain installed because else a new install
would have no access. This file should be used like:
mysqladmin --defaults-file=/etc/mysql/debian.cnf restart
to avoid providing the password in plaintext on a commandline where it would
be visible to any user via the "ps" command.
## When to start the daemon?
We aim to give the admin full control on when MySQL is running.
Issues to be faced here:
OLD:
1. Debconf asks whether MySQL should be started on boot so update-rc.d is
only run if the answer has been yes. The admin is likely to forget
this decision but update-rc.d checks for an existing line in
/etc/runlevel.conf and leaves it intact.
2. On initial install, if the answer is yes, the daemon has to be started.
3. On upgrades it should only be started if it was already running, everything
else is confusing. Especiall relying on an debconf decision made month ago
is considered suboptimal. See bug #274264
Implementation so far:
prerm (called on upgrade before stopping the server):
check for a running server and set flag if necessary
preinst (called on initial install and before unpacking when upgrading):
check for the debconf variable and set flag if necessary
postinst (called on initial install and after each upgrade after unpacking):
call update-rc.d if debconf says yes
call invoce-rc.d if the flag has been set
Problems remaining:
dpkg-reconfigure and setting mysql start on boot to yes did not start mysql
(ok "start on boot" literally does not mean "start now" so that might have been ok)
NEW:
1. --- no debconf anymore for the sake of simplicity. We have runlevel.conf,
the admin should use it
2. On initial install the server is started.
3. On upgrades the server is started exactly if it was running before so the
runlevel configuration is irrelevant. It will be preserved by the mean of
update-rc.d's builtin check.
Implementation:
prerm (called on upgrade before stopping the server):
check for a running server and set flag if necessary
preinst (called on initial install and before unpacking when upgrading):
check for $1 beeing (initial) "install" and set flag
postinst (called on initial install and after each upgrade after unpacking):
call update-rc.d
call invoce-rc.d if the flag has been set

134
debian/additions/my.cnf vendored Normal file
View File

@ -0,0 +1,134 @@
#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
# Here is entries for some specific programs
# The following values assume you have at least 32M ram
# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/english
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
#
# * Fine Tuning
#
key_buffer = 16M
max_allowed_packet = 16M
thread_stack = 128K
thread_cache_size = 8
#
# * Query Cache Configuration
#
query_cache_limit = 1048576
query_cache_size = 16777216
query_cache_type = 1
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
#log = /var/log/mysql/mysql.log
#
# Error logging goes to syslog. This is a Debian improvement :)
#
# Here you can see queries with especially long duration
#log_slow_queries = /var/log/mysql/mysql-slow.log
#
# The following can be used as easy to replay backup logs or for replication.
#server-id = 1
log_bin = /var/log/mysql/mysql-bin.log
# WARNING: Using expire_logs_days without bin_log crashes the server! See README.Debian!
expire_logs_days = 10
max_binlog_size = 100M
#binlog_do_db = include_database_name
#binlog_ignore_db = include_database_name
#
# * BerkeleyDB
#
# Using BerkeleyDB is now discouraged as its support will cease in 5.1.12.
skip-bdb
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
# You might want to disable InnoDB to shrink the mysqld process by circa 100MB.
#skip-innodb
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem
[mysqldump]
quick
quote-names
max_allowed_packet = 16M
[mysql]
#no-auto-rehash # faster start of mysql but no tab completition
[isamchk]
key_buffer = 16M
#
# * NDB Cluster
#
# See /usr/share/doc/mysql-server-*/README.Debian for more information.
#
# The following configuration is read by the NDB Data Nodes (ndbd processes)
# not from the NDB Management Nodes (ndb_mgmd processes).
#
# [MYSQL_CLUSTER]
# ndb-connectstring=127.0.0.1
#
# * IMPORTANT: Additional settings that can override those from this file!
#
!includedir /etc/mysql/conf.d/

View File

@ -0,0 +1,2 @@
W: mysql-dfsg source: maintainer-script-lacks-debhelper-token debian/mysql-server.postinst
W: mysql-server: possible-bashism-in-maintainer-script postinst:68 'p{("a".."z","A".."Z",0..9)[int(rand(62))]}'

35
debian/additions/ndb_mgmd.cnf vendored Normal file
View File

@ -0,0 +1,35 @@
[NDBD DEFAULT]
NoOfReplicas=2
DataMemory=10MB
IndexMemory=25MB
MaxNoOfTables=256
MaxNoOfOrderedIndexes=256
MaxNoOfUniqueHashIndexes=128
[MYSQLD DEFAULT]
[NDB_MGMD DEFAULT]
[TCP DEFAULT]
[NDB_MGMD]
Id=1 # the NDB Management Node (this one)
HostName=127.0.0.1
[NDBD]
Id=2 # the first NDB Data Node
HostName=127.0.0.1
DataDir= /var/lib/mysql-cluster
[NDBD]
Id=3 # the second NDB Data Node
HostName=127.0.0.1
DataDir=/var/lib/mysql-cluster
[MYSQLD]
Id=4 # the first SQL node
HostName=127.0.0.1
# [MYSQLD]
# Id=5 # the second SQL node
# HostName=127.0.0.10

3281
debian/changelog vendored Normal file

File diff suppressed because it is too large Load Diff

1
debian/compat vendored Normal file
View File

@ -0,0 +1 @@
4

353
debian/control.in vendored Normal file
View File

@ -0,0 +1,353 @@
Source: mysql-@MYSQL_BRANDED_BASE_VERSION@
Section: misc
Priority: optional
Maintainer: Monty Taylor <mtaylor@mysql.com>
Uploaders: Mads Martin Joergensen <mads@mysql.com>, MySQL Build Team <build-private@mysql.com>
Build-Depends: libtool (>= 1.4.2-7), g++ (>= 4:3.3.5-3), procps | hurd, debhelper (>= 4.1.16), file (>= 3.28-1), libncurses5-dev (>= 5.0-6), perl (>= 5.6.0), libwrap0-dev (>= 7.6-8.3), zlib1g-dev (>= 1:1.1.3-5), libreadline5-dev | libreadline-dev, psmisc, po-debconf, chrpath, automake1.8, doxygen, gs, dpatch, gawk, bison
Standards-Version: 3.7.2
Package: libmysqlclient@SHARED_LIB_MAJOR_VERSION@off
Section: libs
Architecture: any
Depends: mysql-common (>= ${Source-Version}), ${shlibs:Depends}
Description: mysql database client library
The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
and robust SQL (Structured Query Language) database server. MySQL Server
is intended for mission-critical, heavy-load production systems as well
as for embedding into mass-deployed software. MySQL is a trademark of
MySQL AB.
.
The MySQL software has Dual Licensing, which means you can use the MySQL
software free of charge under the GNU General Public License
(http://www.gnu.org/licenses/). You can also purchase commercial MySQL
licenses from MySQL AB if you do not wish to be bound by the terms of
the GPL. See the chapter "Licensing and Support" in the manual for
further info.
.
The MySQL web site (http://www.mysql.com/) provides the latest
news and information about the MySQL software. Also please see the
documentation and the manual for more information.
.
This package contains the shared libraries (*.so*) which certain
languages and applications need to dynamically load and use MySQL.
Package: libmysqlclient@SHARED_LIB_MAJOR_VERSION@-dev
Architecture: any
Section: libdevel
Depends: libmysqlclient@SHARED_LIB_MAJOR_VERSION@ (>= ${Source-Version}), zlib1g-dev, ${shlibs:Depends}
Conflicts: libmysqlclient14-dev, libmysqlclient12-dev, libmysqlclient10-dev
Provides: libmysqlclient-dev
Description: mysql database development files
The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
and robust SQL (Structured Query Language) database server. MySQL Server
is intended for mission-critical, heavy-load production systems as well
as for embedding into mass-deployed software. MySQL is a trademark of
MySQL AB.
.
The MySQL software has Dual Licensing, which means you can use the MySQL
software free of charge under the GNU General Public License
(http://www.gnu.org/licenses/). You can also purchase commercial MySQL
licenses from MySQL AB if you do not wish to be bound by the terms of
the GPL. See the chapter "Licensing and Support" in the manual for
further info.
.
The MySQL web site (http://www.mysql.com/) provides the latest
news and information about the MySQL software. Also please see the
documentation and the manual for more information.
.
This package contains the development header files and libraries
necessary to develop MySQL client applications.
Package: libndbclient@NDB_SHARED_LIB_MAJOR_VERSION@
Section: libs
Architecture: any
Depends: mysql-common (>= ${Source-Version}), libmysqlclient@SHARED_LIB_MAJOR_VERSION@, ${shlibs:Depends}
Description: mysql cluster NdbApi library
The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
and robust SQL (Structured Query Language) database server. MySQL Server
is intended for mission-critical, heavy-load production systems as well
as for embedding into mass-deployed software. MySQL is a trademark of
MySQL AB.
.
The MySQL software has Dual Licensing, which means you can use the MySQL
software free of charge under the GNU General Public License
(http://www.gnu.org/licenses/). You can also purchase commercial MySQL
licenses from MySQL AB if you do not wish to be bound by the terms of
the GPL. See the chapter "Licensing and Support" in the manual for
further info.
.
The MySQL web site (http://www.mysql.com/) provides the latest
news and information about the MySQL software. Also please see the
documentation and the manual for more information.
.
This package contains the shared libraries (*.so*) which certain
languages and applications need to dynamically load and use MySQL NdbApi.
Package: libndbclient@NDB_SHARED_LIB_MAJOR_VERSION@-dev
Architecture: any
Section: libdevel
Depends: libndbclient@NDB_SHARED_LIB_MAJOR_VERSION@ (>= ${Source-Version}), zlib1g-dev, ${shlibs:Depends}
Provides: libndbclient-dev
Description: mysql cluster NdbApi development files
The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
and robust SQL (Structured Query Language) database server. MySQL Server
is intended for mission-critical, heavy-load production systems as well
as for embedding into mass-deployed software. MySQL is a trademark of
MySQL AB.
.
The MySQL software has Dual Licensing, which means you can use the MySQL
software free of charge under the GNU General Public License
(http://www.gnu.org/licenses/). You can also purchase commercial MySQL
licenses from MySQL AB if you do not wish to be bound by the terms of
the GPL. See the chapter "Licensing and Support" in the manual for
further info.
.
The MySQL web site (http://www.mysql.com/) provides the latest
news and information about the MySQL software. Also please see the
documentation and the manual for more information.
.
This package contains the development header files and libraries
necessary to develop NdbApi client applications.
Package: mysql-common
Section: misc
Architecture: all
Depends: ${shlibs:Depends}, ${misc:Depends}
Conflicts: mysql-common-@MYSQL_BRANDED_PREVIOUS_BASE_VERSION@
Provides: mysql-common-@MYSQL_BRANDED_PREVIOUS_BASE_VERSION@
Replaces: mysql-common-@MYSQL_BRANDED_PREVIOUS_BASE_VERSION@
Description: mysql database common files (e.g. /etc/mysql/my.cnf)
The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
and robust SQL (Structured Query Language) database server. MySQL Server
is intended for mission-critical, heavy-load production systems as well
as for embedding into mass-deployed software. MySQL is a trademark of
MySQL AB.
.
The MySQL software has Dual Licensing, which means you can use the MySQL
software free of charge under the GNU General Public License
(http://www.gnu.org/licenses/). You can also purchase commercial MySQL
licenses from MySQL AB if you do not wish to be bound by the terms of
the GPL. See the chapter "Licensing and Support" in the manual for
further info.
.
The MySQL web site (http://www.mysql.com/) provides the latest
news and information about the MySQL software. Also please see the
documentation and the manual for more information.
.
This package includes files needed by all versions of the client library.
Package: mysql-client-@MYSQL_BRANDED_BASE_VERSION@
Architecture: any
Depends: debianutils (>=1.6), libdbi-perl, libdbd-mysql-perl (>= 1.2202), mysql-common (>= ${Source-Version}), libmysqlclient@SHARED_LIB_MAJOR_VERSION@ (>= ${Source-Version}), ${perl:Depends}, ${shlibs:Depends}, ${misc:Depends}
Provides: virtual-mysql-client, mysql-client, mysql-client-@MYSQL_BRANDED_PREVIOUS_BASE_VERSION@
Conflicts: mysql-client (<< ${Source-Version}), mysql-client-@MYSQL_BRANDED_PREVIOUS_BASE_VERSION@
Replaces: mysql-client (<< ${Source-Version}), mysql-server, mysql-client-@MYSQL_BRANDED_PREVIOUS_BASE_VERSION@
Description: mysql database client binaries
The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
and robust SQL (Structured Query Language) database server. MySQL Server
is intended for mission-critical, heavy-load production systems as well
as for embedding into mass-deployed software. MySQL is a trademark of
MySQL AB.
.
The MySQL software has Dual Licensing, which means you can use the MySQL
software free of charge under the GNU General Public License
(http://www.gnu.org/licenses/). You can also purchase commercial MySQL
licenses from MySQL AB if you do not wish to be bound by the terms of
the GPL. See the chapter "Licensing and Support" in the manual for
further info.
.
The MySQL web site (http://www.mysql.com/) provides the latest
news and information about the MySQL software. Also please see the
documentation and the manual for more information.
.
This package contains the standard MySQL clients and administration tools.
Package: mysql-server-@MYSQL_BRANDED_BASE_VERSION@
Architecture: any
Suggests: tinyca
Recommends: mailx
Pre-Depends: mysql-common (>= ${Source-Version}), adduser (>= 3.40)
Depends: mysql-client-@MYSQL_BRANDED_BASE_VERSION@ (>= ${Source-Version}), libdbi-perl, perl (>= 5.6), ${shlibs:Depends}, ${misc:Depends}, psmisc, passwd, lsb-base (>= 3.0-10)
Conflicts: mysql-server (<< ${Source-Version}), mysql-server-@MYSQL_BRANDED_PREVIOUS_BASE_VERSION@ (<< 5.0.26-3)
Provides: mysql-server, virtual-mysql-server, mysql-server-@MYSQL_BRANDED_PREVIOUS_BASE_VERSION@
Replaces: mysql-server (<< ${Source-Version}), mysql-server-@MYSQL_BRANDED_PREVIOUS_BASE_VERSION@
Description: mysql database server binaries
The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
and robust SQL (Structured Query Language) database server. MySQL Server
is intended for mission-critical, heavy-load production systems as well
as for embedding into mass-deployed software. MySQL is a trademark of
MySQL AB.
.
The MySQL software has Dual Licensing, which means you can use the MySQL
software free of charge under the GNU General Public License
(http://www.gnu.org/licenses/). You can also purchase commercial MySQL
licenses from MySQL AB if you do not wish to be bound by the terms of
the GPL. See the chapter "Licensing and Support" in the manual for
further info.
.
The MySQL web site (http://www.mysql.com/) provides the latest
news and information about the MySQL software. Also please see the
documentation and the manual for more information.
.
This package includes the MySQL server binary (incl. InnoDB) as well
as related utilities to run and administrate a MySQL server.
.
If you want to access and work with the database, you have to install
package mysql-client-@MYSQL_BRANDED_BASE_VERSION@ as well!
Package: mysql-test-@MYSQL_BRANDED_BASE_VERSION@
Architecture: any
Pre-Depends: mysql-common (>= ${Source-Version})
Depends: mysql-client-@MYSQL_BRANDED_BASE_VERSION@ (>= ${Source-Version}), libdbd-mysql-perl, perl (>= 5.6), ${shlibs:Depends}, ${misc:Depends}
Description: MySQL - test suite
The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
and robust SQL (Structured Query Language) database server. MySQL Server
is intended for mission-critical, heavy-load production systems as well
as for embedding into mass-deployed software. MySQL is a trademark of
MySQL AB.
.
The MySQL software has Dual Licensing, which means you can use the MySQL
software free of charge under the GNU General Public License
(http://www.gnu.org/licenses/). You can also purchase commercial MySQL
licenses from MySQL AB if you do not wish to be bound by the terms of
the GPL. See the chapter "Licensing and Support" in the manual for
further info.
.
The MySQL web site (http://www.mysql.com/) provides the latest
news and information about the MySQL software. Also please see the
documentation and the manual for more information.
.
This package contains the MySQL regression test suite.
Package: mysql-storage-@MYSQL_BRANDED_BASE_VERSION@
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: MySQL - ndbcluster storage engine
The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
and robust SQL (Structured Query Language) database server. MySQL Server
is intended for mission-critical, heavy-load production systems as well
as for embedding into mass-deployed software. MySQL is a trademark of
MySQL AB.
.
The MySQL software has Dual Licensing, which means you can use the MySQL
software free of charge under the GNU General Public License
(http://www.gnu.org/licenses/). You can also purchase commercial MySQL
licenses from MySQL AB if you do not wish to be bound by the terms of
the GPL. See the chapter "Licensing and Support" in the manual for
further info.
.
The MySQL web site (http://www.mysql.com/) provides the latest
news and information about the MySQL software. Also please see the
documentation and the manual for more information.
.
This package contains the ndbcluster storage engine.
It is necessary to have this package installed on all
computers that should store ndbcluster table data.
Note that this storage engine can only be used in conjunction
with the MySQL Max server.
Package: mysql-management-@MYSQL_BRANDED_BASE_VERSION@
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: MySQL - ndbcluster storage engine management
The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
and robust SQL (Structured Query Language) database server. MySQL Server
is intended for mission-critical, heavy-load production systems as well
as for embedding into mass-deployed software. MySQL is a trademark of
MySQL AB.
.
The MySQL software has Dual Licensing, which means you can use the MySQL
software free of charge under the GNU General Public License
(http://www.gnu.org/licenses/). You can also purchase commercial MySQL
licenses from MySQL AB if you do not wish to be bound by the terms of
the GPL. See the chapter "Licensing and Support" in the manual for
further info.
.
The MySQL web site (http://www.mysql.com/) provides the latest
news and information about the MySQL software. Also please see the
documentation and the manual for more information.
.
This package contains ndbcluster storage engine management.
It is necessary to have this package installed on at least
one computer in the cluster.
Package: mysql-tools-@MYSQL_BRANDED_BASE_VERSION@
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: MySQL - ndbcluster storage engine basic tools
The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
and robust SQL (Structured Query Language) database server. MySQL Server
is intended for mission-critical, heavy-load production systems as well
as for embedding into mass-deployed software. MySQL is a trademark of
MySQL AB.
.
The MySQL software has Dual Licensing, which means you can use the MySQL
software free of charge under the GNU General Public License
(http://www.gnu.org/licenses/). You can also purchase commercial MySQL
licenses from MySQL AB if you do not wish to be bound by the terms of
the GPL. See the chapter "Licensing and Support" in the manual for
further info.
.
The MySQL web site (http://www.mysql.com/) provides the latest
news and information about the MySQL software. Also please see the
documentation and the manual for more information.
.
This package contains ndbcluster storage engine basic tools.
Package: mysql-extra-@MYSQL_BRANDED_BASE_VERSION@
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: MySQL - ndbcluster storage engine extra tools
The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
and robust SQL (Structured Query Language) database server. MySQL Server
is intended for mission-critical, heavy-load production systems as well
as for embedding into mass-deployed software. MySQL is a trademark of
MySQL AB.
.
The MySQL software has Dual Licensing, which means you can use the MySQL
software free of charge under the GNU General Public License
(http://www.gnu.org/licenses/). You can also purchase commercial MySQL
licenses from MySQL AB if you do not wish to be bound by the terms of
the GPL. See the chapter "Licensing and Support" in the manual for
further info.
.
The MySQL web site (http://www.mysql.com/) provides the latest
news and information about the MySQL software. Also please see the
documentation and the manual for more information.
.
This package contains some extra ndbcluster storage engine tools for
the advanced user.
.
They should be used with caution
Package: mysql-server-@MYSQL_BRANDED_PREVIOUS_BASE_VERSION@
Architecture: any
Section: oldlibs
Priority: extra
Depends: mysql-server-@MYSQL_BRANDED_BASE_VERSION@
Description: mysql database server (transitional package)
MySQL is a fast, stable and true multi-user, multi-threaded SQL database
server. SQL (Structured Query Language) is the most popular database query
language in the world. The main goals of MySQL are speed, robustness and
ease of use.
.
This is an empty transitional package and can safely be removed.
Package: mysql-server
Architecture: all
Depends: mysql-server-@MYSQL_BRANDED_BASE_VERSION@
Description: mysql database server (meta package depending on the latest version)
This is an empty package that depends on the current "best" version of
mysql-server (currently mysql-server-@MYSQL_BRANDED_BASE_VERSION@), as determined by the MySQL
maintainers. Install this package if in doubt about which MySQL version
you want, as this is the one we consider to be in the best shape.
Package: mysql-client
Architecture: all
Depends: mysql-client-@MYSQL_BRANDED_BASE_VERSION@
Description: mysql database client (meta package depending on the latest version)
This is an empty package that depends on the current "best" version of
mysql-client (currently mysql-client-@MYSQL_BRANDED_BASE_VERSION@), as determined by the MySQL
maintainers. Install this package if in doubt about which MySQL version
you want, as this is the one we consider to be in the best shape.

139
debian/copyright vendored Normal file
View File

@ -0,0 +1,139 @@
The Debian package of MySQL was first debianzed on 1997-04-12 by Christian
Schwarz <schwarz@debian.org> and ist maintained since 1999-04-20 by
Christian Hammers <ch@debian.org>.
It can be downloaded from http://www.mysql.com/
Copyright:
According to the file "COPYING" all parts of this package are licenced
under the terms of the GNU GPL Version 2 of which a copy is available
in /usr/share/common-licenses.
To allow free software with other licences than the GPL to link against the
shared library, special terms for "derived works" are defined in the file
"EXCEPTIONS-CLIENT" which is quoted below.
More information can be found on http://www.mysql.com/company/legal/licensing/
The manual had to be removed as it is not free in the sense of the
Debian Free Software Guidelines (DFSG).
-------------------------------------------------------------------------
Appendix I MySQL FLOSS License Exception
****************************************
Version 0.3, 10 February 2005
The MySQL AB Exception for Free/Libre and Open Source Software-only
Applications Using MySQL Client Libraries (the "FLOSS Exception").
Exception Intent
================
We want specified Free/Libre and Open Source Software ("FLOSS")
applications to be able to use specified GPL-licensed MySQL client
libraries (the "Program") despite the fact that not all FLOSS licenses
are compatible with version 2 of the GNU General Public License (the
"GPL").
Legal Terms and Conditions
==========================
As a special exception to the terms and conditions of version 2.0 of the
GPL:
1. You are free to distribute a Derivative Work that is formed
entirely from the Program and one or more works (each, a "FLOSS
Work") licensed under one or more of the licenses listed below in
section 1, as long as:
a. You obey the GPL in all respects for the Program and the
Derivative Work, except for identifiable sections of the
Derivative Work which are not derived from the Program, and
which can reasonably be considered independent and separate
works in themselves,
b. all identifiable sections of the Derivative Work which are not
derived from the Program, and which can reasonably be
considered independent and separate works in themselves,
i
are distributed subject to one of the FLOSS licenses
listed below, and
ii
the object code or executable form of those sections are
accompanied by the complete corresponding
machine-readable source code for those sections on the
same medium and under the same FLOSS license as the
corresponding object code or executable forms of those
sections, and
c. any works which are aggregated with the Program or with a
Derivative Work on a volume of a storage or distribution
medium in accordance with the GPL, can reasonably be
considered independent and separate works in themselves which
are not derivatives of either the Program, a Derivative Work
or a FLOSS Work.
If the above conditions are not met, then the Program may only be
copied, modified, distributed or used under the terms and
conditions of the GPL or another valid licensing option from MySQL
AB.
2. FLOSS License List
*License name* *Version(s)/Copyright Date*
Academic Free License 2.0
Apache Software License 1.0/1.1/2.0
Apple Public Source License 2.0
Artistic license From Perl 5.8.0
BSD license "July 22 1999"
Common Public License 1.0
GNU Library or "Lesser" General Public 2.0/2.1
License (LGPL)
Jabber Open Source License 1.0
MIT license -
Mozilla Public License (MPL) 1.0/1.1
Open Software License 2.0
OpenSSL license (with original SSLeay "2003" ("1998")
license)
PHP License 3.0
Python license (CNRI Python License) -
Python Software Foundation License 2.1.1
Sleepycat License "1999"
W3C License "2001"
X11 License "2001"
Zlib/libpng License -
Zope Public License 2.0
Due to the many variants of some of the above licenses, we require
that any version follow the 2003 version of the Free Software
Foundation's Free Software Definition
(`http://www.gnu.org/philosophy/free-sw.html') or version 1.9 of
the Open Source Definition by the Open Source Initiative
(`http://www.opensource.org/docs/definition.php').
3. Definitions
a. Terms used, but not defined, herein shall have the meaning
provided in the GPL.
b. Derivative Work means a derivative work under copyright law.
4. Applicability This FLOSS Exception applies to all Programs that
contain a notice placed by MySQL AB saying that the Program may be
distributed under the terms of this FLOSS Exception. If you
create or distribute a work which is a Derivative Work of both the
Program and any other work licensed under the GPL, then this FLOSS
Exception is not available for that work; thus, you must remove
the FLOSS Exception notice from that work and comply with the GPL
in all respects, including by retaining all GPL notices. You may
choose to redistribute a copy of the Program exclusively under the
terms of the GPL by removing the FLOSS Exception notice from that
copy of the Program, provided that the copy has never been
modified by you or any third party.

60
debian/copyright.more vendored Normal file
View File

@ -0,0 +1,60 @@
#
# Some random bits of interest.
#
#
# Arjen about OpenSSL
#
http://bugs.mysql.com/?id=6924
Updated by: Arjen Lentz
Date: 2005-11-05
Linking with the client library is covered by the FLOSS exception which
includes OpenSSL now. So that's clean. Indeed, the OpenSSL is not
compliant with the FSF free software guidelines, however it *is*
compliant with the OSI guidelines. And that's good enough for us.
Christian is correct in saying that the author of a GPL app that links
with MySQL may find themselves in a licensing headache (or may not
realize that OpenSSL is involved) but that is their responsibility.
The MySQL client can be linked with a number of other licenses, it
would not be feasible for MySQL to take over the responsibility for
"the next level" of how combinations of licenses work out. There are
too many possibilities, and combinations of more just 2 licenses.
#
# Steve Langasek about OpenSSL vs libmysqlclient
#
Subject: Bug#291945: eleventh-hour transition for mysql-using packages related to apache
Date: Sat, 12 Feb 2005 00:39:58 -0800
From: Steve Langasek <vorlon@debian.org>
> > > > that's great to hear! i'm cc'ing the relevant wishlist bug i have open
> > > > against mysql-server. christian: any chance of getting an openssl enabled
> > > > version of the mysql-client and mysql-server packages?
> > > Yes, I will re-enable openssl in the next upload.
> > Please make sure this does not introduce an openssl dependency to
> > libmysqlclient itself; just because MySQL AB have granted a license
> > exception for OpenSSL does not mean everyone who links to libmysqlclient
> > has done so.
> > I know of at least one GPL-without-exception package that is now using
> > libmysqlclient12 in Debian.
> Nice, so we should check that any linked GPL library directly (obviuolsy) or
> indirectly (with N=1,2,3... levels of indirection) linked against
> openssl adds the exception.
No, we should simply not be linking libmysqlclient against OpenSSL. The
exemption was needed because there exists software that uses both
libmysqlclient and libssl, but making libmysqlclient itself use libssl just
because we now have the exemption will cause licensing problems for
applications which currently do *not* depend on libssl.
> This is a great reason to move asap all possible programs to gnutls,
> indeed.
There are plenty of reasons to move software to gnutls, but doing so is
non-trivial.

14
debian/defs.mk.in vendored Normal file
View File

@ -0,0 +1,14 @@
MYSQL_BUILD_OPTS=--with-comment='MySQL Server (custom)' --with-server-suffix='-custom'
MYSQL_BUILD_CXXFLAGS=-DBIG_JOINS=1 -felide-constructors -fno-rtti -O2
MYSQL_BUILD_CFLAGS=-DBIG_JOINS=1 -O2
MYSQL_BUILD_CC=gcc
MYSQL_BUILD_CXX=gcc
# we re-write state into this file. MYSQL_BASE_VERSION might get a suffix added
# by debian/rules which could result in a nasty loop. VER is there to hold the
# original unadorned version from autoconf
MYSQL_BASE_VERSION=@MYSQL_BASE_VERSION@
MYSQL_PREVIOUS_BASE_VERSION=@MYSQL_PREVIOUS_BASE_VERSION@
MYSQL_BRANDED_BASE_VERSION=@MYSQL_BRANDED_BASE_VERSION@
MYSQL_BRANDED_PREVIOUS_BASE_VERSION=@MYSQL_BRANDED_PREVIOUS_BASE_VERSION@
SHARED_LIB_MAJOR_VERSION=@SHARED_LIB_MAJOR_VERSION@
NDB_SHARED_LIB_MAJOR_VERSION=@NDB_SHARED_LIB_MAJOR_VERSION@

View File

@ -0,0 +1,4 @@
The examples directory includes files that might be needed by some
developers:
- header files not installed by default
- the example file udf_example.cc

2
debian/libmysqlclientSLIB-dev.dirs.in vendored Normal file
View File

@ -0,0 +1,2 @@
usr/include/
usr/lib/

1
debian/libmysqlclientSLIB-dev.docs.in vendored Normal file
View File

@ -0,0 +1 @@
EXCEPTIONS-CLIENT

View File

@ -0,0 +1 @@
sql/udf_example.c

View File

@ -0,0 +1,6 @@
usr/bin/mysql_config
usr/include/*
usr/lib/libmysqlclient.a
usr/lib/libmysqlclient.la
usr/lib/mysql
usr/share/man/man1/mysql_config.1

View File

@ -0,0 +1,2 @@
usr/lib/libmysqlclient.so.15 usr/lib/libmysqlclient.so
usr/lib/libmysqlclient_r.so.15 usr/lib/libmysqlclient_r.so

View File

@ -0,0 +1,30 @@
* Crashs on systems with Cyrix or other old i486 CPUs
=====================================================
As reported http://bugs.mysql.com/bug.php?id=21765 MySQL will segfault on very
old CPUs that do not have support for the "cpuid" instruction.
* Self-build binaries that are linked against libmysqlclient15 MUST be rebuild!
===============================================================================
This only affects binaries that are build on a Debian unstable/testing system
before 2006-03-31 or version 5.0.19. "objdump -T myprogram | grep MYSQL_5.0"
will give a couple of lines output in such a case.
Until now libmysqlclient.so.15 had versioned symbols provided by a Debian
patch. Now MySQL finally decided to adopt this patch but sadly chosed a
different symbol name.
Binaries linked against the old version of the library with my symbol name will
not run with the new version with MySQL's symbol name ("version `MYSQL_5.0' not
found"). The actual name /usr/lib/libmysqlclient.so.15 must stay because else
binaries coming from systems other than Debian would never run on a Debian
server.
So the Debian package had to be renamed from "libmysqlclient15" to
"libmysqlclient15off" and do now conflict with their former version.
-- 2006-03-14, Christian Hammers <ch@debian.org>

1
debian/libmysqlclientSLIBoff.dirs.in vendored Normal file
View File

@ -0,0 +1 @@
usr/lib/

1
debian/libmysqlclientSLIBoff.docs.in vendored Normal file
View File

@ -0,0 +1 @@
EXCEPTIONS-CLIENT

1
debian/libmysqlclientSLIBoff.files.in vendored Normal file
View File

@ -0,0 +1 @@
usr/lib/libmysqlclient*.so.*

View File

@ -0,0 +1,12 @@
#!/bin/bash -e
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0
# vim: ts=4

3
debian/libndbclientNLIB-dev.dirs.in vendored Normal file
View File

@ -0,0 +1,3 @@
usr/include/mysql/storage/ndb/
usr/include/
usr/lib/

3
debian/libndbclientNLIB-dev.files.in vendored Normal file
View File

@ -0,0 +1,3 @@
usr/include/mysql/storage/ndb/*
usr/lib/libndbclient.a
usr/lib/libndbclient.la

1
debian/libndbclientNLIB-dev.links.in vendored Normal file
View File

@ -0,0 +1 @@
usr/lib/libndbclient.so.4 usr/lib/libndbclient.so

View File

@ -0,0 +1,30 @@
* Crashs on systems with Cyrix or other old i486 CPUs
=====================================================
As reported http://bugs.mysql.com/bug.php?id=21765 MySQL will segfault on very
old CPUs that do not have support for the "cpuid" instruction.
* Self-build binaries that are linked against libmysqlclient15 MUST be rebuild!
===============================================================================
This only affects binaries that are build on a Debian unstable/testing system
before 2006-03-31 or version 5.0.19. "objdump -T myprogram | grep MYSQL_5.0"
will give a couple of lines output in such a case.
Until now libmysqlclient.so.15 had versioned symbols provided by a Debian
patch. Now MySQL finally decided to adopt this patch but sadly chosed a
different symbol name.
Binaries linked against the old version of the library with my symbol name will
not run with the new version with MySQL's symbol name ("version `MYSQL_5.0' not
found"). The actual name /usr/lib/libmysqlclient.so.15 must stay because else
binaries coming from systems other than Debian would never run on a Debian
server.
So the Debian package had to be renamed from "libmysqlclient15" to
"libmysqlclient15off" and do now conflict with their former version.
-- 2006-03-14, Christian Hammers <ch@debian.org>

1
debian/libndbclientNLIB.dirs.in vendored Normal file
View File

@ -0,0 +1 @@
usr/lib/

1
debian/libndbclientNLIB.files.in vendored Normal file
View File

@ -0,0 +1 @@
usr/lib/libndbclient*.so.*

12
debian/libndbclientNLIB.postinst.in vendored Normal file
View File

@ -0,0 +1,12 @@
#!/bin/bash -e
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0
# vim: ts=4

6
debian/mysql-client-BASE.NEWS.in vendored Normal file
View File

@ -0,0 +1,6 @@
mysql-dfsg-5.0 (5.0.24a-2) unstable; urgency=low
This package now includes "mysqlreport" from hackmysql.com which generates
a friendly report on the performance relevant variables from SHOW STATUS.
-- Christian Hammers <ch@debian.org> Sun, 3 Sep 2006 16:26:41 +0200

View File

@ -0,0 +1,4 @@
FAQ:
Q: My <tab> completition is gone, why?
A: You have "no-auto-rehash" in the "[mysql]" section of /etc/mysql/my.cnf!

2
debian/mysql-client-BASE.dirs.in vendored Normal file
View File

@ -0,0 +1,2 @@
usr/bin/
usr/share/man/man1/

2
debian/mysql-client-BASE.docs.in vendored Normal file
View File

@ -0,0 +1,2 @@
README
EXCEPTIONS-CLIENT

17
debian/mysql-client-BASE.files.in vendored Normal file
View File

@ -0,0 +1,17 @@
usr/bin/msql2mysql
usr/bin/mysql
usr/bin/mysql_find_rows
usr/bin/mysql_waitpid
usr/bin/mysqlaccess
usr/bin/mysqladmin
usr/bin/mysqlbinlog
usr/bin/mysqlcheck
usr/bin/mysqldump
usr/bin/mysqlimport
usr/bin/mysqlshow
usr/share/lintian/overrides/mysql-client-@MYSQL_BRANDED_BASE_VERSION@
usr/share/man/man1/mysql.1
usr/share/man/man1/mysqlaccess.1
usr/share/man/man1/mysqladmin.1
usr/share/man/man1/mysqldump.1
usr/share/man/man1/mysqlshow.1

View File

@ -0,0 +1 @@
mysql-client-@MYSQL_BRANDED_BASE_VERSION@: package-has-a-duplicate-relation

20
debian/mysql-common.README.Debian.in vendored Normal file
View File

@ -0,0 +1,20 @@
[passwords]
If you change the password of the root user (which is strongly recommended)
you have to create a personal mysql config file in order to let cron run
the /etc/cron.daily script without asking you for the password.
The /root/.my.cnf file should be chmod 0600 (-rw------- root root .my.cnf)
and have the following content:
[mysqladmin]
user = root
password = <secret>
[more than one process]
Note that the shutdown script cannot use the pid number stored in
/var/run, since it is for the first mysqld thread, but we need to kill
the most recent thread to shutdown the server. The upstream developers
are aware of this bug. When maintaining your database, you should use
mysqladmin with your password to shutdown and reload the server rather
than /etc/init.d/mysql.
Scott Hanson and Christian Hammers
<shanson@debian.org> <ch@debian.org>

1
debian/mysql-common.dirs.in vendored Normal file
View File

@ -0,0 +1 @@
etc/mysql/conf.d/

2
debian/mysql-common.files.in vendored Normal file
View File

@ -0,0 +1,2 @@
etc/mysql/my.cnf
usr/share/mysql-common/internal-use-only

7
debian/mysql-common.postrm.in vendored Normal file
View File

@ -0,0 +1,7 @@
#!/bin/bash
if [ "$1" = "purge" ]; then
rmdir /etc/mysql 2>/dev/null || true
fi
#DEBHELPER#

215
debian/mysql-common.preinst.in vendored Normal file
View File

@ -0,0 +1,215 @@
#!/bin/bash -e
#
# summary of how this script can be called:
# * <new-preinst> install
# * <new-preinst> install <old-version>
# * <new-preinst> upgrade <old-version>
# * <old-preinst> abort-upgrade <new-version>
#
if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi
${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }
export PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin
# Try to stop the server in a sane way. If it does not success let the admin
# do it himself. No database directories should be removed while the server
# is running! Another mysqld in e.g. a different chroot is fine for us.
stop_server() {
if [ ! -x /etc/init.d/mysql ]; then return; fi
set +e
if [ -x /usr/sbin/invoke-rc.d ]; then
cmd="invoke-rc.d mysql stop"
else
cmd="/etc/init.d/mysql stop"
fi
$cmd
errno=$?
set -e
# 0=ok, 100=no init script (fresh install)
if [ "$errno" != 0 -a "$errno" != 100 ]; then
echo "${cmd/ */} returned $errno" 1>&2
echo "There is a MySQL server running, but we failed in our attempts to stop it." 1>&2
echo "Stop it yourself and try again!" 1>&2
exit 1
fi
}
start_server() {
if [ ! -x /etc/init.d/mysql ]; then return; fi
set +e
if [ -x /usr/sbin/invoke-rc.d ]; then
cmd="invoke-rc.d mysql start"
else
cmd="/etc/init.d/mysql start"
fi
$cmd
set -e
}
##### here's a bunch of helper functions for converting database formats ######
cvt_get_param(){
/usr/sbin/mysqld --print-defaults \
| tr " " "\n" \
| grep -- "--$1" \
| tail -n 1 \
| cut -d= -f2
}
cvt_setup_stuff(){
mytmp=`mktemp -d -t mysql-ISAM-convert.XXXXXX`
cvt_log="$mytmp/conversion.log"
if [ ! -d "$mytmp" ]; then
echo "can't create temporary directory, oh well." >&2
exit 1
fi
chgrp mysql $mytmp
chmod g+rwx $mytmp
cvt_socket=${mytmp}/mysql.sock
cvt_mysqld="mysqld --skip-grant-tables --skip-networking --socket $cvt_socket"
cvt_mysql="mysql --socket $cvt_socket"
cvt_mysqladmin="mysqladmin --socket $cvt_socket"
}
cvt_get_databases(){
echo fetching database list ... >&2
$cvt_mysql -e 'show databases' | sed -n -e '2,$p'
}
cvt_get_tables(){
echo querying tables in $1 ... >&2
$cvt_mysql $1 -e 'show table status' | sed -n -e '2,$p' | \
cut -f 1,2 | grep -w 'ISAM$' | cut -f 1
}
cvt_convert_table(){
echo converting $1.$2 ... >&2
$cvt_mysql $1 -e "alter table $2 type=MyISAM"
}
cvt_wait_for_server(){
local count
echo -n waiting for server startup.. >&2
while ! $cvt_mysql </dev/null >/dev/null 2>&1; do
echo -n . >&2
sleep 1
count=".$count"
if [ -f $mytmp/mysql.done ]; then
echo "sorry... looks like the server crashed :(" >&2
return 1
elif [ "$count" = "...................." ]; then
echo "sorry... looks like the server didn't start :(" >&2
return 1
fi
done
echo ok. >&2
}
cvt_wait_for_exit(){
local count
echo -n waiting for server shutdown.. >&2
while [ ! -f $mytmp/mysql.done ]; do
echo -n . >&2
sleep 1
count=".$count"
if [ "$count" = "...................." ]; then
echo "hrm... guess it never started?" >&2
return 0
fi
done
echo ok. >&2
}
cvt_cleanup(){
local mysql_kids
rm -rf $mytmp
# kill any mysqld child processes left over. there *shouldn't* be any,
# but let's not take chances with that
mysql_kids=`ps o 'pid command' --ppid $$ | grep -E '^[[:digit:]]+ mysqld ' | cut -d' ' -f1`
if [ "$mysql_kids" ]; then
echo "strange, some mysql processes left around. killing them now." >&2
kill $mysql_kids
sleep 10
mysql_kids=`ps o 'pid command' --ppid $$ | grep -E '^[[:digit:]]+ mysqld ' | cut -d' ' -f1`
if [ "$mysql_kids" ]; then
echo "okay, they're really not getting the hint..." >&2
kill -9 $mysql_kids
fi
fi
}
################################ main() ##########################
# test if upgrading from non conffile state
if [ "$1" = "upgrade" ] && [ -x /usr/sbin/mysqld ]; then
cvt_datadir=`cvt_get_param datadir`
# test for ISAM tables, which we must convert NOW
if [ -n "`find $cvt_datadir -name '*.ISM' 2>/dev/null`" ]; then
pidfile=`cvt_get_param pid-file`
if [ "$pidfile" ] && [ -f "$pidfile" ]; then
server_pid=`cat $pidfile`
if [ "$server_pid" ] && ps $server_pid >/dev/null 2>&1; then
server_running="yes"
fi
fi
# to be sure
stop_server
set +e
cat << EOF >&2
----------------------------------------
WARNING WARNING WARNING
----------------------------------------
It has been detected that are are using ISAM format on some of your
mysql database tables. This format has been deprecated and no longer
supported. to prevent these databases from essentially disappearing,
an attempt at format conversion will now be made. please check after
your upgrade that all tables are present and accounted for.
apologies for the noise, but we thought you'd appreciate it :)
----------------------------------------
WARNING WARNING WARNING
----------------------------------------
EOF
cvt_setup_stuff
($cvt_mysqld >$cvt_log 2>&1; touch $mytmp/mysql.done ) &
if cvt_wait_for_server; then
dbs=`cvt_get_databases`
for db in $dbs; do
tables=`cvt_get_tables $db`
for tbl in $tables; do
cvt_convert_table $db $tbl
done
done
else
cvt_error="yes"
fi
echo shutting down server... >&2
$cvt_mysqladmin shutdown
cvt_wait_for_exit
echo "all done!" >&2
if [ ! "$cvt_error" = "yes" ]; then
cvt_cleanup
else
echo "you might want to look in $mytmp..." >&2
fi
if [ "$server_running" ]; then
start_server
fi
set -e
fi
fi
exit 0

1
debian/mysql-extra-BASE.dirs.in vendored Normal file
View File

@ -0,0 +1 @@
usr/bin

3
debian/mysql-extra-BASE.files.in vendored Normal file
View File

@ -0,0 +1,3 @@
usr/bin/ndb_drop_index
usr/bin/ndb_drop_table
usr/bin/ndb_delete_all

1
debian/mysql-management-BASE.dirs.in vendored Normal file
View File

@ -0,0 +1 @@
usr/sbin

1
debian/mysql-management-BASE.files.in vendored Normal file
View File

@ -0,0 +1 @@
usr/sbin/ndb_mgmd

View File

@ -0,0 +1,86 @@
#!/bin/bash
#
### BEGIN INIT INFO
# Provides: mysql-ndb-mgm
# Required-Start: $syslog
# Required-Stop: $syslog mysql
# Should-Start: $local_fs $remote_fs $network $named $time
# Should-Stop: $local_fs $remote_fs $network $named $time
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start and stop the mysql database cluster management daemon
# Description: Controls the MySQL NDB Management Node daemon "ndb_mgmd".
### END INIT INFO
#
set -e
set -u
${DEBIAN_SCRIPT_DEBUG:+ set -v -x}
# Variables
SELF=$(cd $(dirname $0); pwd -P)/$(basename $0)
DAEMON=/usr/sbin/ndb_mgmd
CONF=/etc/mysql/ndb_mgmd.cnf
export HOME=/etc/mysql/
# Safeguard (relative paths, core dumps..)
cd /
umask 077
# Exit *silently* if we're not supposed to be started.
#
# The Debian scripts should execute these scripts to stop and start
# the daemon when upgrading if it is started. On the other hand it should
# remain silently if the server has not even been configured.
# See /usr/share/doc/mysql-server-*/README.Debian for more information.
test -x $DAEMON || exit 0
test -r $CONF || exit 0
. /lib/lsb/init-functions
#
# main()
#
case "${1:-''}" in
'start')
# Start daemon
log_daemon_msg "Starting MySQL NDB Management Node" "ndb_mgmd"
# --pid-file does not work as the daemon forks itself with $PID=$PID+1
if start-stop-daemon \
--start \
--exec $DAEMON \
--user mysql \
-- \
-f $CONF
then
log_end_msg 0
else
log_end_msg 1
log_warning_msg "Please take a look at the syslog."
exit 1
fi
;;
'stop')
log_daemon_msg "Stopping MySQL NDB Management Node" "ndb_mgmd"
if start-stop-daemon \
--stop \
--oknodo \
--exec $DAEMON
then
log_end_msg 0
else
log_end_msg 1
exit 1
fi
;;
'restart'|'force-reload')
set +e; $SELF stop; set -e
$SELF start
;;
*)
echo "Usage: $SELF start|stop|restart|force-reload"
exit 1
;;
esac

10
debian/mysql-server-BASE.NEWS.in vendored Normal file
View File

@ -0,0 +1,10 @@
mysql-dfsg-5.0 (5.0.18-9) unstable; urgency=low
Rotation of the binary logs is now configured in /etc/mysql/my.cnf with
"expire-logs-days" which defaults to 20 days. The old file
/etc/mysql/debian-log-rotate.conf should be removed together with
/etc/cron.daily/mysql-server after this value has been adjusted. Note that
the old variable defined the number of files whereas the new one defines
a time span in days.
-- Christian Hammers <ch@debian.org> Tue, 24 Jan 2006 22:18:21 +0100

View File

@ -0,0 +1,125 @@
* REMEMBER TO SET THE ROOT PASSWORD !!!
============================================================================
* MYSQL WON'T INSTALL?
======================
MySQL will only install if you have a non-numeric hostname that is resolvable
via the /etc/hosts file. E.g. if the "hostname" command returns "myhostname"
then there must be a line like "10.0.0.1 myhostname".
On upgrades from MySQL 3.23, as shipped with Debian Woody, symlinks in place of
/var/lib/mysql or /var/log/mysql gets accidently removed and have manually be
restored.
* MYSQL WON'T START OR STOP?
============================
You may never ever delete the special mysql user "debian-sys-maint". This
user together with the credentials in /etc/mysql/debian.cnf are used by the
init scripts to stop the server as they would require knowledge of the mysql
root users password else.
So in most of the times you can fix the situation by making sure that the
debian.cnf file contains the right password, e.g. by setting a new one
(remember to do a "flush privileges" then).
* WHAT TO DO AFTER UPGRADES:
============================
- running mysql_upgrade to be able to make use of possibly added new
privilege columns. This script does not give any use more rights.
* WHAT TO DO AFTER INSTALLATION:
================================
The MySQL manual describes certain steps to do at this stage in a separate
chapter. They are not necessary as the Debian packages does them
automatically.
The only thing that is left over for the admin is
- setting the *passwords* !!!
- creating new users and databases
- read the rest of this text
* DOWNGRADING TO 4.0 or 4.1:
============================
Unsupported. Period.
But if you do and get problems or make interesting experiences, mail me, it
might help others.
Ok, if you really want, I would recommend to "mysqldump --opt" all tables,
then purge 4.1, delete /var/lib/mysql, install 4.0 and insert the dumps. Be
carefully, though, with the "mysql" table, you might not simply overwrite that
one as the password for the mysql "debian-sys-maint" user is stored in
/etc/mysql/debian.cnf and needed by /etc/init.d/ to start mysql and check if
it's alive.
* SOME APPLICATION CAN NO LONGER CONNECT:
=========================================
This application is probably linked against libmysqlclient12 or below and
somebody has created a mysql user with new-style passwords.
The old_passwords option which forces backwards compatibility, can be set
in /etc/mysql/conf.d/old_passwords.conf.
If that does not help, the password can be set manually, the application that
inserted the user should be changed or the application that tries to connect
should be updated to libmysqlclient14 or -15.
Read http://dev.mysql.com/doc/refman/5.0/en/old-client.html
* NETWORKING:
=============
For security reasons, the Debian package has enabled networking only on the
loop-back device using "bind-address" in /etc/mysql/my.cnf. Check with
"netstat -tlnp" where it is listening. If your connection is aborted
immediately see if "mysqld: all" or similar is in /etc/hosts.allow and read
hosts_access(5).
* WHERE IS THE DOCUMENTATION?:
==============================
Unfortunately due to licensing restrictions, debian currently not able
to provide the mysql-doc package in any format. For the most up to date
documentation, please go to http://dev.mysql.com/doc.
* PASSWORDS:
============
It is strongly recommended to set a password for the mysql root user (which
is NOT the same as the "normal" root user) with the command:
/usr/bin/mysqladmin -u root password 'enter-your-good-new-password-here'
If you already had a password set add " -p " before "-u" to the line above.
If you are tired to type the password in every time or want to automate your
scripts you can store it in the file $HOME/.my.cnf. It should be chmod 0600
(-rw------- username username .my.cnf) to ensure that nobody else can read
it. Every other configuration parameter can be stored there, too. You will
find an example below and more information in the MySQL manual in
/usr/share/doc/mysql-doc or www.mysql.com.
ATTENTION: It is necessary, that a .my.cnf from root always contains a "user"
line wherever there is a "password" line, else, the Debian maintenance
scripts, that use /etc/mysql/debian.cnf, will use the username
"debian-sys-maint" but the password that is in root's .my.cnf. Also note,
that every change you make in the /root/.my.cnf will affect the mysql cron
script, too.
# an example of $HOME/.my.cnf
[client]
user = your-mysql-username
password = enter-your-good-new-password-here
* BIG_ROWS FOR EVEN MORE ROWS IN A TABLE:
=========================================
If you ever run out of rows in a table there is the possibility of building
the package with "-DBIG_ROWS" which, according to a MySQL employee on
packagers@lists.mysql.com should lead to a 64bit row index (I guess > 2^32
rows) but also to an approx. 5% performance loss.
* NDB CLUSTER ENGINE:
=====================
NDB is the shared-nothing cluster engine since MySQL-4.1.
This package contains the all three components, the mysql backend, the NDB
Data Node and the NDB Management Node. The init scripts of the cluster
daemons will silently exit unless their configuration is provided:
mysql-ndb: needs "ndb-connectstring" in /etc/mysql/my.cnf
mysql-ndb-mgm: needs /etc/mysql/ndb_mgmd.cnf
* EXPIRE_LOGS_DAYS AND LOG_BIN:
===============================
Having expire_logs_days enabled but log-bin not crashes the server. Using both
or none of those options is safe. To prevent this happening during the nightly
log rotation via /etc/logrotate.d/mysql the initscript checks for malicious
combination of options. This is Debian bug #368547 and MySQL bug #17733.

39
debian/mysql-server-BASE.config.in vendored Normal file
View File

@ -0,0 +1,39 @@
#!/bin/bash -e
. /usr/share/debconf/confmodule
if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi
${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }
CNF=/etc/mysql/my.cnf
# Beware that there are two ypwhich one of them needs the 2>/dev/null!
if test -n "`which ypwhich 2>/dev/null`" && ypwhich >/dev/null 2>&1; then
db_input high mysql-server-@MYSQL_BRANDED_BASE_VERSION@/nis_warning || true
db_go
fi
# only ask this question on fresh installs and during "reconfiguration".
# there is also an additional check for empty root passwords in the
# postinst script when the tools are available for us to use.
if [ "$1" = "configure" ] && [ -z "$2" ] || [ "$1" = "reconfigure" ]; then
db_input medium mysql-server/root_password || true
db_go
fi
# If this is an upgrade of an already existing installation ask the user if
# we may use the backwards incompatible but more secure password format.
# This should not be shown at dpkg-reconfigure and except for the dist-upgrade,
# config files are for the admin only!
# Read: If mysql was already installed but not from Etch and it was either 4.0
# or had old_passwords enabled before then the system is affected.
if [ "$1" = "configure" ] &&
[ -f $CNF ] &&
(
[ ! -f /var/lib/mysql/debian-4.1.flag ] ||
egrep -q -i '^[[:space:]]*old.passwords[[:space:]]*=[[:space:]]*(1|true)' $CNF
)
then
db_input medium mysql-server-@MYSQL_BRANDED_BASE_VERSION@/need_sarge_compat || true
db_go
fi

13
debian/mysql-server-BASE.dirs.in vendored Normal file
View File

@ -0,0 +1,13 @@
etc/init.d
etc/logrotate.d
usr/bin
usr/lib
usr/lib/mysql
usr/sbin
usr/share/man/man8
usr/share/info
usr/share/mysql
usr/lib/pkgconfig
var/run/mysqld
var/lib/mysql-upgrade
var/lib/mysql-cluster

2
debian/mysql-server-BASE.docs.in vendored Normal file
View File

@ -0,0 +1,2 @@
EXCEPTIONS-CLIENT
debian/copyright.more

47
debian/mysql-server-BASE.files.in vendored Normal file
View File

@ -0,0 +1,47 @@
usr/bin/my_print_defaults
usr/bin/myisam_ftdump
usr/bin/myisamchk
usr/bin/myisamlog
usr/bin/myisampack
usr/bin/mysql_convert_table_format
usr/bin/mysql_fix_extensions
usr/bin/mysql_fix_privilege_tables
usr/bin/mysql_install_db
usr/bin/mysql_secure_installation
usr/bin/mysql_setpermission
usr/bin/mysql_tzinfo_to_sql
usr/bin/mysql_upgrade
usr/bin/mysql_zap
usr/bin/mysqlbug
usr/bin/mysqld_multi
usr/bin/mysqld_safe
usr/bin/mysqldumpslow
usr/bin/mysqlhotcopy
usr/bin/mysqltest
usr/bin/perror
usr/bin/replace
usr/bin/resolve_stack_dump
usr/bin/resolveip
usr/sbin/mysqld
usr/sbin/mysqlmanager
usr/lib/mysql/mysqld.sym
usr/share/lintian/overrides/mysql-server-@MYSQL_BRANDED_BASE_VERSION@
usr/share/info/mysql.info
usr/share/man/man1/mysqlman.1
usr/share/man/man1/my_print_defaults.1
usr/share/man/man1/myisam_ftdump.1
usr/share/man/man1/myisamchk.1
usr/share/man/man1/myisamlog.1
usr/share/man/man1/myisampack.1
usr/share/man/man8/mysqld.8
usr/share/man/man1/mysqld_multi.1
usr/share/man/man1/mysqld_safe.1
usr/share/man/man1/mysql_fix_privilege_tables.1
usr/share/man/man1/mysql_install_db.1
usr/share/man/man1/mysqlhotcopy.1
usr/share/man/man8/mysqlmanager.8
usr/share/man/man1/mysql_upgrade.1
usr/share/man/man1/mysql_tzinfo_to_sql.1
usr/share/man/man1/mysql_zap.1
usr/share/man/man1/perror.1
usr/share/man/man1/replace.1

1
debian/mysql-server-BASE.links.in vendored Normal file
View File

@ -0,0 +1 @@
usr/bin/mysqld_safe usr/bin/safe_mysqld

View File

@ -0,0 +1,4 @@
mysql-server-@MYSQL_BRANDED_BASE_VERSION@: possible-bashism-in-maintainer-script postinst:81 'p{("a".."z","A".."Z",0..9)[int(rand(62))]}'
mysql-server-@MYSQL_BRANDED_BASE_VERSION@: possible-bashism-in-maintainer-script preinst:33 '${cmd/ */}'
mysql-server-@MYSQL_BRANDED_BASE_VERSION@: statically-linked-binary ./usr/bin/mysql_tzinfo_to_sql
mysql-server-@MYSQL_BRANDED_BASE_VERSION@: statically-linked-binary ./usr/sbin/mysqld

View File

@ -0,0 +1,10 @@
/etc/init.d/mysql\[[0-9]+\]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists\!$
/etc/init.d/mysql\[[0-9]+\]: '/usr/bin/mysqladmin --defaults-(extra-)?file=/etc/mysql/debian.cnf ping' resulted in$
mysqld\[[0-9]+\]: $
mysqld\[[0-9]+\]: Support MySQL by buying support/licenses at http://shop.mysql.com$
mysqld\[[0-9]+\]: Version: .* socket: '/var/run/mysqld/mysqld.sock' port: 3306$
mysqld\[[0-9]+\]: Warning: Ignoring user change to 'mysql' because the user was set to 'mysql' earlier on the command line$
mysqld_safe\[[0-9]+\]: started$
mysqld_safe\[[0-9]+\]: Support MySQL by buying support/licenses at http://shop.mysql.com *$
usermod\[[0-9]+\]: change user `mysql' GID from `([0-9]+)' to `\1'$
usermod\[[0-9]+\]: change user `mysql' shell from `/bin/false' to `/bin/false'$

View File

@ -0,0 +1,31 @@
/etc/init.d/mysql\[[0-9]+\]: [0-9]+ processes alive and '/usr/bin/mysqladmin --defaults-(extra-)?file=/etc/mysql/debian.cnf ping' resulted in$
/etc/init.d/mysql\[[0-9]+\]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists\!$
/etc/init.d/mysql\[[0-9]+\]: '/usr/bin/mysqladmin --defaults-(extra-)?file=/etc/mysql/debian.cnf ping' resulted in$
mysqld\[[0-9]+\]: ?$
mysqld\[[0-9]+\]: .*InnoDB: Shutdown completed
mysqld\[[0-9]+\]: .*InnoDB: Started;
mysqld\[[0-9]+\]: .*InnoDB: Starting shutdown\.\.\.$
mysqld\[[0-9]+\]: .*\[Note\] /usr/sbin/mysqld: Normal shutdown$
mysqld\[[0-9]+\]: .*\[Note\] /usr/sbin/mysqld: ready for connections\.$
mysqld\[[0-9]+\]: .*\[Note\] /usr/sbin/mysqld: Shutdown complete$
mysqld\[[0-9]+\]: Support MySQL by buying support/licenses at http://shop.mysql.com$
mysqld\[[0-9]+\]: /usr/sbin/mysqld: ready for connections\.$
mysqld\[[0-9]+\]: .*/usr/sbin/mysqld: Shutdown Complete$
mysqld\[[0-9]+\]: Version: .* socket
mysqld\[[0-9]+\]: Warning: Ignoring user change to 'mysql' because the user was set to 'mysql' earlier on the command line$
mysqld_safe\[[0-9]+\]: ?$
mysqld_safe\[[0-9]+\]: able to use the new GRANT command!$
mysqld_safe\[[0-9]+\]: ended$
mysqld_safe\[[0-9]+\]: http://www.mysql.com$
mysqld_safe\[[0-9]+\]: NOTE: If you are upgrading from a MySQL <= 3.22.10 you should run$
mysqld_safe\[[0-9]+\]: PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !$
mysqld_safe\[[0-9]+\]: Please report any problems with the /usr/bin/mysqlbug script!$
mysqld_safe\[[0-9]+\]: See the manual for more instructions.$
mysqld_safe\[[0-9]+\]: started$
mysqld_safe\[[0-9]+\]: Support MySQL by buying support/licenses at
mysqld_safe\[[0-9]+\]: The latest information about MySQL is available on the web at$
mysqld_safe\[[0-9]+\]: the /usr/bin/mysql_fix_privilege_tables. Otherwise you will not be$
mysqld_safe\[[0-9]+\]: To do so, start the server, then issue the following commands:$
mysqld_safe\[[0-9]+\]: /usr/bin/mysqladmin -u root password 'new-password'$
usermod\[[0-9]+\]: change user `mysql' GID from `([0-9]+)' to `\1'$
usermod\[[0-9]+\]: change user `mysql' shell from `/bin/false' to `/bin/false'$

View File

@ -0,0 +1,31 @@
/etc/init.d/mysql\[[0-9]+\]: [0-9]+ processes alive and '/usr/bin/mysqladmin --defaults-(extra-)?file=/etc/mysql/debian.cnf ping' resulted in$
/etc/init.d/mysql\[[0-9]+\]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists\!$
/etc/init.d/mysql\[[0-9]+\]: '/usr/bin/mysqladmin --defaults-(extra-)?file=/etc/mysql/debian.cnf ping' resulted in$
mysqld\[[0-9]+\]: ?$
mysqld\[[0-9]+\]: .*InnoDB: Shutdown completed
mysqld\[[0-9]+\]: .*InnoDB: Started;
mysqld\[[0-9]+\]: .*InnoDB: Starting shutdown\.\.\.$
mysqld\[[0-9]+\]: .*\[Note\] /usr/sbin/mysqld: Normal shutdown$
mysqld\[[0-9]+\]: .*\[Note\] /usr/sbin/mysqld: ready for connections\.$
mysqld\[[0-9]+\]: .*\[Note\] /usr/sbin/mysqld: Shutdown complete$
mysqld\[[0-9]+\]: Support MySQL by buying support/licenses at http://shop.mysql.com$
mysqld\[[0-9]+\]: /usr/sbin/mysqld: ready for connections\.$
mysqld\[[0-9]+\]: .*/usr/sbin/mysqld: Shutdown Complete$
mysqld\[[0-9]+\]: Version: .* socket
mysqld\[[0-9]+\]: Warning: Ignoring user change to 'mysql' because the user was set to 'mysql' earlier on the command line$
mysqld_safe\[[0-9]+\]: ?$
mysqld_safe\[[0-9]+\]: able to use the new GRANT command!$
mysqld_safe\[[0-9]+\]: ended$
mysqld_safe\[[0-9]+\]: http://www.mysql.com$
mysqld_safe\[[0-9]+\]: NOTE: If you are upgrading from a MySQL <= 3.22.10 you should run$
mysqld_safe\[[0-9]+\]: PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !$
mysqld_safe\[[0-9]+\]: Please report any problems with the /usr/bin/mysqlbug script!$
mysqld_safe\[[0-9]+\]: See the manual for more instructions.$
mysqld_safe\[[0-9]+\]: started$
mysqld_safe\[[0-9]+\]: Support MySQL by buying support/licenses at
mysqld_safe\[[0-9]+\]: The latest information about MySQL is available on the web at$
mysqld_safe\[[0-9]+\]: the /usr/bin/mysql_fix_privilege_tables. Otherwise you will not be$
mysqld_safe\[[0-9]+\]: To do so, start the server, then issue the following commands:$
mysqld_safe\[[0-9]+\]: /usr/bin/mysqladmin -u root password 'new-password'$
usermod\[[0-9]+\]: change user `mysql' GID from `([0-9]+)' to `\1'$
usermod\[[0-9]+\]: change user `mysql' shell from `/bin/false' to `/bin/false'$

Some files were not shown because too many files have changed in this diff Show More