70
69
there are three modes of operation:
71
70
- automatic recover after a crash
72
in this case commit_list != 0, tc_heuristic_recover==0
71
in this case commit_list.size() != 0, tc_heuristic_recover==0
73
72
all xids from commit_list are committed, others are rolled back
74
73
- manual (heuristic) recover
75
in this case commit_list==0, tc_heuristic_recover != 0
74
in this case commit_list.size()==0, tc_heuristic_recover != 0
76
75
DBA has explicitly specified that all prepared transactions should
77
76
be committed (or rolled back).
78
- no recovery (MySQL did not detect a crash)
79
in this case commit_list==0, tc_heuristic_recover == 0
77
- no recovery (Drizzle did not detect a crash)
78
in this case commit_list.size()==0, tc_heuristic_recover == 0
80
79
there should be no prepared transactions in this case.
82
81
class XaRecover : unary_function<XaResourceManager *, void>
84
84
int trans_len, found_foreign_xids, found_my_xids;
87
const XaResourceManager::commit_list_set &commit_list;
90
90
XaRecover(XID *trans_list_arg, int trans_len_arg,
91
HASH *commit_list_arg, bool dry_run_arg)
91
const XaResourceManager::commit_list_set& commit_list_arg,
92
93
: trans_len(trans_len_arg), found_foreign_xids(0), found_my_xids(0),
94
95
trans_list(trans_list_arg), commit_list(commit_list_arg),
134
hash_search(commit_list, (unsigned char *)&x, sizeof(x)) != 0 :
134
if (commit_list.size() ?
135
commit_list.find(x) != commit_list.end() :
135
136
tc_heuristic_recover == TC_HEURISTIC_RECOVER_COMMIT)
137
138
resource_manager->xaCommitXid(trans_list+i);
150
int XaResourceManager::recoverAllXids(HASH *commit_list)
151
int XaResourceManager::recoverAllXids()
153
const XaResourceManager::commit_list_set empty_commit_set;
154
return recoverAllXids(empty_commit_set);
157
int XaResourceManager::recoverAllXids(const XaResourceManager::commit_list_set &commit_list)
152
159
XID *trans_list= NULL;
153
160
int trans_len= 0;
155
bool dry_run= (commit_list==0 && tc_heuristic_recover==0);
162
bool dry_run= (commit_list.size() == 0 && tc_heuristic_recover==0);
157
164
/* commit_list and tc_heuristic_recover cannot be set both */
158
assert(commit_list==0 || tc_heuristic_recover==0);
165
assert(commit_list.size() == 0 || tc_heuristic_recover == 0);
160
167
if (xa_resource_managers.size() <= 1)