| 310 | */ |
| 311 | |
| 312 | bool trans_commit_implicit(THD *thd) |
| 313 | { |
| 314 | bool res= FALSE; |
| 315 | DBUG_ENTER("trans_commit_implicit"); |
| 316 | |
| 317 | if (trans_check(thd)) |
| 318 | DBUG_RETURN(TRUE); |
| 319 | |
| 320 | if (thd->variables.option_bits & OPTION_GTID_BEGIN) |
| 321 | { |
| 322 | DBUG_PRINT("error", ("OPTION_GTID_BEGIN is set. " |
| 323 | "Master and slave will have different GTID values")); |
| 324 | } |
| 325 | |
| 326 | if (thd->in_multi_stmt_transaction_mode() || |
| 327 | (thd->variables.option_bits & OPTION_TABLE_LOCK)) |
| 328 | { |
| 329 | PSI_stage_info org_stage; |
| 330 | thd->backup_stage(&org_stage); |
| 331 | THD_STAGE_INFO(thd, stage_commit_implicit); |
| 332 | |
| 333 | /* Safety if one did "drop table" on locked tables */ |
| 334 | if (!thd->locked_tables_mode) |
| 335 | thd->variables.option_bits&= ~OPTION_TABLE_LOCK; |
| 336 | thd->server_status&= |
| 337 | ~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY); |
| 338 | DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS")); |
| 339 | res= MY_TEST(ha_commit_trans(thd, TRUE)); |
| 340 | |
| 341 | THD_STAGE_INFO(thd, org_stage); |
| 342 | } |
| 343 | |
| 344 | thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_BINLOG_THIS_TRX); |
| 345 | thd->transaction->all.reset(); |
| 346 | |
| 347 | /* The transaction should be marked as complete in P_S. */ |
| 348 | DBUG_ASSERT(thd->m_transaction_psi == NULL); |
| 349 | |
| 350 | /* |
| 351 | Upon implicit commit, reset the current transaction |
| 352 | isolation level and access mode. We do not care about |
| 353 | @@session.completion_type since it's documented |
| 354 | to not have any effect on implicit commit. |
| 355 | */ |
| 356 | trans_reset_one_shot_chistics(thd); |
| 357 | |
| 358 | trans_track_end_trx(thd); |
| 359 | |
| 360 | DBUG_RETURN(res); |
| 361 | } |
| 362 | |
| 363 | |
| 364 | /** |
no test coverage detected