mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
merged
This commit is contained in:
100
.bzrignore
100
.bzrignore
@ -9,6 +9,7 @@
|
||||
*.lo
|
||||
*.o
|
||||
*.reject
|
||||
*.so
|
||||
*.spec
|
||||
*/*_pure_*warnings
|
||||
*/.pure
|
||||
@ -26,24 +27,18 @@
|
||||
.out
|
||||
.snprj/*
|
||||
.vimrc
|
||||
50
|
||||
=6
|
||||
BUILD/compile-pentium-maintainer
|
||||
BitKeeper/etc/config
|
||||
BitKeeper/etc/csets
|
||||
BitKeeper/etc/csets-in
|
||||
BitKeeper/etc/csets-out
|
||||
BitKeeper/etc/gone
|
||||
BitKeeper/etc/level
|
||||
BitKeeper/etc/pushed
|
||||
BitKeeper/post-commit
|
||||
BitKeeper/post-commit-manual
|
||||
BitKeeper/tmp/*
|
||||
BitKeeper/tmp/bkr3sAHD
|
||||
BitKeeper/tmp/gone
|
||||
COPYING
|
||||
COPYING.LIB
|
||||
Docs/#manual.texi#
|
||||
Docs/INSTALL-BINARY
|
||||
Docs/Images/myaccess-odbc.txt
|
||||
Docs/Images/myaccess.txt
|
||||
@ -67,7 +62,6 @@ Docs/internals_toc.html
|
||||
Docs/manual.aux
|
||||
Docs/manual.cp
|
||||
Docs/manual.cps
|
||||
Docs/manual.de.log
|
||||
Docs/manual.dvi
|
||||
Docs/manual.fn
|
||||
Docs/manual.fns
|
||||
@ -76,8 +70,6 @@ Docs/manual.ky
|
||||
Docs/manual.log
|
||||
Docs/manual.pdf
|
||||
Docs/manual.pg
|
||||
Docs/manual.texi.orig
|
||||
Docs/manual.texi.rej
|
||||
Docs/manual.toc
|
||||
Docs/manual.tp
|
||||
Docs/manual.txt
|
||||
@ -98,17 +90,11 @@ Logs/*
|
||||
MIRRORS
|
||||
Makefile
|
||||
Makefile.in
|
||||
Makefile.in'
|
||||
PENDING/*
|
||||
TAGS
|
||||
aclocal.m4
|
||||
autom4te-2.53.cache/output.0
|
||||
autom4te-2.53.cache/requests
|
||||
autom4te-2.53.cache/traces.0
|
||||
autom4te-2.53.cache/*
|
||||
autom4te.cache/*
|
||||
autom4te.cache/output.0
|
||||
autom4te.cache/requests
|
||||
autom4te.cache/traces.0
|
||||
bdb/README
|
||||
bdb/btree/btree_auto.c
|
||||
bdb/build_unix/*
|
||||
@ -153,13 +139,8 @@ bdb/db/crdel_auto.c
|
||||
bdb/db/db_auto.c
|
||||
bdb/dbinc_auto/*.*
|
||||
bdb/dbreg/dbreg_auto.c
|
||||
bdb/dist/autom4te-2.53.cache/output.0
|
||||
bdb/dist/autom4te-2.53.cache/requests
|
||||
bdb/dist/autom4te-2.53.cache/traces.0
|
||||
bdb/dist/autom4te-2.53.cache/*
|
||||
bdb/dist/autom4te.cache/*
|
||||
bdb/dist/autom4te.cache/output.0
|
||||
bdb/dist/autom4te.cache/requests
|
||||
bdb/dist/autom4te.cache/traces.0
|
||||
bdb/dist/config.hin
|
||||
bdb/dist/configure
|
||||
bdb/dist/tags
|
||||
@ -238,20 +219,13 @@ bdb/test/include.tcl
|
||||
bdb/test/logtrack.list
|
||||
bdb/txn/txn_auto.c
|
||||
binary/*
|
||||
bkpull.log
|
||||
bkpull.log.2
|
||||
bkpull.log.3
|
||||
bkpull.log.4
|
||||
bkpull.log.5
|
||||
bkpull.log.6
|
||||
bkpush.log
|
||||
bkpull.log*
|
||||
bkpush.log*
|
||||
build.log
|
||||
build_tags.sh
|
||||
client/insert_test
|
||||
client/log_event.cc
|
||||
client/log_event.h
|
||||
client/mf_iocache.c
|
||||
client/mf_iocache.cc
|
||||
client/mysql
|
||||
client/mysqladmin
|
||||
client/mysqlbinlog
|
||||
@ -262,11 +236,8 @@ client/mysqlmanager-pwgen
|
||||
client/mysqlmanagerc
|
||||
client/mysqlshow
|
||||
client/mysqltest
|
||||
client/mysys_priv.h
|
||||
client/select_test
|
||||
client/ssl_test
|
||||
client/thimble
|
||||
client/thread_test
|
||||
client_test
|
||||
cmd-line-utils/libedit/common.h
|
||||
cmd-line-utils/libedit/makelist
|
||||
@ -279,12 +250,20 @@ config.status
|
||||
configure
|
||||
configure.lineno
|
||||
core
|
||||
core.2430
|
||||
core.*
|
||||
db-*.*.*
|
||||
dbug/dbug_analyze
|
||||
dbug/example*.r
|
||||
dbug/factorial
|
||||
dbug/factorial.r
|
||||
dbug/main.r
|
||||
dbug/output*.r
|
||||
dbug/user.ps
|
||||
dbug/user.t
|
||||
depcomp
|
||||
emacs.h
|
||||
extra/comp_err
|
||||
extra/charset2html
|
||||
extra/my_print_defaults
|
||||
extra/mysql_install
|
||||
extra/mysql_tzinfo_to_sql
|
||||
@ -296,6 +275,7 @@ extra/resolveip
|
||||
extra/tztime.cc
|
||||
fcns.c
|
||||
fcns.h
|
||||
gdbinit
|
||||
gmon.out
|
||||
hardcopy.0
|
||||
heap/hp_test1
|
||||
@ -309,13 +289,8 @@ include/readline
|
||||
include/readline/*.h
|
||||
include/readline/readline.h
|
||||
include/widec.h
|
||||
innobase/autom4te-2.53.cache/output.0
|
||||
innobase/autom4te-2.53.cache/requests
|
||||
innobase/autom4te-2.53.cache/traces.0
|
||||
innobase/autom4te-2.53.cache/*
|
||||
innobase/autom4te.cache/*
|
||||
innobase/autom4te.cache/output.0
|
||||
innobase/autom4te.cache/requests
|
||||
innobase/autom4te.cache/traces.0
|
||||
innobase/configure.lineno
|
||||
innobase/conftest.s1
|
||||
innobase/conftest.subs
|
||||
@ -435,6 +410,7 @@ libmysqld/sql_db.cc
|
||||
libmysqld/sql_delete.cc
|
||||
libmysqld/sql_derived.cc
|
||||
libmysqld/sql_do.cc
|
||||
libmysqld/sql_error.cc
|
||||
libmysqld/sql_handler.cc
|
||||
libmysqld/sql_help.cc
|
||||
libmysqld/sql_insert.cc
|
||||
@ -445,6 +421,7 @@ libmysqld/sql_manager.cc
|
||||
libmysqld/sql_map.cc
|
||||
libmysqld/sql_olap.cc
|
||||
libmysqld/sql_parse.cc
|
||||
libmysqld/sql_prepare.cc
|
||||
libmysqld/sql_rename.cc
|
||||
libmysqld/sql_repl.cc
|
||||
libmysqld/sql_select.cc
|
||||
@ -479,15 +456,6 @@ linked_server_sources
|
||||
linked_tools_sources
|
||||
locked
|
||||
man/*.1
|
||||
mit-pthreads/config.flags
|
||||
mit-pthreads/include/bits
|
||||
mit-pthreads/include/pthread/machdep.h
|
||||
mit-pthreads/include/pthread/posix.h
|
||||
mit-pthreads/include/sys
|
||||
mit-pthreads/machdep.c
|
||||
mit-pthreads/pg++
|
||||
mit-pthreads/pgcc
|
||||
mit-pthreads/syscall.S
|
||||
myisam/FT1.MYD
|
||||
myisam/FT1.MYI
|
||||
myisam/ft_dump
|
||||
@ -513,9 +481,6 @@ myisam/test1.MYD
|
||||
myisam/test1.MYI
|
||||
myisam/test2.MYD
|
||||
myisam/test2.MYI
|
||||
mysql-4.0.2-alpha-pc-linux-gnu-i686.tar.gz
|
||||
mysql-4.0.2-alpha.tar.gz
|
||||
mysql-max-4.0.2-alpha-pc-linux-gnu-i686.tar.gz
|
||||
mysql-test/gmon.out
|
||||
mysql-test/install_test_db
|
||||
mysql-test/mysql-test-run
|
||||
@ -539,12 +504,6 @@ mysql.proj
|
||||
mysql_priv.h
|
||||
mysqld.S
|
||||
mysqld.sym
|
||||
mysys/#mf_iocache.c#
|
||||
mysys/charset2html
|
||||
mysys/getopt.c
|
||||
mysys/getopt1.c
|
||||
mysys/main.cc
|
||||
mysys/ste5KbMa
|
||||
mysys/test_charset
|
||||
mysys/test_dir
|
||||
mysys/test_gethwaddr
|
||||
@ -667,14 +626,6 @@ ndb/examples/ndbapi_example2/ndbapi_example2
|
||||
ndb/examples/ndbapi_example3/ndbapi_example3
|
||||
ndb/examples/ndbapi_example5/ndbapi_example5
|
||||
ndb/examples/select_all/select_all
|
||||
ndb/lib/libMGM_API.so
|
||||
ndb/lib/libNDB_API.so
|
||||
ndb/lib/libNDB_ODBC.so
|
||||
ndb/lib/libNEWTON_API.so
|
||||
ndb/lib/libNEWTON_BASICTEST_COMMON.so
|
||||
ndb/lib/libREP_API.so
|
||||
ndb/lib/libndbclient.so
|
||||
ndb/lib/libndbclient_extra.so
|
||||
ndb/src/common/mgmcommon/printConfig/*.d
|
||||
ndb/src/cw/cpcd/ndb_cpcd
|
||||
ndb/src/kernel/blocks/backup/restore/ndb_restore
|
||||
@ -806,7 +757,6 @@ sql-bench/test-insert
|
||||
sql-bench/test-select
|
||||
sql-bench/test-transactions
|
||||
sql-bench/test-wisconsin
|
||||
sql/.gdbinit
|
||||
sql/client.c
|
||||
sql/gen_lex_hash
|
||||
sql/gmon.out
|
||||
@ -821,24 +771,12 @@ sql/mysqld
|
||||
sql/mysqld-purecov
|
||||
sql/mysqld-purify
|
||||
sql/mysqld-quantify
|
||||
sql/new.cc
|
||||
sql/pack.c
|
||||
sql/safe_to_cache_query.txt
|
||||
sql/share/*.sys
|
||||
sql/share/charsets/gmon.out
|
||||
sql/share/gmon.out
|
||||
sql/share/mysql
|
||||
sql/share/norwegian-ny/errmsg.sys
|
||||
sql/share/norwegian/errmsg.sys
|
||||
sql/sql_select.cc.orig
|
||||
sql/sql_yacc.cc
|
||||
sql/sql_yacc.h
|
||||
sql/sql_yacc.output
|
||||
sql/sql_yacc.yy.orig
|
||||
sql/test_time
|
||||
sql/udf_example.so
|
||||
sql_error.cc
|
||||
sql_prepare.cc
|
||||
stamp-h
|
||||
stamp-h.in
|
||||
stamp-h1
|
||||
@ -930,10 +868,8 @@ tests/client_test
|
||||
tests/connect_test
|
||||
thread_test
|
||||
tmp/*
|
||||
tools/my_vsnprintf.c
|
||||
tools/mysqlmanager
|
||||
tools/mysqlmngd
|
||||
tools/mysys_priv.h
|
||||
vi.h
|
||||
vio/test-ssl
|
||||
vio/test-sslclient
|
||||
|
@ -2861,12 +2861,10 @@ then
|
||||
AC_DEFINE([THREAD], [1],
|
||||
[Define if you want to have threaded code. This may be undef on client code])
|
||||
# Avoid _PROGRAMS names
|
||||
THREAD_LPROGRAMS="test_thr_alarm\$(EXEEXT) test_thr_lock\$(EXEEXT)"
|
||||
AC_SUBST(THREAD_LPROGRAMS)
|
||||
THREAD_LOBJECTS="thr_alarm.o thr_lock.o thr_mutex.o thr_rwlock.o my_pthread.o my_thr_init.o"
|
||||
AC_SUBST(THREAD_LOBJECTS)
|
||||
server_scripts="mysqld_safe mysql_install_db"
|
||||
sql_server_dirs="strings dbug mysys extra regex"
|
||||
sql_server_dirs="strings mysys dbug extra regex"
|
||||
|
||||
|
||||
#
|
||||
|
@ -16,42 +16,51 @@
|
||||
# MA 02111-1307, USA
|
||||
|
||||
INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include
|
||||
LDADD = libdbug.a ../strings/libmystrings.a
|
||||
LDADD = libdbug.a ../mysys/libmysys.a ../strings/libmystrings.a
|
||||
pkglib_LIBRARIES = libdbug.a
|
||||
noinst_HEADERS = dbug_long.h
|
||||
libdbug_a_SOURCES = dbug.c sanity.c
|
||||
EXTRA_DIST = example1.c example2.c example3.c \
|
||||
user.r monty.doc readme.prof \
|
||||
user.r monty.doc readme.prof dbug_add_tags.pl \
|
||||
main.c factorial.c dbug_analyze.c
|
||||
NROFF_INC = example1.r example2.r example3.r main.r \
|
||||
factorial.r output1.r output2.r output3.r \
|
||||
output4.r output5.r
|
||||
|
||||
|
||||
# Must be linked with libs that are not compiled yet
|
||||
extra_progs: factorial dbug_analyze
|
||||
noinst_PROGRAMS = factorial dbug_analyze
|
||||
factorial_SOURCES = main.c factorial.c
|
||||
dbug_analyze_SOURCES = dbug_analyze.c
|
||||
|
||||
factorial: main.o factorial.o
|
||||
@rm -f factorial
|
||||
$(LINK) main.o factorial.o -lmysys
|
||||
|
||||
dbug_analyze: dbug_analyze.o
|
||||
@rm -f dbug_analyze
|
||||
$(LINK) dbug_analyze.o -lmysys
|
||||
all: user.t user.ps
|
||||
|
||||
user.t: user.r $(NROFF_INC)
|
||||
nroff -cm user.r > $@
|
||||
nroff -mm user.r > $@
|
||||
|
||||
output1.r: $(PROGRAM)
|
||||
factorial 1 2 3 4 5 | cat > $@
|
||||
user.ps: user.r $(NROFF_INC)
|
||||
groff -mm user.r > $@
|
||||
|
||||
output2.r: $(PROGRAM)
|
||||
factorial -\#t:o 2 3 | cat >$@
|
||||
output1.r: factorial
|
||||
./factorial 1 2 3 4 5 | cat > $@
|
||||
|
||||
output3.r: $(PROGRAM)
|
||||
factorial -\#d:t:o 3 | cat >$@
|
||||
output2.r: factorial
|
||||
./factorial -\#t:o 2 3 | cat >$@
|
||||
|
||||
output4.r: $(PROGRAM)
|
||||
factorial -\#d,result:o 4 | cat >$@
|
||||
output3.r: factorial
|
||||
./factorial -\#d:t:o 3 | cat >$@
|
||||
|
||||
output5.r: $(PROGRAM)
|
||||
factorial -\#d:f,factorial:F:L:o 3 | cat >$@
|
||||
output4.r: factorial
|
||||
./factorial -\#d,result:o 4 | cat >$@
|
||||
|
||||
output5.r: factorial
|
||||
./factorial -\#d:f,factorial:F:L:o 3 | cat >$@
|
||||
.c.r:
|
||||
@RM@ -f $@
|
||||
@SED@ -e 's!\\!\\\\!g' $< > $@
|
||||
|
||||
clean:
|
||||
@RM@ -f $(NROFF_INC) user.t user.ps
|
||||
|
||||
# Don't update the files from bitkeeper
|
||||
%::SCCS/s.%
|
||||
|
36
dbug/dbug.c
36
dbug/dbug.c
@ -21,8 +21,7 @@
|
||||
* all copies and derivative works. Thank you. *
|
||||
* *
|
||||
* The author makes no warranty of any kind with respect to this *
|
||||
* product and explicitly disclaims any implied warranties of mer- *ct_lex.table_list.first=0;
|
||||
thd->lex.selec
|
||||
* product and explicitly disclaims any implied warranties of mer- *
|
||||
* chantability or fitness for any particular purpose. *
|
||||
* *
|
||||
******************************************************************************
|
||||
@ -60,8 +59,8 @@
|
||||
*
|
||||
* Michael Widenius:
|
||||
* DBUG_DUMP - To dump a block of memory.
|
||||
* PUSH_FLAG "O" - To be used insted of "o" if we don't
|
||||
* want flushing (for slow systems)
|
||||
* PUSH_FLAG "O" - To be used insted of "o" if we
|
||||
* want flushing after each write
|
||||
* PUSH_FLAG "A" - as 'O', but we will append to the out file instead
|
||||
* of creating a new one.
|
||||
* Check of malloc on entry/exit (option "S")
|
||||
@ -930,7 +929,7 @@ void _db_doprnt_ (const char *format,...)
|
||||
/*
|
||||
* FUNCTION
|
||||
*
|
||||
* _db_dump_ dump a string until '\0' is found
|
||||
* _db_dump_ dump a string in hex
|
||||
*
|
||||
* SYNOPSIS
|
||||
*
|
||||
@ -1204,6 +1203,33 @@ static BOOLEAN DoProfile ()
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* FUNCTION
|
||||
*
|
||||
* _db_strict_keyword_ test keyword for member of keyword list
|
||||
*
|
||||
* SYNOPSIS
|
||||
*
|
||||
* BOOLEAN _db_strict_keyword_ (keyword)
|
||||
* char *keyword;
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* Similar to _db_keyword_, but keyword is NOT accepted if keyword list
|
||||
* is empty. Used in DBUG_EXECUTE_IF() - for actions that must not be
|
||||
* executed by default.
|
||||
*
|
||||
* Returns TRUE if keyword accepted, FALSE otherwise.
|
||||
*
|
||||
*/
|
||||
|
||||
BOOLEAN _db_strict_keyword_ (
|
||||
const char *keyword)
|
||||
{
|
||||
if (stack -> keywords == NULL)
|
||||
return FALSE;
|
||||
return _db_keyword_ (keyword);
|
||||
}
|
||||
|
||||
/*
|
||||
* FUNCTION
|
||||
|
@ -572,6 +572,11 @@ int main (int argc, char **argv)
|
||||
FILE *infile;
|
||||
FILE *outfile = {stdout};
|
||||
|
||||
#if defined(HAVE_PTHREAD_INIT) && defined(THREAD)
|
||||
pthread_init(); /* Must be called before DBUG_ENTER */
|
||||
#endif
|
||||
my_thread_global_init();
|
||||
{
|
||||
DBUG_ENTER ("main");
|
||||
DBUG_PROCESS (argv[0]);
|
||||
my_name = argv[0];
|
||||
@ -601,6 +606,7 @@ int main (int argc, char **argv)
|
||||
output (outfile);
|
||||
DBUG_RETURN (EX_OK);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MSDOS
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
#error This file is not used in MySQL - see ../include/my_dbug.h instead
|
||||
/******************************************************************************
|
||||
* *
|
||||
* N O T I C E *
|
||||
|
@ -13,6 +13,7 @@ char *argv[];
|
||||
#if defined(HAVE_PTHREAD_INIT) && defined(THREAD)
|
||||
pthread_init(); /* Must be called before DBUG_ENTER */
|
||||
#endif
|
||||
my_thread_global_init();
|
||||
{
|
||||
DBUG_ENTER ("main");
|
||||
DBUG_PROCESS (argv[0]);
|
||||
|
233
dbug/user.r
233
dbug/user.r
@ -1,8 +1,13 @@
|
||||
.\" @(#)user.r 1.13 10/29/86
|
||||
.\"
|
||||
.\" 2004-10-29: documented features implemented since 10/29/86
|
||||
.\" formatting cleanup
|
||||
.\" - Sergei Golubchik
|
||||
.\"
|
||||
.\" DBUG (Macro Debugger Package) nroff source
|
||||
.\"
|
||||
.\" nroff -mm user.r >user.t
|
||||
.\" groff -mm user.r >user.ps
|
||||
.\"
|
||||
.\" ===================================================
|
||||
.\"
|
||||
@ -196,7 +201,9 @@ Figure 1 is an example of this type of primitive debugging
|
||||
technique.
|
||||
.DS I N
|
||||
.SP 2
|
||||
\fC
|
||||
.so example1.r
|
||||
\fR
|
||||
.SP 2
|
||||
.ll -5
|
||||
.ce
|
||||
@ -222,7 +229,9 @@ C preprocessor.
|
||||
Figure 2 is an example of all three techniques.
|
||||
.DS I N
|
||||
.SP 2
|
||||
\fC
|
||||
.so example2.r
|
||||
\fR
|
||||
.SP 2
|
||||
.ll -5
|
||||
.ce
|
||||
@ -255,7 +264,9 @@ like an arbitrary and unreasonable restriction.
|
||||
Figure 3 is an example of this usage.
|
||||
.DS I N
|
||||
.SP 2
|
||||
\fC
|
||||
.so example3.r
|
||||
\fR
|
||||
.SP 2
|
||||
.ll -5
|
||||
.ce
|
||||
@ -281,7 +292,9 @@ program is implemented recursively.
|
||||
Figure 4 is the main function for this factorial program.
|
||||
.DS I N
|
||||
.SP 2
|
||||
\fC
|
||||
.so main.r
|
||||
\fR
|
||||
.SP 2
|
||||
.ll -5
|
||||
.ce
|
||||
@ -346,7 +359,7 @@ All of these macros will be fully explained in subsequent sections.
|
||||
To use the debugger, the factorial program is invoked with a command
|
||||
line of the form:
|
||||
.DS CB N
|
||||
factorial -#d:t 1 2 3
|
||||
\fCfactorial -#d:t 1 2 3
|
||||
.DE
|
||||
The
|
||||
.B main
|
||||
@ -373,6 +386,7 @@ by an optional comma separated list of arguments specific
|
||||
to the given flag.
|
||||
Some examples are:
|
||||
.DS CB N
|
||||
\fC
|
||||
-#d:t:o
|
||||
-#d,in,out:f,main:F:L
|
||||
.DE
|
||||
@ -391,7 +405,9 @@ Note that this is not necessarily the best way to do factorials
|
||||
and error conditions are ignored completely.
|
||||
.DS I N
|
||||
.SP 2
|
||||
\fC
|
||||
.so factorial.r
|
||||
\fR
|
||||
.SP 2
|
||||
.ll -5
|
||||
.ce
|
||||
@ -421,7 +437,7 @@ To build the factorial program on a
|
||||
system, compile and
|
||||
link with the command:
|
||||
.DS CB N
|
||||
cc -o factorial main.c factorial.c -ldbug
|
||||
\fCcc -o factorial main.c factorial.c -ldbug
|
||||
.DE
|
||||
The "-ldbug" argument tells the loader to link in the
|
||||
runtime support modules for the
|
||||
@ -429,18 +445,20 @@ runtime support modules for the
|
||||
package.
|
||||
Executing the factorial program with a command of the form:
|
||||
.DS CB N
|
||||
factorial 1 2 3 4 5
|
||||
\fCfactorial 1 2 3 4 5
|
||||
.DE
|
||||
generates the output shown in figure 6.
|
||||
.DS I N
|
||||
.SP 2
|
||||
\fC
|
||||
.so output1.r
|
||||
\fR
|
||||
.SP 2
|
||||
.ll -5
|
||||
.ce
|
||||
Figure 6
|
||||
.ce
|
||||
factorial 1 2 3 4 5
|
||||
\fCfactorial 1 2 3 4 5
|
||||
.ll +5
|
||||
.SP 2
|
||||
.DE
|
||||
@ -449,16 +467,18 @@ factorial 1 2 3 4 5
|
||||
Function level tracing is enabled by passing the debugger
|
||||
the 't' flag in the debug control string.
|
||||
Figure 7 is the output resulting from the command
|
||||
"factorial\ -#t:o\ 3\ 2".
|
||||
"factorial\ -#t:o\ 2\ 3".
|
||||
.DS I N
|
||||
.SP 2
|
||||
\fC
|
||||
.so output2.r
|
||||
\fR
|
||||
.SP 2
|
||||
.ll -5
|
||||
.ce
|
||||
Figure 7
|
||||
.ce
|
||||
factorial -#t:o 3 2
|
||||
\fCfactorial -#t:o 2 3
|
||||
.ll +5
|
||||
.SP 2
|
||||
.DE
|
||||
@ -510,7 +530,7 @@ output instead, via the 'o' flag character.
|
||||
Note that no 'o' implies the default (standard error), a 'o'
|
||||
with no arguments means standard output, and a 'o'
|
||||
with an argument means used the named file.
|
||||
I.E, "factorial\ -#t:o,logfile\ 3\ 2" would write the trace
|
||||
i.e, "factorial\ -#t:o,logfile\ 3\ 2" would write the trace
|
||||
output in "logfile".
|
||||
Because of
|
||||
.B UNIX
|
||||
@ -566,13 +586,15 @@ to a single macro with a huge format string.
|
||||
Figure 8 shows the output for default tracing and debug.
|
||||
.DS I N
|
||||
.SP 2
|
||||
\fC
|
||||
.so output3.r
|
||||
\fR
|
||||
.SP 2
|
||||
.ll -5
|
||||
.ce
|
||||
Figure 8
|
||||
.ce
|
||||
factorial -#d:t:o 3
|
||||
\fCfactorial -#d:t:o 3
|
||||
.ll +5
|
||||
.SP 2
|
||||
.DE
|
||||
@ -591,13 +613,15 @@ To demonstrate selection of specific macros for output, figure
|
||||
the debug control string "-#d,result:o".
|
||||
.DS I N
|
||||
.SP 2
|
||||
\fC
|
||||
.so output4.r
|
||||
\fR
|
||||
.SP 2
|
||||
.ll -5
|
||||
.ce
|
||||
Figure 9
|
||||
.ce
|
||||
factorial -#d,result:o 4
|
||||
\fCfactorial -#d,result:o 4
|
||||
.ll +5
|
||||
.SP 2
|
||||
.DE
|
||||
@ -613,13 +637,15 @@ The 'F' flag enables printing of the source file name and the 'L'
|
||||
flag enables printing of the source file line number.
|
||||
.DS I N
|
||||
.SP 2
|
||||
\fC
|
||||
.so output5.r
|
||||
\fR
|
||||
.SP 2
|
||||
.ll -5
|
||||
.ce
|
||||
Figure 10
|
||||
.ce
|
||||
factorial -#d:f,factorial:F:L:o 3
|
||||
\fCfactorial -#d:f,factorial:F:L:o 3
|
||||
.ll +5
|
||||
.SP 2
|
||||
.DE
|
||||
@ -671,7 +697,7 @@ will cause warning messages from the
|
||||
.I dbug
|
||||
package runtime support module.
|
||||
.SP 1
|
||||
EX:\ DBUG_ENTER\ ("main");
|
||||
EX:\ \fCDBUG_ENTER\ ("main");\fR
|
||||
.SP 1
|
||||
.LI DBUG_RETURN\
|
||||
Used at each exit point of a function containing a
|
||||
@ -693,16 +719,16 @@ DBUG_ENTER
|
||||
macro, and the compiler will complain
|
||||
if the macros are actually used (expanded).
|
||||
.SP 1
|
||||
EX:\ DBUG_RETURN\ (value);
|
||||
EX:\ \fCDBUG_RETURN\ (value);\fR
|
||||
.br
|
||||
EX:\ DBUG_VOID_RETURN;
|
||||
EX:\ \fCDBUG_VOID_RETURN;\fR
|
||||
.SP 1
|
||||
.LI DBUG_PROCESS\
|
||||
Used to name the current process being executed.
|
||||
A typical argument for this macro is "argv[0]", though
|
||||
it will be perfectly happy with any other string.
|
||||
.SP 1
|
||||
EX:\ DBUG_PROCESS\ (argv[0]);
|
||||
EX:\ \fCDBUG_PROCESS\ (argv[0]);\fR
|
||||
.SP 1
|
||||
.LI DBUG_PUSH\
|
||||
Sets a new debugger state by pushing the current
|
||||
@ -720,11 +746,11 @@ The proper usage is to pass a pointer to the first character
|
||||
.B after
|
||||
the "-#" string.
|
||||
.SP 1
|
||||
EX:\ DBUG_PUSH\ (\&(argv[i][2]));
|
||||
EX:\ \fCDBUG_PUSH\ (\&(argv[i][2]));\fR
|
||||
.br
|
||||
EX:\ DBUG_PUSH\ ("d:t");
|
||||
EX:\ \fCDBUG_PUSH\ ("d:t");\fR
|
||||
.br
|
||||
EX:\ DBUG_PUSH\ ("");
|
||||
EX:\ \fCDBUG_PUSH\ ("");\fR
|
||||
.SP 1
|
||||
.LI DBUG_POP\
|
||||
Restores the previous debugger state by popping the state stack.
|
||||
@ -734,7 +760,7 @@ The
|
||||
DBUG_POP
|
||||
macro has no arguments.
|
||||
.SP 1
|
||||
EX:\ DBUG_POP\ ();
|
||||
EX:\ \fCDBUG_POP\ ();\fR
|
||||
.SP 1
|
||||
.LI DBUG_FILE\
|
||||
The
|
||||
@ -744,7 +770,7 @@ stream.
|
||||
It is used in the same manner as the symbols "stdout" and "stderr"
|
||||
in the standard I/O package.
|
||||
.SP 1
|
||||
EX:\ fprintf\ (DBUG_FILE,\ "Doing my own I/O!\n");
|
||||
EX:\ \fCfprintf\ (DBUG_FILE,\ "Doing\ my\ own\ I/O!\\n");\fR
|
||||
.SP 1
|
||||
.LI DBUG_EXECUTE\
|
||||
The DBUG_EXECUTE macro is used to execute any arbitrary C code.
|
||||
@ -754,9 +780,19 @@ This macro must be used cautiously because, like the
|
||||
DBUG_PRINT
|
||||
macro,
|
||||
it is automatically selected by default whenever the 'd' flag has
|
||||
no argument list (I.E., a "-#d:t" control string).
|
||||
no argument list (i.e., a "-#d:t" control string).
|
||||
.SP 1
|
||||
EX:\ DBUG_EXECUTE\ ("abort",\ abort\ ());
|
||||
EX:\ \fCDBUG_EXECUTE\ ("status",\ print_status\ ());\fR
|
||||
.SP 1
|
||||
.LI DBUG_EXECUTE_IF\
|
||||
Works like DBUG_EXECUTE macro, but the code is
|
||||
.B not
|
||||
executed "by default", if the keyword is not explicitly listed in
|
||||
the 'd' flag. Used to conditionally execute "dangerous" actions, e.g
|
||||
to crash the program testing how recovery works, or to introduce an
|
||||
artificial delay checking for race conditions.
|
||||
.SP 1
|
||||
EX:\ \fCDBUG_EXECUTE_IF\ ("crashme",\ abort\ ());\fR
|
||||
.SP 1
|
||||
.LI DBUG_N\
|
||||
These macros, where N is in the range 2-5, are currently obsolete
|
||||
@ -773,11 +809,20 @@ and
|
||||
.B must
|
||||
be enclosed in parenthesis.
|
||||
.SP 1
|
||||
EX:\ DBUG_PRINT\ ("eof",\ ("end\ of\ file\ found"));
|
||||
EX:\ \fCDBUG_PRINT\ ("eof",\ ("end\ of\ file\ found"));\fR
|
||||
.br
|
||||
EX:\ DBUG_PRINT\ ("type",\ ("type\ is\ %x", type));
|
||||
EX:\ \fCDBUG_PRINT\ ("type",\ ("type\ is\ %x", type));\fR
|
||||
.br
|
||||
EX:\ DBUG_PRINT\ ("stp",\ ("%x\ ->\ %s", stp, stp\ ->\ name));
|
||||
EX:\ \fCDBUG_PRINT\ ("stp",\ ("%x\ ->\ %s", stp, stp\ ->\ name));\fR
|
||||
.SP 1
|
||||
.LI DBUG_DUMP\
|
||||
Used to dump a memory block in hex via the "fprintf" library function on the
|
||||
current debug stream, DBUG_FILE.
|
||||
The first argument is a debug keyword, the second is a pointer to
|
||||
a memory to dump, the third is a number of bytes to dump.
|
||||
.SP 1
|
||||
EX: \fCDBUG_DBUG\ ("net",\ packet,\ len);\fR
|
||||
.SP 1
|
||||
.LI DBUG_SETJMP\
|
||||
Used in place of the setjmp() function to first save the current
|
||||
debugger state and then execute the standard setjmp call.
|
||||
@ -786,7 +831,8 @@ DBUG_LONGJMP macro is used to invoke the standard longjmp() call.
|
||||
Currently all instances of DBUG_SETJMP must occur within the
|
||||
same function and at the same function nesting level.
|
||||
.SP 1
|
||||
EX:\ DBUG_SETJMP\ (env);
|
||||
EX: \fCDBUG_SETJMP\ (env);\fR
|
||||
.SP 1
|
||||
.LI DBUG_LONGJMP\
|
||||
Used in place of the longjmp() function to first restore the
|
||||
previous debugger state at the time of the last DBUG_SETJMP
|
||||
@ -797,7 +843,38 @@ It would be possible to maintain separate DBUG_SETJMP and DBUG_LONGJMP
|
||||
pairs by having the debugger runtime support module use the first
|
||||
argument to differentiate the pairs.
|
||||
.SP 1
|
||||
EX:\ DBUG_LONGJMP\ (env,val);
|
||||
EX: \fCDBUG_LONGJMP\ (env,val);\fR
|
||||
.SP 1
|
||||
.LI DBUG_LOCK_FILE\
|
||||
Used in multi-threaded environment to lock DBUG_FILE stream.
|
||||
It can be used, for example, in functions that need to write something to a
|
||||
debug stream more than in one fprintf() call and want to ensure that no other
|
||||
thread will write something in between.
|
||||
.SP 1
|
||||
EX:\fC
|
||||
.br
|
||||
DBUG_LOCK_FILE;
|
||||
.br
|
||||
fprintf (DBUG_FILE, "a=[");
|
||||
.br
|
||||
for (int i=0; i < a_length; i++)
|
||||
.br
|
||||
fprintf (DBUG_FILE, "0x%03x ", a[i]);
|
||||
.br
|
||||
fprintf (DBUG_FILE, "]");
|
||||
.br
|
||||
DBUG_UNLOCK_FILE;\fR
|
||||
.SP 1
|
||||
.LI DBUG_UNLOCK_FILE\
|
||||
Unlocks DBUG_FILE stream, that was locked with a DBUG_LOCK_FILE.
|
||||
.LI DBUG_ASSERT\
|
||||
This macro just does a regular assert(). The difference is that it will be
|
||||
disabled by DBUG_OFF togeher with the
|
||||
.I dbug
|
||||
library. So there will be no need to disable asserts separately with NDEBUG.
|
||||
.SP 1
|
||||
EX:\ \fCDBUG_ASSERT(\ a\ >\ 0);\fR
|
||||
.SP 1
|
||||
.LE
|
||||
|
||||
.SK
|
||||
@ -815,6 +892,16 @@ and the flag characters which enable or disable them.
|
||||
Argument lists enclosed in '[' and ']' are optional.
|
||||
.SP 2
|
||||
.BL 22
|
||||
.LI a[,file]
|
||||
Redirect the debugger output stream and append it to the specified file.
|
||||
The default output stream is stderr.
|
||||
A null argument list causes output to be redirected to stdout.
|
||||
Double the colon, if you want it in the path
|
||||
.SP 1
|
||||
EX: \fCa,C::\\tmp\\log\fR
|
||||
.LI A[,file]
|
||||
Like 'a[,file]' but close and reopen file after each write. It helps to get
|
||||
a complete log file in case of crashes.
|
||||
.LI d[,keywords]
|
||||
Enable output from macros with specified keywords.
|
||||
A null list of keywords implies that all keywords are selected.
|
||||
@ -828,6 +915,14 @@ A null list of functions implies that all functions are selected.
|
||||
.LI F
|
||||
Mark each debugger output line with the name of the source file
|
||||
containing the macro causing the output.
|
||||
.LI i
|
||||
Mark each debugger output line with the PID of the current process.
|
||||
.LI g,[functions]
|
||||
Enable profiling for the specified list of functions.
|
||||
By default profiling is enabled for all functions.
|
||||
See
|
||||
.B PROFILING\ WITH\ DBUG
|
||||
below.
|
||||
.LI L
|
||||
Mark each debugger output line with the source file line number of
|
||||
the macro causing the output.
|
||||
@ -838,9 +933,9 @@ Sequentially number each debugger output line starting at 1.
|
||||
This is useful for reference purposes when debugger output is
|
||||
interspersed with program output.
|
||||
.LI o[,file]
|
||||
Redirect the debugger output stream to the specified file.
|
||||
The default output stream is stderr.
|
||||
A null argument list causes output to be redirected to stdout.
|
||||
Like 'a[,file]' but overwrite old file, do not append.
|
||||
.LI O[,file]
|
||||
Like 'A[,file]' but overwrite old file, do not append.
|
||||
.LI p[,processes]
|
||||
Limit debugger actions to the specified processes.
|
||||
A null list implies all processes.
|
||||
@ -865,11 +960,89 @@ Most useful with
|
||||
.B DBUG_PUSH
|
||||
macros used to temporarily alter the
|
||||
debugger state.
|
||||
.LI S
|
||||
When compiled with
|
||||
.I safemalloc
|
||||
this flag forces "sanity" memory checks (for overwrites/underwrites)
|
||||
on each
|
||||
.B DBUG_ENTER
|
||||
and
|
||||
.B DBUG_RETURN.
|
||||
.LI t[,N]
|
||||
Enable function control flow tracing.
|
||||
The maximum nesting depth is specified by N, and defaults to
|
||||
200.
|
||||
.LE
|
||||
.SK
|
||||
.B
|
||||
PROFILING WITH DBUG
|
||||
.R
|
||||
|
||||
.P
|
||||
With
|
||||
.I dbug
|
||||
one can do profiling in a machine independent fashion,
|
||||
without a need for profiled version of system libraries.
|
||||
For this,
|
||||
.I dbug
|
||||
can write out a file
|
||||
called
|
||||
.B dbugmon.out
|
||||
(by default). This is an ascii file containing lines of the form:
|
||||
.DS CB N
|
||||
\fC<function-name> E <time-entered>
|
||||
<function-name> X <time-exited>
|
||||
.DE
|
||||
|
||||
.P
|
||||
A second program (\fBanalyze\fR) reads this file, and produces a report on
|
||||
standard output.
|
||||
|
||||
.P
|
||||
Profiling is enabled through the
|
||||
.B g
|
||||
flag. It can take a list of
|
||||
function names for which profiling is enabled. By default, it
|
||||
profiles all functions.
|
||||
|
||||
.P
|
||||
The profile file is opened for appending. This
|
||||
is in order that one can run a program several times, and get the
|
||||
sum total of all the times, etc.
|
||||
|
||||
.P
|
||||
An example of the report generated follows:
|
||||
.DS CB N
|
||||
\fC
|
||||
Profile of Execution
|
||||
Execution times are in milliseconds
|
||||
|
||||
Calls Time
|
||||
----- ----
|
||||
Times Percentage Time Spent Percentage
|
||||
Function Called of total in Function of total Importance
|
||||
======== ====== ========== =========== ========== ==========
|
||||
factorial 5 83.33 30 100.00 8333
|
||||
main 1 16.67 0 0.00 0
|
||||
======== ====== ========== =========== ==========
|
||||
Totals 6 100.00 30 100.00
|
||||
.DE
|
||||
.P
|
||||
As you can see, it's quite self-evident. The
|
||||
.B Importance
|
||||
column is a
|
||||
metric obtained by multiplying the percentage of the calls and the percentage
|
||||
of the time. Functions with higher 'importance' benefit the most from
|
||||
being sped up.
|
||||
|
||||
.P
|
||||
As a limitation - setjmp/longjmp, or child processes, are ignored
|
||||
for the time being. Also, profiling does not work
|
||||
in a multi-threaded environment.
|
||||
|
||||
.P
|
||||
Profiling code is (c) Binayak Banerjee.
|
||||
|
||||
.SK
|
||||
.B
|
||||
HINTS AND MISCELLANEOUS
|
||||
@ -934,4 +1107,4 @@ The most common problem is multiply allocated memory.
|
||||
.\" .DE nroff dident like this. davida 900108
|
||||
.CS
|
||||
|
||||
|
||||
.\" vim:filetype=nroff
|
||||
|
@ -20,6 +20,7 @@ LDADD = @CLIENT_EXTRA_LDFLAGS@ ../mysys/libmysys.a \
|
||||
../dbug/libdbug.a ../strings/libmystrings.a
|
||||
bin_PROGRAMS = replace comp_err perror resolveip my_print_defaults \
|
||||
resolve_stack_dump mysql_waitpid
|
||||
noinst_PROGRAMS = charset2html
|
||||
|
||||
# Don't update the files from bitkeeper
|
||||
%::SCCS/s.%
|
||||
|
@ -301,6 +301,9 @@ inline double ulonglong2double(ulonglong value)
|
||||
#define HAVE_SETFILEPOINTER
|
||||
#define HAVE_VIO
|
||||
|
||||
#define HAME_MMAP /* in mysys/my_mmap.c */
|
||||
#define HAVE_GETPAGESIZE /* in mysys/my_mmap.c */
|
||||
|
||||
#ifdef NOT_USED
|
||||
#define HAVE_SNPRINTF /* Gave link error */
|
||||
#define _snprintf snprintf
|
||||
|
@ -25,6 +25,7 @@ extern int _db_on_,_no_db_;
|
||||
extern FILE *_db_fp_;
|
||||
extern char *_db_process_;
|
||||
extern int _db_keyword_(const char *keyword);
|
||||
extern int _db_strict_keyword_(const char *keyword);
|
||||
extern void _db_setjmp_(void);
|
||||
extern void _db_longjmp_(void);
|
||||
extern void _db_push_(const char *control);
|
||||
@ -67,12 +68,15 @@ extern void _db_unlock_file();
|
||||
#define DBUG_LOCK_FILE { _db_lock_file(); }
|
||||
#define DBUG_UNLOCK_FILE { _db_unlock_file(); }
|
||||
#define DBUG_ASSERT(A) assert(A)
|
||||
#define DBUG_EXECUTE_IF(keyword,a1) \
|
||||
{if (_db_on_) {if (_db_strict_keyword_ (keyword)) { a1 }}}
|
||||
#else /* No debugger */
|
||||
|
||||
#define DBUG_ENTER(a1)
|
||||
#define DBUG_RETURN(a1) return(a1)
|
||||
#define DBUG_VOID_RETURN return
|
||||
#define DBUG_EXECUTE(keyword,a1) {}
|
||||
#define DBUG_EXECUTE_IF(keyword,a1) {}
|
||||
#define DBUG_PRINT(keyword,arglist) {}
|
||||
#define DBUG_PUSH(a1) {}
|
||||
#define DBUG_POP() {}
|
||||
|
@ -674,21 +674,43 @@ extern pthread_t shutdown_th, main_th, signal_th;
|
||||
|
||||
#ifndef thread_safe_increment
|
||||
#ifdef HAVE_ATOMIC_ADD
|
||||
#define thread_safe_increment(V,L) atomic_add(1,(atomic_t*) &V);
|
||||
#define thread_safe_increment(V,L) atomic_inc((atomic_t*) &V);
|
||||
#define thread_safe_decrement(V,L) atomic_dec((atomic_t*) &V);
|
||||
#define thread_safe_dec_and_test(V, L) atomic_dec_and_test((atomic_t*) &V);
|
||||
#define thread_safe_add(V,C,L) atomic_add((C),(atomic_t*) &V);
|
||||
#define thread_safe_sub(V,C,L) atomic_sub((C),(atomic_t*) &V);
|
||||
#else
|
||||
#define thread_safe_increment(V,L) \
|
||||
pthread_mutex_lock((L)); (V)++; pthread_mutex_unlock((L));
|
||||
#define thread_safe_add(V,C,L) \
|
||||
pthread_mutex_lock((L)); (V)+=(C); pthread_mutex_unlock((L));
|
||||
(pthread_mutex_lock((L)), (V)++, pthread_mutex_unlock((L)))
|
||||
#define thread_safe_decrement(V,L) \
|
||||
(pthread_mutex_lock((L)), (V)--, pthread_mutex_unlock((L)))
|
||||
#define thread_safe_add(V,C,L) (pthread_mutex_lock((L)), (V)+=(C), pthread_mutex_unlock((L)))
|
||||
#define thread_safe_sub(V,C,L) \
|
||||
pthread_mutex_lock((L)); (V)-=(C); pthread_mutex_unlock((L));
|
||||
(pthread_mutex_lock((L)), (V)-=(C), pthread_mutex_unlock((L)))
|
||||
#if defined (__GNUC__) || defined (__cplusplus)
|
||||
static inline bool thread_safe_dec_and_test(ulong V, pthread_mutex_t *L)
|
||||
{
|
||||
ulong res;
|
||||
pthread_mutex_lock(L);
|
||||
res=V--;
|
||||
pthread_mutex_unlock(L);
|
||||
return res==0;
|
||||
}
|
||||
#else
|
||||
/*
|
||||
what should we do ? define it as static ?
|
||||
a regular function somewhere in mysys/ ?
|
||||
for now it's only used in c++ code, so there's no need to bother
|
||||
*/
|
||||
#warning "No thread_safe_dec_and_test() for this architecture"
|
||||
#endif
|
||||
#endif /* HAVE_ATOMIC_ADD */
|
||||
#ifdef SAFE_STATISTICS
|
||||
#define statistic_increment(V,L) thread_safe_increment((V),(L))
|
||||
#define statistic_decrement(V,L) thread_safe_decrement((V),(L))
|
||||
#define statistic_add(V,C,L) thread_safe_add((V),(C),(L))
|
||||
#else
|
||||
#define statistic_decrement(V,L) (V)--
|
||||
#define statistic_increment(V,L) (V)++
|
||||
#define statistic_add(V,C,L) (V)+=(C)
|
||||
#endif /* SAFE_STATISTICS */
|
||||
|
@ -663,6 +663,8 @@ extern void radixsort_for_str_ptr(uchar* base[], uint number_of_elements,
|
||||
extern qsort_t qsort2(void *base_ptr, size_t total_elems, size_t size,
|
||||
qsort2_cmp cmp, void *cmp_argument);
|
||||
extern qsort2_cmp get_ptr_compare(uint);
|
||||
void my_store_ptr(byte *buff, uint pack_length, my_off_t pos);
|
||||
my_off_t my_get_ptr(byte *ptr, uint pack_length);
|
||||
extern int init_io_cache(IO_CACHE *info,File file,uint cachesize,
|
||||
enum cache_type type,my_off_t seek_offset,
|
||||
pbool use_async_io, myf cache_myflags);
|
||||
@ -772,6 +774,32 @@ void my_free_open_file_info(void);
|
||||
ulonglong my_getsystime(void);
|
||||
my_bool my_gethwaddr(uchar *to);
|
||||
|
||||
#ifdef HAVE_MMAP
|
||||
#include <sys/mman.h>
|
||||
|
||||
#ifndef MAP_NOSYNC
|
||||
#define MAP_NOSYNC 0
|
||||
#endif
|
||||
|
||||
#define my_mmap(a,b,c,d,e,f) mmap(a,b,c,d,e,f)
|
||||
#define my_getpagesize() getpagesize()
|
||||
#define my_munmap(a,b) munmap(a,b)
|
||||
|
||||
#else
|
||||
/* not a complete set of mmap() flags, but only those that nesessary */
|
||||
#define PROT_READ 1
|
||||
#define PROT_WRITE 2
|
||||
#define MAP_NOSYNC 0x800
|
||||
#define MAP_FAILED ((void *)-1)
|
||||
#define MS_SYNC 0x0000
|
||||
|
||||
int my_getpagesize(void);
|
||||
void *my_mmap(void *, size_t, int, int, int, my_off_t);
|
||||
int my_munmap(void *, size_t);
|
||||
#endif
|
||||
|
||||
int my_msync(int, void *, size_t, int);
|
||||
|
||||
/* character sets */
|
||||
extern uint get_charset_number(const char *cs_name, uint cs_flags);
|
||||
extern uint get_collation_number(const char *name);
|
||||
|
@ -1284,3 +1284,10 @@ SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterd");
|
||||
id
|
||||
4
|
||||
DROP TABLE t1;
|
||||
create temporary table t1 (a int, primary key(a)) engine=bdb;
|
||||
select * from t1;
|
||||
a
|
||||
alter table t1 add b int;
|
||||
select * from t1;
|
||||
a b
|
||||
drop table t1;
|
||||
|
@ -929,3 +929,13 @@ SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterb");
|
||||
SELECT id FROM t1 WHERE (list_id = 1) AND (term = "lettera");
|
||||
SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterd");
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# alter temp table
|
||||
#
|
||||
create temporary table t1 (a int, primary key(a)) engine=bdb;
|
||||
select * from t1;
|
||||
alter table t1 add b int;
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
|
@ -26,7 +26,7 @@ noinst_HEADERS = mysys_priv.h my_static.h \
|
||||
my_os2cond.c my_os2dirsrch.c my_os2dirsrch.h \
|
||||
my_os2dlfcn.c my_os2file64.c my_os2mutex.c \
|
||||
my_os2thread.c my_os2tls.c
|
||||
libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c \
|
||||
libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \
|
||||
mf_path.c mf_loadpath.c my_file.c \
|
||||
my_open.c my_create.c my_dup.c my_seek.c my_read.c \
|
||||
my_pread.c my_write.c \
|
||||
@ -57,7 +57,6 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c \
|
||||
EXTRA_DIST = thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \
|
||||
thr_mutex.c thr_rwlock.c
|
||||
libmysys_a_LIBADD = @THREAD_LOBJECTS@
|
||||
noinst_PROGRAMS = charset2html @THREAD_LPROGRAMS@
|
||||
# test_dir_DEPENDENCIES= $(LIBRARIES)
|
||||
# testhash_DEPENDENCIES= $(LIBRARIES)
|
||||
# test_charset_DEPENDENCIES= $(LIBRARIES)
|
||||
@ -105,9 +104,6 @@ test_dir$(EXEEXT): test_dir.c $(LIBRARIES)
|
||||
test_charset$(EXEEXT): test_charset.c $(LIBRARIES)
|
||||
$(LINK) $(FLAGS) -DMAIN $(srcdir)/test_charset.c $(LDADD) $(LIBS)
|
||||
|
||||
charset2html$(EXEEXT): charset2html.c $(LIBRARIES)
|
||||
$(LINK) $(FLAGS) -DMAIN $(srcdir)/charset2html.c $(LDADD) $(LIBS)
|
||||
|
||||
testhash$(EXEEXT): testhash.c $(LIBRARIES)
|
||||
$(LINK) $(FLAGS) -DMAIN $(srcdir)/testhash.c $(LDADD) $(LIBS)
|
||||
|
||||
|
@ -48,9 +48,9 @@ int my_chsize(File fd, my_off_t newlength, int filler, myf MyFlags)
|
||||
DBUG_PRINT("info",("old_size: %ld", (ulong) oldsize));
|
||||
|
||||
if (oldsize > newlength)
|
||||
{
|
||||
#if defined(HAVE_SETFILEPOINTER)
|
||||
/* This is for the moment only true on windows */
|
||||
{
|
||||
long is_success;
|
||||
HANDLE win_file= (HANDLE) _get_osfhandle(fd);
|
||||
long length_low, length_high;
|
||||
@ -63,35 +63,29 @@ int my_chsize(File fd, my_off_t newlength, int filler, myf MyFlags)
|
||||
DBUG_RETURN(0);
|
||||
my_errno= GetLastError();
|
||||
goto err;
|
||||
}
|
||||
#elif defined(HAVE_FTRUNCATE)
|
||||
{
|
||||
if (ftruncate(fd, (off_t) newlength))
|
||||
{
|
||||
my_errno= errno;
|
||||
goto err;
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
#elif defined(HAVE_CHSIZE)
|
||||
{
|
||||
if (chsize(fd, (off_t) newlength))
|
||||
{
|
||||
my_errno=errno;
|
||||
goto err;
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
#else
|
||||
{
|
||||
/*
|
||||
Fill space between requested length and true length with 'filler'
|
||||
We should never come here on any modern machine
|
||||
*/
|
||||
VOID(my_seek(fd, newlength, MY_SEEK_SET, MYF(MY_WME+MY_FAE)));
|
||||
swap_variables(my_off_t, newlength, oldsize);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Full file with 'filler' until it's as big as requested */
|
||||
bfill(buff, IO_SIZE, filler);
|
||||
|
89
mysys/my_mmap.c
Normal file
89
mysys/my_mmap.c
Normal file
@ -0,0 +1,89 @@
|
||||
/* Copyright (C) 2000-2003 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; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#include "mysys_priv.h"
|
||||
|
||||
#ifdef HAVE_MMAP
|
||||
|
||||
/*
|
||||
system msync() only syncs mmap'ed area to fs cache.
|
||||
fsync() is required to really sync to disc
|
||||
*/
|
||||
int my_msync(int fd, void *addr, size_t len, int flags)
|
||||
{
|
||||
msync(addr, len, flags);
|
||||
return my_sync(fd, MYF(0));
|
||||
}
|
||||
|
||||
#else
|
||||
#ifdef __WIN__
|
||||
|
||||
static SECURITY_ATTRIBUTES mmap_security_attributes=
|
||||
{sizeof(SECURITY_ATTRIBUTES), 0, TRUE};
|
||||
|
||||
int my_getpagesize(void)
|
||||
{
|
||||
SYSTEM_INFO si;
|
||||
GetSystemInfo(&si);
|
||||
return si.dwPageSize;
|
||||
}
|
||||
|
||||
void *my_mmap(void *addr, size_t len, int prot,
|
||||
int flags, int fd, my_off_t offset)
|
||||
{
|
||||
DWORD flProtect=0;
|
||||
HANDLE hFileMap;
|
||||
LPVOID ptr;
|
||||
|
||||
flProtect|=SEC_COMMIT;
|
||||
|
||||
hFileMap=CreateFileMapping(fd, NULL, &mmap_security_attributes,
|
||||
PAGE_READWRITE, 0, len, 0);
|
||||
if (hFileMap == 0)
|
||||
return MAP_FAILED;
|
||||
|
||||
ptr=MapViewOfFile(hFileMap,
|
||||
flags & PROT_WRITE ? FILE_MAP_WRITE : FILE_MAP_READ,
|
||||
(DWORD)(offset >> 32), (DWORD)offset, len);
|
||||
|
||||
/*
|
||||
MSDN explicitly states that it's possible to close File Mapping Object
|
||||
even when a view is not unmapped - then the object will be held open
|
||||
implicitly until unmap, as every view stores internally a handler of
|
||||
a corresponding File Mapping Object
|
||||
*/
|
||||
CloseHandle(hFileMap);
|
||||
|
||||
if (ptr)
|
||||
return ptr;
|
||||
|
||||
return MAP_FAILED;
|
||||
}
|
||||
|
||||
int my_munmap(void *addr, size_t len)
|
||||
{
|
||||
return UnmapViewOfFile(addr) ? 0 : -1;
|
||||
}
|
||||
|
||||
int my_msync(int fd, void *addr, size_t len, int flags)
|
||||
{
|
||||
return FlushViewOfFile(addr, len) ? 0 : -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
#error "no mmap!"
|
||||
#endif
|
||||
|
@ -21,6 +21,7 @@
|
||||
*/
|
||||
|
||||
#include "mysys_priv.h"
|
||||
#include <myisampack.h>
|
||||
|
||||
static int ptr_compare(uint *compare_length, uchar **a, uchar **b);
|
||||
static int ptr_compare_0(uint *compare_length, uchar **a, uchar **b);
|
||||
@ -152,3 +153,41 @@ static int ptr_compare_3(uint *compare_length,uchar **a, uchar **b)
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
void my_store_ptr(byte *buff, uint pack_length, my_off_t pos)
|
||||
{
|
||||
switch (pack_length) {
|
||||
#if SIZEOF_OFF_T > 4
|
||||
case 8: mi_int8store(buff,pos); break;
|
||||
case 7: mi_int7store(buff,pos); break;
|
||||
case 6: mi_int6store(buff,pos); break;
|
||||
case 5: mi_int5store(buff,pos); break;
|
||||
#endif
|
||||
case 4: mi_int4store(buff,pos); break;
|
||||
case 3: mi_int3store(buff,pos); break;
|
||||
case 2: mi_int2store(buff,pos); break;
|
||||
case 1: buff[0]= (uchar) pos; break;
|
||||
default: DBUG_ASSERT(0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
my_off_t my_get_ptr(byte *ptr, uint pack_length)
|
||||
{
|
||||
my_off_t pos;
|
||||
switch (pack_length) {
|
||||
#if SIZEOF_OFF_T > 4
|
||||
case 8: pos= (my_off_t) mi_uint8korr(ptr); break;
|
||||
case 7: pos= (my_off_t) mi_uint7korr(ptr); break;
|
||||
case 6: pos= (my_off_t) mi_uint6korr(ptr); break;
|
||||
case 5: pos= (my_off_t) mi_uint5korr(ptr); break;
|
||||
#endif
|
||||
case 4: pos= (my_off_t) mi_uint4korr(ptr); break;
|
||||
case 3: pos= (my_off_t) mi_uint3korr(ptr); break;
|
||||
case 2: pos= (my_off_t) mi_uint2korr(ptr); break;
|
||||
case 1: pos= (my_off_t) mi_uint2korr(ptr); break;
|
||||
default: DBUG_ASSERT(0);
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
|
@ -464,7 +464,7 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
|
||||
error=file->rnd_next(sort_form->record[0]);
|
||||
if (!flag)
|
||||
{
|
||||
ha_store_ptr(ref_pos,ref_length,record); // Position to row
|
||||
my_store_ptr(ref_pos,ref_length,record); // Position to row
|
||||
record+=sort_form->db_record_offset;
|
||||
}
|
||||
else
|
||||
|
@ -172,7 +172,7 @@ int ha_isam::rnd_pos(byte * buf, byte *pos)
|
||||
{
|
||||
statistic_increment(current_thd->status_var.ha_read_rnd_count,
|
||||
&LOCK_status);
|
||||
int error=nisam_rrnd(file, buf, (ulong) ha_get_ptr(pos,ref_length));
|
||||
int error=nisam_rrnd(file, buf, (ulong) my_get_ptr(pos,ref_length));
|
||||
table->status=error ? STATUS_NOT_FOUND: 0;
|
||||
return !error ? 0 : my_errno ? my_errno : -1;
|
||||
}
|
||||
@ -182,7 +182,7 @@ void ha_isam::position(const byte *record)
|
||||
my_off_t position=nisam_position(file);
|
||||
if (position == (my_off_t) ~ (ulong) 0)
|
||||
position=HA_OFFSET_ERROR;
|
||||
ha_store_ptr(ref, ref_length, position);
|
||||
my_store_ptr(ref, ref_length, position);
|
||||
}
|
||||
|
||||
void ha_isam::info(uint flag)
|
||||
@ -227,7 +227,7 @@ void ha_isam::info(uint flag)
|
||||
if (flag & HA_STATUS_ERRKEY)
|
||||
{
|
||||
errkey = info.errkey;
|
||||
ha_store_ptr(dupp_ref, ref_length, info.dupp_key_pos);
|
||||
my_store_ptr(dupp_ref, ref_length, info.dupp_key_pos);
|
||||
}
|
||||
if (flag & HA_STATUS_TIME)
|
||||
update_time = info.update_time;
|
||||
|
@ -138,7 +138,7 @@ int ha_isammrg::rnd_next(byte *buf)
|
||||
int ha_isammrg::rnd_pos(byte * buf, byte *pos)
|
||||
{
|
||||
statistic_increment(current_thd->status_var.ha_read_rnd_count, &LOCK_status);
|
||||
int error=mrg_rrnd(file, buf, (ulong) ha_get_ptr(pos,ref_length));
|
||||
int error=mrg_rrnd(file, buf, (ulong) my_get_ptr(pos,ref_length));
|
||||
table->status=error ? STATUS_NOT_FOUND: 0;
|
||||
return !error ? 0 : my_errno ? my_errno : -1;
|
||||
}
|
||||
@ -146,7 +146,7 @@ int ha_isammrg::rnd_pos(byte * buf, byte *pos)
|
||||
void ha_isammrg::position(const byte *record)
|
||||
{
|
||||
ulong position= mrg_position(file);
|
||||
ha_store_ptr(ref, ref_length, (my_off_t) position);
|
||||
my_store_ptr(ref, ref_length, (my_off_t) position);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1197,7 +1197,7 @@ int ha_myisam::restart_rnd_next(byte *buf, byte *pos)
|
||||
int ha_myisam::rnd_pos(byte * buf, byte *pos)
|
||||
{
|
||||
statistic_increment(current_thd->status_var.ha_read_rnd_count,&LOCK_status);
|
||||
int error=mi_rrnd(file, buf, ha_get_ptr(pos,ref_length));
|
||||
int error=mi_rrnd(file, buf, my_get_ptr(pos,ref_length));
|
||||
table->status=error ? STATUS_NOT_FOUND: 0;
|
||||
return error;
|
||||
}
|
||||
@ -1205,7 +1205,7 @@ int ha_myisam::rnd_pos(byte * buf, byte *pos)
|
||||
void ha_myisam::position(const byte* record)
|
||||
{
|
||||
my_off_t position=mi_position(file);
|
||||
ha_store_ptr(ref, ref_length, position);
|
||||
my_store_ptr(ref, ref_length, position);
|
||||
}
|
||||
|
||||
void ha_myisam::info(uint flag)
|
||||
@ -1261,7 +1261,7 @@ void ha_myisam::info(uint flag)
|
||||
if (flag & HA_STATUS_ERRKEY)
|
||||
{
|
||||
errkey = info.errkey;
|
||||
ha_store_ptr(dupp_ref, ref_length, info.dupp_key_pos);
|
||||
my_store_ptr(dupp_ref, ref_length, info.dupp_key_pos);
|
||||
}
|
||||
if (flag & HA_STATUS_TIME)
|
||||
update_time = info.update_time;
|
||||
|
@ -190,7 +190,7 @@ int ha_myisammrg::rnd_next(byte *buf)
|
||||
int ha_myisammrg::rnd_pos(byte * buf, byte *pos)
|
||||
{
|
||||
statistic_increment(current_thd->status_var.ha_read_rnd_count,&LOCK_status);
|
||||
int error=myrg_rrnd(file, buf, ha_get_ptr(pos,ref_length));
|
||||
int error=myrg_rrnd(file, buf, my_get_ptr(pos,ref_length));
|
||||
table->status=error ? STATUS_NOT_FOUND: 0;
|
||||
return error;
|
||||
}
|
||||
@ -198,7 +198,7 @@ int ha_myisammrg::rnd_pos(byte * buf, byte *pos)
|
||||
void ha_myisammrg::position(const byte *record)
|
||||
{
|
||||
ulonglong position= myrg_position(file);
|
||||
ha_store_ptr(ref, ref_length, (my_off_t) position);
|
||||
my_store_ptr(ref, ref_length, (my_off_t) position);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1845,7 +1845,6 @@ Cursor::fetch(ulong num_rows)
|
||||
error= 0;
|
||||
|
||||
#ifdef USING_TRANSACTIONS
|
||||
if (thd->transaction.all.innobase_tid)
|
||||
ha_release_temporary_latches(thd);
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user