| 2222 | } |
| 2223 | |
| 2224 | static int |
| 2225 | commit_one_phase_2(THD *thd, bool all, THD_TRANS *trans, bool is_real_trans) |
| 2226 | { |
| 2227 | int error= 0; |
| 2228 | uint count= 0; |
| 2229 | Ha_trx_info *ha_info= trans->ha_list, *ha_info_next; |
| 2230 | DBUG_ENTER("commit_one_phase_2"); |
| 2231 | if (is_real_trans) |
| 2232 | DEBUG_SYNC(thd, "commit_one_phase_2"); |
| 2233 | |
| 2234 | if (ha_info) |
| 2235 | { |
| 2236 | int err= 0; |
| 2237 | Ha_trx_info *binlog_ha_info= get_binlog_hton(ha_info); |
| 2238 | if (binlog_ha_info) |
| 2239 | { |
| 2240 | if ((err= binlog_commit(thd, all, is_ro_1pc_trans(thd, ha_info, all, |
| 2241 | is_real_trans)))) |
| 2242 | { |
| 2243 | my_error(ER_ERROR_DURING_COMMIT, MYF(0), err); |
| 2244 | error= 1; |
| 2245 | goto err; |
| 2246 | } |
| 2247 | } |
| 2248 | #ifdef WITH_WSREP |
| 2249 | else |
| 2250 | { |
| 2251 | if (wsrep_on(thd)) |
| 2252 | error= thd->binlog_flush_pending_rows_event(TRUE); |
| 2253 | } |
| 2254 | #endif |
| 2255 | for (; ha_info; ha_info= ha_info_next) |
| 2256 | { |
| 2257 | transaction_participant *ht= ha_info->ht(); |
| 2258 | if ((err= ht->commit(thd, all))) |
| 2259 | { |
| 2260 | my_error(ER_ERROR_DURING_COMMIT, MYF(0), err); |
| 2261 | error=1; |
| 2262 | } |
| 2263 | /* Should this be done only if is_real_trans is set ? */ |
| 2264 | status_var_increment(thd->status_var.ha_commit_count); |
| 2265 | if (is_real_trans && ht != &binlog_tp && ha_info->is_trx_read_write()) |
| 2266 | ++count; |
| 2267 | ha_info_next= ha_info->next(); |
| 2268 | ha_info->reset(); /* keep it conveniently zero-filled */ |
| 2269 | } |
| 2270 | DEBUG_SYNC(thd, "commit_handlerton_after"); |
| 2271 | if (binlog_ha_info && is_real_trans) |
| 2272 | binlog_post_commit(thd, all); |
| 2273 | trans->ha_list= 0; |
| 2274 | trans->no_2pc=0; |
| 2275 | if (all) |
| 2276 | { |
| 2277 | if (thd->transaction->changed_tables) |
| 2278 | query_cache.invalidate(thd, thd->transaction->changed_tables); |
| 2279 | } |
| 2280 | } |
| 2281 |
no test coverage detected