@@ -5037,66 +5037,6 @@ thd_need_ordering_with(const MYSQL_THD thd, const MYSQL_THD other_thd)
5037
5037
return 0 ;
5038
5038
}
5039
5039
5040
-
5041
- /*
5042
- If the storage engine detects a deadlock, and needs to choose a victim
5043
- transaction to roll back, it can call this function to ask the upper
5044
- server layer for which of two possible transactions is prefered to be
5045
- aborted and rolled back.
5046
-
5047
- In parallel replication, if two transactions are running in parallel and
5048
- one is fixed to commit before the other, then the one that commits later
5049
- will be prefered as the victim - chosing the early transaction as a victim
5050
- will not resolve the deadlock anyway, as the later transaction still needs
5051
- to wait for the earlier to commit.
5052
-
5053
- Otherwise, a transaction that uses only transactional tables, and can thus
5054
- be safely rolled back, will be prefered as a deadlock victim over a
5055
- transaction that also modified non-transactional (eg. MyISAM) tables.
5056
-
5057
- The return value is -1 if the first transaction is prefered as a deadlock
5058
- victim, 1 if the second transaction is prefered, or 0 for no preference (in
5059
- which case the storage engine can make the choice as it prefers).
5060
- */
5061
- extern " C" int
5062
- thd_deadlock_victim_preference (const MYSQL_THD thd1, const MYSQL_THD thd2)
5063
- {
5064
- rpl_group_info *rgi1, *rgi2;
5065
- bool nontrans1, nontrans2;
5066
-
5067
- if (!thd1 || !thd2)
5068
- return 0 ;
5069
-
5070
- /*
5071
- If the transactions are participating in the same replication domain in
5072
- parallel replication, then request to select the one that will commit
5073
- later (in the fixed commit order from the master) as the deadlock victim.
5074
- */
5075
- rgi1= thd1->rgi_slave ;
5076
- rgi2= thd2->rgi_slave ;
5077
- if (rgi1 && rgi2 &&
5078
- rgi1->is_parallel_exec &&
5079
- rgi1->rli == rgi2->rli &&
5080
- rgi1->current_gtid .domain_id == rgi2->current_gtid .domain_id )
5081
- return rgi1->gtid_sub_id < rgi2->gtid_sub_id ? 1 : -1 ;
5082
-
5083
- /*
5084
- If one transaction has modified non-transactional tables (so that it
5085
- cannot be safely rolled back), and the other has not, then prefer to
5086
- select the purely transactional one as the victim.
5087
- */
5088
- nontrans1= thd1->transaction .all .modified_non_trans_table ;
5089
- nontrans2= thd2->transaction .all .modified_non_trans_table ;
5090
- if (nontrans1 && !nontrans2)
5091
- return 1 ;
5092
- else if (!nontrans1 && nontrans2)
5093
- return -1 ;
5094
-
5095
- /* No preferences, let the storage engine decide. */
5096
- return 0 ;
5097
- }
5098
-
5099
-
5100
5040
extern " C" int thd_non_transactional_update (const MYSQL_THD thd)
5101
5041
{
5102
5042
return (thd->transaction .all .modified_non_trans_table );
0 commit comments