| 396 | */ |
| 397 | |
| 398 | static bool backup_block_commit(THD *thd) |
| 399 | { |
| 400 | DBUG_ENTER("backup_block_commit"); |
| 401 | if (thd->mdl_context.upgrade_shared_lock(backup_flush_ticket, |
| 402 | MDL_BACKUP_WAIT_COMMIT, |
| 403 | thd->variables.lock_wait_timeout)) |
| 404 | DBUG_RETURN(1); |
| 405 | |
| 406 | /* We can ignore errors from flush_tables () */ |
| 407 | (void) flush_tables(thd, FLUSH_SYS_TABLES); |
| 408 | |
| 409 | if (mysql_bin_log.is_open()) |
| 410 | { |
| 411 | mysql_mutex_lock(mysql_bin_log.get_log_lock()); |
| 412 | mysql_file_sync(mysql_bin_log.get_log_file()->file, MYF(MY_WME)); |
| 413 | mysql_mutex_unlock(mysql_bin_log.get_log_lock()); |
| 414 | } |
| 415 | thd->clear_error(); |
| 416 | |
| 417 | #ifdef WITH_WSREP |
| 418 | if (WSREP_NNULL(thd) && !thd->wsrep_desynced_backup_stage) |
| 419 | { |
| 420 | Wsrep_server_state &server_state= Wsrep_server_state::instance(); |
| 421 | bool mariabackup= (server_state.state() == Wsrep_server_state::s_donor |
| 422 | && !strcmp(wsrep_sst_method, "mariabackup")); |
| 423 | |
| 424 | /* If this node is donor and mariabackup is not used |
| 425 | we desync and pause provider here if it is not yet done. |
| 426 | */ |
| 427 | if (!mariabackup) |
| 428 | { |
| 429 | if (server_state.desync_and_pause().is_undefined()) |
| 430 | DBUG_RETURN(1); |
| 431 | |
| 432 | WSREP_INFO("Server desynched from group during BACKUP STAGE BLOCK_COMMIT."); |
| 433 | thd->wsrep_desynced_backup_stage= true; |
| 434 | DEBUG_SYNC(thd, "wsrep_backup_stage_commit_after_desync_and_pause"); |
| 435 | } |
| 436 | } |
| 437 | #endif /* WITH_WSREP */ |
| 438 | |
| 439 | DBUG_RETURN(0); |
| 440 | } |
| 441 | |
| 442 | |
| 443 | /** |
no test coverage detected