summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/ac-macros/ha_isam.m415
-rw-r--r--include/Makefile.am2
-rw-r--r--include/config-win.h1
-rw-r--r--include/m_ctype.h2
-rw-r--r--include/merge.h93
-rw-r--r--include/my_pthread.h17
-rw-r--r--include/my_sys.h11
-rw-r--r--include/mysql_embed.h1
-rw-r--r--include/nisam.h212
-rw-r--r--mysql-test/include/have_isam.inc4
-rw-r--r--mysql-test/r/have_isam.require2
-rw-r--r--mysql-test/r/replace.result4
-rw-r--r--mysql-test/r/xa.result45
-rw-r--r--mysql-test/t/isam.test247
-rw-r--r--mysql-test/t/replace.test8
-rw-r--r--mysql-test/t/xa.test58
-rw-r--r--mysys/my_sync.c22
-rw-r--r--sql/field.cc4
-rw-r--r--sql/handler.cc13
-rw-r--r--sql/handler.h23
-rw-r--r--sql/item_sum.h2
-rw-r--r--sql/lock.cc17
-rw-r--r--sql/log.cc53
-rw-r--r--sql/mysql_priv.h9
-rw-r--r--sql/mysqld.cc54
-rw-r--r--sql/opt_range.cc3
-rw-r--r--sql/set_var.cc12
-rw-r--r--sql/sql_base.cc1
-rw-r--r--sql/sql_class.cc10
-rw-r--r--sql/sql_class.h9
-rw-r--r--sql/sql_lex.h9
-rw-r--r--sql/sql_parse.cc18
-rw-r--r--sql/sql_yacc.yy150
33 files changed, 321 insertions, 810 deletions
diff --git a/config/ac-macros/ha_isam.m4 b/config/ac-macros/ha_isam.m4
deleted file mode 100644
index 5e354dfa624..00000000000
--- a/config/ac-macros/ha_isam.m4
+++ /dev/null
@@ -1,15 +0,0 @@
-AC_DEFUN([MYSQL_CHECK_ISAM], [
- AC_ARG_WITH([isam], [
- --with-isam Enable the ISAM table type],
- [with_isam="$withval"],
- [with_isam=no])
-
- isam_libs=
- if test X"$with_isam" = X"yes"
- then
- AC_DEFINE([HAVE_ISAM], [1], [Using old ISAM tables])
- isam_libs="\$(top_builddir)/isam/libnisam.a\
- \$(top_builddir)/merge/libmerge.a"
- fi
- AC_SUBST(isam_libs)
-])
diff --git a/include/Makefile.am b/include/Makefile.am
index 08beb4b7236..5f426843950 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -24,7 +24,7 @@ pkginclude_HEADERS = my_dbug.h m_string.h my_sys.h my_list.h my_xml.h \
sslopt-vars.h sslopt-case.h sql_common.h keycache.h \
mysql_time.h $(BUILT_SOURCES)
noinst_HEADERS = config-win.h config-os2.h config-netware.h \
- nisam.h heap.h merge.h my_bitmap.h\
+ heap.h my_bitmap.h\
myisam.h myisampack.h myisammrg.h ft_global.h\
mysys_err.h my_base.h help_start.h help_end.h \
my_nosys.h my_alarm.h queues.h rijndael.h sha1.h \
diff --git a/include/config-win.h b/include/config-win.h
index 4ef5c9323e7..df0530fbef3 100644
--- a/include/config-win.h
+++ b/include/config-win.h
@@ -351,7 +351,6 @@ inline double ulonglong2double(ulonglong value)
#define DO_NOT_REMOVE_THREAD_WRAPPERS
#define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V))
#define thread_safe_decrement(V,L) InterlockedDecrement((long*) &(V))
-#define thread_safe_dec_and_test(V, L) thread_safe_decrement(V,L)
/* The following is only used for statistics, so it should be good enough */
#ifdef __NT__ /* This should also work on Win98 but .. */
#define thread_safe_add(V,C,L) InterlockedExchangeAdd((long*) &(V),(C))
diff --git a/include/m_ctype.h b/include/m_ctype.h
index c41c7385b3d..f5a1503234c 100644
--- a/include/m_ctype.h
+++ b/include/m_ctype.h
@@ -186,7 +186,7 @@ typedef struct my_charset_handler_st
int base, char **e, int *err);
double (*strntod)(struct charset_info_st *, char *s, uint l, char **e,
int *err);
- longlong (*my_strtoll10)(struct charset_info_st *cs,
+ longlong (*strtoll10)(struct charset_info_st *cs,
const char *nptr, char **endptr, int *error);
ulong (*scan)(struct charset_info_st *, const char *b, const char *e,
int sq);
diff --git a/include/merge.h b/include/merge.h
deleted file mode 100644
index 97cea5fabb1..00000000000
--- a/include/merge.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/* Copyright (C) 2000 MySQL AB
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* This file should be included when using merge_isam_funktions */
-/* Author: Michael Widenius */
-
-#ifndef _merge_h
-#define _merge_h
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef _my_base_h
-#include <my_base.h>
-#endif
-#ifndef _nisam_h
-#include <nisam.h>
-#endif
-
-#define MRG_NAME_EXT ".MRG"
-
- /* Param to/from mrg_info */
-
-typedef struct st_mrg_info /* Struct from h_info */
-{
- ulonglong records; /* Records in database */
- ulonglong deleted; /* Deleted records in database */
- ulonglong recpos; /* Pos for last used record */
- ulonglong data_file_length;
- uint reclength; /* Recordlength */
- int errkey; /* With key was dupplicated on err */
- uint options; /* HA_OPTION_... used */
-} MERGE_INFO;
-
-typedef struct st_mrg_table_info
-{
- N_INFO *table;
- ulonglong file_offset;
-} MRG_TABLE;
-
-typedef struct st_merge
-{
- MRG_TABLE *open_tables,*current_table,*end_table,*last_used_table;
- ulonglong records; /* records in tables */
- ulonglong del; /* Removed records */
- ulonglong data_file_length;
- uint tables,options,reclength;
- my_bool cache_in_use;
- LIST open_list;
-} MRG_INFO;
-
-typedef ulong mrg_off_t;
-
- /* Prototypes for merge-functions */
-
-extern int mrg_close(MRG_INFO *file);
-extern int mrg_delete(MRG_INFO *file,const byte *buff);
-extern MRG_INFO *mrg_open(const char *name,int mode,int wait_if_locked);
-extern int mrg_panic(enum ha_panic_function function);
-extern int mrg_rfirst(MRG_INFO *file,byte *buf,int inx);
-extern int mrg_rkey(MRG_INFO *file,byte *buf,int inx,const byte *key,
- uint key_len, enum ha_rkey_function search_flag);
-extern int mrg_rrnd(MRG_INFO *file,byte *buf, mrg_off_t pos);
-extern int mrg_rsame(MRG_INFO *file,byte *record,int inx);
-extern int mrg_update(MRG_INFO *file,const byte *old,const byte *new_rec);
-extern int mrg_info(MRG_INFO *file,MERGE_INFO *x,int flag);
-extern int mrg_lock_database(MRG_INFO *file,int lock_type);
-extern int mrg_create(const char *name,const char **table_names);
-extern int mrg_extra(MRG_INFO *file,enum ha_extra_function function);
-extern ha_rows mrg_records_in_range(MRG_INFO *info,int inx,
- const byte *start_key,uint start_key_len,
- enum ha_rkey_function start_search_flag,
- const byte *end_key,uint end_key_len,
- enum ha_rkey_function end_search_flag);
-
-extern mrg_off_t mrg_position(MRG_INFO *info);
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/include/my_pthread.h b/include/my_pthread.h
index b170753913b..670a4ccf63e 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -678,7 +678,6 @@ extern pthread_t shutdown_th, main_th, signal_th;
#ifdef HAVE_ATOMIC_ADD
#define thread_safe_increment(V,L) atomic_inc((atomic_t*) &V)
#define thread_safe_decrement(V,L) atomic_dec((atomic_t*) &V)
-#define thread_safe_dec_and_test(V, L) atomic_dec_and_test((atomic_t*) &V)
#define thread_safe_add(V,C,L) atomic_add((C),(atomic_t*) &V)
#define thread_safe_sub(V,C,L) atomic_sub((C),(atomic_t*) &V)
#else
@@ -689,22 +688,6 @@ extern pthread_t shutdown_th, main_th, signal_th;
#define thread_safe_add(V,C,L) (pthread_mutex_lock((L)), (V)+=(C), pthread_mutex_unlock((L)))
#define thread_safe_sub(V,C,L) \
(pthread_mutex_lock((L)), (V)-=(C), pthread_mutex_unlock((L)))
-#ifdef __cplusplus
-static inline bool thread_safe_dec_and_test(ulong &V, pthread_mutex_t *L)
-{
- ulong res;
- pthread_mutex_lock(L);
- res=--V;
- pthread_mutex_unlock(L);
- return res==0;
-}
-#else
-/*
- what should we do ? define it as static ?
- a regular function somewhere in mysys/ ?
- for now it's only used in c++ code, so there's no need to bother
-*/
-#endif
#endif /* HAVE_ATOMIC_ADD */
#ifdef SAFE_STATISTICS
#define statistic_increment(V,L) thread_safe_increment((V),(L))
diff --git a/include/my_sys.h b/include/my_sys.h
index 523c0570de7..f63743a4c6c 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -54,11 +54,10 @@ extern int NEAR my_errno; /* Last error in mysys */
#define MY_FAE 8 /* Fatal if any error */
#define MY_WME 16 /* Write message on error */
#define MY_WAIT_IF_FULL 32 /* Wait and try again if disk full error */
-#define MY_RAID 64 /* Support for RAID (not the "Johnson&Johnson"-s one ;) */
-#define MY_FULL_IO 512 /* For my_read - loop intil I/O
- is complete
- */
-#define MY_DONT_CHECK_FILESIZE 128 /* Option to init_io_cache() */
+#define MY_IGNORE_BADFD 32 /* my_sync: ignore 'bad descriptor' errors */
+#define MY_RAID 64 /* Support for RAID */
+#define MY_FULL_IO 512 /* For my_read - loop intil I/O is complete */
+#define MY_DONT_CHECK_FILESIZE 128 /* Option to init_io_cache() */
#define MY_LINK_WARNING 32 /* my_redel() gives warning if links */
#define MY_COPYTIME 64 /* my_redel() copys time */
#define MY_DELETE_OLD 256 /* my_create_with_symlink() */
@@ -72,7 +71,7 @@ extern int NEAR my_errno; /* Last error in mysys */
#define MY_FREE_ON_ERROR 128 /* my_realloc() ; Free old ptr on error */
#define MY_HOLD_ON_ERROR 256 /* my_realloc() ; Return old ptr on error */
#define MY_THREADSAFE 128 /* pread/pwrite: Don't allow interrupts */
-#define MY_DONT_OVERWRITE_FILE 1024 /* my_copy; Don't overwrite file */
+#define MY_DONT_OVERWRITE_FILE 1024 /* my_copy: Don't overwrite file */
#define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */
#define MY_GIVE_INFO 2 /* Give time info about process*/
diff --git a/include/mysql_embed.h b/include/mysql_embed.h
index 603af8e83b8..311d95eda73 100644
--- a/include/mysql_embed.h
+++ b/include/mysql_embed.h
@@ -24,7 +24,6 @@
#undef HAVE_PSTACK /* No stacktrace */
#undef HAVE_DLOPEN /* No udf functions */
#undef HAVE_OPENSSL
-#undef HAVE_ISAM
#undef HAVE_SMEM /* No shared memory */
#undef HAVE_NDBCLUSTER_DB /* No NDB cluster */
diff --git a/include/nisam.h b/include/nisam.h
deleted file mode 100644
index e8f29991a4e..00000000000
--- a/include/nisam.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/* Copyright (C) 2000 MySQL AB
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* This file should be included when using nisam_funktions */
-/* Author: Michael Widenius */
-
-#ifndef _nisam_h
-#define _nisam_h
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef _my_base_h
-#include <my_base.h>
-#endif
- /* defines used by nisam-funktions */
-
-#define N_MAXKEY 16 /* Max allowed keys */
-#define N_MAXKEY_SEG 16 /* Max segments for key */
-#define N_MAX_KEY_LENGTH 256 /* May be increased up to 500 */
-#define N_MAX_KEY_BUFF (N_MAX_KEY_LENGTH+N_MAXKEY_SEG+sizeof(double)-1)
-#define N_MAX_POSSIBLE_KEY_BUFF 500+9
-
-#define N_NAME_IEXT ".ISM"
-#define N_NAME_DEXT ".ISD"
-#define NI_POS_ERROR (~ (ulong) 0)
-
-
- /* Param to/from nisam_info */
-
-typedef struct st_n_isaminfo /* Struct from h_info */
-{
- ulong records; /* Records in database */
- ulong deleted; /* Deleted records in database */
- ulong recpos; /* Pos for last used record */
- ulong newrecpos; /* Pos if we write new record */
- ulong dupp_key_pos; /* Position to record with dupp key */
- ulong data_file_length, /* Length of data file */
- max_data_file_length,
- index_file_length,
- max_index_file_length,
- delete_length;
- uint reclength; /* Recordlength */
- uint mean_reclength; /* Mean recordlength (if packed) */
- uint keys; /* How many keys used */
- uint options; /* HA_OPTION_... used */
- int errkey, /* With key was dupplicated on err */
- sortkey; /* clustered by this key */
- File filenr; /* (uniq) filenr for datafile */
- time_t create_time; /* When table was created */
- time_t isamchk_time;
- time_t update_time;
- ulong *rec_per_key; /* for sql optimizing */
-} N_ISAMINFO;
-
-
- /* Info saved on file for each info-part */
-
-#ifdef __WATCOMC__
-#pragma pack(2)
-#define uint uint16 /* Same format as in MSDOS */
-#endif
-
-#ifdef __ZTC__
-#pragma ZTC align 2
-#define uint uint16 /* Same format as in MSDOS */
-#endif
-
-typedef struct st_n_save_keyseg /* Key-portion */
-{
- uint8 type; /* Typ av nyckel (f|r sort) */
- uint8 flag; /* HA_DIFF_LENGTH */
- uint16 start; /* Start of key in record */
- uint16 length; /* Keylength */
-} N_SAVE_KEYSEG;
-
-typedef struct st_n_save_keydef /* Key definition with create & info */
-{
- uint8 flag; /* NOSAME, PACK_USED */
- uint8 keysegs; /* Number of key-segment */
- uint16 block_length; /* Length of keyblock (auto) */
- uint16 keylength; /* Tot length of keyparts (auto) */
- uint16 minlength; /* min length of (packed) key (auto) */
- uint16 maxlength; /* max length of (packed) key (auto) */
-} N_SAVE_KEYDEF;
-
-typedef struct st_n_save_recinfo /* Info of record */
-{
- int16 type; /* en_fieldtype */
- uint16 length; /* length of field */
-} N_SAVE_RECINFO;
-
-
-#ifdef __ZTC__
-#pragma ZTC align
-#undef uint
-#endif
-
-#ifdef __WATCOMC__
-#pragma pack()
-#undef uint
-#endif
-
-
-struct st_isam_info; /* For referense */
-
-#ifndef ISAM_LIBRARY
-typedef struct st_isam_info N_INFO;
-#endif
-
-typedef struct st_n_keyseg /* Key-portion */
-{
- N_SAVE_KEYSEG base;
-} N_KEYSEG;
-
-
-typedef struct st_n_keydef /* Key definition with open & info */
-{
- N_SAVE_KEYDEF base;
- N_KEYSEG seg[N_MAXKEY_SEG+1];
- int (*bin_search)(struct st_isam_info *info,struct st_n_keydef *keyinfo,
- uchar *page,uchar *key,
- uint key_len,uint comp_flag,uchar * *ret_pos,
- uchar *buff);
- uint (*get_key)(struct st_n_keydef *keyinfo,uint nod_flag,uchar * *page,
- uchar *key);
-} N_KEYDEF;
-
-
-typedef struct st_decode_tree /* Decode huff-table */
-{
- uint16 *table;
- uint quick_table_bits;
- byte *intervalls;
-} DECODE_TREE;
-
-
-struct st_bit_buff;
-
-typedef struct st_n_recinfo /* Info of record */
-{
- N_SAVE_RECINFO base;
-#ifndef NOT_PACKED_DATABASES
- void (*unpack)(struct st_n_recinfo *rec,struct st_bit_buff *buff,
- uchar *start,uchar *end);
- enum en_fieldtype base_type;
- uint space_length_bits,pack_type;
- DECODE_TREE *huff_tree;
-#endif
-} N_RECINFO;
-
-
-extern my_string nisam_log_filename; /* Name of logfile */
-extern uint nisam_block_size;
-extern my_bool nisam_flush;
-
- /* Prototypes for nisam-functions */
-
-extern int nisam_close(struct st_isam_info *file);
-extern int nisam_delete(struct st_isam_info *file,const byte *buff);
-extern struct st_isam_info *nisam_open(const char *name,int mode,
- uint wait_if_locked);
-extern int nisam_panic(enum ha_panic_function function);
-extern int nisam_rfirst(struct st_isam_info *file,byte *buf,int inx);
-extern int nisam_rkey(struct st_isam_info *file,byte *buf,int inx,
- const byte *key,
- uint key_len, enum ha_rkey_function search_flag);
-extern int nisam_rlast(struct st_isam_info *file,byte *buf,int inx);
-extern int nisam_rnext(struct st_isam_info *file,byte *buf,int inx);
-extern int nisam_rprev(struct st_isam_info *file,byte *buf,int inx);
-extern int nisam_rrnd(struct st_isam_info *file,byte *buf,ulong pos);
-extern int nisam_rsame(struct st_isam_info *file,byte *record,int inx);
-extern int nisam_rsame_with_pos(struct st_isam_info *file,byte *record,
- int inx,ulong pos);
-extern int nisam_update(struct st_isam_info *file,const byte *old,
- const byte *new_record);
-extern int nisam_write(struct st_isam_info *file,const byte *buff);
-extern int nisam_info(struct st_isam_info *file,N_ISAMINFO *x,int flag);
-extern ulong nisam_position(struct st_isam_info *info);
-extern int nisam_lock_database(struct st_isam_info *file,int lock_type);
-extern int nisam_create(const char *name,uint keys,N_KEYDEF *keyinfo,
- N_RECINFO *recinfo,ulong records,
- ulong reloc,uint flags,uint options,
- ulong data_file_length);
-extern int nisam_extra(struct st_isam_info *file,
- enum ha_extra_function function);
-extern ulong nisam_records_in_range(struct st_isam_info *info,int inx,
- const byte *start_key,uint start_key_len,
- enum ha_rkey_function start_search_flag,
- const byte *end_key,uint end_key_len,
- enum ha_rkey_function end_search_flag);
-extern int nisam_log(int activate_log);
-extern int nisam_is_changed(struct st_isam_info *info);
-extern uint _calc_blob_length(uint length , const byte *pos);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/mysql-test/include/have_isam.inc b/mysql-test/include/have_isam.inc
deleted file mode 100644
index 830170c921f..00000000000
--- a/mysql-test/include/have_isam.inc
+++ /dev/null
@@ -1,4 +0,0 @@
--- require r/have_isam.require
-disable_query_log;
-show variables like "have_isam";
-enable_query_log;
diff --git a/mysql-test/r/have_isam.require b/mysql-test/r/have_isam.require
deleted file mode 100644
index 9b4142361ed..00000000000
--- a/mysql-test/r/have_isam.require
+++ /dev/null
@@ -1,2 +0,0 @@
-Variable_name Value
-have_isam YES
diff --git a/mysql-test/r/replace.result b/mysql-test/r/replace.result
index 83cde76215a..a7d59fcfa62 100644
--- a/mysql-test/r/replace.result
+++ b/mysql-test/r/replace.result
@@ -3,12 +3,10 @@ CREATE TABLE t1 (
gesuchnr int(11) DEFAULT '0' NOT NULL,
benutzer_id int(11) DEFAULT '0' NOT NULL,
PRIMARY KEY (gesuchnr,benutzer_id)
-) engine=ISAM;
+);
replace into t1 (gesuchnr,benutzer_id) values (2,1);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
-alter table t1 engine=myisam;
-replace into t1 (gesuchnr,benutzer_id) values (1,1);
alter table t1 engine=heap;
replace into t1 (gesuchnr,benutzer_id) values (1,1);
drop table t1;
diff --git a/mysql-test/r/xa.result b/mysql-test/r/xa.result
new file mode 100644
index 00000000000..1dde495d6ae
--- /dev/null
+++ b/mysql-test/r/xa.result
@@ -0,0 +1,45 @@
+drop table if exists t1, t2;
+create table t1 (a int) engine=innodb;
+xa start 'test1';
+insert t1 values (10);
+xa end 'test1';
+xa prepare 'test1';
+xa rollback 'test1';
+select * from t1;
+a
+xa start 'test2';
+xa start 'test-bad';
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed in the ACTIVE state
+insert t1 values (20);
+xa prepare 'test2';
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed in the ACTIVE state
+xa end 'test2';
+xa prepare 'test2';
+xa commit 'test2';
+select * from t1;
+a
+20
+xa start 'testa','testb';
+insert t1 values (30);
+xa end 'testa','testb';
+xa start 0x7465737462, 0x2030405060, 0xb;
+insert t1 values (40);
+xa end 'testb',' 0@P`',11;
+xa prepare 'testb',0x2030405060,11;
+xa recover;
+formatID gtrid_length bqual_length data
+11 5 5 testb 0@P`
+xa prepare 'testa','testb';
+xa recover;
+formatID gtrid_length bqual_length data
+11 5 5 testb 0@P`
+1 5 5 testatestb
+xa commit 'testb',0x2030405060,11;
+xa rollback 'testa','testb';
+xa start 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
+select * from t1;
+a
+20
+40
+drop table t1;
diff --git a/mysql-test/t/isam.test b/mysql-test/t/isam.test
deleted file mode 100644
index f77d29fd20f..00000000000
--- a/mysql-test/t/isam.test
+++ /dev/null
@@ -1,247 +0,0 @@
--- source include/have_isam.inc
-
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
-#
-# Test possible problem with rows that are about 65535 bytes long
-#
-
-create table t1 (a tinyint not null auto_increment, b blob not null, primary key (a)) engine=isam;
-
-let $1=100;
-disable_query_log;
---disable_warnings
-while ($1)
-{
- eval insert into t1 (b) values(repeat(char(65+$1),65540-$1));
- dec $1;
-}
-enable_query_log;
---enable_warnings
-delete from t1 where (a & 1);
-select sum(length(b)) from t1;
-drop table t1;
-
-#
-# Test of auto_increment; The test for BDB tables is in bdb.test
-#
-
-create table t1 (a int not null auto_increment,b int, primary key (a)) engine=isam;
-insert into t1 values (1,1),(NULL,2),(3,3),(NULL,4);
-delete from t1 where a=4 or a=2;
-insert into t1 values (NULL,4),(NULL,5),(6,6);
-select * from t1;
-delete from t1 where a=6;
-#show table status like "t1";
-replace t1 values (3,1);
-replace t1 values (3,3);
-ALTER TABLE t1 add c int;
-insert into t1 values (NULL,6,6);
-select * from t1;
-drop table t1;
-
-#
-# Test of some CREATE TABLE's that should fail
-#
---error 1121
-create table t1 (a int,b text, index(a)) engine=isam;
---error 1073
-create table t1 (a int,b text, index(b)) engine=isam;
---error 1075
-create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) engine=isam;
---error 1121
-create table t1 (ordid int(8), unique (ordid)) engine=isam;
-drop table if exists t1;
-
-#
-# Test of some show commands
-#
-
-create table t1 (a int not null primary key, b int not null,c int not null, key(b,c));
-insert into t1 values (1,2,2),(2,2,3),(3,2,4),(4,2,4);
-create table t2 engine=isam select * from t1;
-optimize table t1;
-check table t1,t2;
-repair table t1,t2;
-check table t2,t1;
-lock tables t1 write;
-check table t2,t1;
-show columns from t1;
-show full columns from t1;
-show index from t1;
-drop table t1,t2;
-
-#
-# test of table with huge number of packed fields
-#
-
-create table t1 (i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8
-int, i9 int, i10 int, i11 int, i12 int, i13 int, i14 int, i15 int, i16 int, i17
-int, i18 int, i19 int, i20 int, i21 int, i22 int, i23 int, i24 int, i25 int,
-i26 int, i27 int, i28 int, i29 int, i30 int, i31 int, i32 int, i33 int, i34
-int, i35 int, i36 int, i37 int, i38 int, i39 int, i40 int, i41 int, i42 int,
-i43 int, i44 int, i45 int, i46 int, i47 int, i48 int, i49 int, i50 int, i51
-int, i52 int, i53 int, i54 int, i55 int, i56 int, i57 int, i58 int, i59 int,
-i60 int, i61 int, i62 int, i63 int, i64 int, i65 int, i66 int, i67 int, i68
-int, i69 int, i70 int, i71 int, i72 int, i73 int, i74 int, i75 int, i76 int,
-i77 int, i78 int, i79 int, i80 int, i81 int, i82 int, i83 int, i84 int, i85
-int, i86 int, i87 int, i88 int, i89 int, i90 int, i91 int, i92 int, i93 int,
-i94 int, i95 int, i96 int, i97 int, i98 int, i99 int, i100 int, i101 int, i102
-int, i103 int, i104 int, i105 int, i106 int, i107 int, i108 int, i109 int, i110
-int, i111 int, i112 int, i113 int, i114 int, i115 int, i116 int, i117 int, i118
-int, i119 int, i120 int, i121 int, i122 int, i123 int, i124 int, i125 int, i126
-int, i127 int, i128 int, i129 int, i130 int, i131 int, i132 int, i133 int, i134
-int, i135 int, i136 int, i137 int, i138 int, i139 int, i140 int, i141 int, i142
-int, i143 int, i144 int, i145 int, i146 int, i147 int, i148 int, i149 int, i150
-int, i151 int, i152 int, i153 int, i154 int, i155 int, i156 int, i157 int, i158
-int, i159 int, i160 int, i161 int, i162 int, i163 int, i164 int, i165 int, i166
-int, i167 int, i168 int, i169 int, i170 int, i171 int, i172 int, i173 int, i174
-int, i175 int, i176 int, i177 int, i178 int, i179 int, i180 int, i181 int, i182
-int, i183 int, i184 int, i185 int, i186 int, i187 int, i188 int, i189 int, i190
-int, i191 int, i192 int, i193 int, i194 int, i195 int, i196 int, i197 int, i198
-int, i199 int, i200 int, i201 int, i202 int, i203 int, i204 int, i205 int, i206
-int, i207 int, i208 int, i209 int, i210 int, i211 int, i212 int, i213 int, i214
-int, i215 int, i216 int, i217 int, i218 int, i219 int, i220 int, i221 int, i222
-int, i223 int, i224 int, i225 int, i226 int, i227 int, i228 int, i229 int, i230
-int, i231 int, i232 int, i233 int, i234 int, i235 int, i236 int, i237 int, i238
-int, i239 int, i240 int, i241 int, i242 int, i243 int, i244 int, i245 int, i246
-int, i247 int, i248 int, i249 int, i250 int, i251 int, i252 int, i253 int, i254
-int, i255 int, i256 int, i257 int, i258 int, i259 int, i260 int, i261 int, i262
-int, i263 int, i264 int, i265 int, i266 int, i267 int, i268 int, i269 int, i270
-int, i271 int, i272 int, i273 int, i274 int, i275 int, i276 int, i277 int, i278
-int, i279 int, i280 int, i281 int, i282 int, i283 int, i284 int, i285 int, i286
-int, i287 int, i288 int, i289 int, i290 int, i291 int, i292 int, i293 int, i294
-int, i295 int, i296 int, i297 int, i298 int, i299 int, i300 int, i301 int, i302
-int, i303 int, i304 int, i305 int, i306 int, i307 int, i308 int, i309 int, i310
-int, i311 int, i312 int, i313 int, i314 int, i315 int, i316 int, i317 int, i318
-int, i319 int, i320 int, i321 int, i322 int, i323 int, i324 int, i325 int, i326
-int, i327 int, i328 int, i329 int, i330 int, i331 int, i332 int, i333 int, i334
-int, i335 int, i336 int, i337 int, i338 int, i339 int, i340 int, i341 int, i342
-int, i343 int, i344 int, i345 int, i346 int, i347 int, i348 int, i349 int, i350
-int, i351 int, i352 int, i353 int, i354 int, i355 int, i356 int, i357 int, i358
-int, i359 int, i360 int, i361 int, i362 int, i363 int, i364 int, i365 int, i366
-int, i367 int, i368 int, i369 int, i370 int, i371 int, i372 int, i373 int, i374
-int, i375 int, i376 int, i377 int, i378 int, i379 int, i380 int, i381 int, i382
-int, i383 int, i384 int, i385 int, i386 int, i387 int, i388 int, i389 int, i390
-int, i391 int, i392 int, i393 int, i394 int, i395 int, i396 int, i397 int, i398
-int, i399 int, i400 int, i401 int, i402 int, i403 int, i404 int, i405 int, i406
-int, i407 int, i408 int, i409 int, i410 int, i411 int, i412 int, i413 int, i414
-int, i415 int, i416 int, i417 int, i418 int, i419 int, i420 int, i421 int, i422
-int, i423 int, i424 int, i425 int, i426 int, i427 int, i428 int, i429 int, i430
-int, i431 int, i432 int, i433 int, i434 int, i435 int, i436 int, i437 int, i438
-int, i439 int, i440 int, i441 int, i442 int, i443 int, i444 int, i445 int, i446
-int, i447 int, i448 int, i449 int, i450 int, i451 int, i452 int, i453 int, i454
-int, i455 int, i456 int, i457 int, i458 int, i459 int, i460 int, i461 int, i462
-int, i463 int, i464 int, i465 int, i466 int, i467 int, i468 int, i469 int, i470
-int, i471 int, i472 int, i473 int, i474 int, i475 int, i476 int, i477 int, i478
-int, i479 int, i480 int, i481 int, i482 int, i483 int, i484 int, i485 int, i486
-int, i487 int, i488 int, i489 int, i490 int, i491 int, i492 int, i493 int, i494
-int, i495 int, i496 int, i497 int, i498 int, i499 int, i500 int, i501 int, i502
-int, i503 int, i504 int, i505 int, i506 int, i507 int, i508 int, i509 int, i510
-int, i511 int, i512 int, i513 int, i514 int, i515 int, i516 int, i517 int, i518
-int, i519 int, i520 int, i521 int, i522 int, i523 int, i524 int, i525 int, i526
-int, i527 int, i528 int, i529 int, i530 int, i531 int, i532 int, i533 int, i534
-int, i535 int, i536 int, i537 int, i538 int, i539 int, i540 int, i541 int, i542
-int, i543 int, i544 int, i545 int, i546 int, i547 int, i548 int, i549 int, i550
-int, i551 int, i552 int, i553 int, i554 int, i555 int, i556 int, i557 int, i558
-int, i559 int, i560 int, i561 int, i562 int, i563 int, i564 int, i565 int, i566
-int, i567 int, i568 int, i569 int, i570 int, i571 int, i572 int, i573 int, i574
-int, i575 int, i576 int, i577 int, i578 int, i579 int, i580 int, i581 int, i582
-int, i583 int, i584 int, i585 int, i586 int, i587 int, i588 int, i589 int, i590
-int, i591 int, i592 int, i593 int, i594 int, i595 int, i596 int, i597 int, i598
-int, i599 int, i600 int, i601 int, i602 int, i603 int, i604 int, i605 int, i606
-int, i607 int, i608 int, i609 int, i610 int, i611 int, i612 int, i613 int, i614
-int, i615 int, i616 int, i617 int, i618 int, i619 int, i620 int, i621 int, i622
-int, i623 int, i624 int, i625 int, i626 int, i627 int, i628 int, i629 int, i630
-int, i631 int, i632 int, i633 int, i634 int, i635 int, i636 int, i637 int, i638
-int, i639 int, i640 int, i641 int, i642 int, i643 int, i644 int, i645 int, i646
-int, i647 int, i648 int, i649 int, i650 int, i651 int, i652 int, i653 int, i654
-int, i655 int, i656 int, i657 int, i658 int, i659 int, i660 int, i661 int, i662
-int, i663 int, i664 int, i665 int, i666 int, i667 int, i668 int, i669 int, i670
-int, i671 int, i672 int, i673 int, i674 int, i675 int, i676 int, i677 int, i678
-int, i679 int, i680 int, i681 int, i682 int, i683 int, i684 int, i685 int, i686
-int, i687 int, i688 int, i689 int, i690 int, i691 int, i692 int, i693 int, i694
-int, i695 int, i696 int, i697 int, i698 int, i699 int, i700 int, i701 int, i702
-int, i703 int, i704 int, i705 int, i706 int, i707 int, i708 int, i709 int, i710
-int, i711 int, i712 int, i713 int, i714 int, i715 int, i716 int, i717 int, i718
-int, i719 int, i720 int, i721 int, i722 int, i723 int, i724 int, i725 int, i726
-int, i727 int, i728 int, i729 int, i730 int, i731 int, i732 int, i733 int, i734
-int, i735 int, i736 int, i737 int, i738 int, i739 int, i740 int, i741 int, i742
-int, i743 int, i744 int, i745 int, i746 int, i747 int, i748 int, i749 int, i750
-int, i751 int, i752 int, i753 int, i754 int, i755 int, i756 int, i757 int, i758
-int, i759 int, i760 int, i761 int, i762 int, i763 int, i764 int, i765 int, i766
-int, i767 int, i768 int, i769 int, i770 int, i771 int, i772 int, i773 int, i774
-int, i775 int, i776 int, i777 int, i778 int, i779 int, i780 int, i781 int, i782
-int, i783 int, i784 int, i785 int, i786 int, i787 int, i788 int, i789 int, i790
-int, i791 int, i792 int, i793 int, i794 int, i795 int, i796 int, i797 int, i798
-int, i799 int, i800 int, i801 int, i802 int, i803 int, i804 int, i805 int, i806
-int, i807 int, i808 int, i809 int, i810 int, i811 int, i812 int, i813 int, i814
-int, i815 int, i816 int, i817 int, i818 int, i819 int, i820 int, i821 int, i822
-int, i823 int, i824 int, i825 int, i826 int, i827 int, i828 int, i829 int, i830
-int, i831 int, i832 int, i833 int, i834 int, i835 int, i836 int, i837 int, i838
-int, i839 int, i840 int, i841 int, i842 int, i843 int, i844 int, i845 int, i846
-int, i847 int, i848 int, i849 int, i850 int, i851 int, i852 int, i853 int, i854
-int, i855 int, i856 int, i857 int, i858 int, i859 int, i860 int, i861 int, i862
-int, i863 int, i864 int, i865 int, i866 int, i867 int, i868 int, i869 int, i870
-int, i871 int, i872 int, i873 int, i874 int, i875 int, i876 int, i877 int, i878
-int, i879 int, i880 int, i881 int, i882 int, i883 int, i884 int, i885 int, i886
-int, i887 int, i888 int, i889 int, i890 int, i891 int, i892 int, i893 int, i894
-int, i895 int, i896 int, i897 int, i898 int, i899 int, i900 int, i901 int, i902
-int, i903 int, i904 int, i905 int, i906 int, i907 int, i908 int, i909 int, i910
-int, i911 int, i912 int, i913 int, i914 int, i915 int, i916 int, i917 int, i918
-int, i919 int, i920 int, i921 int, i922 int, i923 int, i924 int, i925 int, i926
-int, i927 int, i928 int, i929 int, i930 int, i931 int, i932 int, i933 int, i934
-int, i935 int, i936 int, i937 int, i938 int, i939 int, i940 int, i941 int, i942
-int, i943 int, i944 int, i945 int, i946 int, i947 int, i948 int, i949 int, i950
-int, i951 int, i952 int, i953 int, i954 int, i955 int, i956 int, i957 int, i958
-int, i959 int, i960 int, i961 int, i962 int, i963 int, i964 int, i965 int, i966
-int, i967 int, i968 int, i969 int, i970 int, i971 int, i972 int, i973 int, i974
-int, i975 int, i976 int, i977 int, i978 int, i979 int, i980 int, i981 int, i982
-int, i983 int, i984 int, i985 int, i986 int, i987 int, i988 int, i989 int, i990
-int, i991 int, i992 int, i993 int, i994 int, i995 int, i996 int, i997 int, i998
-int, i999 int, i1000 int, b blob) row_format=dynamic;
-insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, "Sergei");
-update t1 set b=repeat('a',256);
-update t1 set i1=0, i2=0, i3=0, i4=0, i5=0, i6=0, i7=0;
-check table t1;
-drop table t1;
diff --git a/mysql-test/t/replace.test b/mysql-test/t/replace.test
index 8429d80a4ef..2b3775f4f67 100644
--- a/mysql-test/t/replace.test
+++ b/mysql-test/t/replace.test
@@ -1,7 +1,5 @@
--- source include/have_isam.inc
-
#
-# Test of REPLACE with ISAM and MyISAM and HEAP
+# Test of REPLACE with MyISAM and HEAP
#
--disable_warnings
@@ -12,13 +10,11 @@ CREATE TABLE t1 (
gesuchnr int(11) DEFAULT '0' NOT NULL,
benutzer_id int(11) DEFAULT '0' NOT NULL,
PRIMARY KEY (gesuchnr,benutzer_id)
-) engine=ISAM;
+);
replace into t1 (gesuchnr,benutzer_id) values (2,1);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
-alter table t1 engine=myisam;
-replace into t1 (gesuchnr,benutzer_id) values (1,1);
alter table t1 engine=heap;
replace into t1 (gesuchnr,benutzer_id) values (1,1);
drop table t1;
diff --git a/mysql-test/t/xa.test b/mysql-test/t/xa.test
new file mode 100644
index 00000000000..321e5008035
--- /dev/null
+++ b/mysql-test/t/xa.test
@@ -0,0 +1,58 @@
+#
+# WL#1756
+#
+-- source include/have_innodb.inc
+--disable_warnings
+drop table if exists t1, t2;
+--enable_warnings
+create table t1 (a int) engine=innodb;
+xa start 'test1';
+insert t1 values (10);
+xa end 'test1';
+xa prepare 'test1';
+xa rollback 'test1';
+select * from t1;
+
+xa start 'test2';
+--error 1399
+xa start 'test-bad';
+insert t1 values (20);
+--error 1399
+xa prepare 'test2';
+xa end 'test2';
+xa prepare 'test2';
+xa commit 'test2';
+select * from t1;
+
+xa start 'testa','testb';
+insert t1 values (30);
+xa end 'testa','testb';
+
+connect (con1,localhost,,,);
+connection con1;
+
+# gtrid [ , bqual [ , formatID ] ]
+xa start 0x7465737462, 0x2030405060, 0xb;
+insert t1 values (40);
+xa end 'testb',' 0@P`',11;
+xa prepare 'testb',0x2030405060,11;
+
+xa recover;
+
+# uncomment the line below when binlog will be able to prepare
+#disconnect con1;
+connection default;
+
+xa prepare 'testa','testb';
+
+xa recover;
+
+xa commit 'testb',0x2030405060,11;
+xa rollback 'testa','testb';
+
+--error 1064
+xa start 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz';
+
+select * from t1;
+drop table t1;
+
diff --git a/mysys/my_sync.c b/mysys/my_sync.c
index bd372f03c87..bfaf09ce402 100644
--- a/mysys/my_sync.c
+++ b/mysys/my_sync.c
@@ -27,7 +27,14 @@
my_flags Flags (now only MY_WME is supported)
NOTE
- If file system supports its, only file data is synced, not inode date
+ If file system supports its, only file data is synced, not inode data.
+
+ MY_IGNORE_BADFD is useful when fd is "volatile" - not protected by a
+ mutex. In this case by the time of fsync(), fd may be already closed by
+ another thread, or even reassigned to a different file. With this flag -
+ MY_IGNORE_BADFD - such a situation will not be considered an error.
+ (which is correct behaviour, if we know that the other thread synced the
+ file before closing)
RETURN
0 ok
@@ -55,10 +62,15 @@ int my_sync(File fd, myf my_flags)
if (res)
{
- if (!(my_errno= errno))
- my_errno= -1; /* Unknown error */
- if (my_flags & MY_WME)
+ int er= errno;
+ if (!(my_errno= er))
+ my_errno= -1; /* Unknown error */
+ if (my_flags & MY_IGNORE_BADFD &&
+ (er == EBADF || er == EINVAL || er == EROFS))
+ res= 0;
+ else if (my_flags & MY_WME)
my_error(EE_SYNC, MYF(ME_BELL+ME_WAITTANG), my_filename(fd), my_errno);
}
DBUG_RETURN(res);
-} /* my_read */
+} /* my_sync */
+
diff --git a/sql/field.cc b/sql/field.cc
index 4ef80a99695..cfda1ab29fc 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -3230,13 +3230,13 @@ int Field_long::store(const char *from,uint len,CHARSET_INFO *cs)
long store_tmp;
int error;
char *end;
-
+
tmp_scan= cs->cset->scan(cs, from, from+len, MY_SEQ_SPACES);
len-= tmp_scan;
from+= tmp_scan;
end= (char*) from+len;
- tmp= cs->cset->my_strtoll10(cs, from, &end, &error);
+ tmp= cs->cset->strtoll10(cs, from, &end, &error);
if (error != MY_ERRNO_EDOM)
{
diff --git a/sql/handler.cc b/sql/handler.cc
index 330ea83566c..3eead37482b 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -25,10 +25,6 @@
#include "ha_heap.h"
#include "ha_myisam.h"
#include "ha_myisammrg.h"
-#ifdef HAVE_ISAM
-#include "ha_isam.h"
-#include "ha_isammrg.h"
-#endif
#ifdef HAVE_BERKELEY_DB
#include "ha_berkeley.h"
#endif
@@ -750,17 +746,15 @@ int ha_autocommit_or_rollback(THD *thd, int error)
DBUG_RETURN(error);
}
-int ha_commit_or_rollback_by_xid(LEX_STRING *ident, bool commit)
+int ha_commit_or_rollback_by_xid(XID *xid, bool commit)
{
- XID xid;
handlerton **ht= handlertons, **end_ht=ht+total_ha;
int res= 1;
- xid.set(ident);
for ( ; ht < end_ht ; ht++)
if ((*ht)->recover)
res= res &&
- (*(commit ? (*ht)->commit_by_xid : (*ht)->rollback_by_xid))(&xid);
+ (*(commit ? (*ht)->commit_by_xid : (*ht)->rollback_by_xid))(xid);
return res;
}
@@ -2366,10 +2360,9 @@ TYPELIB *ha_known_exts(void)
const char **ext, *old_ext;
known_extensions_id= mysys_usage_id;
- found_exts.push_back((char*) ".db");
found_exts.push_back((char*) triggers_file_ext);
for (types= sys_table_types; types->type; types++)
- {
+ {
if (*types->value == SHOW_OPTION_YES)
{
handler *file= get_new_handler(0,(enum db_type) types->db_type);
diff --git a/sql/handler.h b/sql/handler.h
index e5b63c7f25c..3751af29194 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -213,13 +213,22 @@ struct xid_t {
long bqual_length;
char data[XIDDATASIZE]; // not \0-terminated !
- bool eq(LEX_STRING *l) { return eq(l->length, 0, l->str); }
+ bool eq(struct xid_t *xid)
+ { return !memcmp(this, xid, sizeof(long)*3+gtrid_length+bqual_length); }
bool eq(long g, long b, const char *d)
{ return g == gtrid_length && b == bqual_length && !memcmp(d, data, g+b); }
- void set(LEX_STRING *l) { set(l->length, 0, l->str); }
+ void set(struct xid_t *xid)
+ { memcpy(this, xid, sizeof(long)*3+xid->gtrid_length+xid->bqual_length); }
+ void set(long f, const char *g, long gl, const char *b, long bl)
+ {
+ formatID= f;
+ memcpy(data, g, gtrid_length= gl);
+ memcpy(data+gl, b, bqual_length= bl);
+ }
void set(ulonglong xid)
{
my_xid tmp;
+ formatID= 1;
set(MYSQL_XID_PREFIX_LEN, 0, MYSQL_XID_PREFIX);
memcpy(data+MYSQL_XID_PREFIX_LEN, &server_id, sizeof(server_id));
tmp= xid;
@@ -228,7 +237,7 @@ struct xid_t {
}
void set(long g, long b, const char *d)
{
- formatID=1;
+ formatID= 1;
gtrid_length= g;
bqual_length= b;
memcpy(data, d, g+b);
@@ -244,7 +253,7 @@ struct xid_t {
my_xid get_my_xid()
{
return gtrid_length == MYSQL_XID_GTRID_LEN && bqual_length == 0 &&
- *(ulong*)(data+MYSQL_XID_PREFIX_LEN) == server_id &&
+ !memcmp(data+MYSQL_XID_PREFIX_LEN, &server_id, sizeof(server_id)) &&
!memcmp(data, MYSQL_XID_PREFIX, MYSQL_XID_PREFIX_LEN) ?
quick_get_my_xid() : 0;
}
@@ -261,8 +270,8 @@ typedef struct xid_t XID;
/*
handlerton is a singleton structure - one instance per storage engine -
- to provide access to storage engine functionality that works on
- "global" level (unlike handler class that works on per-table basis)
+ to provide access to storage engine functionality that works on the
+ "global" level (unlike handler class that works on a per-table basis)
usually handlerton instance is defined statically in ha_xxx.cc as
@@ -826,7 +835,7 @@ int ha_release_temporary_latches(THD *thd);
/* transactions: interface to handlerton functions */
int ha_start_consistent_snapshot(THD *thd);
-int ha_commit_or_rollback_by_xid(LEX_STRING *ident, bool commit);
+int ha_commit_or_rollback_by_xid(XID *xid, bool commit);
int ha_commit_one_phase(THD *thd, bool all);
int ha_rollback_trans(THD *thd, bool all);
int ha_prepare(THD *thd);
diff --git a/sql/item_sum.h b/sql/item_sum.h
index d03ef94b9cd..8c8360b0726 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -734,7 +734,7 @@ public:
return 0; /* Null value */
cs= res->charset();
end= (char*) res->ptr()+res->length();
- return cs->cset->my_strtoll10(cs, res->ptr(), &end, &err_not_used);
+ return cs->cset->strtoll10(cs, res->ptr(), &end, &err_not_used);
}
my_decimal *val_decimal(my_decimal *dec);
enum Item_result result_type () const { return STRING_RESULT; }
diff --git a/sql/lock.cc b/sql/lock.cc
index 266e8dc4d4d..a8ccba32d4f 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -736,6 +736,13 @@ static void print_lock_error(int error, const char *table)
protect_against_global_read_lock
count of threads which have set protection against global read lock.
+ access to them is protected with a mutex LOCK_global_read_lock
+
+ (XXX: one should never take LOCK_open if LOCK_global_read_lock is taken,
+ otherwise a deadlock may occur - see mysql_rm_table. Other mutexes could
+ be a problem too - grep the code for global_read_lock if you want to use
+ any other mutex here)
+
How blocking of threads by global read lock is achieved: that's
advisory. Any piece of code which should be blocked by global read lock must
be designed like this:
@@ -773,7 +780,7 @@ static void print_lock_error(int error, const char *table)
table instance of thd2
thd1: COMMIT; # blocked by thd3.
thd1 blocks thd2 which blocks thd3 which blocks thd1: deadlock.
-
+
Note that we need to support that one thread does
FLUSH TABLES WITH READ LOCK; and then COMMIT;
(that's what innobackup does, for some good reason).
@@ -818,7 +825,7 @@ bool lock_global_read_lock(THD *thd)
}
thd->global_read_lock= GOT_GLOBAL_READ_LOCK;
global_read_lock++;
- thd->exit_cond(old_message);
+ thd->exit_cond(old_message); // this unlocks LOCK_global_read_lock
}
/*
We DON'T set global_read_lock_blocks_commit now, it will be set after
@@ -887,8 +894,8 @@ bool wait_if_global_read_lock(THD *thd, bool abort_on_refresh,
The following is only true in case of a global read locks (which is rare)
and if old_message is set
*/
- if (unlikely(need_exit_cond))
- thd->exit_cond(old_message);
+ if (unlikely(need_exit_cond))
+ thd->exit_cond(old_message); // this unlocks LOCK_global_read_lock
else
pthread_mutex_unlock(&LOCK_global_read_lock);
DBUG_RETURN(result);
@@ -938,7 +945,7 @@ bool make_global_read_lock_block_commit(THD *thd)
global_read_lock_blocks_commit--; // undo what we did
else
thd->global_read_lock= MADE_GLOBAL_READ_LOCK_BLOCK_COMMIT;
- thd->exit_cond(old_message);
+ thd->exit_cond(old_message); // this unlocks LOCK_global_read_lock
DBUG_RETURN(error);
}
diff --git a/sql/log.cc b/sql/log.cc
index 9af70a4d527..1d6bb4cdf41 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -1531,18 +1531,20 @@ bool MYSQL_LOG::write(THD *thd,enum enum_server_command command,
return 0;
}
-
-inline bool sync_binlog(IO_CACHE *cache)
+bool MYSQL_LOG::flush_and_sync()
{
- if (sync_binlog_period == ++sync_binlog_counter && sync_binlog_period)
+ int err=0, fd=log_file.file;
+ safe_mutex_assert_owner(&LOCK_log);
+ if (flush_io_cache(&log_file))
+ return 1;
+ if (++sync_binlog_counter >= sync_binlog_period && sync_binlog_period)
{
sync_binlog_counter= 0;
- return my_sync(cache->file, MYF(MY_WME));
+ err=my_sync(fd, MYF(MY_WME));
}
- return 0;
+ return err;
}
-
/*
Write an event to the binary log
*/
@@ -1675,8 +1677,8 @@ bool MYSQL_LOG::write(Log_event *event_info)
}
}
- /*
- Write the SQL command
+ /*
+ Write the SQL command
*/
if (event_info->write(file))
@@ -1684,8 +1686,10 @@ bool MYSQL_LOG::write(Log_event *event_info)
if (file == &log_file) // we are writing to the real log (disk)
{
- if (flush_io_cache(file) || sync_binlog(file))
+ if (flush_and_sync())
goto err;
+ signal_update();
+ rotate_and_purge(RP_LOCK_LOG_IS_ALREADY_LOCKED);
}
error=0;
@@ -1698,15 +1702,9 @@ err:
my_error(ER_ERROR_ON_WRITE, MYF(0), name, errno);
write_error=1;
}
- if (file == &log_file)
- {
- signal_update();
- rotate_and_purge(RP_LOCK_LOG_IS_ALREADY_LOCKED);
- }
}
pthread_mutex_unlock(&LOCK_log);
-
DBUG_RETURN(error);
}
@@ -1813,7 +1811,7 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, Log_event *commit_event)
if (commit_event->write(&log_file))
goto err;
DBUG_skip_commit:
- if (flush_io_cache(&log_file) || sync_binlog(&log_file))
+ if (flush_and_sync())
goto err;
DBUG_EXECUTE_IF("half_binlogged_transaction", abort(););
if (cache->error) // Error on read
@@ -1983,26 +1981,26 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length,
SYNOPSIS
wait_for_update()
thd Thread variable
- master_or_slave If 0, the caller is the Binlog_dump thread from master;
+ is_slave If 0, the caller is the Binlog_dump thread from master;
if 1, the caller is the SQL thread from the slave. This
influences only thd->proc_info.
NOTES
One must have a lock on LOCK_log before calling this function.
- This lock will be freed before return! That's required by
+ This lock will be released before return! That's required by
THD::enter_cond() (see NOTES in sql_class.h).
*/
-void MYSQL_LOG::wait_for_update(THD* thd, bool master_or_slave)
+void MYSQL_LOG::wait_for_update(THD* thd, bool is_slave)
{
const char *old_msg;
DBUG_ENTER("wait_for_update");
old_msg= thd->enter_cond(&update_cond, &LOCK_log,
- master_or_slave ?
+ is_slave ?
"Has read all relay log; waiting for the slave I/O "
- "thread to update it" :
+ "thread to update it" :
"Has sent all binlog to slave; waiting for binlog "
- "to be updated");
+ "to be updated");
pthread_cond_wait(&update_cond, &LOCK_log);
thd->exit_cond(old_msg);
DBUG_VOID_RETURN;
@@ -2051,7 +2049,12 @@ void MYSQL_LOG::close(uint exiting)
my_pwrite(log_file.file, &flags, 1, offset, MYF(0));
}
- if (my_close(log_file.file,MYF(0)) < 0 && ! write_error)
+ if (my_sync(log_file.file,MYF(MY_WME)) && ! write_error)
+ {
+ write_error=1;
+ sql_print_error(ER(ER_ERROR_ON_WRITE), name, errno);
+ }
+ if (my_close(log_file.file,MYF(MY_WME)) && ! write_error)
{
write_error=1;
sql_print_error(ER(ER_ERROR_ON_WRITE), name, errno);
@@ -2945,8 +2948,10 @@ int TC_LOG_BINLOG::log(THD *thd, my_xid xid)
void TC_LOG_BINLOG::unlog(ulong cookie, my_xid xid)
{
- if (thread_safe_dec_and_test(prepared_xids, &LOCK_prep_xids))
+ pthread_mutex_lock(&LOCK_prep_xids);
+ if (--prepared_xids == 0)
pthread_cond_signal(&COND_prep_xids);
+ pthread_mutex_unlock(&LOCK_prep_xids);
rotate_and_purge(0); // as ::write() did not rotate
}
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 7290cfd8e0d..1b1da6772af 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -1114,10 +1114,6 @@ extern MY_BITMAP temp_pool;
extern String my_empty_string;
extern const String my_null_string;
extern SHOW_VAR init_vars[],status_vars[], internal_vars[];
-extern SHOW_COMP_OPTION have_isam;
-extern SHOW_COMP_OPTION have_innodb;
-extern SHOW_COMP_OPTION have_berkeley_db;
-extern SHOW_COMP_OPTION have_ndbcluster;
extern struct system_variables global_system_variables;
extern struct system_variables max_system_variables;
extern struct system_status_var global_status_var;
@@ -1138,12 +1134,13 @@ extern struct my_option my_long_options[];
extern SHOW_COMP_OPTION have_isam, have_innodb, have_berkeley_db;
extern SHOW_COMP_OPTION have_example_db, have_archive_db, have_csv_db;
extern SHOW_COMP_OPTION have_federated_db;
+extern SHOW_COMP_OPTION have_blackhole_db;
+extern SHOW_COMP_OPTION have_ndbcluster;
extern SHOW_COMP_OPTION have_raid, have_openssl, have_symlink;
-extern SHOW_COMP_OPTION have_query_cache, have_berkeley_db, have_innodb;
+extern SHOW_COMP_OPTION have_query_cache;
extern SHOW_COMP_OPTION have_geometry, have_rtree_keys;
extern SHOW_COMP_OPTION have_crypt;
extern SHOW_COMP_OPTION have_compress;
-extern SHOW_COMP_OPTION have_blackhole_db;
#ifndef __WIN__
extern pthread_t signal_thread;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index e1303585114..ba149e5cee6 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -30,9 +30,6 @@
#include "ha_innodb.h"
#endif
#include "ha_myisam.h"
-#ifdef HAVE_ISAM
-#include "ha_isam.h"
-#endif
#ifdef HAVE_NDBCLUSTER_DB
#include "ha_ndbcluster.h"
#endif
@@ -47,11 +44,6 @@
#else
#define OPT_BDB_DEFAULT 0
#endif
-#ifdef HAVE_ISAM_DB
-#define OPT_ISAM_DEFAULT 1
-#else
-#define OPT_ISAM_DEFAULT 0
-#endif
#ifdef HAVE_NDBCLUSTER_DB
#define OPT_NDBCLUSTER_DEFAULT 0
#if defined(NOT_ENOUGH_TESTED) \
@@ -64,7 +56,6 @@
#define OPT_NDBCLUSTER_DEFAULT 0
#endif
-#include <nisam.h>
#include <thr_alarm.h>
#include <ft_global.h>
#include <errmsg.h>
@@ -4342,7 +4333,7 @@ Disable with --skip-bdb (will save memory).",
"Don't try to recover Berkeley DB tables on start.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"bdb-no-sync", OPT_BDB_NOSYNC,
- "Disable synchronously flushing logs. This option is deprecated, use --skip-sync-bdb-logs or sync-bdb-logs=0 instead",
+ "This option is deprecated, use --skip-sync-bdb-logs instead",
// (gptr*) &opt_sync_bdb_logs, (gptr*) &opt_sync_bdb_logs, 0, GET_BOOL,
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"bdb-shared-data", OPT_BDB_SHARED,
@@ -4551,9 +4542,8 @@ Disable with --skip-innodb-doublewrite.", (gptr*) &innobase_use_doublewrite,
(gptr*) &global_system_variables.innodb_support_xa,
0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
#endif /* End HAVE_INNOBASE_DB */
- {"isam", OPT_ISAM, "Enable ISAM (if this version of MySQL supports it). \
-Disable with --skip-isam.",
- (gptr*) &opt_isam, (gptr*) &opt_isam, 0, GET_BOOL, NO_ARG, OPT_ISAM_DEFAULT, 0, 0,
+ {"isam", OPT_ISAM, "Obsolete. ISAM storage engine is no longer supported.",
+ (gptr*) &opt_isam, (gptr*) &opt_isam, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"language", 'L',
"Client error messages in given language. May be given as a full path.",
@@ -5469,36 +5459,35 @@ The minimum value for this variable is 4096.",
1, 0},
#ifdef HAVE_BERKELEY_DB
{"sync-bdb-logs", OPT_BDB_SYNC,
- "Synchronously flush logs. Enabled by default",
+ "Synchronously flush Berkeley DB logs. Enabled by default",
(gptr*) &opt_sync_bdb_logs, (gptr*) &opt_sync_bdb_logs, 0, GET_BOOL,
NO_ARG, 1, 0, 0, 0, 0, 0},
#endif /* HAVE_BERKELEY_DB */
{"sync-binlog", OPT_SYNC_BINLOG,
- "Sync the binlog to disk after every #th event. \
-#=0 (the default) does no sync. Syncing slows MySQL down",
- (gptr*) &sync_binlog_period,
- (gptr*) &sync_binlog_period, 0, GET_ULONG, REQUIRED_ARG, 0, 0, ~0L, 0, 1,
- 0},
+ "Synchronously flush binary log to disk after every #th event. "
+ "Use 0 (default) to disable synchronous flushing.",
+ (gptr*) &sync_binlog_period, (gptr*) &sync_binlog_period, 0, GET_ULONG,
+ REQUIRED_ARG, 1, 0, ~0L, 0, 1, 0},
+ {"sync-frm", OPT_SYNC_FRM, "Sync .frm to disk on create. Enabled by default.",
+ (gptr*) &opt_sync_frm, (gptr*) &opt_sync_frm, 0, GET_BOOL, NO_ARG, 1, 0,
+ 0, 0, 0, 0},
#ifdef DOES_NOTHING_YET
{"sync-replication", OPT_SYNC_REPLICATION,
- "Enable synchronous replication",
+ "Enable synchronous replication.",
(gptr*) &global_system_variables.sync_replication,
(gptr*) &global_system_variables.sync_replication,
0, GET_ULONG, REQUIRED_ARG, 0, 0, 1, 0, 1, 0},
{"sync-replication-slave-id", OPT_SYNC_REPLICATION_SLAVE_ID,
- "Synchronous replication is wished for this slave",
+ "Synchronous replication is wished for this slave.",
(gptr*) &global_system_variables.sync_replication_slave_id,
(gptr*) &global_system_variables.sync_replication_slave_id,
0, GET_ULONG, REQUIRED_ARG, 0, 0, ~0L, 0, 1, 0},
{"sync-replication-timeout", OPT_SYNC_REPLICATION_TIMEOUT,
- "Synchronous replication timeout",
+ "Synchronous replication timeout.",
(gptr*) &global_system_variables.sync_replication_timeout,
(gptr*) &global_system_variables.sync_replication_timeout,
0, GET_ULONG, REQUIRED_ARG, 10, 0, ~0L, 0, 1, 0},
#endif
- {"sync-frm", OPT_SYNC_FRM, "Sync .frm to disk on create. Enabled by default",
- (gptr*) &opt_sync_frm, (gptr*) &opt_sync_frm, 0, GET_BOOL, NO_ARG, 1, 0,
- 0, 0, 0, 0},
{"table_cache", OPT_TABLE_CACHE,
"The number of open tables for all threads.", (gptr*) &table_cache_size,
(gptr*) &table_cache_size, 0, GET_ULONG, REQUIRED_ARG, 64, 1, 512*1024L,
@@ -5962,11 +5951,7 @@ static void mysql_init_variables(void)
#else
have_innodb=SHOW_OPTION_NO;
#endif
-#ifdef HAVE_ISAM
- have_isam=SHOW_OPTION_YES;
-#else
have_isam=SHOW_OPTION_NO;
-#endif
#ifdef HAVE_EXAMPLE_DB
have_example_db= SHOW_OPTION_YES;
#else
@@ -6375,9 +6360,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt_error_log= 0; // Force logs to stdout
break;
case (int) OPT_FLUSH:
-#ifdef HAVE_ISAM
- nisam_flush=1;
-#endif
myisam_flush=1;
flush_time=0; // No auto flush
break;
@@ -6484,14 +6466,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
have_berkeley_db= SHOW_OPTION_DISABLED;
#endif
break;
- case OPT_ISAM:
-#ifdef HAVE_ISAM
- if (opt_isam)
- have_isam= SHOW_OPTION_YES;
- else
- have_isam= SHOW_OPTION_DISABLED;
-#endif
- break;
case OPT_NDBCLUSTER:
#ifdef HAVE_NDBCLUSTER_DB
if (opt_ndbcluster)
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 44e2f5ee9f2..9920d89519e 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -42,7 +42,6 @@
#include "mysql_priv.h"
#include <m_ctype.h>
-#include <nisam.h>
#include "sql_select.h"
#ifndef EXTRA_DEBUG
@@ -51,7 +50,7 @@
#endif
/*
- Convert double value to #rows. Currently this does floor(), and we
+ Convert double value to #rows. Currently this does floor(), and we
might consider using round() instead.
*/
#define double2rows(x) ((ha_rows)(x))
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 457df3f2947..3523e444216 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -954,10 +954,12 @@ struct show_var_st init_vars[]= {
{"sql_warnings", (char*) &sys_sql_warnings, SHOW_BOOL},
#ifdef HAVE_REPLICATION
{sys_sync_binlog_period.name,(char*) &sys_sync_binlog_period, SHOW_SYS},
+#ifdef DOES_NOTHING_YET
{sys_sync_replication.name, (char*) &sys_sync_replication, SHOW_SYS},
{sys_sync_replication_slave_id.name, (char*) &sys_sync_replication_slave_id,SHOW_SYS},
{sys_sync_replication_timeout.name, (char*) &sys_sync_replication_timeout,SHOW_SYS},
#endif
+#endif
{sys_sync_frm.name, (char*) &sys_sync_frm, SHOW_SYS},
#ifdef HAVE_TZNAME
{"system_time_zone", system_time_zone, SHOW_CHAR},
@@ -2495,14 +2497,6 @@ bool sys_var_sync_binlog_period::update(THD *thd, set_var *var)
{
pthread_mutex_t *lock_log= mysql_bin_log.get_log_lock();
sync_binlog_period= (ulong) var->save_result.ulonglong_value;
- /*
- Must reset the counter otherwise it may already be beyond the new period
- and so the new period will not be taken into account. Need mutex otherwise
- might be cancelled by a simultanate ++ in MYSQL_LOG::write().
- */
- pthread_mutex_lock(lock_log);
- sync_binlog_counter= 0;
- pthread_mutex_unlock(lock_log);
return 0;
}
#endif /* HAVE_REPLICATION */
@@ -2522,7 +2516,7 @@ bool sys_var_rand_seed2::update(THD *thd, set_var *var)
bool sys_var_thd_time_zone::check(THD *thd, set_var *var)
{
- char buff[MAX_TIME_ZONE_NAME_LENGTH];
+ char buff[MAX_TIME_ZONE_NAME_LENGTH];
String str(buff, sizeof(buff), &my_charset_latin1);
String *res= var->value->val_str(&str);
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 736b372cc8f..145244f1c02 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -25,7 +25,6 @@
#include <m_ctype.h>
#include <my_dir.h>
#include <hash.h>
-#include <nisam.h>
#ifdef __WIN__
#include <io.h>
#endif
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 95d436069e2..cdda013d23a 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -343,7 +343,9 @@ void THD::change_user(void)
void THD::cleanup(void)
{
DBUG_ENTER("THD::cleanup");
- ha_rollback(this);
+ /* TODO uncomment the line below when binlog will be able to prepare */
+ // if (transaction.xa_state != XA_PREPARED)
+ ha_rollback(this);
if (locked_tables)
{
lock=locked_tables; locked_tables=0;
@@ -385,17 +387,17 @@ THD::~THD()
add_to_status(&global_status_var, &status_var);
/* Close connection */
-#ifndef EMBEDDED_LIBRARY
+#ifndef EMBEDDED_LIBRARY
if (net.vio)
{
vio_delete(net.vio);
- net_end(&net);
+ net_end(&net);
}
#endif
if (!cleanup_done)
cleanup();
- ha_close_connection(this);
+ ha_close_connection(this);
sp_cache_clear(&sp_proc_cache);
sp_cache_clear(&sp_func_cache);
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 517bf92abff..62cee00043b 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -327,6 +327,7 @@ public:
bool is_active(const char* log_file_name);
int update_log_index(LOG_INFO* linfo, bool need_update_threads);
void rotate_and_purge(uint flags);
+ bool flush_and_sync();
int purge_logs(const char *to_log, bool included,
bool need_mutex, bool need_update_threads,
ulonglong *decrease_log_space);
@@ -1264,18 +1265,18 @@ public:
pthread_mutex_unlock(&LOCK_delete);
}
void close_active_vio();
-#endif
+#endif
void awake(THD::killed_state state_to_set);
/*
For enter_cond() / exit_cond() to work the mutex must be got before
- enter_cond() (in 4.1 an assertion will soon ensure this); this mutex is
- then released by exit_cond(). Use must be:
- lock mutex; enter_cond(); your code; exit_cond().
+ enter_cond(); this mutex is then released by exit_cond().
+ Usage must be: lock mutex; enter_cond(); your code; exit_cond().
*/
inline const char* enter_cond(pthread_cond_t *cond, pthread_mutex_t* mutex,
const char* msg)
{
const char* old_msg = proc_info;
+ safe_mutex_assert_owner(mutex);
mysys_var->current_mutex = mutex;
mysys_var->current_cond = cond;
proc_info = msg;
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 32a62173059..d8c83434423 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -695,6 +695,7 @@ typedef struct st_lex
Item *default_value, *on_update_value;
LEX_STRING comment, ident;
LEX_USER *grant_user;
+ XID *xid;
gptr yacc_yyss,yacc_yyvs;
THD *thd;
CHARSET_INFO *charset;
@@ -738,7 +739,7 @@ typedef struct st_lex
enum enum_tx_isolation tx_isolation;
enum enum_ha_read_modes ha_read_mode;
union {
- enum ha_rkey_function ha_rkey_mode;
+ enum ha_rkey_function ha_rkey_mode;
enum xa_option_words xa_opt;
};
enum enum_var_type option_type;
@@ -764,15 +765,15 @@ typedef struct st_lex
ALTER_INFO alter_info;
/* Prepared statements SQL syntax:*/
LEX_STRING prepared_stmt_name; /* Statement name (in all queries) */
- /*
+ /*
Prepared statement query text or name of variable that holds the
prepared statement (in PREPARE ... queries)
*/
- LEX_STRING prepared_stmt_code;
+ LEX_STRING prepared_stmt_code;
/* If true, prepared_stmt_code is a name of variable that holds the query */
bool prepared_stmt_code_is_varref;
/* Names of user variables holding parameters (in EXECUTE) */
- List<LEX_STRING> prepared_stmt_params;
+ List<LEX_STRING> prepared_stmt_params;
/*
Points to part of global table list which contains time zone tables
implicitly used by the statement.
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 029563bb53d..69126e35554 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -4317,7 +4317,7 @@ unsent_create_error:
case SQLCOM_XA_START:
if (thd->transaction.xa_state == XA_IDLE && thd->lex->xa_opt == XA_RESUME)
{
- if (! thd->transaction.xid.eq(&thd->lex->ident))
+ if (! thd->transaction.xid.eq(thd->lex->xid))
{
my_error(ER_XAER_NOTA, MYF(0));
break;
@@ -4326,7 +4326,7 @@ unsent_create_error:
send_ok(thd);
break;
}
- if (thd->lex->ident.length > MAXGTRIDSIZE || thd->lex->xa_opt != XA_NONE)
+ if (thd->lex->xa_opt != XA_NONE)
{ // JOIN is not supported yet. TODO
my_error(ER_XAER_INVAL, MYF(0));
break;
@@ -4344,7 +4344,7 @@ unsent_create_error:
}
DBUG_ASSERT(thd->transaction.xid.is_null());
thd->transaction.xa_state=XA_ACTIVE;
- thd->transaction.xid.set(&thd->lex->ident);
+ thd->transaction.xid.set(thd->lex->xid);
thd->options= ((thd->options & (ulong) ~(OPTION_STATUS_NO_TRANS_UPDATE)) |
OPTION_BEGIN);
thd->server_status|= SERVER_STATUS_IN_TRANS;
@@ -4363,7 +4363,7 @@ unsent_create_error:
xa_state_names[thd->transaction.xa_state]);
break;
}
- if (!thd->transaction.xid.eq(&thd->lex->ident))
+ if (!thd->transaction.xid.eq(thd->lex->xid))
{
my_error(ER_XAER_NOTA, MYF(0));
break;
@@ -4378,7 +4378,7 @@ unsent_create_error:
xa_state_names[thd->transaction.xa_state]);
break;
}
- if (!thd->transaction.xid.eq(&thd->lex->ident))
+ if (!thd->transaction.xid.eq(thd->lex->xid))
{
my_error(ER_XAER_NOTA, MYF(0));
break;
@@ -4393,9 +4393,9 @@ unsent_create_error:
send_ok(thd);
break;
case SQLCOM_XA_COMMIT:
- if (!thd->transaction.xid.eq(&thd->lex->ident))
+ if (!thd->transaction.xid.eq(thd->lex->xid))
{
- if (!(res= !ha_commit_or_rollback_by_xid(&thd->lex->ident, 1)))
+ if (!(res= !ha_commit_or_rollback_by_xid(thd->lex->xid, 1)))
my_error(ER_XAER_NOTA, MYF(0));
else
send_ok(thd);
@@ -4428,9 +4428,9 @@ unsent_create_error:
thd->transaction.xa_state=XA_NOTR;
break;
case SQLCOM_XA_ROLLBACK:
- if (!thd->transaction.xid.eq(&thd->lex->ident))
+ if (!thd->transaction.xid.eq(thd->lex->xid))
{
- if (!(res= !ha_commit_or_rollback_by_xid(&thd->lex->ident, 0)))
+ if (!(res= !ha_commit_or_rollback_by_xid(thd->lex->xid, 0)))
my_error(ER_XAER_NOTA, MYF(0));
else
send_ok(thd);
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 4924f78dc0a..3c2577acf96 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -47,13 +47,13 @@ const LEX_STRING null_lex_str={0,0};
#define yyoverflow(A,B,C,D,E,F) {ulong val= *(F); if(my_yyoverflow((B), (D), &val)) { yyerror((char*) (A)); return 2; } else { *(F)= (YYSIZE_T)val; }}
-#define WARN_DEPRECATED(A,B) \
+#define WARN_DEPRECATED(A,B) \
push_warning_printf(((THD *)yythd), MYSQL_ERROR::WARN_LEVEL_WARN, \
- ER_WARN_DEPRECATED_SYNTAX, \
+ ER_WARN_DEPRECATED_SYNTAX, \
ER(ER_WARN_DEPRECATED_SYNTAX), (A), (B));
-#define TEST_ASSERT(A) \
- if (!(A)) \
+#define TEST_ASSERT(A) \
+ if (!(A)) \
{ \
yyerror(ER(ER_SYNTAX_ERROR)); \
YYABORT; \
@@ -243,7 +243,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token DUPLICATE_SYM
%token DYNAMIC_SYM
%token EACH_SYM
-%token EALLOCATE_SYM
%token ELSEIF_SYM
%token ELT_FUNC
%token ENABLE_SYM
@@ -702,7 +701,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
union_opt select_derived_init
%type <ulong_num>
- ULONG_NUM raid_types merge_insert_types
+ ulong_num raid_types merge_insert_types
%type <ulonglong_number>
ulonglong_num
@@ -1039,16 +1038,16 @@ master_def:
Lex->mi.password = $3.str;
}
|
- MASTER_PORT_SYM EQ ULONG_NUM
+ MASTER_PORT_SYM EQ ulong_num
{
Lex->mi.port = $3;
}
|
- MASTER_CONNECT_RETRY_SYM EQ ULONG_NUM
+ MASTER_CONNECT_RETRY_SYM EQ ulong_num
{
Lex->mi.connect_retry = $3;
}
- | MASTER_SSL_SYM EQ ULONG_NUM
+ | MASTER_SSL_SYM EQ ulong_num
{
Lex->mi.ssl= $3 ?
LEX_MASTER_INFO::SSL_ENABLE : LEX_MASTER_INFO::SSL_DISABLE;
@@ -1102,7 +1101,7 @@ master_file_def:
{
Lex->mi.relay_log_name = $3.str;
}
- | RELAY_LOG_POS_SYM EQ ULONG_NUM
+ | RELAY_LOG_POS_SYM EQ ulong_num
{
Lex->mi.relay_log_pos = $3;
/* Adjust if < BIN_LOG_HEADER_SIZE (same comment as Lex->mi.pos) */
@@ -1792,7 +1791,7 @@ sp_hcond_list:
;
sp_cond:
- ULONG_NUM
+ ulong_num
{ /* mysql errno */
$$= (sp_cond_type_t *)YYTHD->alloc(sizeof(sp_cond_type_t));
$$->type= sp_cond_type_t::number;
@@ -2578,18 +2577,18 @@ create_table_option:
| TYPE_SYM opt_equal storage_engines { Lex->create_info.db_type= $3; WARN_DEPRECATED("TYPE=storage_engine","ENGINE=storage_engine"); Lex->create_info.used_fields|= HA_CREATE_USED_ENGINE; }
| MAX_ROWS opt_equal ulonglong_num { Lex->create_info.max_rows= $3; Lex->create_info.used_fields|= HA_CREATE_USED_MAX_ROWS;}
| MIN_ROWS opt_equal ulonglong_num { Lex->create_info.min_rows= $3; Lex->create_info.used_fields|= HA_CREATE_USED_MIN_ROWS;}
- | AVG_ROW_LENGTH opt_equal ULONG_NUM { Lex->create_info.avg_row_length=$3; Lex->create_info.used_fields|= HA_CREATE_USED_AVG_ROW_LENGTH;}
+ | AVG_ROW_LENGTH opt_equal ulong_num { Lex->create_info.avg_row_length=$3; Lex->create_info.used_fields|= HA_CREATE_USED_AVG_ROW_LENGTH;}
| PASSWORD opt_equal TEXT_STRING_sys { Lex->create_info.password=$3.str; Lex->create_info.used_fields|= HA_CREATE_USED_PASSWORD; }
| COMMENT_SYM opt_equal TEXT_STRING_sys { Lex->create_info.comment=$3.str; Lex->create_info.used_fields|= HA_CREATE_USED_COMMENT; }
| AUTO_INC opt_equal ulonglong_num { Lex->create_info.auto_increment_value=$3; Lex->create_info.used_fields|= HA_CREATE_USED_AUTO;}
- | PACK_KEYS_SYM opt_equal ULONG_NUM { Lex->create_info.table_options|= $3 ? HA_OPTION_PACK_KEYS : HA_OPTION_NO_PACK_KEYS; Lex->create_info.used_fields|= HA_CREATE_USED_PACK_KEYS;}
+ | PACK_KEYS_SYM opt_equal ulong_num { Lex->create_info.table_options|= $3 ? HA_OPTION_PACK_KEYS : HA_OPTION_NO_PACK_KEYS; Lex->create_info.used_fields|= HA_CREATE_USED_PACK_KEYS;}
| PACK_KEYS_SYM opt_equal DEFAULT { Lex->create_info.table_options&= ~(HA_OPTION_PACK_KEYS | HA_OPTION_NO_PACK_KEYS); Lex->create_info.used_fields|= HA_CREATE_USED_PACK_KEYS;}
- | CHECKSUM_SYM opt_equal ULONG_NUM { Lex->create_info.table_options|= $3 ? HA_OPTION_CHECKSUM : HA_OPTION_NO_CHECKSUM; Lex->create_info.used_fields|= HA_CREATE_USED_CHECKSUM; }
- | DELAY_KEY_WRITE_SYM opt_equal ULONG_NUM { Lex->create_info.table_options|= $3 ? HA_OPTION_DELAY_KEY_WRITE : HA_OPTION_NO_DELAY_KEY_WRITE; Lex->create_info.used_fields|= HA_CREATE_USED_DELAY_KEY_WRITE; }
+ | CHECKSUM_SYM opt_equal ulong_num { Lex->create_info.table_options|= $3 ? HA_OPTION_CHECKSUM : HA_OPTION_NO_CHECKSUM; Lex->create_info.used_fields|= HA_CREATE_USED_CHECKSUM; }
+ | DELAY_KEY_WRITE_SYM opt_equal ulong_num { Lex->create_info.table_options|= $3 ? HA_OPTION_DELAY_KEY_WRITE : HA_OPTION_NO_DELAY_KEY_WRITE; Lex->create_info.used_fields|= HA_CREATE_USED_DELAY_KEY_WRITE; }
| ROW_FORMAT_SYM opt_equal row_types { Lex->create_info.row_type= $3; Lex->create_info.used_fields|= HA_CREATE_USED_ROW_FORMAT; }
| RAID_TYPE opt_equal raid_types { Lex->create_info.raid_type= $3; Lex->create_info.used_fields|= HA_CREATE_USED_RAID;}
- | RAID_CHUNKS opt_equal ULONG_NUM { Lex->create_info.raid_chunks= $3; Lex->create_info.used_fields|= HA_CREATE_USED_RAID;}
- | RAID_CHUNKSIZE opt_equal ULONG_NUM { Lex->create_info.raid_chunksize= $3*RAID_BLOCK_SIZE; Lex->create_info.used_fields|= HA_CREATE_USED_RAID;}
+ | RAID_CHUNKS opt_equal ulong_num { Lex->create_info.raid_chunks= $3; Lex->create_info.used_fields|= HA_CREATE_USED_RAID;}
+ | RAID_CHUNKSIZE opt_equal ulong_num { Lex->create_info.raid_chunksize= $3*RAID_BLOCK_SIZE; Lex->create_info.used_fields|= HA_CREATE_USED_RAID;}
| UNION_SYM opt_equal '(' table_list ')'
{
/* Move the union list to the merge_list */
@@ -2666,7 +2665,7 @@ row_types:
raid_types:
RAID_STRIPED_SYM { $$= RAID_TYPE_0; }
| RAID_0_SYM { $$= RAID_TYPE_0; }
- | ULONG_NUM { $$=$1;};
+ | ulong_num { $$=$1;};
merge_insert_types:
NO_SYM { $$= MERGE_INSERT_DISABLED; }
@@ -4704,7 +4703,7 @@ simple_expr:
{ $$= new Item_func_yearweek($3,new Item_int((char*) "0",0,1)); }
| YEARWEEK '(' expr ',' expr ')'
{ $$= new Item_func_yearweek($3, $5); }
- | BENCHMARK_SYM '(' ULONG_NUM ',' expr ')'
+ | BENCHMARK_SYM '(' ulong_num ',' expr ')'
{
$$=new Item_func_benchmark($3,$5);
Lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
@@ -4989,7 +4988,7 @@ table_ref:
join_table_list:
derived_table_list { TEST_ASSERT($$=$1); }
;
-
+
/* Warning - may return NULL in case of incomplete SELECT */
derived_table_list:
table_ref { $$=$1; }
@@ -5033,7 +5032,7 @@ join_table:
$$=$6;
}
| table_ref RIGHT opt_outer JOIN_SYM table_ref ON expr
- {
+ {
LEX *lex= Lex;
TEST_ASSERT($1 && $5);
if (!($$= lex->current_select->convert_right_join()))
@@ -5047,7 +5046,7 @@ join_table:
sel->save_names_for_using_list($1, $5);
}
USING '(' using_list ')'
- {
+ {
LEX *lex= Lex;
if (!($$= lex->current_select->convert_right_join()))
YYABORT;
@@ -5063,7 +5062,7 @@ join_table:
}
| table_ref NATURAL JOIN_SYM table_factor
{ TEST_ASSERT($1 && ($$=$4)); add_join_natural($1,$4); };
-
+
normal_join:
JOIN_SYM {}
@@ -5109,9 +5108,9 @@ table_factor:
sel->master_unit()->fake_select_lex;
}
if ($2->init_nested_join(lex->thd))
- YYABORT;
+ YYABORT;
$$= 0;
- /* incomplete derived tables return NULL, we must be
+ /* incomplete derived tables return NULL, we must be
nested in select_derived rule to be here. */
}
| '(' get_select_lex select_derived union_opt ')' opt_table_alias
@@ -5119,7 +5118,7 @@ table_factor:
/* Use $2 instead of Lex->current_select as derived table will
alter value of Lex->current_select. */
- if (!($3 || $6) && $2->embedding &&
+ if (!($3 || $6) && $2->embedding &&
!$2->embedding->nested_join->join_list.elements)
{
/* we have a derived table ($3 == NULL) but no alias,
@@ -5144,7 +5143,7 @@ table_factor:
(List<String> *)0)))
YYABORT;
- sel->add_joined_table($$);
+ sel->add_joined_table($$);
}
else
if ($4 || $6)
@@ -5171,7 +5170,7 @@ select_derived:
LEX *lex= Lex;
/* for normal joins, $3 != NULL and end_nested_join() != NULL,
for derived tables, both must equal NULL */
-
+
if (!($$= $1->end_nested_join(lex->thd)) && $3)
YYABORT;
if (!$3 && $$)
@@ -5215,7 +5214,7 @@ select_derived_init:
SELECT_SYM
{
LEX *lex= Lex;
- SELECT_LEX *sel= lex->current_select;
+ SELECT_LEX *sel= lex->current_select;
TABLE_LIST *embedding;
if (!sel->embedding || sel->end_nested_join(lex->thd))
{
@@ -5488,21 +5487,21 @@ limit_clause:
;
limit_options:
- ULONG_NUM
+ ulong_num
{
SELECT_LEX *sel= Select;
sel->select_limit= $1;
sel->offset_limit= 0L;
sel->explicit_limit= 1;
}
- | ULONG_NUM ',' ULONG_NUM
+ | ulong_num ',' ulong_num
{
SELECT_LEX *sel= Select;
sel->select_limit= $3;
sel->offset_limit= $1;
sel->explicit_limit= 1;
}
- | ULONG_NUM OFFSET_SYM ULONG_NUM
+ | ulong_num OFFSET_SYM ulong_num
{
SELECT_LEX *sel= Select;
sel->select_limit= $1;
@@ -5525,11 +5524,12 @@ delete_limit_clause:
sel->explicit_limit= 1;
};
-ULONG_NUM:
- NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); }
+ulong_num:
+ NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); }
+ | HEX_NUM { int error; $$= (ulong) strtol($1.str, (char**) 0, 16); }
| LONG_NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); }
| ULONGLONG_NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); }
- | DECIMAL_NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); }
+ | DECIMAL_NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); }
| FLOAT_NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); }
;
@@ -6139,7 +6139,7 @@ show_param:
| NEW_SYM MASTER_SYM FOR_SYM SLAVE WITH MASTER_LOG_FILE_SYM EQ
TEXT_STRING_sys AND_SYM MASTER_LOG_POS_SYM EQ ulonglong_num
AND_SYM MASTER_SERVER_ID_SYM EQ
- ULONG_NUM
+ ulong_num
{
Lex->sql_command = SQLCOM_SHOW_NEW_MASTER;
Lex->mi.log_file_name = $8.str;
@@ -6688,7 +6688,7 @@ fields_or_vars:
| field_or_var
{ Lex->field_list.push_back($1); }
;
-
+
field_or_var:
simple_ident_nospvar {$$= $1;}
| '@' ident_or_text
@@ -6836,9 +6836,9 @@ NUM_literal:
}
}
;
-
+
/**********************************************************************
-** Createing different items.
+** Creating different items.
**********************************************************************/
insert_ident:
@@ -6854,8 +6854,8 @@ table_wild:
| ident '.' ident '.' '*'
{
$$ = new Item_field((YYTHD->client_capabilities &
- CLIENT_NO_SCHEMA ? NullS : $1.str),
- $3.str,"*");
+ CLIENT_NO_SCHEMA ? NullS : $1.str),
+ $3.str,"*");
Lex->current_select->with_wild++;
}
;
@@ -6898,53 +6898,53 @@ simple_ident_nospvar:
(Item*) new Item_ref(NullS,NullS,$1.str);
}
| simple_ident_q { $$= $1; }
- ;
+ ;
simple_ident_q:
ident '.' ident
{
THD *thd= YYTHD;
LEX *lex= thd->lex;
-
+
/*
FIXME This will work ok in simple_ident_nospvar case because
we can't meet simple_ident_nospvar in trigger now. But it
should be changed in future.
*/
if (lex->sphead && lex->sphead->m_type == TYPE_ENUM_TRIGGER &&
- (!my_strcasecmp(system_charset_info, $1.str, "NEW") ||
+ (!my_strcasecmp(system_charset_info, $1.str, "NEW") ||
!my_strcasecmp(system_charset_info, $1.str, "OLD")))
{
Item_trigger_field *trg_fld;
bool new_row= ($1.str[0]=='N' || $1.str[0]=='n');
-
+
if (lex->trg_chistics.event == TRG_EVENT_INSERT &&
!new_row)
{
my_error(ER_TRG_NO_SUCH_ROW_IN_TRG, MYF(0), "OLD", "on INSERT");
YYABORT;
}
-
+
if (lex->trg_chistics.event == TRG_EVENT_DELETE &&
new_row)
{
my_error(ER_TRG_NO_SUCH_ROW_IN_TRG, MYF(0), "NEW", "on DELETE");
YYABORT;
}
-
+
if (!(trg_fld= new Item_trigger_field(new_row ?
Item_trigger_field::NEW_ROW:
Item_trigger_field::OLD_ROW,
$3.str)))
YYABORT;
-
+
/*
Let us add this item to list of all Item_trigger_field objects
in trigger.
*/
lex->trg_table_fields.link_in_list((byte *)trg_fld,
(byte**)&trg_fld->next_trg_field);
-
+
$$= (Item *)trg_fld;
}
else
@@ -7073,7 +7073,7 @@ ident:
;
ident_or_text:
- ident { $$=$1;}
+ ident { $$=$1;}
| TEXT_STRING_sys { $$=$1;}
| LEX_HOSTNAME { $$=$1;};
@@ -8124,25 +8124,25 @@ grant_option_list:
grant_option:
GRANT OPTION { Lex->grant |= GRANT_ACL;}
- | MAX_QUERIES_PER_HOUR ULONG_NUM
+ | MAX_QUERIES_PER_HOUR ulong_num
{
LEX *lex=Lex;
lex->mqh.questions=$2;
lex->mqh.specified_limits|= USER_RESOURCES::QUERIES_PER_HOUR;
}
- | MAX_UPDATES_PER_HOUR ULONG_NUM
+ | MAX_UPDATES_PER_HOUR ulong_num
{
LEX *lex=Lex;
lex->mqh.updates=$2;
lex->mqh.specified_limits|= USER_RESOURCES::UPDATES_PER_HOUR;
}
- | MAX_CONNECTIONS_PER_HOUR ULONG_NUM
+ | MAX_CONNECTIONS_PER_HOUR ulong_num
{
LEX *lex=Lex;
lex->mqh.conn_per_hour= $2;
lex->mqh.specified_limits|= USER_RESOURCES::CONNECTIONS_PER_HOUR;
}
- | MAX_USER_CONNECTIONS_SYM ULONG_NUM
+ | MAX_USER_CONNECTIONS_SYM ulong_num
{
LEX *lex=Lex;
lex->mqh.user_conn= $2;
@@ -8413,38 +8413,52 @@ check_option:
xa: XA_SYM begin_or_start xid opt_join_or_resume
{
- LEX *lex= Lex;
- lex->sql_command = SQLCOM_XA_START;
+ Lex->sql_command = SQLCOM_XA_START;
}
| XA_SYM END xid opt_suspend_or_migrate
{
- LEX *lex= Lex;
- lex->sql_command = SQLCOM_XA_END;
+ Lex->sql_command = SQLCOM_XA_END;
}
| XA_SYM PREPARE_SYM xid
{
- LEX *lex= Lex;
- lex->sql_command = SQLCOM_XA_PREPARE;
+ Lex->sql_command = SQLCOM_XA_PREPARE;
}
| XA_SYM COMMIT_SYM xid opt_one_phase
{
- LEX *lex= Lex;
- lex->sql_command = SQLCOM_XA_COMMIT;
+ Lex->sql_command = SQLCOM_XA_COMMIT;
}
| XA_SYM ROLLBACK_SYM xid
{
- LEX *lex= Lex;
- lex->sql_command = SQLCOM_XA_ROLLBACK;
+ Lex->sql_command = SQLCOM_XA_ROLLBACK;
}
| XA_SYM RECOVER_SYM
{
- LEX *lex= Lex;
- lex->sql_command = SQLCOM_XA_RECOVER;
+ Lex->sql_command = SQLCOM_XA_RECOVER;
}
;
-xid: ident_or_text { Lex->ident=$1; }
- ;
+xid: text_string
+ {
+ TEST_ASSERT($1->length() <= MAXGTRIDSIZE);
+ if (!(Lex->xid=(XID *)YYTHD->alloc(sizeof(XID))))
+ YYABORT;
+ Lex->xid->set(1L, $1->ptr(), $1->length(), 0, 0);
+ }
+ | text_string ',' text_string
+ {
+ TEST_ASSERT($1->length() <= MAXGTRIDSIZE && $3->length() <= MAXBQUALSIZE);
+ if (!(Lex->xid=(XID *)YYTHD->alloc(sizeof(XID))))
+ YYABORT;
+ Lex->xid->set(1L, $1->ptr(), $1->length(), $3->ptr(), $3->length());
+ }
+ | text_string ',' text_string ',' ulong_num
+ {
+ TEST_ASSERT($1->length() <= MAXGTRIDSIZE && $3->length() <= MAXBQUALSIZE);
+ if (!(Lex->xid=(XID *)YYTHD->alloc(sizeof(XID))))
+ YYABORT;
+ Lex->xid->set($5, $1->ptr(), $1->length(), $3->ptr(), $3->length());
+ }
+ ;
begin_or_start: BEGIN_SYM {}
| START_SYM {}