| 303 | } |
| 304 | |
| 305 | int Wsrep_high_priority_service::commit(const wsrep::ws_handle& ws_handle, |
| 306 | const wsrep::ws_meta& ws_meta) |
| 307 | { |
| 308 | DBUG_ENTER("Wsrep_high_priority_service::commit"); |
| 309 | THD* thd= m_thd; |
| 310 | DBUG_ASSERT(thd->wsrep_trx().active()); |
| 311 | thd->wsrep_cs().prepare_for_ordering(ws_handle, ws_meta, true); |
| 312 | thd_proc_info(thd, "committing"); |
| 313 | int ret=0; |
| 314 | |
| 315 | const bool is_ordered= !ws_meta.seqno().is_undefined(); |
| 316 | |
| 317 | if (!thd->transaction->stmt.is_empty()) |
| 318 | ret= trans_commit_stmt(thd); |
| 319 | |
| 320 | if (ret == 0) |
| 321 | ret= trans_commit(thd); |
| 322 | |
| 323 | if (ret == 0) |
| 324 | { |
| 325 | m_rgi->cleanup_context(thd, 0); |
| 326 | } |
| 327 | |
| 328 | m_thd->release_transactional_locks(); |
| 329 | |
| 330 | thd_proc_info(thd, "wsrep applier committed"); |
| 331 | |
| 332 | if (!is_ordered) |
| 333 | { |
| 334 | m_thd->wsrep_cs().before_rollback(); |
| 335 | m_thd->wsrep_cs().after_rollback(); |
| 336 | } |
| 337 | else if (m_thd->wsrep_trx().state() == wsrep::transaction::s_executing) |
| 338 | { |
| 339 | /* |
| 340 | Wsrep commit was ordered but it did not go through commit time |
| 341 | hooks and remains active. Cycle through commit hooks to release |
| 342 | commit order and to make cleanup happen in after_applying() call. |
| 343 | |
| 344 | This is a workaround for CTAS with empty result set. |
| 345 | */ |
| 346 | WSREP_DEBUG("Commit not finished for applier %llu", thd->thread_id); |
| 347 | ret= ret || m_thd->wsrep_cs().before_commit() || |
| 348 | m_thd->wsrep_cs().ordered_commit() || |
| 349 | m_thd->wsrep_cs().after_commit(); |
| 350 | } |
| 351 | |
| 352 | thd->lex->sql_command= SQLCOM_END; |
| 353 | |
| 354 | free_root(thd->mem_root, MYF(MY_KEEP_PREALLOC)); |
| 355 | |
| 356 | must_exit_= check_exit_status(); |
| 357 | DBUG_RETURN(ret); |
| 358 | } |
| 359 | |
| 360 | int Wsrep_high_priority_service::rollback(const wsrep::ws_handle& ws_handle, |
| 361 | const wsrep::ws_meta& ws_meta) |
nothing calls this directly
no test coverage detected