diff options
author | Konstantin Osipov <kostja@sun.com> | 2010-05-06 02:02:08 +0400 |
---|---|---|
committer | Konstantin Osipov <kostja@sun.com> | 2010-05-06 02:02:08 +0400 |
commit | 9e62cf67b3cf0b92e4f57d49149000d640963bed (patch) | |
tree | e68e344b9f436b051706e830672ac8fbaa869662 /sql/handler.cc | |
parent | b47e4fbf834b260924d0eb15067f318f00dfbecd (diff) | |
download | mariadb-git-9e62cf67b3cf0b92e4f57d49149000d640963bed.tar.gz |
Clean-up, give better names, add comments to
thd->in_multi_stmt_transaction() and thd->active_transaction().
include/mysql_com.h:
Comment SERVER_STATUS_IN_TRANS flag.
sql/ha_ndbcluster.cc:
Rename: thd->in_multi_stmt_transaction() ->
thd->in_multi_stmt_transaction_mode().
sql/handler.cc:
Add comments.
sql/log.cc:
Rename: thd->in_multi_stmt_transaction() ->
thd->in_multi_stmt_transaction_mode().
sql/log_event.cc:
Rename: thd->in_multi_stmt_transaction() ->
thd->in_multi_stmt_transaction_mode().
sql/sql_base.cc:
Rename: thd->in_multi_stmt_transaction() ->
thd->in_multi_stmt_transaction_mode().
sql/sql_cache.cc:
Rename: thd->active_transaction() ->
thd->in_active_multi_stmt_transaction().
sql/sql_class.cc:
Rename: thd->in_multi_stmt_transaction() ->
thd->in_multi_stmt_transaction_mode().
sql/sql_class.h:
Rename and comment two transaction processing- related methods.
sql/sql_parse.cc:
Rename: thd->in_multi_stmt_transaction() ->
thd->in_multi_stmt_transaction_mode().
Rename: thd->active_transaction() ->
thd->in_active_multi_stmt_transaction().
sql/sql_prepare.cc:
Rename: thd->in_multi_stmt_transaction() ->
thd->in_multi_stmt_transaction_mode().
sql/sql_rename.cc:
Rename: thd->active_transaction() ->
thd->in_active_multi_stmt_transaction().
sql/sql_table.cc:
Rename: thd->active_transaction() ->
thd->in_active_multi_stmt_transaction().
sql/sys_vars.cc:
Rename: thd->active_transaction() ->
thd->in_active_multi_stmt_transaction().
sql/transaction.cc:
Rename: thd->in_multi_stmt_transaction() ->
thd->in_multi_stmt_transaction_mode().
Rename: thd->active_transaction() ->
thd->in_active_multi_stmt_transaction().
Diffstat (limited to 'sql/handler.cc')
-rw-r--r-- | sql/handler.cc | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/sql/handler.cc b/sql/handler.cc index ee02441e7ff..c0a5e2ff55c 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -1245,7 +1245,14 @@ end: /** @note This function does not care about global read lock. A caller should. + + @param[in] all Is set in case of explicit commit + (COMMIT statement), or implicit commit + issued by DDL. Is not set when called + at the end of statement, even if + autocommit=1. */ + int ha_commit_one_phase(THD *thd, bool all) { int error=0; @@ -1253,9 +1260,15 @@ int ha_commit_one_phase(THD *thd, bool all) /* "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, + transaction 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. + We establish the value of 'is_real_trans' by checking + if it's an explicit COMMIT/BEGIN statement, or implicit + commit issued by DDL (all == TRUE), or if we're running + in autocommit mode (it's only in the autocommit mode + ha_commit_one_phase() can be called with an empty + transaction.all.ha_list, see why in trans_register_ha()). */ bool is_real_trans=all || thd->transaction.all.ha_list == 0; Ha_trx_info *ha_info= trans->ha_list, *ha_info_next; @@ -1303,9 +1316,15 @@ int ha_rollback_trans(THD *thd, bool all) /* "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, + transaction 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. + We establish the value of 'is_real_trans' by checking + if it's an explicit COMMIT or BEGIN statement, or implicit + commit issued by DDL (in these cases all == TRUE), + or if we're running in autocommit mode (it's only in the autocommit mode + ha_commit_one_phase() is called with an empty + transaction.all.ha_list, see why in trans_register_ha()). */ bool is_real_trans=all || thd->transaction.all.ha_list == 0; DBUG_ENTER("ha_rollback_trans"); @@ -1358,7 +1377,7 @@ int ha_rollback_trans(THD *thd, bool all) if (all) thd->variables.tx_isolation=thd->session_tx_isolation; } - /* Always cleanup. Even if there nht==0. There may be savepoints. */ + /* Always cleanup. Even if nht==0. There may be savepoints. */ if (is_real_trans) thd->transaction.cleanup(); if (all) |