summaryrefslogtreecommitdiff
path: root/sql/handler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/handler.cc')
-rw-r--r--sql/handler.cc21
1 files changed, 11 insertions, 10 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index 7db339f89e8..ca535f35c57 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -1186,17 +1186,16 @@ int ha_commit_trans(THD *thd, bool all)
Sic: we know that prepare() is not NULL since otherwise
trans->no_2pc would have been set.
*/
- if ((err= ht->prepare(ht, thd, all)))
- my_error(ER_ERROR_DURING_COMMIT, MYF(0), err);
+ err= ht->prepare(ht, thd, all);
status_var_increment(thd->status_var.ha_prepare_count);
+ if (err)
+ my_error(ER_ERROR_DURING_COMMIT, MYF(0), err);
if (err)
goto err;
- if (ht->prepare_ordered)
- need_prepare_ordered= TRUE;
- if (ht->commit_ordered)
- need_commit_ordered= TRUE;
+ need_prepare_ordered|= (ht->prepare_ordered != NULL);
+ need_commit_ordered|= (ht->commit_ordered != NULL);
}
DBUG_EXECUTE_IF("crash_commit_after_prepare", DBUG_ABORT(););
@@ -1225,8 +1224,7 @@ int ha_commit_trans(THD *thd, bool all)
/* Come here if error and we need to rollback. */
err:
- if (!error)
- error= 1;
+ error= 1; /* Transaction was rolled back */
ha_rollback_trans(thd, all);
end:
@@ -1877,8 +1875,11 @@ int ha_start_consistent_snapshot(THD *thd)
bool warn= true;
/*
- Holding the LOCK_commit_ordered mutex ensures that for any transaction
- we either see it committed in all engines, or in none.
+ Holding the LOCK_commit_ordered mutex ensures that we get the same
+ snapshot for all engines (including the binary log). This allows us
+ among other things to do backups with
+ START TRANSACTION WITH CONSISTENT SNAPSHOT and
+ have a consistent binlog position.
*/
pthread_mutex_lock(&LOCK_commit_ordered);
plugin_foreach(thd, snapshot_handlerton, MYSQL_STORAGE_ENGINE_PLUGIN, &warn);