Commit 57902c74 authored by unknown's avatar unknown

Merge


BitKeeper/deleted/.del-acinclude.m4~f4ab416bac5003:
  Auto merged
configure.in:
  Auto merged
include/mysql.h:
  Auto merged
scripts/Makefile.am:
  Auto merged
mysql-test/r/drop_temp_table.result:
  SCCS merged
sql/sql_base.cc:
  SCCS merged
parents ac1e5aba 18dcc5dd
...@@ -918,9 +918,11 @@ if test "$ac_cv_header_termio_h" = "no" -a "$ac_cv_header_termios_h" = "no" ...@@ -918,9 +918,11 @@ if test "$ac_cv_header_termio_h" = "no" -a "$ac_cv_header_termios_h" = "no"
then then
AC_CHECK_FUNC(gtty, , AC_CHECK_LIB(compat, gtty)) AC_CHECK_FUNC(gtty, , AC_CHECK_LIB(compat, gtty))
fi fi
# We make a special variable for client library's to avoid including
# thread libs in the client. # We make a special variable for non-threaded version of LIBS to avoid
NON_THREADED_CLIENT_LIBS="$LIBS $ZLIB_LIBS" # including thread libs into non-threaded version of MySQL client library.
# Later in this script LIBS will be augmented with a threads library.
NON_THREADED_LIBS="$LIBS"
AC_MSG_CHECKING([for int8]) AC_MSG_CHECKING([for int8])
case $SYSTEM_TYPE in case $SYSTEM_TYPE in
...@@ -1497,7 +1499,7 @@ then ...@@ -1497,7 +1499,7 @@ then
if test -f /usr/lib/libxnet.so -a "$SYSTEM_TYPE" = "sni-sysv4" if test -f /usr/lib/libxnet.so -a "$SYSTEM_TYPE" = "sni-sysv4"
then then
LIBS="-lxnet $LIBS" LIBS="-lxnet $LIBS"
NON_THREADED_CLIENT_LIBS="$NON_THREADED_CLIENT_LIBS -lxnet" NON_THREADED_LIBS="-lxnet $NON_THREADED_LIBS"
with_named_thread="-Kthread $LDFLAGS -lxnet" with_named_thread="-Kthread $LDFLAGS -lxnet"
LD_FLAGS="" LD_FLAGS=""
CFLAGS="-Kthread $CFLAGS" CFLAGS="-Kthread $CFLAGS"
...@@ -2444,7 +2446,7 @@ dnl This probably should be cleaned up more - for now the threaded ...@@ -2444,7 +2446,7 @@ dnl This probably should be cleaned up more - for now the threaded
dnl client is just using plain-old libs. dnl client is just using plain-old libs.
sql_client_dirs="libmysql strings regex client" sql_client_dirs="libmysql strings regex client"
linked_client_targets="linked_libmysql_sources" linked_client_targets="linked_libmysql_sources"
CLIENT_LIBS=$NON_THREADED_CLIENT_LIBS
if test "$THREAD_SAFE_CLIENT" != "no" if test "$THREAD_SAFE_CLIENT" != "no"
then then
sql_client_dirs="libmysql_r $sql_client_dirs" sql_client_dirs="libmysql_r $sql_client_dirs"
...@@ -2452,9 +2454,11 @@ then ...@@ -2452,9 +2454,11 @@ then
AC_DEFINE([THREAD_SAFE_CLIENT], [1], [Should be client be thread safe]) AC_DEFINE([THREAD_SAFE_CLIENT], [1], [Should be client be thread safe])
fi fi
CLIENT_LIBS="$CLIENT_LIBS $STATIC_NSS_FLAGS" CLIENT_LIBS="$NON_THREADED_LIBS $openssl_libs $ZLIB_LIBS $STATIC_NSS_FLAGS"
AC_SUBST(CLIENT_LIBS) AC_SUBST(CLIENT_LIBS)
AC_SUBST(NON_THREADED_LIBS)
AC_SUBST(STATIC_NSS_FLAGS)
AC_SUBST(sql_client_dirs) AC_SUBST(sql_client_dirs)
AC_SUBST(linked_client_targets) AC_SUBST(linked_client_targets)
......
...@@ -4,7 +4,9 @@ connection con1; ...@@ -4,7 +4,9 @@ connection con1;
reset master; reset master;
create database `drop-temp+table-test`; create database `drop-temp+table-test`;
use `drop-temp+table-test`; use `drop-temp+table-test`;
create temporary table shortn1 (a int);
create temporary table `table:name` (a int); create temporary table `table:name` (a int);
create temporary table shortn2 (a int);
select get_lock("a",10); select get_lock("a",10);
disconnect con1; disconnect con1;
...@@ -15,5 +17,6 @@ connection con2; ...@@ -15,5 +17,6 @@ connection con2;
select get_lock("a",10); select get_lock("a",10);
let $VERSION=`select version()`; let $VERSION=`select version()`;
--replace_result $VERSION VERSION --replace_result $VERSION VERSION
--replace_column 2 # 5 #
show binlog events; show binlog events;
drop database `drop-temp+table-test`; drop database `drop-temp+table-test`;
...@@ -140,6 +140,9 @@ SUFFIXES = .sh ...@@ -140,6 +140,9 @@ SUFFIXES = .sh
-e 's!@''IS_LINUX''@!@IS_LINUX@!' \ -e 's!@''IS_LINUX''@!@IS_LINUX@!' \
-e "s!@""CONF_COMMAND""@!@CONF_COMMAND@!" \ -e "s!@""CONF_COMMAND""@!@CONF_COMMAND@!" \
-e 's!@''MYSQLD_USER''@!@MYSQLD_USER@!' \ -e 's!@''MYSQLD_USER''@!@MYSQLD_USER@!' \
-e 's!@''STATIC_NSS_FLAGS''@!@STATIC_NSS_FLAGS@!' \
-e 's!@''NON_THREADED_LIBS''@!@NON_THREADED_LIBS@!' \
-e 's!@''ZLIB_DEPS''@!@ZLIB_DEPS@!' \
-e "s!@MAKE@!$(MAKE)!" \ -e "s!@MAKE@!$(MAKE)!" \
$< > $@-t $< > $@-t
@CHMOD@ +x $@-t @CHMOD@ +x $@-t
......
...@@ -82,13 +82,14 @@ version='@VERSION@' ...@@ -82,13 +82,14 @@ version='@VERSION@'
socket='@MYSQL_UNIX_ADDR@' socket='@MYSQL_UNIX_ADDR@'
port='@MYSQL_TCP_PORT@' port='@MYSQL_TCP_PORT@'
ldflags='@LDFLAGS@' ldflags='@LDFLAGS@'
client_libs='@CLIENT_LIBS@'
# Create options # Create options
libs="$ldflags -L$pkglibdir -lmysqlclient $client_libs" libs="$ldflags -L$pkglibdir -lmysqlclient @ZLIB_DEPS@ @NON_THREADED_LIBS@"
libs="$libs @openssl_libs@ @STATIC_NSS_FLAGS@"
libs=`echo "$libs" | sed -e 's; \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;'` libs=`echo "$libs" | sed -e 's; \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;'`
libs_r="$ldflags -L$pkglibdir -lmysqlclient_r @LIBS@ @ZLIB_LIBS@ @openssl_libs@"
libs_r="$ldflags -L$pkglibdir -lmysqlclient_r @ZLIB_DEPS@ @LIBS@ @openssl_libs@"
libs_r=`echo "$libs_r" | sed -e 's; \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;'` libs_r=`echo "$libs_r" | sed -e 's; \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;'`
cflags="-I$pkgincludedir @CFLAGS@ " #note: end space! cflags="-I$pkgincludedir @CFLAGS@ " #note: end space!
include="-I$pkgincludedir" include="-I$pkgincludedir"
......
...@@ -497,51 +497,48 @@ void close_temporary(TABLE *table,bool delete_table) ...@@ -497,51 +497,48 @@ void close_temporary(TABLE *table,bool delete_table)
void close_temporary_tables(THD *thd) void close_temporary_tables(THD *thd)
{ {
TABLE *table,*next; TABLE *table,*next;
char *query, *end; char *query, *name_in_query, *end;
uint query_buf_size; uint greatest_key_length= 0;
bool found_user_tables = 0;
if (!thd->temporary_tables) if (!thd->temporary_tables)
return; return;
/*
We write a DROP TEMPORARY TABLE for each temp table left, so that our
replication slave can clean them up. Not one multi-table DROP TABLE binlog
event: this would cause problems if slave uses --replicate-*-table.
*/
LINT_INIT(end); LINT_INIT(end);
query_buf_size= 50; // Enough for DROP ... TABLE IF EXISTS
/* We'll re-use always same buffer so make it big enough for longest name */
for (table=thd->temporary_tables ; table ; table=table->next) for (table=thd->temporary_tables ; table ; table=table->next)
/* greatest_key_length= max(greatest_key_length, table->s->key_length);
We are going to add 4 ` around the db/table names, so 1 does not look
enough; indeed it is enough, because table->key_length is greater (by 8,
because of server_id and thread_id) than db||table.
*/
query_buf_size+= table->s->key_length+1;
if ((query = alloc_root(thd->mem_root, query_buf_size))) if ((query = alloc_root(thd->mem_root, greatest_key_length+50)))
// Better add "if exists", in case a RESET MASTER has been done // Better add "if exists", in case a RESET MASTER has been done
end=strmov(query, "DROP /*!40005 TEMPORARY */ TABLE IF EXISTS "); name_in_query= strmov(query, "DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `");
for (table=thd->temporary_tables ; table ; table=next) for (table=thd->temporary_tables ; table ; table=next)
{ {
if (query) // we might be out of memory, but this is not fatal /*
{ In we are OOM for 'query' this is not fatal. We skip temporary tables
// skip temporary tables not created directly by the user not created directly by the user.
if (table->s->table_name[0] != '#') */
found_user_tables = 1; if (query && mysql_bin_log.is_open() && (table->s->table_name[0] != '#'))
end = strxmov(end,"`",table->s->db,"`.`",
table->s->table_name,"`,", NullS);
}
next=table->next;
close_temporary(table);
}
if (query && found_user_tables && mysql_bin_log.is_open())
{ {
/* The -1 is to remove last ',' */ /*
thd->clear_error(); Here we assume table_cache_key always starts
Query_log_event qinfo(thd, query, (ulong)(end-query)-1, 0, FALSE); with \0 terminated db name
*/
end = strxmov(name_in_query, table->s->db, "`.`",
table->s->table_name, "`", NullS);
Query_log_event qinfo(thd, query, (ulong)(end-query), 0, FALSE);
/* /*
Imagine the thread had created a temp table, then was doing a SELECT, and Imagine the thread had created a temp table, then was doing a SELECT, and
the SELECT was killed. Then it's not clever to mark the statement above as the SELECT was killed. Then it's not clever to mark the statement above as
"killed", because it's not really a statement updating data, and there "killed", because it's not really a statement updating data, and there
are 99.99% chances it will succeed on slave. are 99.99% chances it will succeed on slave. And, if thread is
killed now, it's not clever either.
If a real update (one updating a persistent table) was killed on the If a real update (one updating a persistent table) was killed on the
master, then this real update will be logged with error_code=killed, master, then this real update will be logged with error_code=killed,
rightfully causing the slave to stop. rightfully causing the slave to stop.
...@@ -549,6 +546,9 @@ void close_temporary_tables(THD *thd) ...@@ -549,6 +546,9 @@ void close_temporary_tables(THD *thd)
qinfo.error_code= 0; qinfo.error_code= 0;
mysql_bin_log.write(&qinfo); mysql_bin_log.write(&qinfo);
} }
next=table->next;
close_temporary(table);
}
thd->temporary_tables=0; thd->temporary_tables=0;
} }
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
# Process this file with automake to create Makefile.in # Process this file with automake to create Makefile.in
noinst_LTLIBRARIES=libz.la pkglib_LTLIBRARIES=libz.la
noinst_HEADERS= crc32.h deflate.h inffast.h inffixed.h inflate.h \ noinst_HEADERS= crc32.h deflate.h inffast.h inffixed.h inflate.h \
inftrees.h trees.h zconf.h zlib.h zutil.h inftrees.h trees.h zconf.h zlib.h zutil.h
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment