summaryrefslogtreecommitdiff
path: root/sql/transaction.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2012-10-01 13:15:29 +0200
committerSergei Golubchik <sergii@pisem.net>2012-10-01 13:15:29 +0200
commit416d0aebbfaaa00802d00105a0bd2faedb8b8f04 (patch)
tree5244b83a9f22d4d5899154c9a64a316111bbe6b6 /sql/transaction.cc
parentadf6e145f77d2f7b049b977ee55ed12d05b96eac (diff)
downloadmariadb-git-416d0aebbfaaa00802d00105a0bd2faedb8b8f04.tar.gz
more fixes for test cases
mysql-test/suite/innodb/include/restart_and_reinit.inc: drop and recreate mysql.innodb* tables when deleting innodb table spaces mysql-test/t/ssl_8k_key-master.opt: with loose- prefix ssl errors are ignored sql-common/client.c: compiler warnings sql/field.cc: use the new function sql/item.cc: don't convert time to double or decimal via longlong, this loses sub-second part. Use dedicated functions. sql/item.h: incorrect cast_to_int type for params sql/item_strfunc.cc: use the new function sql/lex.h: unused sql/my_decimal.h: helper macro sql/sql_plugin.cc: workaround for a compiler warning sql/sql_yacc.yy: unused sql/transaction.cc: fix the merge for SERVER_STATUS_IN_TRANS_READONLY protocol flag storage/sphinx/CMakeLists.txt: compiler warnings
Diffstat (limited to 'sql/transaction.cc')
-rw-r--r--sql/transaction.cc43
1 files changed, 28 insertions, 15 deletions
diff --git a/sql/transaction.cc b/sql/transaction.cc
index 277a95b90a9..7d8fc89ec8c 100644
--- a/sql/transaction.cc
+++ b/sql/transaction.cc
@@ -135,7 +135,9 @@ bool trans_begin(THD *thd, uint flags)
(thd->variables.option_bits & OPTION_TABLE_LOCK))
{
thd->variables.option_bits&= ~OPTION_TABLE_LOCK;
- thd->server_status&= ~SERVER_STATUS_IN_TRANS;
+ thd->server_status&=
+ ~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY);
+ DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS"));
res= test(ha_commit_trans(thd, TRUE));
}
@@ -178,6 +180,7 @@ bool trans_begin(THD *thd, uint flags)
thd->server_status|= SERVER_STATUS_IN_TRANS;
if (thd->tx_read_only)
thd->server_status|= SERVER_STATUS_IN_TRANS_READONLY;
+ DBUG_PRINT("info", ("setting SERVER_STATUS_IN_TRANS"));
/* ha_start_consistent_snapshot() relies on OPTION_BEGIN flag set. */
if (flags & MYSQL_START_TRANS_OPT_WITH_CONS_SNAPSHOT)
@@ -204,16 +207,18 @@ bool trans_commit(THD *thd)
if (trans_check(thd))
DBUG_RETURN(TRUE);
- thd->server_status&= ~SERVER_STATUS_IN_TRANS;
+ thd->server_status&=
+ ~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY);
+ DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS"));
res= ha_commit_trans(thd, TRUE);
- if (res)
/*
if res is non-zero, then ha_commit_trans has rolled back the
transaction, so the hooks for rollback will be called.
*/
- RUN_HOOK(transaction, after_rollback, (thd, FALSE));
+ if (res)
+ (void) RUN_HOOK(transaction, after_rollback, (thd, FALSE));
else
- RUN_HOOK(transaction, after_commit, (thd, FALSE));
+ (void) RUN_HOOK(transaction, after_commit, (thd, FALSE));
thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
thd->transaction.all.modified_non_trans_table= FALSE;
thd->lex->start_transaction_opt= 0;
@@ -247,7 +252,9 @@ bool trans_commit_implicit(THD *thd)
/* Safety if one did "drop table" on locked tables */
if (!thd->locked_tables_mode)
thd->variables.option_bits&= ~OPTION_TABLE_LOCK;
- thd->server_status&= ~SERVER_STATUS_IN_TRANS;
+ thd->server_status&=
+ ~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY);
+ DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS"));
res= test(ha_commit_trans(thd, TRUE));
}
@@ -256,7 +263,7 @@ bool trans_commit_implicit(THD *thd)
/*
Upon implicit commit, reset the current transaction
- isolation level. We do not care about
+ isolation level and access mode. We do not care about
@@session.completion_type since it's documented
to not have any effect on implicit commit.
*/
@@ -284,9 +291,11 @@ bool trans_rollback(THD *thd)
if (trans_check(thd))
DBUG_RETURN(TRUE);
- thd->server_status&= ~SERVER_STATUS_IN_TRANS;
+ thd->server_status&=
+ ~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY);
+ DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS"));
res= ha_rollback_trans(thd, TRUE);
- RUN_HOOK(transaction, after_rollback, (thd, FALSE));
+ (void) RUN_HOOK(transaction, after_rollback, (thd, FALSE));
thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
thd->transaction.all.modified_non_trans_table= FALSE;
thd->lex->start_transaction_opt= 0;
@@ -332,14 +341,14 @@ bool trans_commit_stmt(THD *thd)
}
}
- if (res)
/*
if res is non-zero, then ha_commit_trans has rolled back the
transaction, so the hooks for rollback will be called.
*/
- RUN_HOOK(transaction, after_rollback, (thd, FALSE));
+ if (res)
+ (void) RUN_HOOK(transaction, after_rollback, (thd, FALSE));
else
- RUN_HOOK(transaction, after_commit, (thd, FALSE));
+ (void) RUN_HOOK(transaction, after_commit, (thd, FALSE));
thd->transaction.stmt.reset();
@@ -379,7 +388,7 @@ bool trans_rollback_stmt(THD *thd)
}
}
- RUN_HOOK(transaction, after_rollback, (thd, FALSE));
+ (void) RUN_HOOK(transaction, after_rollback, (thd, FALSE));
thd->transaction.stmt.reset();
@@ -756,7 +765,9 @@ bool trans_xa_commit(THD *thd)
thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
thd->transaction.all.modified_non_trans_table= FALSE;
- thd->server_status&= ~SERVER_STATUS_IN_TRANS;
+ thd->server_status&=
+ ~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY);
+ DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS"));
xid_cache_delete(&thd->transaction.xid_state);
thd->transaction.xid_state.xa_state= XA_NOTR;
@@ -803,7 +814,9 @@ bool trans_xa_rollback(THD *thd)
thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
thd->transaction.all.modified_non_trans_table= FALSE;
- thd->server_status&= ~SERVER_STATUS_IN_TRANS;
+ thd->server_status&=
+ ~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY);
+ DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS"));
xid_cache_delete(&thd->transaction.xid_state);
thd->transaction.xid_state.xa_state= XA_NOTR;