MCPcopy Create free account
hub / github.com/MariaDB/server / process_master_state

Function process_master_state

sql/sql_table.cc:10482–10517  ·  view source on GitHub ↗

process_master_state:- process the info->state recieved from master We will comapre master state with alter_result In the case of ROLLBACK_ALTER alter_result > 0 In the case of COMMIT_ALTER alter_result == 0 if the condition is not satisfied we will report error and Return 1. Make sure wait_for_master is called before calling this function This function should be called only at th

Source from the content-addressed store, hash-verified

10480 @retval 0 Ok
10481*/
10482static int process_master_state(THD *thd, int alter_result,
10483 uint64 &start_alter_id, bool if_exists)
10484{
10485#ifdef HAVE_REPLICATION
10486 start_alter_info *info= thd->rgi_slave->sa_info;
10487 bool partial_alter= false;
10488
10489 if (info->state == start_alter_state::INVALID)
10490 {
10491 /* the caller has not yet called SA logging nor wait for master decision */
10492 if (!write_bin_log_start_alter(thd, partial_alter, start_alter_id,
10493 if_exists))
10494 wait_for_master(thd);
10495
10496 DBUG_ASSERT(!partial_alter);
10497 }
10498
10499 /* this function shouldn't be called twice */
10500 DBUG_ASSERT(start_alter_id);
10501
10502 start_alter_id= 0;
10503 if ((info->state == start_alter_state::ROLLBACK_ALTER && alter_result >= 0)
10504 || (info->state == start_alter_state::COMMIT_ALTER && !alter_result))
10505 {
10506 alter_committed(thd, info, thd->rgi_slave->rli->mi);
10507 return 0;
10508 }
10509 else
10510 {
10511 thd->is_slave_error= 1;
10512 return 1;
10513 }
10514#else
10515 return 0;
10516#endif
10517}
10518
10519/*
10520 Returns a (global unique) identifier of START Alter when slave applier

Callers 2

mysql_alter_tableFunction · 0.85

Calls 3

wait_for_masterFunction · 0.85
alter_committedFunction · 0.85

Tested by

no test coverage detected