Commit 6f8ebb47 authored by mskold@mysql.com's avatar mskold@mysql.com

Merge mskold@build.mysql.com:/home/bk/mysql-4.1-ndb

into mysql.com:/usr/local/home/marty/MySQL/test/mysql-4.1
parents ba924c0a 43826f09
......@@ -77,6 +77,7 @@ Docs/mysql.xml
Docs/safe-mysql.xml
Docs/tex.fmt
Docs/texi2dvi.out
EXCEPTIONS-CLIENT
INSTALL-SOURCE
INSTALL-WIN-SOURCE
Logs/*
......@@ -272,11 +273,13 @@ emacs.h
extra/comp_err
extra/my_print_defaults
extra/mysql_install
extra/mysql_tzinfo_to_sql
extra/mysql_waitpid
extra/perror
extra/replace
extra/resolve_stack_dump
extra/resolveip
extra/tztime.cc
fcns.c
fcns.h
gmon.out
......@@ -316,6 +319,7 @@ isam/test3
libmysql/*.c
libmysql/conf_to_src
libmysql/my_static.h
libmysql/my_time.c
libmysql/mysys_priv.h
libmysql/net.c
libmysql/vio_priv.h
......@@ -382,6 +386,7 @@ libmysqld/log_event.cc
libmysqld/md5.c
libmysqld/mf_iocache.cc
libmysqld/mini_client.cc
libmysqld/my_time.c
libmysqld/net_pkg.cc
libmysqld/net_serv.cc
libmysqld/opt_ft.cc
......@@ -644,7 +649,71 @@ ndb/lib/libREP_API.so
ndb/lib/libndbclient.so
ndb/lib/libndbclient_extra.so
ndb/src/common/mgmcommon/printConfig/*.d
ndb/src/cw/cpcd/ndb_cpcd
ndb/src/kernel/blocks/backup/restore/ndb_restore
ndb/src/kernel/ndbd
ndb/src/mgmclient/ndb_mgm
ndb/src/mgmclient/test_cpcd/*.d
ndb/src/mgmsrv/ndb_mgmd
ndb/test/ndbapi/bank/bankCreator
ndb/test/ndbapi/bank/bankMakeGL
ndb/test/ndbapi/bank/bankSumAccounts
ndb/test/ndbapi/bank/bankTimer
ndb/test/ndbapi/bank/bankTransactionMaker
ndb/test/ndbapi/bank/bankValidateAllGLs
ndb/test/ndbapi/bank/testBank
ndb/test/ndbapi/create_all_tabs
ndb/test/ndbapi/create_tab
ndb/test/ndbapi/drop_all_tabs
ndb/test/ndbapi/flexAsynch
ndb/test/ndbapi/flexBench
ndb/test/ndbapi/flexHammer
ndb/test/ndbapi/flexTT
ndb/test/ndbapi/testBackup
ndb/test/ndbapi/testBasic
ndb/test/ndbapi/testBasicAsynch
ndb/test/ndbapi/testBlobs
ndb/test/ndbapi/testDataBuffers
ndb/test/ndbapi/testDeadlock
ndb/test/ndbapi/testDict
ndb/test/ndbapi/testIndex
ndb/test/ndbapi/testMgm
ndb/test/ndbapi/testNdbApi
ndb/test/ndbapi/testNodeRestart
ndb/test/ndbapi/testOIBasic
ndb/test/ndbapi/testOperations
ndb/test/ndbapi/testRestartGci
ndb/test/ndbapi/testScan
ndb/test/ndbapi/testScanInterpreter
ndb/test/ndbapi/testScanPerf
ndb/test/ndbapi/testSystemRestart
ndb/test/ndbapi/testTimeout
ndb/test/ndbapi/testTransactions
ndb/test/ndbapi/test_event
ndb/test/run-test/atrt
ndb/test/tools/copy_tab
ndb/test/tools/create_index
ndb/test/tools/hugoCalculator
ndb/test/tools/hugoFill
ndb/test/tools/hugoLoad
ndb/test/tools/hugoLockRecords
ndb/test/tools/hugoPkDelete
ndb/test/tools/hugoPkRead
ndb/test/tools/hugoPkReadRecord
ndb/test/tools/hugoPkUpdate
ndb/test/tools/hugoScanRead
ndb/test/tools/hugoScanUpdate
ndb/test/tools/ndb_cpcc
ndb/test/tools/restart
ndb/test/tools/verify_index
ndb/tools/ndb_delete_all
ndb/tools/ndb_desc
ndb/tools/ndb_drop_index
ndb/tools/ndb_drop_table
ndb/tools/ndb_select_all
ndb/tools/ndb_select_count
ndb/tools/ndb_show_tables
ndb/tools/ndb_waiter
pull.log
regex/re
repl-tests/test-repl-ts/repl-timestamp.master.reject
......@@ -715,7 +784,10 @@ sql/gen_lex_hash
sql/gmon.out
sql/lex_hash.h
sql/mini_client_errors.c
sql/my_time.c
sql/mysql_tzinfo_to_sql
sql/mysql_tzinfo_to_sql.cc
sql/mysql_tzinfo_to_sql_tztime.cc
sql/mysqlbinlog
sql/mysqld
sql/mysqld-purecov
......@@ -770,41 +842,13 @@ support-files/mysql-log-rotate
support-files/mysql.server
support-files/mysql.spec
tags
test_xml
tests/client_test
tests/connect_test
thread_test
tmp/*
tools/my_vsnprintf.c
tools/mysqlmanager
tools/mysqlmngd
tools/mysys_priv.h
vi.h
vio/test-ssl
vio/test-sslclient
vio/test-sslserver
vio/viotest-ssl
extra/tztime.cc
extra/mysql_tzinfo_to_sql
sql/mysql_tzinfo_to_sql_tztime.cc
sql/my_time.c
libmysql/my_time.c
libmysqld/my_time.c
sql/mysql_tzinfo_to_sql
sql/mysql_tzinfo_to_sql.cc
ndb/src/cw/cpcd/ndb_cpcd
ndb/src/kernel/ndbd
ndb/src/kernel/blocks/backup/restore/ndb_restore
ndb/src/mgmclient/ndb_mgm
ndb/src/mgmsrv/ndb_mgmd
ndb/tools/ndb_delete_all
ndb/tools/ndb_desc
ndb/tools/ndb_drop_index
ndb/tools/ndb_drop_table
ndb/tools/ndb_select_all
ndb/tools/ndb_select_count
ndb/tools/ndb_show_tables
ndb/tools/ndb_waiter
test/ndbapi/bank/bankCreator
test/ndbapi/bank/bankMakeGL
test/ndbapi/bank/bankSumAccounts
test/ndbapi/bank/bankTimer
test/ndbapi/bank/bankTransactionMaker
test/ndbapi/bank/bankValidateAllGLs
test/ndbapi/bank/testBank
test/ndbapi/create_all_tabs
test/ndbapi/create_tab
test/ndbapi/drop_all_tabs
......@@ -833,13 +877,6 @@ test/ndbapi/testSystemRestart
test/ndbapi/testTimeout
test/ndbapi/testTransactions
test/ndbapi/test_event
test/ndbapi/bank/bankCreator
test/ndbapi/bank/bankMakeGL
test/ndbapi/bank/bankSumAccounts
test/ndbapi/bank/bankTimer
test/ndbapi/bank/bankTransactionMaker
test/ndbapi/bank/bankValidateAllGLs
test/ndbapi/bank/testBank
test/run-test/atrt
test/tools/copy_tab
test/tools/create_index
......@@ -856,55 +893,17 @@ test/tools/hugoScanUpdate
test/tools/ndb_cpcc
test/tools/restart
test/tools/verify_index
ndb/test/ndbapi/create_all_tabs
ndb/test/ndbapi/create_tab
ndb/test/ndbapi/drop_all_tabs
ndb/test/ndbapi/flexAsynch
ndb/test/ndbapi/flexBench
ndb/test/ndbapi/flexHammer
ndb/test/ndbapi/flexTT
ndb/test/ndbapi/testBackup
ndb/test/ndbapi/testBasic
ndb/test/ndbapi/testBasicAsynch
ndb/test/ndbapi/testBlobs
ndb/test/ndbapi/testDataBuffers
ndb/test/ndbapi/testDeadlock
ndb/test/ndbapi/testDict
ndb/test/ndbapi/testIndex
ndb/test/ndbapi/testMgm
ndb/test/ndbapi/testNdbApi
ndb/test/ndbapi/testNodeRestart
ndb/test/ndbapi/testOIBasic
ndb/test/ndbapi/testOperations
ndb/test/ndbapi/testRestartGci
ndb/test/ndbapi/testScan
ndb/test/ndbapi/testScanInterpreter
ndb/test/ndbapi/testScanPerf
ndb/test/ndbapi/testSystemRestart
ndb/test/ndbapi/testTimeout
ndb/test/ndbapi/testTransactions
ndb/test/ndbapi/test_event
ndb/test/ndbapi/bank/bankCreator
ndb/test/ndbapi/bank/bankMakeGL
ndb/test/ndbapi/bank/bankSumAccounts
ndb/test/ndbapi/bank/bankTimer
ndb/test/ndbapi/bank/bankTransactionMaker
ndb/test/ndbapi/bank/bankValidateAllGLs
ndb/test/ndbapi/bank/testBank
ndb/test/run-test/atrt
ndb/test/tools/copy_tab
ndb/test/tools/create_index
ndb/test/tools/hugoCalculator
ndb/test/tools/hugoFill
ndb/test/tools/hugoLoad
ndb/test/tools/hugoLockRecords
ndb/test/tools/hugoPkDelete
ndb/test/tools/hugoPkRead
ndb/test/tools/hugoPkReadRecord
ndb/test/tools/hugoPkUpdate
ndb/test/tools/hugoScanRead
ndb/test/tools/hugoScanUpdate
ndb/test/tools/ndb_cpcc
ndb/test/tools/restart
ndb/test/tools/verify_index
EXCEPTIONS-CLIENT
test_xml
tests/client_test
tests/connect_test
thread_test
tmp/*
tools/my_vsnprintf.c
tools/mysqlmanager
tools/mysqlmngd
tools/mysys_priv.h
vi.h
vio/test-ssl
vio/test-sslclient
vio/test-sslserver
vio/viotest-ssl
......@@ -649,7 +649,7 @@ history_save(History *h, const char *fname)
retval = HPREV(h, &ev), i++) {
len = strlen(ev.str) * 4;
if (len >= max_size) {
max_size = (len + 1023) & 1023;
max_size = (len + 1023) & ~1023;
ptr = h_realloc(ptr, max_size);
}
(void) strvis(ptr, ev.str, VIS_WHITE);
......
......@@ -644,29 +644,17 @@ typedef SOCKET_SIZE_TYPE size_socket;
#endif
#endif /* defined (HAVE_LONG_LONG) && !defined(ULONGLONG_MAX)*/
#if SIZEOF_LONG == 4
#define INT_MIN32 ((long) 0x80000000L)
#define INT_MAX32 ((long) 0x7FFFFFFFL)
#define UINT_MAX32 ((long) 0xFFFFFFFFL)
#define INT_MIN24 ((long) 0xFF800000L)
#define INT_MAX24 0x007FFFFFL
#define UINT_MAX24 0x00FFFFFFL
#define INT_MIN16 ((short int) 0x8000)
#define INT_MIN32 (~0x7FFFFFFFL)
#define INT_MAX32 0x7FFFFFFFL
#define UINT_MAX32 0xFFFFFFFFL
#define INT_MIN24 (~0x007FFFFF)
#define INT_MAX24 0x007FFFFF
#define UINT_MAX24 0x00FFFFFF
#define INT_MIN16 (~0x7FFF)
#define INT_MAX16 0x7FFF
#define UINT_MAX16 0xFFFF
#define INT_MIN8 ((char) 0x80)
#define INT_MAX8 ((char) 0x7F)
#else /* Probably Alpha */
#define INT_MIN32 ((long) (int) 0x80000000)
#define INT_MAX32 ((long) (int) 0x7FFFFFFF)
#define UINT_MAX32 ((long) (int) 0xFFFFFFFF)
#define INT_MIN24 ((long) (int) 0xFF800000)
#define INT_MAX24 ((long) (int) 0x007FFFFF)
#define UINT_MAX24 ((long) (int) 0x00FFFFFF)
#define INT_MIN16 ((short int) 0xFFFF8000)
#define INT_MAX16 ((short int) 0x00007FFF)
#define UINT_MAX16 ((short int) 0x0000FFFF)
#endif
#define INT_MIN8 (~0x7F)
#define INT_MAX8 0x7F
/* From limits.h instead */
#ifndef DBL_MIN
......
reset master;
drop table if exists t1;
create table t1 (a int) type=HEAP;
insert into t1 values(10);
create table t1 type=HEAP select 10 as a;
insert into t1 values(11);
show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.001 79 Query 1 79 use `test`; create table t1 (a int) type=HEAP
master-bin.001 147 Query 1 147 use `test`; DELETE FROM `test`.`t1`
master-bin.001 205 Query 1 205 use `test`; insert into t1 values(10)
master-bin.001 79 Query 1 79 use `test`; create table t1 type=HEAP select 10 as a
master-bin.001 154 Query 1 154 use `test`; insert into t1 values(11)
reset slave;
start slave;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) default NULL
`a` bigint(2) NOT NULL default '0'
) TYPE=HEAP
select * from t1;
a
10
11
select * from t1;
a
select * from t1 limit 10;
......
......@@ -1899,3 +1899,16 @@ select t000.a, count(*) `C` FROM t1 t000 GROUP BY t000.a HAVING count(*) > ALL (
a C
1 1
drop table t1,t2;
create table t1 (a int not null auto_increment primary key, b varchar(40), fulltext(b));
insert into t1 (b) values ('ball'),('ball games'), ('games'), ('foo'), ('foobar'), ('Serg'), ('Sergei'),('Georg'), ('Patrik'),('Hakan');
create table t2 (a int);
insert into t2 values (1),(3),(2),(7);
select a,b from t1 where match(b) against ('Ball') > 0;
a b
1 ball
2 ball games
select a from t2 where a in (select a from t1 where match(b) against ('Ball') > 0);
a
1
2
drop table t1,t2;
......@@ -135,6 +135,9 @@ t1 CREATE TABLE `t1` (
`b` double(200,30) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (c20 char);
insert into t1 values (5000.0);
drop table t1;
create table t1 (f float(54));
ERROR 42000: Incorrect column specifier for column 'f'
drop table if exists t1;
......@@ -13,8 +13,10 @@ connect (slave,localhost,root,,test,0,slave.sock);
connection master;
reset master;
drop table if exists t1;
create table t1 (a int) type=HEAP;
insert into t1 values(10);
# we use CREATE SELECT to verify that DELETE does not get into binlog
# before CREATE SELECT
create table t1 type=HEAP select 10 as a;
insert into t1 values(11);
save_master_pos;
show binlog events from 79;
connection slave;
......
......@@ -1222,3 +1222,16 @@ CREATE TABLE `t2` ( `b` int(11) default NULL, `a` int(11) default NULL) ENGINE=M
insert into t2 values (1,2);
select t000.a, count(*) `C` FROM t1 t000 GROUP BY t000.a HAVING count(*) > ALL (SELECT count(*) FROM t2 t001 WHERE t001.a=1);
drop table t1,t2;
#
# BUG#4769 - fulltext in subselect
#
create table t1 (a int not null auto_increment primary key, b varchar(40), fulltext(b));
insert into t1 (b) values ('ball'),('ball games'), ('games'), ('foo'), ('foobar'), ('Serg'), ('Sergei'),('Georg'), ('Patrik'),('Hakan');
create table t2 (a int);
insert into t2 values (1),(3),(2),(7);
select a,b from t1 where match(b) against ('Ball') > 0;
select a from t2 where a in (select a from t1 where match(b) against ('Ball') > 0);
drop table t1,t2;
......@@ -72,6 +72,13 @@ select * from t1;
show create table t1;
drop table t1;
#
# float in a char(1) field
#
create table t1 (c20 char);
insert into t1 values (5000.0);
drop table t1;
# Errors
--error 1063
......@@ -79,3 +86,4 @@ create table t1 (f float(54)); # Should give an error
--disable_warnings
drop table if exists t1;
--enable_warnings
......@@ -98,7 +98,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix,
if (strlen(dir)+ pfx_len > FN_REFLEN-2)
{
errno=my_errno= ENAMETOOLONG;
return 1;
DBUG_RETURN(file);
}
strmov(convert_dirname(to,dir,NullS),prefix_buff);
org_file=mkstemp(to);
......@@ -124,7 +124,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix,
#ifdef OS2
/* changing environ variable doesn't work with VACPP */
char buffer[256], *end;
buffer[sizeof[buffer)-1]= 0;
buffer[sizeof(buffer)-1]= 0;
end= strxnmov(buffer, sizeof(buffer)-1, (char*) "TMP=", dir, NullS);
/* remove ending backslash */
if (end[-1] == '\\')
......
......@@ -45,7 +45,6 @@ mysqld_LDADD = @MYSQLD_EXTRA_LDFLAGS@ \
@innodb_system_libs@ \
@ndbcluster_libs@ @ndbcluster_system_libs@ \
$(LDADD) $(CXXLDFLAGS) $(WRAPLIBS) @LIBDL@ @openssl_libs@
mysqld_DEPENDENCIES = @ndbcluster_libs@ @ndbcluster_system_libs@
noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \
item_strfunc.h item_timefunc.h item_uniq.h \
item_create.h item_subselect.h item_row.h \
......
......@@ -4279,7 +4279,7 @@ int Field_str::store(double nr)
{
bool use_scientific_notation=TRUE;
char buff[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE];
int length;
uint length;
if (field_length < 32 && nr > 1) // TODO: negative numbers
{
if (ceiling == 0)
......@@ -4295,11 +4295,19 @@ int Field_str::store(double nr)
}
use_scientific_notation= (ceiling < nr);
}
length= sprintf(buff, "%-.*g",
use_scientific_notation ? max(0,field_length-5) : field_length,
nr);
DBUG_ASSERT(length <= field_length);
return store((const char *)buff, (uint) length, charset());
length= (uint)sprintf(buff, "%-.*g",
use_scientific_notation ? max(0,(int)field_length-5) : field_length,
nr);
/*
+1 below is because "precision" in %g above means the
max. number of significant digits, not the output width.
Thus the width can be larger than number of significant digits by 1
(for decimal point)
the test for field_length < 5 is for extreme cases,
like inserting 500.0 in char(1)
*/
DBUG_ASSERT(field_length < 5 || length <= field_length+1);
return store((const char *)buff, min(length, field_length), charset());
}
int Field_string::store(longlong nr)
......
......@@ -40,6 +40,7 @@ have disables the InnoDB inlining in this file. */
#include <m_ctype.h>
#include <hash.h>
#include <myisampack.h>
#include <mysys_err.h>
#define MAX_ULONG_BIT ((ulong) 1 << (sizeof(ulong)*8-1))
......@@ -433,6 +434,7 @@ innobase_mysql_tmpfile(void)
/* out: temporary file descriptor, or < 0 on error */
{
char filename[FN_REFLEN];
int fd2 = -1;
File fd = create_temp_file(filename, NullS, "ib",
#ifdef __WIN__
O_BINARY | O_TRUNC | O_SEQUENTIAL |
......@@ -440,12 +442,31 @@ innobase_mysql_tmpfile(void)
#endif /* __WIN__ */
O_CREAT | O_EXCL | O_RDWR,
MYF(MY_WME));
#ifndef __WIN__
if (fd >= 0) {
#ifndef __WIN__
/* On Windows, open files cannot be removed, but files can be
created with the O_TEMPORARY flag to the same effect
("delete on close"). */
unlink(filename);
}
#endif /* !__WIN__ */
return(fd);
/* Copy the file descriptor, so that the additional resources
allocated by create_temp_file() can be freed by invoking
my_close().
Because the file descriptor returned by this function
will be passed to fdopen(), it will be closed by invoking
fclose(), which in turn will invoke close() instead of
my_close(). */
fd2 = dup(fd);
if (fd2 < 0) {
DBUG_PRINT("error",("Got error %d on dup",fd2));
my_errno=errno;
my_error(EE_OUT_OF_FILERESOURCES,
MYF(ME_BELL+ME_WAITTANG), filename, my_errno);
}
my_close(fd, MYF(MY_WME));
}
return(fd2);
}
/*************************************************************************
......
......@@ -1877,6 +1877,19 @@ void MYSQL_LOG::set_max_size(ulong max_size_arg)
}
Disable_binlog::Disable_binlog(THD *thd_arg) :
thd(thd_arg), save_options(thd_arg->options)
{
thd_arg->options&= ~OPTION_BIN_LOG;
}
Disable_binlog::~Disable_binlog()
{
thd->options= save_options;
}
/*
Check if a string is a valid number
......
......@@ -518,7 +518,8 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
int mysql_create_table(THD *thd,const char *db, const char *table_name,
HA_CREATE_INFO *create_info,
List<create_field> &fields, List<Key> &keys,
bool tmp_table, bool no_log, uint select_field_count);
bool tmp_table, uint select_field_count);
TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
const char *db, const char *name,
List<create_field> *extra_fields,
......
......@@ -1017,6 +1017,26 @@ public:
#define SYSTEM_THREAD_SLAVE_IO 2
#define SYSTEM_THREAD_SLAVE_SQL 4
/*
Disables binary logging for one thread, and resets it back to what it was
before being disabled.
Some functions (like the internal mysql_create_table() when it's called by
mysql_alter_table()) must NOT write to the binlog (binlogging is done at the
at a later stage of the command already, and must be, for locking reasons);
so we internally disable it temporarily by creating the Disable_binlog
object and reset the state by destroying the object (don't forget that! or
write code so that the object gets automatically destroyed when leaving a
block, see example in sql_table.cc).
*/
class Disable_binlog {
private:
THD *thd;
ulong save_options;
public:
Disable_binlog(THD *thd_arg);
~Disable_binlog();
};
/*
Used to hold information about file and file structure in exchainge
via non-DB file (...INTO OUTFILE..., ...LOAD DATA...)
......
......@@ -2379,7 +2379,7 @@ mysql_execute_command(THD *thd)
res= mysql_create_table(thd,create_table->db,
create_table->real_name, &lex->create_info,
lex->create_list,
lex->key_list,0,0,0); // do logging
lex->key_list,0,0);
}
if (!res)
send_ok(thd);
......
......@@ -729,6 +729,10 @@ JOIN::optimize()
(select_lex->ftfunc_list->elements ?
SELECT_NO_JOIN_CACHE : 0));
/* Perform FULLTEXT search before all regular searches */
if (!(select_options & SELECT_DESCRIBE))
init_ftfuncs(thd, select_lex, test(order));
/*
is this simple IN subquery?
*/
......@@ -784,7 +788,7 @@ JOIN::optimize()
join_tab->info= "Using index; Using where";
else
join_tab->info= "Using index";
DBUG_RETURN(unit->item->
change_engine(new subselect_indexsubquery_engine(thd,
join_tab,
......@@ -849,8 +853,6 @@ JOIN::optimize()
}
having= 0;
/* Perform FULLTEXT search before all regular searches */
init_ftfuncs(thd, select_lex, test(order));
/* Create a tmp table if distinct or if the sort is too complicated */
if (need_tmp)
{
......@@ -858,7 +860,7 @@ JOIN::optimize()
thd->proc_info="Creating tmp table";
init_items_ref_array();
tmp_table_param.hidden_field_count= (all_fields.elements -
fields_list.elements);
if (!(exec_tmp_table1 =
......
......@@ -1090,7 +1090,6 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
keys List of keys to create
tmp_table Set to 1 if this is an internal temporary table
(From ALTER TABLE)
no_log Don't log the query to binary log.
DESCRIPTION
If one creates a temporary table, this is automaticly opened
......@@ -1108,7 +1107,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
int mysql_create_table(THD *thd,const char *db, const char *table_name,
HA_CREATE_INFO *create_info,
List<create_field> &fields,
List<Key> &keys,bool tmp_table,bool no_log,
List<Key> &keys,bool tmp_table,
uint select_field_count)
{
char path[FN_REFLEN];
......@@ -1277,7 +1276,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
}
thd->tmp_table_used= 1;
}
if (!tmp_table && !no_log)
if (!tmp_table)
{
// Must be written before unlock
mysql_update_log.write(thd,thd->query, thd->query_length);
......@@ -1352,6 +1351,7 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
TABLE *table;
tmp_table.table_name=0;
uint select_field_count= items->elements;
Disable_binlog disable_binlog(thd);
DBUG_ENTER("create_table_from_items");
/* Add selected items to field list */
......@@ -1382,9 +1382,17 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
}
/* create and lock table */
/* QQ: This should be done atomic ! */
/* We don't log the statement, it will be logged later */
if (mysql_create_table(thd,db,name,create_info,*extra_fields,
*keys,0,1,select_field_count)) // no logging
*keys,0,select_field_count))
DBUG_RETURN(0);
/*
If this is a HEAP table, the automatic DELETE FROM which is written to the
binlog when a HEAP table is opened for the first time since startup, must
not be written: 1) it would be wrong (imagine we're in CREATE SELECT: we
don't want to delete from it) 2) it would be written before the CREATE
TABLE, which is a wrong order. So we keep binary logging disabled.
*/
if (!(table=open_table(thd,db,name,name,(bool*) 0)))
{
quick_rm_table(create_info->db_type,db,table_case_name(create_info,name));
......@@ -1401,6 +1409,7 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
}
table->file->extra(HA_EXTRA_WRITE_CACHE);
DBUG_RETURN(table);
/* Note that leaving the function resets binlogging properties */
}
......@@ -3008,12 +3017,14 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
}
else
create_info->data_file_name=create_info->index_file_name=0;
if ((error=mysql_create_table(thd, new_db, tmp_name,
create_info,
create_list,key_list,1,1,0))) // no logging
DBUG_RETURN(error);
{
/* We don't log the statement, it will be logged later */
Disable_binlog disable_binlog(thd);
if ((error=mysql_create_table(thd, new_db, tmp_name,
create_info,
create_list,key_list,1,0)))
DBUG_RETURN(error);
}
if (table->tmp_table)
new_table=open_table(thd,new_db,tmp_name,tmp_name,0);
else
......
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