Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
751f2d1f
Commit
751f2d1f
authored
Sep 16, 2000
by
monty@donna.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Faster log::write() call, memory leak fix, flush master fix.
parent
a99c1757
Changes
26
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
321 additions
and
205 deletions
+321
-205
BUILD/compile-alpha-ccc
BUILD/compile-alpha-ccc
+3
-1
Docs/manual.texi
Docs/manual.texi
+50
-25
configure.in
configure.in
+2
-2
include/my_sys.h
include/my_sys.h
+2
-1
myisammrg/myrg_close.c
myisammrg/myrg_close.c
+2
-2
myisammrg/myrg_open.c
myisammrg/myrg_open.c
+9
-3
mysys/mf_format.c
mysys/mf_format.c
+5
-1
mysys/mf_keycache.c
mysys/mf_keycache.c
+2
-1
mysys/my_static.h
mysys/my_static.h
+0
-2
sql/ChangeLog
sql/ChangeLog
+4
-0
sql/lock.cc
sql/lock.cc
+1
-0
sql/log.cc
sql/log.cc
+41
-42
sql/mysql_priv.h
sql/mysql_priv.h
+1
-1
sql/mysqld.cc
sql/mysqld.cc
+57
-12
sql/sql_acl.cc
sql/sql_acl.cc
+1
-1
sql/sql_base.cc
sql/sql_base.cc
+2
-7
sql/sql_class.cc
sql/sql_class.cc
+6
-4
sql/sql_class.h
sql/sql_class.h
+7
-5
sql/sql_db.cc
sql/sql_db.cc
+13
-7
sql/sql_delete.cc
sql/sql_delete.cc
+12
-6
sql/sql_insert.cc
sql/sql_insert.cc
+18
-9
sql/sql_load.cc
sql/sql_load.cc
+7
-7
sql/sql_parse.cc
sql/sql_parse.cc
+38
-46
sql/sql_rename.cc
sql/sql_rename.cc
+6
-3
sql/sql_table.cc
sql/sql_table.cc
+26
-14
sql/sql_update.cc
sql/sql_update.cc
+6
-3
No files found.
BUILD/compile-alpha-ccc
View file @
751f2d1f
...
@@ -6,11 +6,13 @@ aclocal; autoheader; aclocal; automake; autoconf
...
@@ -6,11 +6,13 @@ aclocal; autoheader; aclocal; automake; autoconf
CC=ccc CFLAGS="-fast -O3 -fomit-frame-pointer" CXX=gcc CXXFLAGS="-O6 -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti -mcpu=ev6 -Wa,-mev6" CXXLDFLAGS='/usr/lib/compaq/libots-2.2.7/libots.so /usr/lib/compaq/cpml-5.0.0/libcpml_ev6.a' ./configure --prefix=/usr/local/mysql --disable-shared --with-extra-charsets=complex --enable-thread-safe-client
CC=ccc CFLAGS="-fast -O3 -fomit-frame-pointer" CXX=gcc CXXFLAGS="-O6 -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti -mcpu=ev6 -Wa,-mev6" CXXLDFLAGS='/usr/lib/compaq/libots-2.2.7/libots.so /usr/lib/compaq/cpml-5.0.0/libcpml_ev6.a' ./configure --prefix=/usr/local/mysql --disable-shared --with-extra-charsets=complex --enable-thread-safe-client
make
make
rm */.deps/*
make
if [ $? = 0 ]
if [ $? = 0 ]
then
then
rm */.deps/*
rm */.deps/*
bin/mysqladmin shutdown
bin/mysqladmin shutdown
make install
sur
make install
if [ $? = 0 ]
if [ $? = 0 ]
then
then
scripts/make_binary_distribution
scripts/make_binary_distribution
...
...
Docs/manual.texi
View file @
751f2d1f
...
@@ -5917,12 +5917,12 @@ The solution to this is to do one of the following steps:
...
@@ -5917,12 +5917,12 @@ The solution to this is to do one of the following steps:
@itemize @bullet
@itemize @bullet
@item
@item
Configure with @code{CFLAGS=-DHAVE_CURSES_H CXXFLAGS=-DHAVE_CURSES_H ./configure}
@item
Edit @file{/usr/include/widec.h} as indicted above and rerun configure
Edit @file{/usr/include/widec.h} as indicted above and rerun configure
@item
@item
Remove the @code{#define HAVE_TERM} line from @file{config.h} file and
Remove the @code{#define HAVE_TERM} line from @file{config.h} file and
run @code{make} again.
run @code{make} again.
@item
Configure with @code{CFLAGS=-DHAVE_CURSES CXXFLAGS=-DHAVE_CURSES ./configure}
@end itemize
@end itemize
If you get a problem that your linker can't find @code{-lz} when linking
If you get a problem that your linker can't find @code{-lz} when linking
...
@@ -5950,9 +5950,9 @@ experience problems with core dumps under load, you should use the
...
@@ -5950,9 +5950,9 @@ experience problems with core dumps under load, you should use the
following @code{configure} command:
following @code{configure} command:
@example
@example
shell> CC=gcc CFLAGS="-O6 -fomit-frame-pointer" \
shell> CC=gcc CFLAGS="-O6 -fomit-frame-pointer
-DHAVE_CURSES_H
" \
CXX=gcc \
CXX=gcc \
CXXFLAGS="-O6 -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti" \
CXXFLAGS="-O6 -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti
-DHAVE_CURSES_H
" \
./configure --prefix=/usr/local/mysql
./configure --prefix=/usr/local/mysql
@end example
@end example
...
@@ -8557,6 +8557,11 @@ LOW_PRIORITY ...} to lower the priority of only one query, or by
...
@@ -8557,6 +8557,11 @@ LOW_PRIORITY ...} to lower the priority of only one query, or by
priority in one thread.
priority in one thread.
@xref{Table locking}.
@xref{Table locking}.
@item --memlock
Lock the @code{mysqld} process in memory. This works only if your system
supports the @code{mlockall()} system call. This may help if you have
a problem where the opearting system is causing @code{mysqld} to swap on disk.
@item --pid-file=path
@item --pid-file=path
Path to pid file used by @code{safe_mysqld}.
Path to pid file used by @code{safe_mysqld}.
...
@@ -8597,6 +8602,11 @@ because sometimes it takes a long time to perform backward resolutions.
...
@@ -8597,6 +8602,11 @@ because sometimes it takes a long time to perform backward resolutions.
@strong{MySQL} 3.22 caches hostnames (unless @code{--skip-host-cache} is
@strong{MySQL} 3.22 caches hostnames (unless @code{--skip-host-cache} is
used) and has this option enabled by default.
used) and has this option enabled by default.
@item --skip-concurrent-insert
Turn of that one can insert and select at the same time on @code{MyISAM}
tables. (This is only to be used if you think you have found a bug
in this feature).
@item --skip-delay-key-write
@item --skip-delay-key-write
Ignore the @code{delay_key_write} option for all tables.
Ignore the @code{delay_key_write} option for all tables.
@xref{Server parameters}.
@xref{Server parameters}.
...
@@ -10210,13 +10220,14 @@ The following @code{mysqld} options affect networking security:
...
@@ -10210,13 +10220,14 @@ The following @code{mysqld} options affect networking security:
@table @code
@table @code
@item --secure
@item --secure
IP numbers returned by the @code{gethostbyname()} system call are checked to
IP numbers returned by the @code{gethostbyname()} system call are
make sure they resolve back to the original hostname. This makes it harder
checked to make sure they resolve back to the original hostname. This
for someone on the outside to get access by pretending to be another host. This
makes it harder for someone on the outside to get access by pretending
option also adds some sanity checks of hostnames. The option is turned off
to be another host. This option also adds some sanity checks of
by default in @strong{MySQL} 3.21 because sometimes it takes a long time to
hostnames. The option is turned off by default in @strong{MySQL} 3.21
perform backward resolutions. @strong{MySQL} 3.22 caches hostnames and has
because sometimes it takes a long time to perform backward resolutions.
this option enabled by default.
@strong{MySQL} 3.22 caches hostnames and has this option enabled by
default.
@item --skip-grant-tables
@item --skip-grant-tables
This option causes the server not to use the privilege system at all. This
This option causes the server not to use the privilege system at all. This
...
@@ -17953,6 +17964,10 @@ files directly, because the contents of the file must travel from the client
...
@@ -17953,6 +17964,10 @@ files directly, because the contents of the file must travel from the client
host to the server host. On the other hand, you do not need the
host to the server host. On the other hand, you do not need the
@strong{file} privilege to load local files.
@strong{file} privilege to load local files.
Note that you can't read from a FIFO with @code{LOAD DATA INFILE}; If
you need to read from a FIFO (for example the output from gunzip), use
@code{LOAD DATA LOCAL INFILE} instead.
@cindex @code{mysqlimport}
@cindex @code{mysqlimport}
You can also load data files by using the @code{mysqlimport} utility; it
You can also load data files by using the @code{mysqlimport} utility; it
operates by sending a @code{LOAD DATA INFILE} command to the server. The
operates by sending a @code{LOAD DATA INFILE} command to the server. The
...
@@ -35513,12 +35528,13 @@ only on Linux.
...
@@ -35513,12 +35528,13 @@ only on Linux.
You can always find the latest version
You can always find the latest version
@uref{http://www.trash.net/~ffischer/admin/index.html, here}.
@uref{http://www.trash.net/~ffischer/admin/index.html, here}.
@item @uref{http://www.mysql.com/Downloads/Win32/MySQL-Maker092.zip,MySQL-Maker 092}.
@c Link temporary removed on request because of a bug in the current version
Shareware @strong{MySQL} client for windows. It's WYSIWYG tool which allows
@c @item @uref{http://www.mysql.com/Downloads/Win32/MySQL-Maker092.zip,MySQL-Maker 092}.
you to create, change and delete databases and tables.
@c Shareware @strong{MySQL} client for windows. It's WYSIWYG tool which allows
You can change field - structure and add, change and delete data in
@c you to create, change and delete databases and tables.
these tables directly without ODBC-driver.
@c You can change field - structure and add, change and delete data in
@uref{http://62.26.183.157/presult/support/su_sweiche_download.html, MySQL Maker homepage}
@c these tables directly without ODBC-driver.
@c @uref{http://62.26.183.157/presult/support/su_sweiche_download.html, MySQL Maker homepage}
@item @uref{http://www.mysql.com/Downloads/Contrib/mysqlwinadmn.zip, mysqlwinadmn.zip}
@item @uref{http://www.mysql.com/Downloads/Contrib/mysqlwinadmn.zip, mysqlwinadmn.zip}
Windows GUI (binary only) to administrate a database, by David B. Mansel,
Windows GUI (binary only) to administrate a database, by David B. Mansel,
...
@@ -35653,9 +35669,9 @@ programming! By Marc Beneteau, @email{marc@@odbsoft.com}.
...
@@ -35653,9 +35669,9 @@ programming! By Marc Beneteau, @email{marc@@odbsoft.com}.
@item @uref{http://www.mysql.com/Downloads/Contrib/sqlhtml.tar.gz, sqlhtml.tar.gz}
@item @uref{http://www.mysql.com/Downloads/Contrib/sqlhtml.tar.gz, sqlhtml.tar.gz}
SQL/HTML is an HTML database manager for @strong{MySQL} using @code{DBI} 1.06.
SQL/HTML is an HTML database manager for @strong{MySQL} using @code{DBI} 1.06.
@item @uref{http://www.mysql.com/Downloads/Contrib/udmsearch-3.0.21.tar.gz, UdmSearch 3.0.2
1
(stable version)}
@item @uref{http://www.mysql.com/Downloads/Contrib/udmsearch-3.0.21.tar.gz, UdmSearch 3.0.2
2
(stable version)}
@item @uref{http://www.mysql.com/Downloads/Contrib/udmsearch-3.1.3.tar.gz, UdmSearch 3.1.3 (development version)}
@item @uref{http://www.mysql.com/Downloads/Contrib/udmsearch-3.1.3.tar.gz, UdmSearch 3.1.3 (development version)}
@item @uref{http://
mysearch.udm.net
, UdmSearch home page}
@item @uref{http://
search.mnoGo.ru
, UdmSearch home page}
A SQL-based search engine for Internet. By
A SQL-based search engine for Internet. By
Alexander I. Barkov @email{bar@@izhcom.ru}.
Alexander I. Barkov @email{bar@@izhcom.ru}.
...
@@ -36291,6 +36307,19 @@ though, so 3.23 is not released as a stable version yet.
...
@@ -36291,6 +36307,19 @@ though, so 3.23 is not released as a stable version yet.
@appendixsubsec Changes in release 3.23.25
@appendixsubsec Changes in release 3.23.25
@itemize @bullet
@itemize @bullet
@item
@item
Fixed a core dump bug when doing @code{FLUSH MASTER} when one didn't give
a filename argument to @code{--log-bin}
@item
Added missing ha_berkeley.x files to the MySQL windows source distribution.
@item
Fixed some mutex bugs in the log code that could cause thread blocks if new
log files couldn't be created.
@item
Added lock time and number of selected processed rows to slow query log.
@item
Added @code{--memlock} option to mysqld to lock mysqld in memory on
systems with the @code{mlockall()} call (like in Solaris).
@item
@code{HEAP} tables didn't use keys properly. (Bug from 3.23.23)
@code{HEAP} tables didn't use keys properly. (Bug from 3.23.23)
@item
@item
Added better support for @code{MERGE} tables (keys, mapping, creation,
Added better support for @code{MERGE} tables (keys, mapping, creation,
...
@@ -40543,6 +40572,8 @@ Subqueries. @code{select id from t where grp in (select grp from g where u > 100
...
@@ -40543,6 +40572,8 @@ Subqueries. @code{select id from t where grp in (select grp from g where u > 100
@item
@item
Add range checking to @code{MERGE} tables.
Add range checking to @code{MERGE} tables.
@item
@item
@code{SHOW OPEN TABLES}
@item
Port of @strong{MySQL} to BeOS.
Port of @strong{MySQL} to BeOS.
@item
@item
Add a temporary key buffer cache during @code{insert/delete/update} so that we
Add a temporary key buffer cache during @code{insert/delete/update} so that we
...
@@ -40802,18 +40833,12 @@ Negative @code{LIMIT} to retrieve data from the end.
...
@@ -40802,18 +40833,12 @@ Negative @code{LIMIT} to retrieve data from the end.
@item
@item
Alarm around client connect/read/write functions.
Alarm around client connect/read/write functions.
@item
@item
Make a @code{mysqld} version which isn't multithreaded (3-5 days).
@item
Please note the changes to @code{safe_mysqld}: according to FSSTND (which
Please note the changes to @code{safe_mysqld}: according to FSSTND (which
Debian tries to follow) PID files should go into @file{/var/run/<progname>.pid}
Debian tries to follow) PID files should go into @file{/var/run/<progname>.pid}
and log files into @file{/var/log}. It would be nice if you could put the
and log files into @file{/var/log}. It would be nice if you could put the
"DATADIR" in the first declaration of "pidfile" and "log", so the
"DATADIR" in the first declaration of "pidfile" and "log", so the
placement of these files can be changed with a single statement.
placement of these files can be changed with a single statement.
@item
@item
Better dynamic record layout to avoid fragmentation.
@item
@code{UPDATE SET blob=read_blob_from_file('my_gif') where id=1;}
@item
Allow a client to request logging.
Allow a client to request logging.
@item
@item
Add use of @code{zlib()} for @code{gzip}-ed files to @code{LOAD DATA INFILE}.
Add use of @code{zlib()} for @code{gzip}-ed files to @code{LOAD DATA INFILE}.
configure.in
View file @
751f2d1f
...
@@ -1172,7 +1172,7 @@ AC_SUBST(MAKE_SHELL)
...
@@ -1172,7 +1172,7 @@ AC_SUBST(MAKE_SHELL)
# Already-done: stdlib.h string.h unistd.h termios.h
# Already-done: stdlib.h string.h unistd.h termios.h
AC_CHECK_HEADERS(varargs.h stdarg.h dirent.h locale.h ndir.h sys/dir.h \
AC_CHECK_HEADERS(varargs.h stdarg.h dirent.h locale.h ndir.h sys/dir.h \
sys/file.h sys/ndir.h sys/ptem.h sys/pte.h sys/select.h sys/stream.h \
sys/file.h sys/ndir.h sys/ptem.h sys/pte.h sys/select.h sys/stream.h \
curses.h termcap.h termio.h termbits.h asm/termbits.h grp.h)
sys/mman.h
curses.h termcap.h termio.h termbits.h asm/termbits.h grp.h)
# Already-done: strcasecmp
# Already-done: strcasecmp
AC_CHECK_FUNCS(lstat putenv select setenv setlocale strcoll tcgetattr)
AC_CHECK_FUNCS(lstat putenv select setenv setlocale strcoll tcgetattr)
...
@@ -1218,7 +1218,7 @@ AC_CHECK_FUNCS(alarm bmove \
...
@@ -1218,7 +1218,7 @@ AC_CHECK_FUNCS(alarm bmove \
pthread_setschedparam pthread_attr_setprio pthread_attr_setschedparam \
pthread_setschedparam pthread_attr_setprio pthread_attr_setschedparam \
pthread_attr_create pthread_getsequence_np pthread_attr_setstacksize \
pthread_attr_create pthread_getsequence_np pthread_attr_setstacksize \
pthread_condattr_create rwlock_init pthread_rwlock_rdlock \
pthread_condattr_create rwlock_init pthread_rwlock_rdlock \
crypt dlopen dlerror fchmod getpass getpassphrase initgroups)
crypt dlopen dlerror fchmod getpass getpassphrase initgroups
, mlockall
)
# Sanity check: We chould not have any fseeko symbol unless
# Sanity check: We chould not have any fseeko symbol unless
# large_file_support=yes
# large_file_support=yes
...
...
include/my_sys.h
View file @
751f2d1f
...
@@ -179,11 +179,12 @@ extern void free_charsets(void);
...
@@ -179,11 +179,12 @@ extern void free_charsets(void);
extern
char
*
list_charsets
(
myf
want_flags
);
/* my_free() this string... */
extern
char
*
list_charsets
(
myf
want_flags
);
/* my_free() this string... */
/* statistic
t
s */
/* statistics */
extern
ulong
_my_cache_w_requests
,
_my_cache_write
,
_my_cache_r_requests
,
extern
ulong
_my_cache_w_requests
,
_my_cache_write
,
_my_cache_r_requests
,
_my_cache_read
;
_my_cache_read
;
extern
ulong
_my_blocks_used
,
_my_blocks_changed
;
extern
ulong
_my_blocks_used
,
_my_blocks_changed
;
extern
uint
my_file_opened
,
my_stream_opened
;
extern
uint
my_file_opened
,
my_stream_opened
;
extern
my_bool
key_cache_inited
;
/* Point to current my_message() */
/* Point to current my_message() */
extern
void
(
*
my_sigtstp_cleanup
)(
void
),
extern
void
(
*
my_sigtstp_cleanup
)(
void
),
...
...
myisammrg/myrg_close.c
View file @
751f2d1f
...
@@ -18,8 +18,7 @@
...
@@ -18,8 +18,7 @@
#include "mymrgdef.h"
#include "mymrgdef.h"
int
myrg_close
(
info
)
int
myrg_close
(
MYRG_INFO
*
info
)
register
MYRG_INFO
*
info
;
{
{
int
error
=
0
,
new_error
;
int
error
=
0
,
new_error
;
MYRG_TABLE
*
file
;
MYRG_TABLE
*
file
;
...
@@ -28,6 +27,7 @@ register MYRG_INFO *info;
...
@@ -28,6 +27,7 @@ register MYRG_INFO *info;
for
(
file
=
info
->
open_tables
;
file
!=
info
->
end_table
;
file
++
)
for
(
file
=
info
->
open_tables
;
file
!=
info
->
end_table
;
file
++
)
if
((
new_error
=
mi_close
(
file
->
table
)))
if
((
new_error
=
mi_close
(
file
->
table
)))
error
=
new_error
;
error
=
new_error
;
delete_queue
(
&
info
->
by_key
);
pthread_mutex_lock
(
&
THR_LOCK_open
);
pthread_mutex_lock
(
&
THR_LOCK_open
);
myrg_open_list
=
list_delete
(
myrg_open_list
,
&
info
->
open_list
);
myrg_open_list
=
list_delete
(
myrg_open_list
,
&
info
->
open_list
);
pthread_mutex_unlock
(
&
THR_LOCK_open
);
pthread_mutex_unlock
(
&
THR_LOCK_open
);
...
...
myisammrg/myrg_open.c
View file @
751f2d1f
...
@@ -86,7 +86,7 @@ int handle_locking;
...
@@ -86,7 +86,7 @@ int handle_locking;
*
m_info
=
info
;
*
m_info
=
info
;
m_info
->
open_tables
=
(
MYRG_TABLE
*
)
(
m_info
+
1
);
m_info
->
open_tables
=
(
MYRG_TABLE
*
)
(
m_info
+
1
);
m_info
->
tables
=
files
;
m_info
->
tables
=
files
;
for
(
i
=
files
;
i
--
>
0
;
)
for
(
i
=
files
;
i
--
>
0
;
)
{
{
m_info
->
open_tables
[
i
].
table
=
isam
;
m_info
->
open_tables
[
i
].
table
=
isam
;
...
@@ -104,12 +104,16 @@ int handle_locking;
...
@@ -104,12 +104,16 @@ int handle_locking;
m_info
->
open_tables
[
i
].
file_offset
=
(
my_off_t
)
file_offset
;
m_info
->
open_tables
[
i
].
file_offset
=
(
my_off_t
)
file_offset
;
file_offset
+=
m_info
->
open_tables
[
i
].
table
->
state
->
data_file_length
;
file_offset
+=
m_info
->
open_tables
[
i
].
table
->
state
->
data_file_length
;
}
}
errpos
=
2
;
if
(
sizeof
(
my_off_t
)
==
4
&&
file_offset
>
(
ulonglong
)
(
ulong
)
~
0L
)
if
(
sizeof
(
my_off_t
)
==
4
&&
file_offset
>
(
ulonglong
)
(
ulong
)
~
0L
)
{
{
my_errno
=
HA_ERR_RECORD_FILE_FULL
;
my_errno
=
HA_ERR_RECORD_FILE_FULL
;
my_free
((
char
*
)
m_info
,
MYF
(
0
));
goto
err
;
goto
err
;
}
}
/* Allocate memory for queue */
if
(
m_info
->
open_tables
->
table
->
s
->
base
.
keys
&&
_myrg_init_queue
(
m_info
,
0
,
HA_READ_KEY_EXACT
))
goto
err
;
m_info
->
end_table
=
m_info
->
open_tables
+
files
;
m_info
->
end_table
=
m_info
->
open_tables
+
files
;
m_info
->
last_used_table
=
m_info
->
open_tables
;
m_info
->
last_used_table
=
m_info
->
open_tables
;
...
@@ -119,12 +123,14 @@ int handle_locking;
...
@@ -119,12 +123,14 @@ int handle_locking;
pthread_mutex_lock
(
&
THR_LOCK_open
);
pthread_mutex_lock
(
&
THR_LOCK_open
);
myrg_open_list
=
list_add
(
myrg_open_list
,
&
m_info
->
open_list
);
myrg_open_list
=
list_add
(
myrg_open_list
,
&
m_info
->
open_list
);
pthread_mutex_unlock
(
&
THR_LOCK_open
);
pthread_mutex_unlock
(
&
THR_LOCK_open
);
m_info
->
by_key
.
root
=
0
;
DBUG_RETURN
(
m_info
);
DBUG_RETURN
(
m_info
);
err:
err:
save_errno
=
my_errno
;
save_errno
=
my_errno
;
switch
(
errpos
)
{
switch
(
errpos
)
{
case
2
:
my_free
((
char
*
)
m_info
,
MYF
(
0
));
/* Fall through */
case
1
:
case
1
:
VOID
(
my_fclose
(
file
,
MYF
(
0
)));
VOID
(
my_fclose
(
file
,
MYF
(
0
)));
for
(
i
=
files
;
i
--
>
0
;
)
for
(
i
=
files
;
i
--
>
0
;
)
...
...
mysys/mf_format.c
View file @
751f2d1f
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
/* 8 Pack filename as short as possibly */
/* 8 Pack filename as short as possibly */
/* 16 Resolve symbolic links for filename */
/* 16 Resolve symbolic links for filename */
/* 32 Resolve filename to full path */
/* 32 Resolve filename to full path */
/* 64 Return NULL if too long path */
#ifdef MAXPATHLEN
#ifdef MAXPATHLEN
#define BUFF_LEN MAXPATHLEN
#define BUFF_LEN MAXPATHLEN
...
@@ -80,7 +81,10 @@ my_string fn_format(my_string to, const char *name, const char *dsk,
...
@@ -80,7 +81,10 @@ my_string fn_format(my_string to, const char *name, const char *dsk,
if
(
strlen
(
dev
)
+
length
+
strlen
(
ext
)
>=
FN_REFLEN
||
length
>=
FN_LEN
)
if
(
strlen
(
dev
)
+
length
+
strlen
(
ext
)
>=
FN_REFLEN
||
length
>=
FN_LEN
)
{
/* To long path, return original */
{
/* To long path, return original */
uint
tmp_length
=
strlength
(
startpos
);
uint
tmp_length
;
if
(
flag
&
64
)
return
0
;
tmp_length
=
strlength
(
startpos
);
DBUG_PRINT
(
"error"
,(
"dev: '%s' ext: '%s' length: %d"
,
dev
,
ext
,
length
));
DBUG_PRINT
(
"error"
,(
"dev: '%s' ext: '%s' length: %d"
,
dev
,
ext
,
length
));
(
void
)
strmake
(
to
,
startpos
,
min
(
tmp_length
,
FN_REFLEN
-
1
));
(
void
)
strmake
(
to
,
startpos
,
min
(
tmp_length
,
FN_REFLEN
-
1
));
}
}
...
...
mysys/mf_keycache.c
View file @
751f2d1f
...
@@ -85,7 +85,7 @@ int init_key_cache(ulong use_mem,
...
@@ -85,7 +85,7 @@ int init_key_cache(ulong use_mem,
if
(
key_cache_inited
&&
_my_disk_blocks
>
0
)
if
(
key_cache_inited
&&
_my_disk_blocks
>
0
)
{
{
DBUG_PRINT
(
"warning"
,(
"key cache al
l
ready in use"
));
/* purecov: inspected */
DBUG_PRINT
(
"warning"
,(
"key cache already in use"
));
/* purecov: inspected */
DBUG_RETURN
(
0
);
/* purecov: inspected */
DBUG_RETURN
(
0
);
/* purecov: inspected */
}
}
if
(
!
key_cache_inited
)
if
(
!
key_cache_inited
)
...
@@ -161,6 +161,7 @@ void end_key_cache(void)
...
@@ -161,6 +161,7 @@ void end_key_cache(void)
_my_disk_blocks
=
-
1
;
_my_disk_blocks
=
-
1
;
}
}
}
}
key_cache_inited
=
0
;
DBUG_PRINT
(
"status"
,
DBUG_PRINT
(
"status"
,
(
"used: %d changed: %d w_requests: %ld writes: %ld r_requests: %ld reads: %ld"
,
(
"used: %d changed: %d w_requests: %ld writes: %ld r_requests: %ld reads: %ld"
,
_my_blocks_used
,
_my_blocks_changed
,
_my_cache_w_requests
,
_my_blocks_used
,
_my_blocks_changed
,
_my_cache_w_requests
,
...
...
mysys/my_static.h
View file @
751f2d1f
...
@@ -52,8 +52,6 @@ extern char NEAR curr_dir[FN_REFLEN],NEAR home_dir_buff[FN_REFLEN];
...
@@ -52,8 +52,6 @@ extern char NEAR curr_dir[FN_REFLEN],NEAR home_dir_buff[FN_REFLEN];
extern
volatile
int
_my_signals
;
extern
volatile
int
_my_signals
;
extern
struct
st_remember
_my_sig_remember
[
MAX_SIGNALS
];
extern
struct
st_remember
_my_sig_remember
[
MAX_SIGNALS
];
extern
my_bool
key_cache_inited
;
extern
const
char
*
soundex_map
;
extern
const
char
*
soundex_map
;
extern
USED_MEM
*
my_once_root_block
;
extern
USED_MEM
*
my_once_root_block
;
...
...
sql/ChangeLog
View file @
751f2d1f
2000-09-15 Michael Widenius <monty@mysql.com>
* Added a thd argument to log::write() to get more speed.
2000-09-01 Michael Widenius <monty@mysql.com>
2000-09-01 Michael Widenius <monty@mysql.com>
* Avoid allocation of "localhost" string.
* Avoid allocation of "localhost" string.
...
...
sql/lock.cc
View file @
751f2d1f
...
@@ -127,6 +127,7 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd,TABLE **tables,uint count)
...
@@ -127,6 +127,7 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd,TABLE **tables,uint count)
sql_lock
=
0
;
sql_lock
=
0
;
}
}
}
}
thd
->
lock_time
();
DBUG_RETURN
(
sql_lock
);
DBUG_RETURN
(
sql_lock
);
}
}
...
...
sql/log.cc
View file @
751f2d1f
...
@@ -338,7 +338,7 @@ void MYSQL_LOG::new_file()
...
@@ -338,7 +338,7 @@ void MYSQL_LOG::new_file()
close
();
close
();
open
(
old_name
,
log_type
,
new_name
);
open
(
old_name
,
log_type
,
new_name
);
my_free
(
old_name
,
MYF
(
0
));
my_free
(
old_name
,
MYF
(
0
));
if
(
!
file
)
// Something
go
t wrong
if
(
!
file
)
// Something
wen
t wrong
log_type
=
LOG_CLOSED
;
log_type
=
LOG_CLOSED
;
last_time
=
query_start
=
0
;
last_time
=
query_start
=
0
;
write_error
=
0
;
write_error
=
0
;
...
@@ -347,10 +347,10 @@ void MYSQL_LOG::new_file()
...
@@ -347,10 +347,10 @@ void MYSQL_LOG::new_file()
}
}
void
MYSQL_LOG
::
write
(
enum
enum_server_command
command
,
void
MYSQL_LOG
::
write
(
THD
*
thd
,
enum
enum_server_command
command
,
const
char
*
format
,...)
const
char
*
format
,...)
{
{
if
(
name
&&
(
what_to_log
&
(
1L
<<
(
uint
)
command
)))
if
(
is_open
()
&&
(
what_to_log
&
(
1L
<<
(
uint
)
command
)))
{
{
va_list
args
;
va_list
args
;
va_start
(
args
,
format
);
va_start
(
args
,
format
);
...
@@ -359,7 +359,6 @@ void MYSQL_LOG::write(enum enum_server_command command,
...
@@ -359,7 +359,6 @@ void MYSQL_LOG::write(enum enum_server_command command,
{
{
time_t
skr
;
time_t
skr
;
ulong
id
;
ulong
id
;
THD
*
thd
=
current_thd
;
int
error
=
0
;
int
error
=
0
;
if
(
thd
)
if
(
thd
)
{
// Normal thread
{
// Normal thread
...
@@ -423,14 +422,14 @@ void MYSQL_LOG::write(enum enum_server_command command,
...
@@ -423,14 +422,14 @@ void MYSQL_LOG::write(enum enum_server_command command,
void
MYSQL_LOG
::
write
(
Query_log_event
*
event_info
)
void
MYSQL_LOG
::
write
(
Query_log_event
*
event_info
)
{
{
if
(
name
)
if
(
is_open
()
)
{
{
VOID
(
pthread_mutex_lock
(
&
LOCK_log
));
VOID
(
pthread_mutex_lock
(
&
LOCK_log
));
if
(
file
)
if
(
file
)
{
{
THD
*
thd
=
event_info
->
thd
;
THD
*
thd
=
event_info
->
thd
;
if
((
!
(
thd
->
options
&
OPTION_BIN_LOG
)
&&
if
((
!
(
thd
->
options
&
OPTION_BIN_LOG
)
&&
thd
->
master_access
&
PROCESS_ACL
)
||
thd
->
master_access
&
PROCESS_ACL
)
||
!
db_ok
(
event_info
->
db
,
binlog_do_db
,
binlog_ignore_db
))
!
db_ok
(
event_info
->
db
,
binlog_do_db
,
binlog_ignore_db
))
{
{
VOID
(
pthread_mutex_unlock
(
&
LOCK_log
));
VOID
(
pthread_mutex_unlock
(
&
LOCK_log
));
...
@@ -457,57 +456,50 @@ void MYSQL_LOG::write(Query_log_event* event_info)
...
@@ -457,57 +456,50 @@ void MYSQL_LOG::write(Query_log_event* event_info)
}
}
}
}
if
(
event_info
->
write
(
file
))
if
(
event_info
->
write
(
file
))
{
{
sql_print_error
(
ER
(
ER_ERROR_ON_WRITE
),
name
,
errno
);
sql_print_error
(
ER
(
ER_ERROR_ON_WRITE
),
name
,
errno
);
}
}
err:
err:
VOID
(
pthread_cond_broadcast
(
&
COND_binlog_update
));
VOID
(
pthread_cond_broadcast
(
&
COND_binlog_update
));
VOID
(
pthread_mutex_unlock
(
&
LOCK_log
));
}
}
VOID
(
pthread_mutex_unlock
(
&
LOCK_log
));
}
}
}
}
void
MYSQL_LOG
::
write
(
Load_log_event
*
event_info
)
void
MYSQL_LOG
::
write
(
Load_log_event
*
event_info
)
{
{
if
(
name
)
if
(
is_open
()
)
{
{
VOID
(
pthread_mutex_lock
(
&
LOCK_log
));
VOID
(
pthread_mutex_lock
(
&
LOCK_log
));
if
(
file
)
if
(
file
)
{
{
THD
*
thd
=
event_info
->
thd
;
THD
*
thd
=
event_info
->
thd
;
if
(
!
(
thd
->
options
&
OPTION_BIN_LOG
)
&&
if
(
(
thd
->
options
&
OPTION_BIN_LOG
)
||
(
thd
->
master_access
&
PROCESS_ACL
))
!
(
thd
->
master_access
&
PROCESS_ACL
))
{
{
VOID
(
pthread_mutex_unlock
(
&
LOCK_log
));
if
(
event_info
->
write
(
file
))
return
;
sql_print_error
(
ER
(
ER_ERROR_ON_WRITE
),
name
,
errno
);
VOID
(
pthread_cond_broadcast
(
&
COND_binlog_update
));
}
}
if
(
event_info
->
write
(
file
))
sql_print_error
(
ER
(
ER_ERROR_ON_WRITE
),
name
,
errno
);
VOID
(
pthread_cond_broadcast
(
&
COND_binlog_update
));
VOID
(
pthread_mutex_unlock
(
&
LOCK_log
));
}
}
VOID
(
pthread_mutex_unlock
(
&
LOCK_log
));
}
}
}
}
/* Write update log in a format suitable for incremental backup */
/* Write update log in a format suitable for incremental backup */
void
MYSQL_LOG
::
write
(
const
char
*
query
,
uint
query_length
,
void
MYSQL_LOG
::
write
(
THD
*
thd
,
const
char
*
query
,
uint
query_length
,
ulong
time_for_query
)
time_t
query_start
)
{
{
if
(
name
)
if
(
is_open
()
)
{
{
time_t
current_time
;
VOID
(
pthread_mutex_lock
(
&
LOCK_log
));
VOID
(
pthread_mutex_lock
(
&
LOCK_log
));
if
(
file
)
if
(
file
)
{
// Safety agains reopen
{
// Safety agains reopen
int
error
=
0
;
int
error
=
0
;
THD
*
thd
=
current_thd
;
char
buff
[
80
],
*
end
;
char
buff
[
80
],
*
end
;
end
=
buff
;
end
=
buff
;
if
(
!
(
thd
->
options
&
OPTION_UPDATE_LOG
)
&&
if
(
!
(
thd
->
options
&
OPTION_UPDATE_LOG
)
&&
...
@@ -518,13 +510,13 @@ void MYSQL_LOG::write(const char *query, uint query_length,
...
@@ -518,13 +510,13 @@ void MYSQL_LOG::write(const char *query, uint query_length,
}
}
if
(
specialflag
&
SPECIAL_LONG_LOG_FORMAT
)
if
(
specialflag
&
SPECIAL_LONG_LOG_FORMAT
)
{
{
time_t
skr
=
time
(
NULL
);
current_time
=
time
(
NULL
);
if
(
skr
!=
last_time
)
if
(
current_time
!=
last_time
)
{
{
last_time
=
skr
;
last_time
=
current_time
;
struct
tm
tm_tmp
;
struct
tm
tm_tmp
;
struct
tm
*
start
;
struct
tm
*
start
;
localtime_r
(
&
skr
,
&
tm_tmp
);
localtime_r
(
&
current_time
,
&
tm_tmp
);
start
=&
tm_tmp
;
start
=&
tm_tmp
;
if
(
fprintf
(
file
,
"# Time: %02d%02d%02d %2d:%02d:%02d
\n
"
,
if
(
fprintf
(
file
,
"# Time: %02d%02d%02d %2d:%02d:%02d
\n
"
,
start
->
tm_year
%
100
,
start
->
tm_year
%
100
,
...
@@ -542,8 +534,16 @@ void MYSQL_LOG::write(const char *query, uint query_length,
...
@@ -542,8 +534,16 @@ void MYSQL_LOG::write(const char *query, uint query_length,
thd
->
ip
?
thd
->
ip
:
""
)
<
0
)
thd
->
ip
?
thd
->
ip
:
""
)
<
0
)
error
=
errno
;;
error
=
errno
;;
}
}
if
(
time_for_query
)
if
(
query_start
)
fprintf
(
file
,
"# Time: %lu
\n
"
,
time_for_query
);
{
/* For slow query log */
if
(
!
(
specialflag
&
SPECIAL_LONG_LOG_FORMAT
))
current_time
=
time
(
NULL
);
fprintf
(
file
,
"# Time: %lu Lock_time: %lu Rows_sent %lu
\n
"
,
(
ulong
)
(
current_time
-
query_start
),
(
ulong
)
(
thd
->
time_after_lock
-
query_start
),
(
ulong
)
thd
->
sent_row_count
);
}
if
(
thd
->
db
&&
strcmp
(
thd
->
db
,
db
))
if
(
thd
->
db
&&
strcmp
(
thd
->
db
,
db
))
{
// Database changed
{
// Database changed
if
(
fprintf
(
file
,
"use %s;
\n
"
,
thd
->
db
)
<
0
)
if
(
fprintf
(
file
,
"use %s;
\n
"
,
thd
->
db
)
<
0
)
...
@@ -637,16 +637,15 @@ void MYSQL_LOG::close(bool exiting)
...
@@ -637,16 +637,15 @@ void MYSQL_LOG::close(bool exiting)
name
=
0
;
name
=
0
;
}
}
if
(
exiting
&&
index_file
)
if
(
exiting
&&
index_file
)
{
if
(
my_fclose
(
index_file
,
MYF
(
0
))
<
0
&&
!
write_error
)
{
{
if
(
my_fclose
(
index_file
,
MYF
(
0
))
<
0
&&
!
write_error
)
write_error
=
1
;
{
sql_print_error
(
ER
(
ER_ERROR_ON_WRITE
),
name
,
errno
);
write_error
=
1
;
sql_print_error
(
ER
(
ER_ERROR_ON_WRITE
),
name
,
errno
);
}
index_file
=
0
;
}
}
index_file
=
0
;
}
}
}
...
...
sql/mysql_priv.h
View file @
751f2d1f
...
@@ -458,7 +458,7 @@ extern pthread_mutex_t LOCK_mysql_create_db,LOCK_Acl,LOCK_open,
...
@@ -458,7 +458,7 @@ extern pthread_mutex_t LOCK_mysql_create_db,LOCK_Acl,LOCK_open,
extern
pthread_cond_t
COND_refresh
,
COND_thread_count
,
COND_binlog_update
,
extern
pthread_cond_t
COND_refresh
,
COND_thread_count
,
COND_binlog_update
,
COND_slave_stopped
;
COND_slave_stopped
;
extern
pthread_attr_t
connection_attrib
;
extern
pthread_attr_t
connection_attrib
;
extern
bool
opt_endinfo
,
using_udf_functions
;
extern
bool
opt_endinfo
,
using_udf_functions
,
locked_in_memory
;
extern
ulong
ha_read_count
,
ha_write_count
,
ha_delete_count
,
ha_update_count
,
extern
ulong
ha_read_count
,
ha_write_count
,
ha_delete_count
,
ha_update_count
,
ha_read_key_count
,
ha_read_next_count
,
ha_read_prev_count
,
ha_read_key_count
,
ha_read_next_count
,
ha_read_prev_count
,
ha_read_first_count
,
ha_read_last_count
,
ha_read_first_count
,
ha_read_last_count
,
...
...
sql/mysqld.cc
View file @
751f2d1f
...
@@ -72,6 +72,10 @@ int allow_severity = LOG_INFO;
...
@@ -72,6 +72,10 @@ int allow_severity = LOG_INFO;
int
deny_severity
=
LOG_WARNING
;
int
deny_severity
=
LOG_WARNING
;
#endif
/* HAVE_LIBWRAP */
#endif
/* HAVE_LIBWRAP */
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif
#if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H)
#if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H)
#include <ieeefp.h>
#include <ieeefp.h>
#ifdef HAVE_FP_EXCEPT // Fix type conflict
#ifdef HAVE_FP_EXCEPT // Fix type conflict
...
@@ -139,13 +143,13 @@ static my_socket unix_sock= INVALID_SOCKET,ip_sock= INVALID_SOCKET;
...
@@ -139,13 +143,13 @@ static my_socket unix_sock= INVALID_SOCKET,ip_sock= INVALID_SOCKET;
static
ulong
back_log
,
connect_timeout
,
concurrency
;
static
ulong
back_log
,
connect_timeout
,
concurrency
;
static
my_string
opt_logname
=
0
,
opt_update_logname
=
0
,
static
my_string
opt_logname
=
0
,
opt_update_logname
=
0
,
opt_binlog_index_name
=
0
,
opt_slow_logname
=
0
;
opt_binlog_index_name
=
0
,
opt_slow_logname
=
0
;
my_string
opt_bin_logname
=
0
;
// this one needs to be
seen in sql_parse.cc
my_string
opt_bin_logname
=
0
;
// this one needs to be seen in sql_parse.cc
static
char
mysql_home
[
FN_REFLEN
],
pidfile_name
[
FN_REFLEN
];
static
char
mysql_home
[
FN_REFLEN
],
pidfile_name
[
FN_REFLEN
];
static
pthread_t
select_thread
;
static
pthread_t
select_thread
;
static
pthread_t
flush_thread
;
// Used when debugging
static
pthread_t
flush_thread
;
// Used when debugging
static
bool
opt_log
,
opt_update_log
,
opt_bin_log
,
opt_slow_log
,
opt_noacl
,
static
bool
opt_log
,
opt_update_log
,
opt_bin_log
,
opt_slow_log
,
opt_noacl
,
opt_disable_networking
=
0
,
opt_bootstrap
=
0
,
opt_skip_show_db
=
0
,
opt_disable_networking
=
0
,
opt_bootstrap
=
0
,
opt_skip_show_db
=
0
,
opt_ansi_mode
,
opt_myisam_log
=
0
;
opt_ansi_mode
=
0
,
opt_myisam_log
=
0
;
bool
opt_sql_bin_update
=
0
,
opt_log_slave_updates
=
0
;
bool
opt_sql_bin_update
=
0
,
opt_log_slave_updates
=
0
;
// if sql_bin_update is true, SQL_LOG_UPDATE and SQL_LOG_BIN are kept in sync, and are
// if sql_bin_update is true, SQL_LOG_UPDATE and SQL_LOG_BIN are kept in sync, and are
...
@@ -197,7 +201,7 @@ uint master_port = MYSQL_PORT, master_connect_retry = 60;
...
@@ -197,7 +201,7 @@ uint master_port = MYSQL_PORT, master_connect_retry = 60;
ulong
max_tmp_tables
,
max_heap_table_size
;
ulong
max_tmp_tables
,
max_heap_table_size
;
ulong
bytes_sent
=
0L
,
bytes_received
=
0L
;
ulong
bytes_sent
=
0L
,
bytes_received
=
0L
;
bool
opt_endinfo
,
using_udf_functions
,
low_priority_updates
;
bool
opt_endinfo
,
using_udf_functions
,
low_priority_updates
,
locked_in_memory
;
bool
volatile
abort_loop
,
select_thread_in_use
,
flush_thread_in_use
,
grant_option
;
bool
volatile
abort_loop
,
select_thread_in_use
,
flush_thread_in_use
,
grant_option
;
bool
volatile
ready_to_exit
,
shutdown_in_progress
;
bool
volatile
ready_to_exit
,
shutdown_in_progress
;
ulong
refresh_version
=
1L
,
flush_version
=
1L
;
/* Increments on each reload */
ulong
refresh_version
=
1L
,
flush_version
=
1L
;
/* Increments on each reload */
...
@@ -589,6 +593,7 @@ void clean_up(void)
...
@@ -589,6 +593,7 @@ void clean_up(void)
x_free
((
gptr
)
errmsg
[
ERRMAPP
]);
/* Free messages */
x_free
((
gptr
)
errmsg
[
ERRMAPP
]);
/* Free messages */
free_defaults
(
defaults_argv
);
free_defaults
(
defaults_argv
);
my_free
(
mysql_tmpdir
,
MYF
(
0
));
my_free
(
mysql_tmpdir
,
MYF
(
0
));
x_free
(
opt_bin_logname
);
my_end
(
opt_endinfo
?
MY_CHECK_ERROR
|
MY_GIVE_INFO
:
0
);
my_end
(
opt_endinfo
?
MY_CHECK_ERROR
|
MY_GIVE_INFO
:
0
);
/* Tell main we are ready */
/* Tell main we are ready */
...
@@ -1472,6 +1477,13 @@ int main(int argc, char **argv)
...
@@ -1472,6 +1477,13 @@ int main(int argc, char **argv)
LOG_NEW
);
LOG_NEW
);
if
(
opt_bin_log
)
if
(
opt_bin_log
)
{
{
if
(
!
opt_bin_logname
)
{
char
tmp
[
FN_REFLEN
];
strnmov
(
tmp
,
hostname
,
FN_REFLEN
-
5
);
strmov
(
strcend
(
tmp
,
'.'
),
"-bin"
);
opt_bin_logname
=
my_strdup
(
tmp
,
MYF
(
MY_WME
));
}
mysql_bin_log
.
set_index_file_name
(
opt_binlog_index_name
);
mysql_bin_log
.
set_index_file_name
(
opt_binlog_index_name
);
open_log
(
&
mysql_bin_log
,
hostname
,
opt_bin_logname
,
"-bin"
,
open_log
(
&
mysql_bin_log
,
hostname
,
opt_bin_logname
,
"-bin"
,
LOG_BIN
);
LOG_BIN
);
...
@@ -1484,6 +1496,21 @@ int main(int argc, char **argv)
...
@@ -1484,6 +1496,21 @@ int main(int argc, char **argv)
sql_print_error
(
"Can't init databases"
);
sql_print_error
(
"Can't init databases"
);
exit
(
1
);
exit
(
1
);
}
}
#ifdef HAVE_MLOCKALL
if
(
locked_in_memory
&&
!
geteuid
())
{
ha_key_cache
();
if
(
mlockall
(
MCL_CURRENT
))
{
sql_print_error
(
"Warning: Failed to lock memory. Errno: %d
\n
"
,
errno
);
}
else
locked_in_memory
=
1
;
}
#else
locked_in_memory
=
0
;
#endif
if
(
opt_myisam_log
)
if
(
opt_myisam_log
)
(
void
)
mi_log
(
1
);
(
void
)
mi_log
(
1
);
ft_init_stopwords
(
ft_precompiled_stopwords
);
/* SerG */
ft_init_stopwords
(
ft_precompiled_stopwords
);
/* SerG */
...
@@ -2171,7 +2198,8 @@ enum options {
...
@@ -2171,7 +2198,8 @@ enum options {
OPT_MASTER_CONNECT_RETRY
,
OPT_SQL_BIN_UPDATE_SAME
,
OPT_MASTER_CONNECT_RETRY
,
OPT_SQL_BIN_UPDATE_SAME
,
OPT_REPLICATE_DO_DB
,
OPT_REPLICATE_IGNORE_DB
,
OPT_REPLICATE_DO_DB
,
OPT_REPLICATE_IGNORE_DB
,
OPT_LOG_SLAVE_UPDATES
,
OPT_BINLOG_DO_DB
,
OPT_LOG_SLAVE_UPDATES
,
OPT_BINLOG_DO_DB
,
OPT_BINLOG_IGNORE_DB
,
OPT_WANT_CORE
OPT_BINLOG_IGNORE_DB
,
OPT_WANT_CORE
,
OPT_SKIP_CONCURRENT_INSERT
,
OPT_MEMLOCK
};
};
static
struct
option
long_options
[]
=
{
static
struct
option
long_options
[]
=
{
...
@@ -2225,6 +2253,7 @@ static struct option long_options[] = {
...
@@ -2225,6 +2253,7 @@ static struct option long_options[] = {
{
"master-port"
,
required_argument
,
0
,
(
int
)
OPT_MASTER_PORT
},
{
"master-port"
,
required_argument
,
0
,
(
int
)
OPT_MASTER_PORT
},
{
"master-connect-retry"
,
required_argument
,
0
,
(
int
)
OPT_MASTER_CONNECT_RETRY
},
{
"master-connect-retry"
,
required_argument
,
0
,
(
int
)
OPT_MASTER_CONNECT_RETRY
},
{
"master-info-file"
,
required_argument
,
0
,
(
int
)
OPT_MASTER_INFO_FILE
},
{
"master-info-file"
,
required_argument
,
0
,
(
int
)
OPT_MASTER_INFO_FILE
},
{
"memlock"
,
no_argument
,
0
,
(
int
)
OPT_MEMLOCK
},
{
"new"
,
no_argument
,
0
,
'n'
},
{
"new"
,
no_argument
,
0
,
'n'
},
{
"old-protocol"
,
no_argument
,
0
,
'o'
},
{
"old-protocol"
,
no_argument
,
0
,
'o'
},
#ifndef DBUG_OFF
#ifndef DBUG_OFF
...
@@ -2240,6 +2269,7 @@ static struct option long_options[] = {
...
@@ -2240,6 +2269,7 @@ static struct option long_options[] = {
#ifdef HAVE_BERKELEY_DB
#ifdef HAVE_BERKELEY_DB
{
"skip-bdb"
,
no_argument
,
0
,
(
int
)
OPT_BDB_SKIP
},
{
"skip-bdb"
,
no_argument
,
0
,
(
int
)
OPT_BDB_SKIP
},
#endif
#endif
{
"skip-concurrent-insert"
,
no_argument
,
0
,
(
int
)
OPT_SKIP_CONCURRENT_INSERT
},
{
"skip-delay-key-write"
,
no_argument
,
0
,
(
int
)
OPT_SKIP_DELAY_KEY_WRITE
},
{
"skip-delay-key-write"
,
no_argument
,
0
,
(
int
)
OPT_SKIP_DELAY_KEY_WRITE
},
{
"skip-grant-tables"
,
no_argument
,
0
,
(
int
)
OPT_SKIP_GRANT
},
{
"skip-grant-tables"
,
no_argument
,
0
,
(
int
)
OPT_SKIP_GRANT
},
{
"skip-locking"
,
no_argument
,
0
,
(
int
)
OPT_SKIP_LOCK
},
{
"skip-locking"
,
no_argument
,
0
,
(
int
)
OPT_SKIP_LOCK
},
...
@@ -2369,6 +2399,9 @@ struct show_var_st init_vars[]= {
...
@@ -2369,6 +2399,9 @@ struct show_var_st init_vars[]= {
{
"interactive_timeout"
,
(
char
*
)
&
net_interactive_timeout
,
SHOW_LONG
},
{
"interactive_timeout"
,
(
char
*
)
&
net_interactive_timeout
,
SHOW_LONG
},
{
"key_buffer_size"
,
(
char
*
)
&
keybuff_size
,
SHOW_LONG
},
{
"key_buffer_size"
,
(
char
*
)
&
keybuff_size
,
SHOW_LONG
},
{
"language"
,
language
,
SHOW_CHAR
},
{
"language"
,
language
,
SHOW_CHAR
},
#ifdef HAVE_MEMLOCKALL
{
"locked_in_memory"
,
(
char
*
)
&
locked_in_memory
,
SHOW_BOOL
},
#endif
{
"log"
,
(
char
*
)
&
opt_log
,
SHOW_BOOL
},
{
"log"
,
(
char
*
)
&
opt_log
,
SHOW_BOOL
},
{
"log_update"
,
(
char
*
)
&
opt_update_log
,
SHOW_BOOL
},
{
"log_update"
,
(
char
*
)
&
opt_update_log
,
SHOW_BOOL
},
{
"log_bin"
,
(
char
*
)
&
opt_bin_log
,
SHOW_BOOL
},
{
"log_bin"
,
(
char
*
)
&
opt_bin_log
,
SHOW_BOOL
},
...
@@ -2532,9 +2565,10 @@ static void usage(void)
...
@@ -2532,9 +2565,10 @@ static void usage(void)
Log slow queries to this log file. Defaults logging
\n
\
Log slow queries to this log file. Defaults logging
\n
\
to hostname-slow.log
\n
\
to hostname-slow.log
\n
\
--pid-file=path Pid file used by safe_mysqld
\n
\
--pid-file=path Pid file used by safe_mysqld
\n
\
-
P, --port=... Port number to use for connection
\n
\
-
-memlock Lock mysqld in memory
\n
\
-n, --new Use very new possible 'unsafe' functions
\n
\
-n, --new Use very new possible 'unsafe' functions
\n
\
-o, --old-protocol Use the old (3.20) protocol
\n
"
);
-o, --old-protocol Use the old (3.20) protocol
\n
\
-P, --port=... Port number to use for connection
\n
"
);
#ifndef DBUG_OFF
#ifndef DBUG_OFF
puts
(
"\
puts
(
"\
--one-thread Only use one thread (for debugging under Linux)
\n
"
);
--one-thread Only use one thread (for debugging under Linux)
\n
"
);
...
@@ -2546,6 +2580,8 @@ static void usage(void)
...
@@ -2546,6 +2580,8 @@ static void usage(void)
Start without grant tables. This gives all users
\n
\
Start without grant tables. This gives all users
\n
\
FULL ACCESS to all tables!
\n
\
FULL ACCESS to all tables!
\n
\
--safe-mode Skip some optimize stages (for testing)
\n
\
--safe-mode Skip some optimize stages (for testing)
\n
\
--skip-concurrent-insert
\n
\
Don't use concurrent insert with MyISAM
\n
\
--skip-delay-key-write
\n
\
--skip-delay-key-write
\n
\
Ignore the delay_key_write option for all tables
\n
\
Ignore the delay_key_write option for all tables
\n
\
--skip-locking Don't use system locking. To use isamchk one has
\n
\
--skip-locking Don't use system locking. To use isamchk one has
\n
\
...
@@ -2607,11 +2643,12 @@ The default values (after parsing the command line arguments) are:\n\n");
...
@@ -2607,11 +2643,12 @@ The default values (after parsing the command line arguments) are:\n\n");
printf
(
"logfile: %s
\n
"
,
opt_logname
);
printf
(
"logfile: %s
\n
"
,
opt_logname
);
if
(
opt_update_logname
)
if
(
opt_update_logname
)
printf
(
"update log: %s
\n
"
,
opt_update_logname
);
printf
(
"update log: %s
\n
"
,
opt_update_logname
);
if
(
opt_bin_logname
)
if
(
opt_bin_log
)
{
{
printf
(
"binary log: %s
\n
"
,
opt_bin_logname
);
printf
(
"binary log: %s
\n
"
,
opt_bin_logname
?
opt_bin_logname
:
""
);
printf
(
"binary log index: %s
\n
"
,
opt_binlog_index_name
);
printf
(
"binary log index: %s
\n
"
,
}
opt_binlog_index_name
?
opt_binlog_index_name
:
""
);
}
if
(
opt_slow_logname
)
if
(
opt_slow_logname
)
printf
(
"update log: %s
\n
"
,
opt_slow_logname
);
printf
(
"update log: %s
\n
"
,
opt_slow_logname
);
printf
(
"TCP port: %d
\n
"
,
mysql_port
);
printf
(
"TCP port: %d
\n
"
,
mysql_port
);
...
@@ -2771,7 +2808,9 @@ static void get_options(int argc,char **argv)
...
@@ -2771,7 +2808,9 @@ static void get_options(int argc,char **argv)
break
;
break
;
case
(
int
)
OPT_BIN_LOG
:
case
(
int
)
OPT_BIN_LOG
:
opt_bin_log
=
1
;
opt_bin_log
=
1
;
opt_bin_logname
=
optarg
;
x_free
(
opt_bin_logname
);
if
(
optarg
&&
optarg
[
0
])
opt_bin_logname
=
my_strdup
(
optarg
,
MYF
(
0
));
break
;
break
;
case
(
int
)
OPT_LOG_SLAVE_UPDATES
:
case
(
int
)
OPT_LOG_SLAVE_UPDATES
:
opt_log_slave_updates
=
1
;
opt_log_slave_updates
=
1
;
...
@@ -2820,6 +2859,9 @@ static void get_options(int argc,char **argv)
...
@@ -2820,6 +2859,9 @@ static void get_options(int argc,char **argv)
myisam_delay_key_write
=
0
;
myisam_delay_key_write
=
0
;
myisam_concurrent_insert
=
0
;
myisam_concurrent_insert
=
0
;
break
;
break
;
case
(
int
)
OPT_SKIP_CONCURRENT_INSERT
:
myisam_concurrent_insert
=
0
;
break
;
case
(
int
)
OPT_SKIP_PRIOR
:
case
(
int
)
OPT_SKIP_PRIOR
:
opt_specialflag
|=
SPECIAL_NO_PRIOR
;
opt_specialflag
|=
SPECIAL_NO_PRIOR
;
break
;
break
;
...
@@ -2853,6 +2895,9 @@ static void get_options(int argc,char **argv)
...
@@ -2853,6 +2895,9 @@ static void get_options(int argc,char **argv)
opt_specialflag
|=
SPECIAL_SKIP_SHOW_DB
;
opt_specialflag
|=
SPECIAL_SKIP_SHOW_DB
;
mysql_port
=
0
;
mysql_port
=
0
;
break
;
break
;
case
(
int
)
OPT_MEMLOCK
:
locked_in_memory
=
1
;
break
;
case
(
int
)
OPT_ONE_THREAD
:
case
(
int
)
OPT_ONE_THREAD
:
test_flags
|=
TEST_NO_THREADS
;
test_flags
|=
TEST_NO_THREADS
;
break
;
break
;
...
...
sql/sql_acl.cc
View file @
751f2d1f
...
@@ -820,7 +820,7 @@ bool change_password(THD *thd, const char *host, const char *user,
...
@@ -820,7 +820,7 @@ bool change_password(THD *thd, const char *host, const char *user,
acl_user
->
user
,
acl_user
->
user
,
acl_user
->
host
.
hostname
?
acl_user
->
host
.
hostname
:
""
,
acl_user
->
host
.
hostname
?
acl_user
->
host
.
hostname
:
""
,
new_password
));
new_password
));
mysql_update_log
.
write
(
buff
,(
uint
)
strlen
(
buff
)
);
mysql_update_log
.
write
(
thd
,
buff
,
qinfo
.
q_len
);
mysql_bin_log
.
write
(
&
qinfo
);
mysql_bin_log
.
write
(
&
qinfo
);
return
0
;
return
0
;
}
}
...
...
sql/sql_base.cc
View file @
751f2d1f
...
@@ -29,7 +29,6 @@
...
@@ -29,7 +29,6 @@
#include <io.h>
#include <io.h>
#endif
#endif
static
int
key_cache_used
=
0
;
TABLE
*
unused_tables
;
/* Used by mysql_test */
TABLE
*
unused_tables
;
/* Used by mysql_test */
HASH
open_cache
;
/* Used by mysql_test */
HASH
open_cache
;
/* Used by mysql_test */
...
@@ -550,10 +549,9 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh,
...
@@ -550,10 +549,9 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh,
VOID
(
hash_delete
(
&
open_cache
,(
byte
*
)
unused_tables
));
VOID
(
hash_delete
(
&
open_cache
,(
byte
*
)
unused_tables
));
#endif
#endif
}
}
if
(
!
open_cache
.
records
)
if
(
!
open_cache
.
records
&&
!
locked_in_memory
)
{
{
end_key_cache
();
/* No tables in memory */
end_key_cache
();
/* No tables in memory */
key_cache_used
=
0
;
}
}
refresh_version
++
;
// Force close of open tables
refresh_version
++
;
// Force close of open tables
}
}
...
@@ -980,11 +978,8 @@ TABLE *open_table(THD *thd,const char *db,const char *table_name,
...
@@ -980,11 +978,8 @@ TABLE *open_table(THD *thd,const char *db,const char *table_name,
table
->
key_length
=
key_length
;
table
->
key_length
=
key_length
;
table
->
version
=
refresh_version
;
table
->
version
=
refresh_version
;
table
->
flush_version
=
flush_version
;
table
->
flush_version
=
flush_version
;
if
(
!
key_cache_used
)
if
(
!
key_cache_inited
)
{
key_cache_used
=
1
;
ha_key_cache
();
ha_key_cache
();
}
DBUG_PRINT
(
"info"
,
(
"inserting table %p into the cache"
,
table
));
DBUG_PRINT
(
"info"
,
(
"inserting table %p into the cache"
,
table
));
VOID
(
hash_insert
(
&
open_cache
,(
byte
*
)
table
));
VOID
(
hash_insert
(
&
open_cache
,(
byte
*
)
table
));
}
}
...
...
sql/sql_class.cc
View file @
751f2d1f
...
@@ -221,6 +221,7 @@ bool select_send::send_data(List<Item> &items)
...
@@ -221,6 +221,7 @@ bool select_send::send_data(List<Item> &items)
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
}
}
}
}
thd
->
sent_row_count
++
;
bool
error
=
my_net_write
(
&
thd
->
net
,(
char
*
)
packet
->
ptr
(),
packet
->
length
());
bool
error
=
my_net_write
(
&
thd
->
net
,(
char
*
)
packet
->
ptr
(),
packet
->
length
());
DBUG_RETURN
(
error
);
DBUG_RETURN
(
error
);
}
}
...
@@ -256,6 +257,7 @@ select_export::~select_export()
...
@@ -256,6 +257,7 @@ select_export::~select_export()
(
void
)
my_close
(
file
,
MYF
(
0
));
(
void
)
my_close
(
file
,
MYF
(
0
));
file
=
-
1
;
file
=
-
1
;
}
}
thd
->
sent_row_count
=
row_count
;
}
}
int
int
...
@@ -461,10 +463,10 @@ bool select_export::send_data(List<Item> &items)
...
@@ -461,10 +463,10 @@ bool select_export::send_data(List<Item> &items)
void
select_export
::
send_error
(
uint
errcode
,
const
char
*
err
)
void
select_export
::
send_error
(
uint
errcode
,
const
char
*
err
)
{
{
::
send_error
(
&
thd
->
net
,
errcode
,
err
);
::
send_error
(
&
thd
->
net
,
errcode
,
err
);
(
void
)
end_io_cache
(
&
cache
);
(
void
)
end_io_cache
(
&
cache
);
(
void
)
my_close
(
file
,
MYF
(
0
));
(
void
)
my_close
(
file
,
MYF
(
0
));
file
=
-
1
;
file
=
-
1
;
}
}
...
...
sql/sql_class.h
View file @
751f2d1f
...
@@ -94,8 +94,9 @@ class MYSQL_LOG {
...
@@ -94,8 +94,9 @@ class MYSQL_LOG {
void
open
(
const
char
*
log_name
,
enum_log_type
log_type
,
void
open
(
const
char
*
log_name
,
enum_log_type
log_type
,
const
char
*
new_name
=
0
);
const
char
*
new_name
=
0
);
void
new_file
(
void
);
void
new_file
(
void
);
void
write
(
enum
enum_server_command
command
,
const
char
*
format
,...);
void
write
(
THD
*
thd
,
enum
enum_server_command
command
,
const
char
*
format
,...);
void
write
(
const
char
*
query
,
uint
query_length
,
ulong
time_to_do_query
=
0
);
void
write
(
THD
*
thd
,
const
char
*
query
,
uint
query_length
,
time_t
query_start
=
0
);
void
write
(
Query_log_event
*
event_info
);
// binary log write
void
write
(
Query_log_event
*
event_info
);
// binary log write
void
write
(
Load_log_event
*
event_info
);
void
write
(
Load_log_event
*
event_info
);
...
@@ -111,7 +112,7 @@ class MYSQL_LOG {
...
@@ -111,7 +112,7 @@ class MYSQL_LOG {
int
find_next_log
(
LOG_INFO
*
linfo
);
int
find_next_log
(
LOG_INFO
*
linfo
);
int
get_current_log
(
LOG_INFO
*
linfo
);
int
get_current_log
(
LOG_INFO
*
linfo
);
bool
is_open
()
{
return
log_type
!=
LOG_CLOSED
;
}
inline
bool
is_open
()
{
return
log_type
!=
LOG_CLOSED
;
}
char
*
get_index_fname
()
{
return
index_file_name
;}
char
*
get_index_fname
()
{
return
index_file_name
;}
char
*
get_log_fname
()
{
return
log_file_name
;
}
char
*
get_log_fname
()
{
return
log_file_name
;
}
};
};
...
@@ -241,7 +242,7 @@ class THD :public ilink {
...
@@ -241,7 +242,7 @@ class THD :public ilink {
const
char
*
where
;
const
char
*
where
;
char
*
last_nx_table
;
// last non-existent table, we need this for replication
char
*
last_nx_table
;
// last non-existent table, we need this for replication
char
*
last_nx_db
;
// database of the last nx table
char
*
last_nx_db
;
// database of the last nx table
time_t
start_time
;
time_t
start_time
,
time_after_lock
;
time_t
connect_time
,
thr_create_time
;
// track down slow pthread_create
time_t
connect_time
,
thr_create_time
;
// track down slow pthread_create
thr_lock_type
update_lock_default
;
thr_lock_type
update_lock_default
;
delayed_insert
*
di
;
delayed_insert
*
di
;
...
@@ -257,7 +258,7 @@ class THD :public ilink {
...
@@ -257,7 +258,7 @@ class THD :public ilink {
#endif
#endif
ulonglong
next_insert_id
,
last_insert_id
,
current_insert_id
;
ulonglong
next_insert_id
,
last_insert_id
,
current_insert_id
;
ha_rows
select_limit
,
offset_limit
,
default_select_limit
,
cuted_fields
,
ha_rows
select_limit
,
offset_limit
,
default_select_limit
,
cuted_fields
,
max_join_size
;
max_join_size
,
sent_row_count
;
ulong
query_id
,
version
,
inactive_timeout
,
options
,
thread_id
;
ulong
query_id
,
version
,
inactive_timeout
,
options
,
thread_id
;
long
dbug_thread_id
;
long
dbug_thread_id
;
pthread_t
real_id
;
pthread_t
real_id
;
...
@@ -276,6 +277,7 @@ class THD :public ilink {
...
@@ -276,6 +277,7 @@ class THD :public ilink {
inline
time_t
query_start
()
{
query_start_used
=
1
;
return
start_time
;
}
inline
time_t
query_start
()
{
query_start_used
=
1
;
return
start_time
;
}
inline
void
set_time
()
{
if
(
!
user_time
)
time
(
&
start_time
);
}
inline
void
set_time
()
{
if
(
!
user_time
)
time
(
&
start_time
);
}
inline
void
set_time
(
time_t
t
)
{
start_time
=
t
;
user_time
=
1
;
}
inline
void
set_time
(
time_t
t
)
{
start_time
=
t
;
user_time
=
1
;
}
inline
void
lock_time
()
{
time
(
&
time_after_lock
);
}
inline
void
insert_id
(
ulonglong
id
)
inline
void
insert_id
(
ulonglong
id
)
{
last_insert_id
=
id
;
insert_id_used
=
1
;
}
{
last_insert_id
=
id
;
insert_id_used
=
1
;
}
inline
ulonglong
insert_id
(
void
)
inline
ulonglong
insert_id
(
void
)
...
...
sql/sql_db.cc
View file @
751f2d1f
...
@@ -71,9 +71,12 @@ void mysql_create_db(THD *thd, char *db, uint create_options)
...
@@ -71,9 +71,12 @@ void mysql_create_db(THD *thd, char *db, uint create_options)
path
);
path
);
}
}
{
{
mysql_update_log
.
write
(
thd
->
query
,
thd
->
query_length
);
mysql_update_log
.
write
(
thd
,
thd
->
query
,
thd
->
query_length
);
Query_log_event
qinfo
(
thd
,
thd
->
query
);
if
(
mysql_bin_log
.
is_open
())
mysql_bin_log
.
write
(
&
qinfo
);
{
Query_log_event
qinfo
(
thd
,
thd
->
query
);
mysql_bin_log
.
write
(
&
qinfo
);
}
}
}
if
(
thd
->
query
==
path
)
if
(
thd
->
query
==
path
)
{
{
...
@@ -131,9 +134,12 @@ void mysql_rm_db(THD *thd,char *db,bool if_exists)
...
@@ -131,9 +134,12 @@ void mysql_rm_db(THD *thd,char *db,bool if_exists)
thd
->
query_length
=
(
uint
)
(
strxmov
(
path
,
"drop database "
,
db
,
NullS
)
-
thd
->
query_length
=
(
uint
)
(
strxmov
(
path
,
"drop database "
,
db
,
NullS
)
-
path
);
path
);
}
}
mysql_update_log
.
write
(
thd
->
query
,
thd
->
query_length
);
mysql_update_log
.
write
(
thd
,
thd
->
query
,
thd
->
query_length
);
Query_log_event
qinfo
(
thd
,
thd
->
query
);
if
(
mysql_bin_log
.
is_open
())
mysql_bin_log
.
write
(
&
qinfo
);
{
Query_log_event
qinfo
(
thd
,
thd
->
query
);
mysql_bin_log
.
write
(
&
qinfo
);
}
if
(
thd
->
query
==
path
)
if
(
thd
->
query
==
path
)
{
{
thd
->
query
=
0
;
// just in case
thd
->
query
=
0
;
// just in case
...
@@ -276,7 +282,7 @@ bool mysql_change_db(THD *thd,const char *name)
...
@@ -276,7 +282,7 @@ bool mysql_change_db(THD *thd,const char *name)
thd
->
priv_user
,
thd
->
priv_user
,
thd
->
host
?
thd
->
host
:
thd
->
ip
?
thd
->
ip
:
"unknown"
,
thd
->
host
?
thd
->
host
:
thd
->
ip
?
thd
->
ip
:
"unknown"
,
dbname
);
dbname
);
mysql_log
.
write
(
COM_INIT_DB
,
ER
(
ER_DBACCESS_DENIED_ERROR
),
mysql_log
.
write
(
thd
,
COM_INIT_DB
,
ER
(
ER_DBACCESS_DENIED_ERROR
),
thd
->
priv_user
,
thd
->
priv_user
,
thd
->
host
?
thd
->
host
:
thd
->
ip
?
thd
->
ip
:
"unknown"
,
thd
->
host
?
thd
->
host
:
thd
->
ip
?
thd
->
ip
:
"unknown"
,
dbname
);
dbname
);
...
...
sql/sql_delete.cc
View file @
751f2d1f
...
@@ -89,9 +89,12 @@ static int generate_table(THD *thd, TABLE_LIST *table_list,
...
@@ -89,9 +89,12 @@ static int generate_table(THD *thd, TABLE_LIST *table_list,
if
(
!
error
)
if
(
!
error
)
{
{
send_ok
(
&
thd
->
net
);
// This should return record count
send_ok
(
&
thd
->
net
);
// This should return record count
mysql_update_log
.
write
(
thd
->
query
,
thd
->
query_length
);
mysql_update_log
.
write
(
thd
,
thd
->
query
,
thd
->
query_length
);
Query_log_event
qinfo
(
thd
,
thd
->
query
);
if
(
mysql_bin_log
.
is_open
())
mysql_bin_log
.
write
(
&
qinfo
);
{
Query_log_event
qinfo
(
thd
,
thd
->
query
);
mysql_bin_log
.
write
(
&
qinfo
);
}
}
}
DBUG_RETURN
(
error
?
-
1
:
0
);
DBUG_RETURN
(
error
?
-
1
:
0
);
}
}
...
@@ -188,9 +191,12 @@ int mysql_delete(THD *thd,TABLE_LIST *table_list,COND *conds,ha_rows limit,
...
@@ -188,9 +191,12 @@ int mysql_delete(THD *thd,TABLE_LIST *table_list,COND *conds,ha_rows limit,
VOID
(
table
->
file
->
extra
(
HA_EXTRA_READCHECK
));
VOID
(
table
->
file
->
extra
(
HA_EXTRA_READCHECK
));
if
(
deleted
)
if
(
deleted
)
{
{
mysql_update_log
.
write
(
thd
->
query
,
thd
->
query_length
);
mysql_update_log
.
write
(
thd
,
thd
->
query
,
thd
->
query_length
);
Query_log_event
qinfo
(
thd
,
thd
->
query
);
if
(
mysql_bin_log
.
is_open
())
mysql_bin_log
.
write
(
&
qinfo
);
{
Query_log_event
qinfo
(
thd
,
thd
->
query
);
mysql_bin_log
.
write
(
&
qinfo
);
}
}
}
if
(
ha_autocommit_or_rollback
(
thd
,
error
>=
0
))
if
(
ha_autocommit_or_rollback
(
thd
,
error
>=
0
))
error
=
1
;
error
=
1
;
...
...
sql/sql_insert.cc
View file @
751f2d1f
...
@@ -246,9 +246,12 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields,
...
@@ -246,9 +246,12 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields,
id
=
table
->
next_number_field
->
val_int
();
// Return auto_increment value
id
=
table
->
next_number_field
->
val_int
();
// Return auto_increment value
if
(
info
.
copied
||
info
.
deleted
)
if
(
info
.
copied
||
info
.
deleted
)
{
{
mysql_update_log
.
write
(
thd
->
query
,
thd
->
query_length
);
mysql_update_log
.
write
(
thd
,
thd
->
query
,
thd
->
query_length
);
Query_log_event
qinfo
(
thd
,
thd
->
query
);
if
(
mysql_bin_log
.
is_open
())
mysql_bin_log
.
write
(
&
qinfo
);
{
Query_log_event
qinfo
(
thd
,
thd
->
query
);
mysql_bin_log
.
write
(
&
qinfo
);
}
}
}
error
=
ha_autocommit_or_rollback
(
thd
,
error
);
error
=
ha_autocommit_or_rollback
(
thd
,
error
);
if
(
thd
->
lock
)
if
(
thd
->
lock
)
...
@@ -1085,9 +1088,12 @@ bool delayed_insert::handle_inserts(void)
...
@@ -1085,9 +1088,12 @@ bool delayed_insert::handle_inserts(void)
}
}
if
(
row
->
query
&&
row
->
log_query
)
if
(
row
->
query
&&
row
->
log_query
)
{
{
mysql_update_log
.
write
(
row
->
query
,
row
->
query_length
);
mysql_update_log
.
write
(
&
thd
,
row
->
query
,
row
->
query_length
);
Query_log_event
qinfo
(
&
thd
,
row
->
query
);
if
(
mysql_bin_log
.
is_open
())
mysql_bin_log
.
write
(
&
qinfo
);
{
Query_log_event
qinfo
(
&
thd
,
row
->
query
);
mysql_bin_log
.
write
(
&
qinfo
);
}
}
}
if
(
table
->
blob_fields
)
if
(
table
->
blob_fields
)
free_delayed_insert_blobs
(
table
);
free_delayed_insert_blobs
(
table
);
...
@@ -1245,9 +1251,12 @@ bool select_insert::send_eof()
...
@@ -1245,9 +1251,12 @@ bool select_insert::send_eof()
if
(
last_insert_id
)
if
(
last_insert_id
)
thd
->
insert_id
(
last_insert_id
);
// For update log
thd
->
insert_id
(
last_insert_id
);
// For update log
::
send_ok
(
&
thd
->
net
,
info
.
copied
,
last_insert_id
,
buff
);
::
send_ok
(
&
thd
->
net
,
info
.
copied
,
last_insert_id
,
buff
);
mysql_update_log
.
write
(
thd
->
query
,
thd
->
query_length
);
mysql_update_log
.
write
(
thd
,
thd
->
query
,
thd
->
query_length
);
Query_log_event
qinfo
(
thd
,
thd
->
query
);
if
(
mysql_bin_log
.
is_open
())
mysql_bin_log
.
write
(
&
qinfo
);
{
Query_log_event
qinfo
(
thd
,
thd
->
query
);
mysql_bin_log
.
write
(
&
qinfo
);
}
return
0
;
return
0
;
}
}
}
}
...
...
sql/sql_load.cc
View file @
751f2d1f
...
@@ -244,14 +244,14 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
...
@@ -244,14 +244,14 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
sprintf
(
name
,
ER
(
ER_LOAD_INFO
),
info
.
records
,
info
.
deleted
,
sprintf
(
name
,
ER
(
ER_LOAD_INFO
),
info
.
records
,
info
.
deleted
,
info
.
records
-
info
.
copied
,
thd
->
cuted_fields
);
info
.
records
-
info
.
copied
,
thd
->
cuted_fields
);
send_ok
(
&
thd
->
net
,
info
.
copied
+
info
.
deleted
,
0L
,
name
);
send_ok
(
&
thd
->
net
,
info
.
copied
+
info
.
deleted
,
0L
,
name
);
mysql_update_log
.
write
(
thd
->
query
,
thd
->
query_length
);
mysql_update_log
.
write
(
thd
,
thd
->
query
,
thd
->
query_length
);
if
(
!
read_file_from_client
)
if
(
!
read_file_from_client
)
{
{
ex
->
skip_lines
=
save_skip_lines
;
ex
->
skip_lines
=
save_skip_lines
;
Load_log_event
qinfo
(
thd
,
ex
,
table
->
table_name
,
fields
,
handle_duplicates
);
Load_log_event
qinfo
(
thd
,
ex
,
table
->
table_name
,
fields
,
handle_duplicates
);
mysql_bin_log
.
write
(
&
qinfo
);
mysql_bin_log
.
write
(
&
qinfo
);
}
}
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
...
...
sql/sql_parse.cc
View file @
751f2d1f
...
@@ -119,7 +119,7 @@ static bool check_user(THD *thd,enum_server_command command, const char *user,
...
@@ -119,7 +119,7 @@ static bool check_user(THD *thd,enum_server_command command, const char *user,
thd
->
user
,
thd
->
user
,
thd
->
host
?
thd
->
host
:
thd
->
ip
,
thd
->
host
?
thd
->
host
:
thd
->
ip
,
passwd
[
0
]
?
ER
(
ER_YES
)
:
ER
(
ER_NO
));
passwd
[
0
]
?
ER
(
ER_YES
)
:
ER
(
ER_NO
));
mysql_log
.
write
(
COM_CONNECT
,
ER
(
ER_ACCESS_DENIED_ERROR
),
mysql_log
.
write
(
thd
,
COM_CONNECT
,
ER
(
ER_ACCESS_DENIED_ERROR
),
thd
->
user
,
thd
->
user
,
thd
->
host
?
thd
->
host
:
thd
->
ip
?
thd
->
ip
:
"unknown ip"
,
thd
->
host
?
thd
->
host
:
thd
->
ip
?
thd
->
ip
:
"unknown ip"
,
passwd
[
0
]
?
ER
(
ER_YES
)
:
ER
(
ER_NO
));
passwd
[
0
]
?
ER
(
ER_YES
)
:
ER
(
ER_NO
));
...
@@ -137,7 +137,7 @@ static bool check_user(THD *thd,enum_server_command command, const char *user,
...
@@ -137,7 +137,7 @@ static bool check_user(THD *thd,enum_server_command command, const char *user,
return
(
1
);
return
(
1
);
}
}
}
}
mysql_log
.
write
(
command
,
mysql_log
.
write
(
thd
,
command
,
(
thd
->
priv_user
==
thd
->
user
?
(
thd
->
priv_user
==
thd
->
user
?
(
char
*
)
"%s@%s on %s"
:
(
char
*
)
"%s@%s on %s"
:
(
char
*
)
"%s@%s as anonymous on %s"
),
(
char
*
)
"%s@%s as anonymous on %s"
),
...
@@ -578,7 +578,7 @@ bool do_command(THD *thd)
...
@@ -578,7 +578,7 @@ bool do_command(THD *thd)
switch
(
command
)
{
switch
(
command
)
{
case
COM_INIT_DB
:
case
COM_INIT_DB
:
if
(
!
mysql_change_db
(
thd
,
packet
+
1
))
if
(
!
mysql_change_db
(
thd
,
packet
+
1
))
mysql_log
.
write
(
command
,
"%s"
,
thd
->
db
);
mysql_log
.
write
(
thd
,
command
,
"%s"
,
thd
->
db
);
break
;
break
;
case
COM_TABLE_DUMP
:
case
COM_TABLE_DUMP
:
{
{
...
@@ -646,7 +646,7 @@ bool do_command(THD *thd)
...
@@ -646,7 +646,7 @@ bool do_command(THD *thd)
thd
->
packet
.
shrink
(
net_buffer_length
);
// Reclaim some memory
thd
->
packet
.
shrink
(
net_buffer_length
);
// Reclaim some memory
if
(
!
(
specialflag
&
SPECIAL_NO_PRIOR
))
if
(
!
(
specialflag
&
SPECIAL_NO_PRIOR
))
my_pthread_setprio
(
pthread_self
(),
QUERY_PRIOR
);
my_pthread_setprio
(
pthread_self
(),
QUERY_PRIOR
);
mysql_log
.
write
(
command
,
"%s"
,
thd
->
query
);
mysql_log
.
write
(
thd
,
command
,
"%s"
,
thd
->
query
);
DBUG_PRINT
(
"query"
,(
"%s"
,
thd
->
query
));
DBUG_PRINT
(
"query"
,(
"%s"
,
thd
->
query
));
mysql_parse
(
thd
,
thd
->
query
,
packet_length
-
1
);
mysql_parse
(
thd
,
thd
->
query
,
packet_length
-
1
);
if
(
!
(
specialflag
&
SPECIAL_NO_PRIOR
))
if
(
!
(
specialflag
&
SPECIAL_NO_PRIOR
))
...
@@ -671,7 +671,7 @@ bool do_command(THD *thd)
...
@@ -671,7 +671,7 @@ bool do_command(THD *thd)
thd
->
free_list
=
0
;
thd
->
free_list
=
0
;
table_list
.
name
=
table_list
.
real_name
=
thd
->
strdup
(
packet
+
1
);
table_list
.
name
=
table_list
.
real_name
=
thd
->
strdup
(
packet
+
1
);
thd
->
query
=
fields
=
thd
->
strdup
(
strend
(
packet
+
1
)
+
1
);
thd
->
query
=
fields
=
thd
->
strdup
(
strend
(
packet
+
1
)
+
1
);
mysql_log
.
write
(
command
,
"%s %s"
,
table_list
.
real_name
,
fields
);
mysql_log
.
write
(
thd
,
command
,
"%s %s"
,
table_list
.
real_name
,
fields
);
remove_escape
(
table_list
.
real_name
);
// This can't have wildcards
remove_escape
(
table_list
.
real_name
);
// This can't have wildcards
if
(
check_access
(
thd
,
SELECT_ACL
,
table_list
.
db
,
&
thd
->
col_access
))
if
(
check_access
(
thd
,
SELECT_ACL
,
table_list
.
db
,
&
thd
->
col_access
))
...
@@ -685,7 +685,7 @@ bool do_command(THD *thd)
...
@@ -685,7 +685,7 @@ bool do_command(THD *thd)
}
}
#endif
#endif
case
COM_QUIT
:
case
COM_QUIT
:
mysql_log
.
write
(
command
,
NullS
);
mysql_log
.
write
(
thd
,
command
,
NullS
);
net
->
error
=
0
;
// Don't give 'abort' message
net
->
error
=
0
;
// Don't give 'abort' message
error
=
TRUE
;
// End server
error
=
TRUE
;
// End server
break
;
break
;
...
@@ -695,7 +695,7 @@ bool do_command(THD *thd)
...
@@ -695,7 +695,7 @@ bool do_command(THD *thd)
char
*
db
=
thd
->
strdup
(
packet
+
1
);
char
*
db
=
thd
->
strdup
(
packet
+
1
);
if
(
check_access
(
thd
,
CREATE_ACL
,
db
,
0
,
1
))
if
(
check_access
(
thd
,
CREATE_ACL
,
db
,
0
,
1
))
break
;
break
;
mysql_log
.
write
(
command
,
packet
+
1
);
mysql_log
.
write
(
thd
,
command
,
packet
+
1
);
mysql_create_db
(
thd
,
db
,
0
);
mysql_create_db
(
thd
,
db
,
0
);
break
;
break
;
}
}
...
@@ -704,7 +704,7 @@ bool do_command(THD *thd)
...
@@ -704,7 +704,7 @@ bool do_command(THD *thd)
char
*
db
=
thd
->
strdup
(
packet
+
1
);
char
*
db
=
thd
->
strdup
(
packet
+
1
);
if
(
check_access
(
thd
,
DROP_ACL
,
db
,
0
,
1
))
if
(
check_access
(
thd
,
DROP_ACL
,
db
,
0
,
1
))
break
;
break
;
mysql_log
.
write
(
command
,
db
);
mysql_log
.
write
(
thd
,
command
,
db
);
mysql_rm_db
(
thd
,
db
,
0
);
mysql_rm_db
(
thd
,
db
,
0
);
break
;
break
;
}
}
...
@@ -712,7 +712,7 @@ bool do_command(THD *thd)
...
@@ -712,7 +712,7 @@ bool do_command(THD *thd)
{
{
if
(
check_access
(
thd
,
FILE_ACL
,
any_db
))
if
(
check_access
(
thd
,
FILE_ACL
,
any_db
))
break
;
break
;
mysql_log
.
write
(
command
,
0
);
mysql_log
.
write
(
thd
,
command
,
0
);
ulong
pos
;
ulong
pos
;
ushort
flags
;
ushort
flags
;
...
@@ -726,7 +726,7 @@ bool do_command(THD *thd)
...
@@ -726,7 +726,7 @@ bool do_command(THD *thd)
uint
options
=
(
uchar
)
packet
[
1
];
uint
options
=
(
uchar
)
packet
[
1
];
if
(
check_access
(
thd
,
RELOAD_ACL
,
any_db
))
if
(
check_access
(
thd
,
RELOAD_ACL
,
any_db
))
break
;
break
;
mysql_log
.
write
(
command
,
NullS
);
mysql_log
.
write
(
thd
,
command
,
NullS
);
if
(
reload_acl_and_cache
(
thd
,
options
,
(
TABLE_LIST
*
)
0
))
if
(
reload_acl_and_cache
(
thd
,
options
,
(
TABLE_LIST
*
)
0
))
send_error
(
net
,
0
);
send_error
(
net
,
0
);
else
else
...
@@ -737,7 +737,7 @@ bool do_command(THD *thd)
...
@@ -737,7 +737,7 @@ bool do_command(THD *thd)
if
(
check_access
(
thd
,
SHUTDOWN_ACL
,
any_db
))
if
(
check_access
(
thd
,
SHUTDOWN_ACL
,
any_db
))
break
;
/* purecov: inspected */
break
;
/* purecov: inspected */
DBUG_PRINT
(
"quit"
,(
"Got shutdown command"
));
DBUG_PRINT
(
"quit"
,(
"Got shutdown command"
));
mysql_log
.
write
(
command
,
NullS
);
mysql_log
.
write
(
thd
,
command
,
NullS
);
send_eof
(
net
);
send_eof
(
net
);
#ifdef __WIN__
#ifdef __WIN__
sleep
(
1
);
// must wait after eof()
sleep
(
1
);
// must wait after eof()
...
@@ -752,7 +752,7 @@ bool do_command(THD *thd)
...
@@ -752,7 +752,7 @@ bool do_command(THD *thd)
case
COM_STATISTICS
:
case
COM_STATISTICS
:
{
{
mysql_log
.
write
(
command
,
NullS
);
mysql_log
.
write
(
thd
,
command
,
NullS
);
char
buff
[
200
];
char
buff
[
200
];
ulong
uptime
=
(
ulong
)
(
time
((
time_t
*
)
0
)
-
start_time
);
ulong
uptime
=
(
ulong
)
(
time
((
time_t
*
)
0
)
-
start_time
);
sprintf
((
char
*
)
buff
,
sprintf
((
char
*
)
buff
,
...
@@ -776,7 +776,7 @@ bool do_command(THD *thd)
...
@@ -776,7 +776,7 @@ bool do_command(THD *thd)
case
COM_PROCESS_INFO
:
case
COM_PROCESS_INFO
:
if
(
!
thd
->
priv_user
[
0
]
&&
check_access
(
thd
,
PROCESS_ACL
,
any_db
))
if
(
!
thd
->
priv_user
[
0
]
&&
check_access
(
thd
,
PROCESS_ACL
,
any_db
))
break
;
break
;
mysql_log
.
write
(
command
,
NullS
);
mysql_log
.
write
(
thd
,
command
,
NullS
);
mysqld_list_processes
(
thd
,
thd
->
master_access
&
PROCESS_ACL
?
NullS
:
mysqld_list_processes
(
thd
,
thd
->
master_access
&
PROCESS_ACL
?
NullS
:
thd
->
priv_user
,
0
);
thd
->
priv_user
,
0
);
break
;
break
;
...
@@ -790,7 +790,7 @@ bool do_command(THD *thd)
...
@@ -790,7 +790,7 @@ bool do_command(THD *thd)
if
(
check_access
(
thd
,
PROCESS_ACL
,
any_db
))
if
(
check_access
(
thd
,
PROCESS_ACL
,
any_db
))
break
;
/* purecov: inspected */
break
;
/* purecov: inspected */
mysql_print_status
(
thd
);
mysql_print_status
(
thd
);
mysql_log
.
write
(
command
,
NullS
);
mysql_log
.
write
(
thd
,
command
,
NullS
);
send_eof
(
net
);
send_eof
(
net
);
break
;
break
;
case
COM_SLEEP
:
case
COM_SLEEP
:
...
@@ -816,8 +816,7 @@ bool do_command(THD *thd)
...
@@ -816,8 +816,7 @@ bool do_command(THD *thd)
if
((
ulong
)
(
thd
->
start_time
-
start_of_query
)
>
long_query_time
)
if
((
ulong
)
(
thd
->
start_time
-
start_of_query
)
>
long_query_time
)
{
{
long_query_count
++
;
long_query_count
++
;
mysql_slow_log
.
write
(
thd
->
query
,
thd
->
query_length
,
mysql_slow_log
.
write
(
thd
,
thd
->
query
,
thd
->
query_length
,
start_of_query
);
(
ulong
)
(
thd
->
start_time
-
start_of_query
));
}
}
VOID
(
pthread_mutex_lock
(
&
LOCK_thread_count
));
// For process list
VOID
(
pthread_mutex_lock
(
&
LOCK_thread_count
));
// For process list
thd
->
proc_info
=
0
;
thd
->
proc_info
=
0
;
...
@@ -1625,11 +1624,14 @@ mysql_execute_command(void)
...
@@ -1625,11 +1624,14 @@ mysql_execute_command(void)
res
=
mysql_table_grant
(
thd
,
tables
,
lex
->
users_list
,
lex
->
columns
,
res
=
mysql_table_grant
(
thd
,
tables
,
lex
->
users_list
,
lex
->
columns
,
lex
->
grant
,
lex
->
sql_command
==
SQLCOM_REVOKE
);
lex
->
grant
,
lex
->
sql_command
==
SQLCOM_REVOKE
);
if
(
!
res
)
if
(
!
res
)
{
mysql_update_log
.
write
(
thd
,
thd
->
query
,
thd
->
query_length
);
if
(
mysql_bin_log
.
is_open
())
{
{
mysql_update_log
.
write
(
thd
->
query
,
thd
->
query_length
);
Query_log_event
qinfo
(
thd
,
thd
->
query
);
Query_log_event
qinfo
(
thd
,
thd
->
query
);
mysql_bin_log
.
write
(
&
qinfo
);
mysql_bin_log
.
write
(
&
qinfo
);
}
}
}
}
}
else
else
{
{
...
@@ -1643,9 +1645,12 @@ mysql_execute_command(void)
...
@@ -1643,9 +1645,12 @@ mysql_execute_command(void)
lex
->
sql_command
==
SQLCOM_REVOKE
);
lex
->
sql_command
==
SQLCOM_REVOKE
);
if
(
!
res
)
if
(
!
res
)
{
{
mysql_update_log
.
write
(
thd
->
query
,
thd
->
query_length
);
mysql_update_log
.
write
(
thd
,
thd
->
query
,
thd
->
query_length
);
Query_log_event
qinfo
(
thd
,
thd
->
query
);
if
(
mysql_bin_log
.
is_open
())
mysql_bin_log
.
write
(
&
qinfo
);
{
Query_log_event
qinfo
(
thd
,
thd
->
query
);
mysql_bin_log
.
write
(
&
qinfo
);
}
}
}
}
}
break
;
break
;
...
@@ -1905,6 +1910,7 @@ mysql_init_query(THD *thd)
...
@@ -1905,6 +1910,7 @@ mysql_init_query(THD *thd)
thd
->
lex
.
table_list
.
next
=
(
byte
**
)
&
thd
->
lex
.
table_list
.
first
;
thd
->
lex
.
table_list
.
next
=
(
byte
**
)
&
thd
->
lex
.
table_list
.
first
;
thd
->
fatal_error
=
0
;
// Safety
thd
->
fatal_error
=
0
;
// Safety
thd
->
last_insert_id_used
=
thd
->
query_start_used
=
thd
->
insert_id_used
=
0
;
thd
->
last_insert_id_used
=
thd
->
query_start_used
=
thd
->
insert_id_used
=
0
;
thd
->
sent_row_count
=
0
;
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
...
@@ -2625,37 +2631,23 @@ static int change_master(THD* thd)
...
@@ -2625,37 +2631,23 @@ static int change_master(THD* thd)
static
void
reset_master
()
static
void
reset_master
()
{
{
if
(
!
mysql_bin_log
.
is_open
())
if
(
!
mysql_bin_log
.
is_open
())
{
{
my_error
(
ER_FLUSH_MASTER_BINLOG_CLOSED
,
MYF
(
ME_BELL
+
ME_WAITTANG
));
my_error
(
ER_FLUSH_MASTER_BINLOG_CLOSED
,
MYF
(
ME_BELL
+
ME_WAITTANG
));
return
;
return
;
}
}
LOG_INFO
linfo
;
LOG_INFO
linfo
;
if
(
mysql_bin_log
.
find_first_log
(
&
linfo
,
""
))
if
(
mysql_bin_log
.
find_first_log
(
&
linfo
,
""
))
return
;
return
;
for
(;;)
for
(;;)
{
my_delete
(
linfo
.
log_file_name
,
MYF
(
MY_WME
));
if
(
mysql_bin_log
.
find_next_log
(
&
linfo
))
break
;
}
mysql_bin_log
.
close
(
1
);
// exiting close
my_delete
(
mysql_bin_log
.
get_index_fname
(),
MYF
(
MY_WME
));
char
tmp
[
FN_REFLEN
];
if
(
!
opt_bin_logname
||
!
opt_bin_logname
[
0
])
{
{
char
hostname
[
FN_REFLEN
];
my_delete
(
linfo
.
log_file_name
,
MYF
(
MY_WME
));
if
(
gethostname
(
hostname
,
sizeof
(
hostname
)
-
4
)
<
0
)
if
(
mysql_bin_log
.
find_next_log
(
&
linfo
))
strmov
(
hostname
,
"mysql"
);
break
;
strnmov
(
tmp
,
hostname
,
FN_REFLEN
-
5
);
strmov
(
strcend
(
tmp
,
'.'
),
"-bin"
);
opt_bin_logname
=
tmp
;
}
}
mysql_bin_log
.
close
(
1
);
// exiting close
my_delete
(
mysql_bin_log
.
get_index_fname
(),
MYF
(
MY_WME
));
mysql_bin_log
.
open
(
opt_bin_logname
,
LOG_BIN
);
mysql_bin_log
.
open
(
opt_bin_logname
,
LOG_BIN
);
}
}
...
...
sql/sql_rename.cc
View file @
751f2d1f
...
@@ -87,9 +87,12 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list)
...
@@ -87,9 +87,12 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list)
}
}
if
(
!
error
)
if
(
!
error
)
{
{
mysql_update_log
.
write
(
thd
->
query
,
thd
->
query_length
);
mysql_update_log
.
write
(
thd
,
thd
->
query
,
thd
->
query_length
);
Query_log_event
qinfo
(
thd
,
thd
->
query
);
if
(
mysql_bin_log
.
is_open
())
mysql_bin_log
.
write
(
&
qinfo
);
{
Query_log_event
qinfo
(
thd
,
thd
->
query
);
mysql_bin_log
.
write
(
&
qinfo
);
}
send_ok
(
&
thd
->
net
);
send_ok
(
&
thd
->
net
);
}
}
for
(
TABLE_LIST
*
table
=
table_list
;
table
!=
lock_table
;
table
=
table
->
next
)
for
(
TABLE_LIST
*
table
=
table_list
;
table
!=
lock_table
;
table
=
table
->
next
)
...
...
sql/sql_table.cc
View file @
751f2d1f
...
@@ -117,9 +117,12 @@ int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists)
...
@@ -117,9 +117,12 @@ int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists)
}
}
if
(
some_tables_deleted
)
if
(
some_tables_deleted
)
{
{
mysql_update_log
.
write
(
thd
->
query
,
thd
->
query_length
);
mysql_update_log
.
write
(
thd
,
thd
->
query
,
thd
->
query_length
);
Query_log_event
qinfo
(
thd
,
thd
->
query
);
if
(
mysql_bin_log
.
is_open
())
mysql_bin_log
.
write
(
&
qinfo
);
{
Query_log_event
qinfo
(
thd
,
thd
->
query
);
mysql_bin_log
.
write
(
&
qinfo
);
}
}
}
VOID
(
pthread_cond_broadcast
(
&
COND_refresh
));
// Signal to refresh
VOID
(
pthread_cond_broadcast
(
&
COND_refresh
));
// Signal to refresh
...
@@ -526,9 +529,12 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
...
@@ -526,9 +529,12 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
if
(
!
tmp_table
&&
!
no_log
)
if
(
!
tmp_table
&&
!
no_log
)
{
{
// Must be written before unlock
// Must be written before unlock
mysql_update_log
.
write
(
thd
->
query
,
thd
->
query_length
);
mysql_update_log
.
write
(
thd
,
thd
->
query
,
thd
->
query_length
);
Query_log_event
qinfo
(
thd
,
thd
->
query
);
if
(
mysql_bin_log
.
is_open
())
mysql_bin_log
.
write
(
&
qinfo
);
{
Query_log_event
qinfo
(
thd
,
thd
->
query
);
mysql_bin_log
.
write
(
&
qinfo
);
}
}
}
if
(
create_info
->
options
&
HA_LEX_CREATE_TMP_TABLE
)
if
(
create_info
->
options
&
HA_LEX_CREATE_TMP_TABLE
)
{
{
...
@@ -966,9 +972,12 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
...
@@ -966,9 +972,12 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
if
(
!
error
)
if
(
!
error
)
{
{
mysql_update_log
.
write
(
thd
->
query
,
thd
->
query_length
);
mysql_update_log
.
write
(
thd
,
thd
->
query
,
thd
->
query_length
);
Query_log_event
qinfo
(
thd
,
thd
->
query
);
if
(
mysql_bin_log
.
is_open
())
mysql_bin_log
.
write
(
&
qinfo
);
{
Query_log_event
qinfo
(
thd
,
thd
->
query
);
mysql_bin_log
.
write
(
&
qinfo
);
}
send_ok
(
&
thd
->
net
);
send_ok
(
&
thd
->
net
);
}
}
...
@@ -1257,10 +1266,12 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
...
@@ -1257,10 +1266,12 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
my_free
((
gptr
)
new_table
,
MYF
(
0
));
my_free
((
gptr
)
new_table
,
MYF
(
0
));
goto
err
;
goto
err
;
}
}
mysql_update_log
.
write
(
thd
->
query
,
thd
->
query_length
);
mysql_update_log
.
write
(
thd
,
thd
->
query
,
thd
->
query_length
);
Query_log_event
qinfo
(
thd
,
thd
->
query
);
if
(
mysql_bin_log
.
is_open
())
mysql_bin_log
.
write
(
&
qinfo
);
{
Query_log_event
qinfo
(
thd
,
thd
->
query
);
mysql_bin_log
.
write
(
&
qinfo
);
}
goto
end_temporary
;
goto
end_temporary
;
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
...
@@ -1364,7 +1375,8 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
...
@@ -1364,7 +1375,8 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
}
}
thd
->
proc_info
=
"end"
;
thd
->
proc_info
=
"end"
;
mysql_update_log
.
write
(
thd
->
query
,
thd
->
query_length
);
mysql_update_log
.
write
(
thd
,
thd
->
query
,
thd
->
query_length
);
if
(
mysql_bin_log
.
is_open
())
{
{
Query_log_event
qinfo
(
thd
,
thd
->
query
);
Query_log_event
qinfo
(
thd
,
thd
->
query
);
mysql_bin_log
.
write
(
&
qinfo
);
mysql_bin_log
.
write
(
&
qinfo
);
...
...
sql/sql_update.cc
View file @
751f2d1f
...
@@ -237,9 +237,12 @@ int mysql_update(THD *thd,TABLE_LIST *table_list,List<Item> &fields,
...
@@ -237,9 +237,12 @@ int mysql_update(THD *thd,TABLE_LIST *table_list,List<Item> &fields,
table
->
time_stamp
=
save_time_stamp
;
// Restore auto timestamp pointer
table
->
time_stamp
=
save_time_stamp
;
// Restore auto timestamp pointer
if
(
updated
)
if
(
updated
)
{
{
mysql_update_log
.
write
(
thd
->
query
,
thd
->
query_length
);
mysql_update_log
.
write
(
thd
,
thd
->
query
,
thd
->
query_length
);
Query_log_event
qinfo
(
thd
,
thd
->
query
);
if
(
mysql_bin_log
.
is_open
())
mysql_bin_log
.
write
(
&
qinfo
);
{
Query_log_event
qinfo
(
thd
,
thd
->
query
);
mysql_bin_log
.
write
(
&
qinfo
);
}
}
}
if
(
ha_autocommit_or_rollback
(
thd
,
error
>=
0
))
if
(
ha_autocommit_or_rollback
(
thd
,
error
>=
0
))
error
=
1
;
error
=
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment