Commit 3738f785 authored by Tatiana A. Nurnberg's avatar Tatiana A. Nurnberg

auto-merge

parents 56ae4a7f 12f91b1d
...@@ -4110,7 +4110,7 @@ static my_bool dump_all_views_in_db(char *database) ...@@ -4110,7 +4110,7 @@ static my_bool dump_all_views_in_db(char *database)
for (numrows= 0 ; (table= getTableName(1)); ) for (numrows= 0 ; (table= getTableName(1)); )
{ {
char *end= strmov(afterdot, table); char *end= strmov(afterdot, table);
if (include_table((uchar*) hash_key,end - hash_key)) if (include_table(hash_key,end - hash_key))
{ {
numrows++; numrows++;
dynstr_append_checked(&query, quote_name(table, table_buff, 1)); dynstr_append_checked(&query, quote_name(table, table_buff, 1));
...@@ -4131,7 +4131,7 @@ static my_bool dump_all_views_in_db(char *database) ...@@ -4131,7 +4131,7 @@ static my_bool dump_all_views_in_db(char *database)
while ((table= getTableName(0))) while ((table= getTableName(0)))
{ {
char *end= strmov(afterdot, table); char *end= strmov(afterdot, table);
if (include_table((uchar*) hash_key, end - hash_key)) if (include_table(hash_key, end - hash_key))
get_view_structure(table, database); get_view_structure(table, database);
} }
if (opt_xml) if (opt_xml)
......
...@@ -701,7 +701,7 @@ rl_function_of_keyseq (keyseq, map, type) ...@@ -701,7 +701,7 @@ rl_function_of_keyseq (keyseq, map, type)
{ {
unsigned char ic = keyseq[i]; unsigned char ic = keyseq[i];
if (META_CHAR (ic) && _rl_convert_meta_chars_to_ascii) if (META_BYTE (ic) && _rl_convert_meta_chars_to_ascii)
{ {
if (map[ESC].type == ISKMAP) if (map[ESC].type == ISKMAP)
{ {
......
...@@ -59,7 +59,8 @@ ...@@ -59,7 +59,8 @@
#define largest_char 255 /* Largest character value. */ #define largest_char 255 /* Largest character value. */
#define CTRL_CHAR(c) ((c) < control_character_threshold && (((c) & 0x80) == 0)) #define CTRL_CHAR(c) ((c) < control_character_threshold && (((c) & 0x80) == 0))
#define META_CHAR(c) ((c) > meta_character_threshold && (c) <= largest_char) #define META_BYTE(c) ((c) > meta_character_threshold)
#define META_CHAR(c) (META_BYTE(c) && (c) <= largest_char)
#define CTRL(c) ((c) & control_character_mask) #define CTRL(c) ((c) & control_character_mask)
#define META(c) ((c) | meta_character_bit) #define META(c) ((c) | meta_character_bit)
......
...@@ -1888,7 +1888,7 @@ rl_character_len (c, pos) ...@@ -1888,7 +1888,7 @@ rl_character_len (c, pos)
uc = (unsigned char)c; uc = (unsigned char)c;
if (META_CHAR (uc)) if (META_BYTE (uc))
return ((_rl_output_meta_chars == 0) ? 4 : 1); return ((_rl_output_meta_chars == 0) ? 4 : 1);
if (uc == '\t') if (uc == '\t')
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
.\" === Set line length .\" === Set line length
.\".ll 6.5i .\".ll 6.5i
.TL .TL
.warn 0
D B U G D B U G
.P 0 .P 0
C Program Debugging Package C Program Debugging Package
......
...@@ -511,7 +511,7 @@ typedef int (*qsort2_cmp)(const void *, const void *, const void *); ...@@ -511,7 +511,7 @@ typedef int (*qsort2_cmp)(const void *, const void *, const void *);
((info)->write_pos + (Count) <=(info)->write_end ?\ ((info)->write_pos + (Count) <=(info)->write_end ?\
(memcpy((info)->write_pos, (Buffer), (size_t)(Count)),\ (memcpy((info)->write_pos, (Buffer), (size_t)(Count)),\
((info)->write_pos+=(Count)),0) : \ ((info)->write_pos+=(Count)),0) : \
(*(info)->write_function)((info),(Buffer),(Count))) (*(info)->write_function)((info),(uchar *)(Buffer),(Count)))
#define my_b_get(info) \ #define my_b_get(info) \
((info)->read_pos != (info)->read_end ?\ ((info)->read_pos != (info)->read_end ?\
......
...@@ -25,6 +25,7 @@ test_SCRIPTS = mtr \ ...@@ -25,6 +25,7 @@ test_SCRIPTS = mtr \
mysql-stress-test.pl mysql-stress-test.pl
nobase_test_DATA = \ nobase_test_DATA = \
valgrind.supp \
lib/v1/mysql-test-run.pl \ lib/v1/mysql-test-run.pl \
lib/v1/mtr_cases.pl \ lib/v1/mtr_cases.pl \
lib/v1/mtr_io.pl \ lib/v1/mtr_io.pl \
...@@ -41,7 +42,6 @@ nobase_test_DATA = \ ...@@ -41,7 +42,6 @@ nobase_test_DATA = \
lib/v1/mtr_im.pl \ lib/v1/mtr_im.pl \
lib/v1/mtr_process.pl \ lib/v1/mtr_process.pl \
lib/v1/mtr_unique.pl \ lib/v1/mtr_unique.pl \
\
lib/mtr_cases.pm \ lib/mtr_cases.pm \
lib/mtr_gcov.pl \ lib/mtr_gcov.pl \
lib/mtr_gprof.pl \ lib/mtr_gprof.pl \
...@@ -69,9 +69,8 @@ nobase_test_DATA = \ ...@@ -69,9 +69,8 @@ nobase_test_DATA = \
SUBDIRS = lib/My/SafeProcess SUBDIRS = lib/My/SafeProcess
EXTRA_DIST = README \ EXTRA_DIST = README \
valgrind.supp \
$(test_SCRIPTS) \ $(test_SCRIPTS) \
$(nobase_test_DATA) $(nobase_test_DATA)
# List of directories containing test + result files and the # List of directories containing test + result files and the
# related test data files that should be copied # related test data files that should be copied
...@@ -93,7 +92,7 @@ TEST_DIRS = t r include std_data std_data/parts collections \ ...@@ -93,7 +92,7 @@ TEST_DIRS = t r include std_data std_data/parts collections \
suite/jp suite/jp/t suite/jp/r suite/jp/std_data suite/jp/include \ suite/jp suite/jp/t suite/jp/r suite/jp/std_data suite/jp/include \
suite/manual/t suite/manual/r \ suite/manual/t suite/manual/r \
suite/ndb_team suite/ndb_team/t suite/ndb_team/r \ suite/ndb_team suite/ndb_team/t suite/ndb_team/r \
suite/rpl suite/rpl/data suite/rpl/include suite/rpl/r \ suite/rpl suite/rpl/include suite/rpl/r \
suite/rpl/t \ suite/rpl/t \
suite/stress/include suite/stress/t suite/stress/r \ suite/stress/include suite/stress/t suite/stress/r \
suite/ndb suite/ndb/t suite/ndb/r \ suite/ndb suite/ndb/t suite/ndb/r \
......
...@@ -75,3 +75,9 @@ xa rollback 'a','c'; ...@@ -75,3 +75,9 @@ xa rollback 'a','c';
xa start 'a','c'; xa start 'a','c';
drop table t1; drop table t1;
End of 5.0 tests End of 5.0 tests
xa start 'a';
xa end 'a';
xa rollback 'a';
xa start 'a';
xa end 'a';
xa rollback 'a';
...@@ -124,6 +124,17 @@ drop table t1; ...@@ -124,6 +124,17 @@ drop table t1;
--echo End of 5.0 tests --echo End of 5.0 tests
#
# Bug#44672: Assertion failed: thd->transaction.xid_state.xid.is_null()
#
xa start 'a';
xa end 'a';
xa rollback 'a';
xa start 'a';
xa end 'a';
xa rollback 'a';
# Wait till all disconnects are completed # Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc --source include/wait_until_count_sessions.inc
...@@ -1073,6 +1073,13 @@ int ha_commit_trans(THD *thd, bool all) ...@@ -1073,6 +1073,13 @@ int ha_commit_trans(THD *thd, bool all)
user, or an implicit commit issued by a DDL. user, or an implicit commit issued by a DDL.
*/ */
THD_TRANS *trans= all ? &thd->transaction.all : &thd->transaction.stmt; THD_TRANS *trans= all ? &thd->transaction.all : &thd->transaction.stmt;
/*
"real" is a nick name for a transaction for which a commit will
make persistent changes. E.g. a 'stmt' transaction inside a 'all'
transation is not 'real': even though it's possible to commit it,
the changes are not durable as they might be rolled back if the
enclosing 'all' transaction is rolled back.
*/
bool is_real_trans= all || thd->transaction.all.ha_list == 0; bool is_real_trans= all || thd->transaction.all.ha_list == 0;
Ha_trx_info *ha_info= trans->ha_list; Ha_trx_info *ha_info= trans->ha_list;
my_xid xid= thd->transaction.xid_state.xid.get_my_xid(); my_xid xid= thd->transaction.xid_state.xid.get_my_xid();
...@@ -1184,16 +1191,9 @@ int ha_commit_trans(THD *thd, bool all) ...@@ -1184,16 +1191,9 @@ int ha_commit_trans(THD *thd, bool all)
if (rw_trans) if (rw_trans)
start_waiting_global_read_lock(thd); start_waiting_global_read_lock(thd);
} }
else if (all) /* Free resources and perform other cleanup even for 'empty' transactions. */
{ else if (is_real_trans)
/*
A COMMIT of an empty transaction. There may be savepoints.
Destroy them. If the transaction is not empty
savepoints are cleared in ha_commit_one_phase()
or ha_rollback_trans().
*/
thd->transaction.cleanup(); thd->transaction.cleanup();
}
#endif /* USING_TRANSACTIONS */ #endif /* USING_TRANSACTIONS */
DBUG_RETURN(error); DBUG_RETURN(error);
} }
...@@ -1206,6 +1206,13 @@ int ha_commit_one_phase(THD *thd, bool all) ...@@ -1206,6 +1206,13 @@ int ha_commit_one_phase(THD *thd, bool all)
{ {
int error=0; int error=0;
THD_TRANS *trans=all ? &thd->transaction.all : &thd->transaction.stmt; THD_TRANS *trans=all ? &thd->transaction.all : &thd->transaction.stmt;
/*
"real" is a nick name for a transaction for which a commit will
make persistent changes. E.g. a 'stmt' transaction inside a 'all'
transation is not 'real': even though it's possible to commit it,
the changes are not durable as they might be rolled back if the
enclosing 'all' transaction is rolled back.
*/
bool is_real_trans=all || thd->transaction.all.ha_list == 0; bool is_real_trans=all || thd->transaction.all.ha_list == 0;
Ha_trx_info *ha_info= trans->ha_list, *ha_info_next; Ha_trx_info *ha_info= trans->ha_list, *ha_info_next;
DBUG_ENTER("ha_commit_one_phase"); DBUG_ENTER("ha_commit_one_phase");
...@@ -1227,8 +1234,6 @@ int ha_commit_one_phase(THD *thd, bool all) ...@@ -1227,8 +1234,6 @@ int ha_commit_one_phase(THD *thd, bool all)
} }
trans->ha_list= 0; trans->ha_list= 0;
trans->no_2pc=0; trans->no_2pc=0;
if (is_real_trans)
thd->transaction.xid_state.xid.null();
if (all) if (all)
{ {
#ifdef HAVE_QUERY_CACHE #ifdef HAVE_QUERY_CACHE
...@@ -1236,8 +1241,9 @@ int ha_commit_one_phase(THD *thd, bool all) ...@@ -1236,8 +1241,9 @@ int ha_commit_one_phase(THD *thd, bool all)
query_cache.invalidate(thd->transaction.changed_tables); query_cache.invalidate(thd->transaction.changed_tables);
#endif #endif
thd->variables.tx_isolation=thd->session_tx_isolation; thd->variables.tx_isolation=thd->session_tx_isolation;
thd->transaction.cleanup();
} }
if (is_real_trans)
thd->transaction.cleanup();
} }
#endif /* USING_TRANSACTIONS */ #endif /* USING_TRANSACTIONS */
DBUG_RETURN(error); DBUG_RETURN(error);
...@@ -1249,6 +1255,13 @@ int ha_rollback_trans(THD *thd, bool all) ...@@ -1249,6 +1255,13 @@ int ha_rollback_trans(THD *thd, bool all)
int error=0; int error=0;
THD_TRANS *trans=all ? &thd->transaction.all : &thd->transaction.stmt; THD_TRANS *trans=all ? &thd->transaction.all : &thd->transaction.stmt;
Ha_trx_info *ha_info= trans->ha_list, *ha_info_next; Ha_trx_info *ha_info= trans->ha_list, *ha_info_next;
/*
"real" is a nick name for a transaction for which a commit will
make persistent changes. E.g. a 'stmt' transaction inside a 'all'
transation is not 'real': even though it's possible to commit it,
the changes are not durable as they might be rolled back if the
enclosing 'all' transaction is rolled back.
*/
bool is_real_trans=all || thd->transaction.all.ha_list == 0; bool is_real_trans=all || thd->transaction.all.ha_list == 0;
DBUG_ENTER("ha_rollback_trans"); DBUG_ENTER("ha_rollback_trans");
...@@ -1294,18 +1307,13 @@ int ha_rollback_trans(THD *thd, bool all) ...@@ -1294,18 +1307,13 @@ int ha_rollback_trans(THD *thd, bool all)
} }
trans->ha_list= 0; trans->ha_list= 0;
trans->no_2pc=0; trans->no_2pc=0;
if (is_real_trans) if (is_real_trans && thd->transaction_rollback_request)
{ thd->transaction.xid_state.rm_error= thd->main_da.sql_errno();
if (thd->transaction_rollback_request)
thd->transaction.xid_state.rm_error= thd->main_da.sql_errno();
else
thd->transaction.xid_state.xid.null();
}
if (all) if (all)
thd->variables.tx_isolation=thd->session_tx_isolation; thd->variables.tx_isolation=thd->session_tx_isolation;
} }
/* Always cleanup. Even if there nht==0. There may be savepoints. */ /* Always cleanup. Even if there nht==0. There may be savepoints. */
if (all) if (is_real_trans)
thd->transaction.cleanup(); thd->transaction.cleanup();
#endif /* USING_TRANSACTIONS */ #endif /* USING_TRANSACTIONS */
if (all) if (all)
......
...@@ -1464,6 +1464,14 @@ class THD :public Statement, ...@@ -1464,6 +1464,14 @@ class THD :public Statement,
{ {
changed_tables= 0; changed_tables= 0;
savepoints= 0; savepoints= 0;
/*
If rm_error is raised, it means that this piece of a distributed
transaction has failed and must be rolled back. But the user must
rollback it explicitly, so don't start a new distributed XA until
then.
*/
if (!xid_state.rm_error)
xid_state.xid.null();
#ifdef USING_TRANSACTIONS #ifdef USING_TRANSACTIONS
free_root(&mem_root,MYF(MY_KEEP_PREALLOC)); free_root(&mem_root,MYF(MY_KEEP_PREALLOC));
#endif #endif
......
...@@ -46,7 +46,7 @@ int myrg_create(const char *name, const char **table_names, ...@@ -46,7 +46,7 @@ int myrg_create(const char *name, const char **table_names,
fn_same(buff,name,4); fn_same(buff,name,4);
*(end=strend(buff))='\n'; *(end=strend(buff))='\n';
end[1]=0; end[1]=0;
if (my_write(file,(char*) buff,(uint) (end-buff+1), if (my_write(file,(uchar*) buff,(uint) (end-buff+1),
MYF(MY_WME | MY_NABP))) MYF(MY_WME | MY_NABP)))
goto err; goto err;
} }
......
...@@ -328,7 +328,10 @@ my_string_repertoire(CHARSET_INFO *cs, const char *str, ulong length) ...@@ -328,7 +328,10 @@ my_string_repertoire(CHARSET_INFO *cs, const char *str, ulong length)
{ {
my_wc_t wc; my_wc_t wc;
int chlen; int chlen;
for (; (chlen= cs->cset->mb_wc(cs, &wc, str, strend)) > 0; str+= chlen) for (; (chlen= cs->cset->mb_wc(cs, &wc,
(const unsigned char *) str,
(const unsigned char *) strend)) > 0;
str+= chlen)
{ {
if (wc > 0x7F) if (wc > 0x7F)
return MY_REPERTOIRE_UNICODE30; return MY_REPERTOIRE_UNICODE30;
......
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