Commit a70adb5d authored by guilhem@mysql.com's avatar guilhem@mysql.com

Merge

parents be593c32 b97a519d
......@@ -918,9 +918,11 @@ if test "$ac_cv_header_termio_h" = "no" -a "$ac_cv_header_termios_h" = "no"
then
AC_CHECK_FUNC(gtty, , AC_CHECK_LIB(compat, gtty))
fi
# We make a special variable for client library's to avoid including
# thread libs in the client.
NON_THREADED_CLIENT_LIBS="$LIBS $ZLIB_LIBS"
# We make a special variable for non-threaded version of LIBS to avoid
# 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])
case $SYSTEM_TYPE in
......@@ -1497,7 +1499,7 @@ then
if test -f /usr/lib/libxnet.so -a "$SYSTEM_TYPE" = "sni-sysv4"
then
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"
LD_FLAGS=""
CFLAGS="-Kthread $CFLAGS"
......@@ -2444,7 +2446,7 @@ dnl This probably should be cleaned up more - for now the threaded
dnl client is just using plain-old libs.
sql_client_dirs="libmysql strings regex client"
linked_client_targets="linked_libmysql_sources"
CLIENT_LIBS=$NON_THREADED_CLIENT_LIBS
if test "$THREAD_SAFE_CLIENT" != "no"
then
sql_client_dirs="libmysql_r $sql_client_dirs"
......@@ -2452,9 +2454,11 @@ then
AC_DEFINE([THREAD_SAFE_CLIENT], [1], [Should be client be thread safe])
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(NON_THREADED_LIBS)
AC_SUBST(STATIC_NSS_FLAGS)
AC_SUBST(sql_client_dirs)
AC_SUBST(linked_client_targets)
......
......@@ -4,7 +4,9 @@ connection con1;
reset master;
create database `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 shortn2 (a int);
select get_lock("a",10);
disconnect con1;
......@@ -15,5 +17,6 @@ connection con2;
select get_lock("a",10);
let $VERSION=`select version()`;
--replace_result $VERSION VERSION
--replace_column 2 # 5 #
show binlog events;
drop database `drop-temp+table-test`;
......@@ -140,6 +140,9 @@ SUFFIXES = .sh
-e 's!@''IS_LINUX''@!@IS_LINUX@!' \
-e "s!@""CONF_COMMAND""@!@CONF_COMMAND@!" \
-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)!" \
$< > $@-t
@CHMOD@ +x $@-t
......
......@@ -82,13 +82,14 @@ version='@VERSION@'
socket='@MYSQL_UNIX_ADDR@'
port='@MYSQL_TCP_PORT@'
ldflags='@LDFLAGS@'
client_libs='@CLIENT_LIBS@'
# 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_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; *\$;;'`
cflags="-I$pkgincludedir @CFLAGS@ " #note: end space!
include="-I$pkgincludedir"
......
......@@ -497,58 +497,58 @@ void close_temporary(TABLE *table,bool delete_table)
void close_temporary_tables(THD *thd)
{
TABLE *table,*next;
char *query, *end;
uint query_buf_size;
bool found_user_tables = 0;
char *query, *name_in_query, *end;
uint greatest_key_length= 0;
if (!thd->temporary_tables)
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);
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)
/*
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;
greatest_key_length= max(greatest_key_length, table->s->key_length);
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
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)
{
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
not created directly by the user.
*/
if (query && mysql_bin_log.is_open() && (table->s->table_name[0] != '#'))
{
// skip temporary tables not created directly by the user
if (table->s->table_name[0] != '#')
found_user_tables = 1;
end = strxmov(end,"`",table->s->db,"`.`",
table->s->table_name,"`,", NullS);
/*
Here we assume table_cache_key always starts
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
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
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
master, then this real update will be logged with error_code=killed,
rightfully causing the slave to stop.
*/
qinfo.error_code= 0;
mysql_bin_log.write(&qinfo);
}
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();
Query_log_event qinfo(thd, query, (ulong)(end-query)-1, 0, FALSE);
/*
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
"killed", because it's not really a statement updating data, and there
are 99.99% chances it will succeed on slave.
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,
rightfully causing the slave to stop.
*/
qinfo.error_code= 0;
mysql_bin_log.write(&qinfo);
}
thd->temporary_tables=0;
}
......
......@@ -16,7 +16,7 @@
# 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 \
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