diff options
author | Sergei Golubchik <serg@mariadb.org> | 2017-03-13 10:18:15 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2017-03-31 19:28:58 +0200 |
commit | 143e771deef47e4afdd5d8dcdaddc424f919af83 (patch) | |
tree | bece802f0bcecc31b1b988b814332c3b8fd5f1b3 | |
parent | 6e899642fe65eb3f36ff33fbb7b77052a0f216e6 (diff) | |
download | mariadb-git-143e771deef47e4afdd5d8dcdaddc424f919af83.tar.gz |
ha_start_consistent_snapshot() did not check for errors
-rw-r--r-- | sql/handler.cc | 13 | ||||
-rw-r--r-- | sql/sql_parse.cc | 4 |
2 files changed, 11 insertions, 6 deletions
diff --git a/sql/handler.cc b/sql/handler.cc index c28ab2a7bd7..a6016646d3c 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -2212,7 +2212,8 @@ static my_bool snapshot_handlerton(THD *thd, plugin_ref plugin, if (hton->state == SHOW_OPTION_YES && hton->start_consistent_snapshot) { - hton->start_consistent_snapshot(hton, thd); + if (hton->start_consistent_snapshot(hton, thd)) + return TRUE; *((bool *)arg)= false; } return FALSE; @@ -2220,7 +2221,7 @@ static my_bool snapshot_handlerton(THD *thd, plugin_ref plugin, int ha_start_consistent_snapshot(THD *thd) { - bool warn= true; + bool err, warn= true; /* Holding the LOCK_commit_ordered mutex ensures that we get the same @@ -2230,9 +2231,15 @@ int ha_start_consistent_snapshot(THD *thd) have a consistent binlog position. */ mysql_mutex_lock(&LOCK_commit_ordered); - plugin_foreach(thd, snapshot_handlerton, MYSQL_STORAGE_ENGINE_PLUGIN, &warn); + err= plugin_foreach(thd, snapshot_handlerton, MYSQL_STORAGE_ENGINE_PLUGIN, &warn); mysql_mutex_unlock(&LOCK_commit_ordered); + if (err) + { + ha_rollback_trans(thd, true); + return 1; + } + /* Same idea as when one wants to CREATE TABLE in one engine which does not exist: diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index bbf3bc00a9d..590d2dfe681 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -5515,9 +5515,7 @@ end_with_restore_list: (longlong) thd->thread_id); goto error; } - /* MyRocks: hton->start_consistent_snapshot call may fail with an error */ - if (!thd->is_error()) - my_ok(thd); + my_ok(thd); break; case SQLCOM_COMMIT: { |