| 2171 | */ |
| 2172 | |
| 2173 | int ha_commit_one_phase(THD *thd, bool all) |
| 2174 | { |
| 2175 | THD_TRANS *trans=all ? &thd->transaction->all : &thd->transaction->stmt; |
| 2176 | /* |
| 2177 | "real" is a nick name for a transaction for which a commit will |
| 2178 | make persistent changes. E.g. a 'stmt' transaction inside a 'all' |
| 2179 | transaction is not 'real': even though it's possible to commit it, |
| 2180 | the changes are not durable as they might be rolled back if the |
| 2181 | enclosing 'all' transaction is rolled back. |
| 2182 | We establish the value of 'is_real_trans' by checking |
| 2183 | if it's an explicit COMMIT/BEGIN statement, or implicit |
| 2184 | commit issued by DDL (all == TRUE), or if we're running |
| 2185 | in autocommit mode (it's only in the autocommit mode |
| 2186 | ha_commit_one_phase() can be called with an empty |
| 2187 | transaction.all.ha_list, see why in trans_register_ha()). |
| 2188 | */ |
| 2189 | bool is_real_trans= ((all || thd->transaction->all.ha_list == 0) && |
| 2190 | !(thd->variables.option_bits & OPTION_GTID_BEGIN)); |
| 2191 | int res; |
| 2192 | DBUG_ENTER("ha_commit_one_phase"); |
| 2193 | if (is_real_trans) |
| 2194 | { |
| 2195 | DEBUG_SYNC(thd, "ha_commit_one_phase"); |
| 2196 | if ((res= thd->wait_for_prior_commit())) |
| 2197 | DBUG_RETURN(res); |
| 2198 | } |
| 2199 | res= commit_one_phase_2(thd, all, trans, is_real_trans); |
| 2200 | DBUG_RETURN(res); |
| 2201 | } |
| 2202 | |
| 2203 | static bool is_ro_1pc_trans(THD *thd, Ha_trx_info *ha_info, bool all, |
| 2204 | bool is_real_trans) |
no test coverage detected