summaryrefslogtreecommitdiffstats
path: root/storage/spider/spd_trx.h
blob: 3bf93aada1a94a3aa3740ad639b8d740f89ac955 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
/* Copyright (C) 2008-2019 Kentoku Shiba
   Copyright (C) 2019 MariaDB corp

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; version 2 of the License.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */

int spider_free_trx_conn(
  SPIDER_TRX *trx,
  bool trx_free
);

int spider_free_trx_another_conn(
  SPIDER_TRX *trx,
  bool lock
);

int spider_trx_another_lock_tables(
  SPIDER_TRX *trx
);

int spider_trx_another_flush_tables(
  SPIDER_TRX *trx
);

int spider_trx_all_flush_tables(
  SPIDER_TRX *trx
);

int spider_trx_all_unlock_tables(
  SPIDER_TRX *trx
);

int spider_trx_all_start_trx(
  SPIDER_TRX *trx
);

int spider_trx_all_flush_logs(
  SPIDER_TRX *trx
);

int spider_free_trx_alloc(
  SPIDER_TRX *trx
);

void spider_free_trx_alter_table_alloc(
  SPIDER_TRX *trx,
  SPIDER_ALTER_TABLE *alter_table
);

int spider_free_trx_alter_table(
  SPIDER_TRX *trx
);

int spider_create_trx_alter_table(
  SPIDER_TRX *trx,
  SPIDER_SHARE *share,
  bool now_create
);

bool spider_cmp_trx_alter_table(
  SPIDER_ALTER_TABLE *cmp1,
  SPIDER_ALTER_TABLE *cmp2
);

SPIDER_TRX *spider_get_trx(
  THD *thd,
  bool regist_allocated_thds,
  int *error_num
);

int spider_free_trx(
  SPIDER_TRX *trx,
  bool need_lock,
  bool reset_ha_data= true
);

int spider_check_and_set_trx_isolation(
  SPIDER_CONN *conn,
  int *need_mon
);

int spider_check_and_set_autocommit(
  THD *thd,
  SPIDER_CONN *conn,
  int *need_mon
);

int spider_check_and_set_sql_log_off(
  THD *thd,
  SPIDER_CONN *conn,
  int *need_mon
);

int spider_check_and_set_wait_timeout(
  THD *thd,
  SPIDER_CONN *conn,
  int *need_mon
);

int spider_check_and_set_sql_mode(
  THD *thd,
  SPIDER_CONN *conn,
  int *need_mon
);

int spider_check_and_set_time_zone(
  THD *thd,
  SPIDER_CONN *conn,
  int *need_mon
);

int spider_start_internal_consistent_snapshot(
  SPIDER_TRX *trx,
  SPIDER_CONN *conn,
  int *need_mon
);

int spider_internal_start_trx(
  ha_spider *spider
);

int spider_internal_start_trx_for_connection(
  ha_spider *spider,
  SPIDER_CONN *conn,
  int link_idx
);

int spider_internal_xa_commit(
  THD* thd,
  SPIDER_TRX *trx,
  XID* xid,
  TABLE *table_xa,
  TABLE *table_xa_member
);

int spider_internal_xa_rollback(
  THD* thd,
  SPIDER_TRX *trx
);

int spider_internal_xa_prepare(
  THD* thd,
  SPIDER_TRX *trx,
  TABLE *table_xa,
  TABLE *table_xa_member,
  bool internal_xa
);

int spider_internal_xa_recover(
  THD* thd,
  XID* xid_list,
  uint len
);

int spider_initinal_xa_recover(
  XID* xid_list,
  uint len
);

int spider_internal_xa_commit_by_xid(
  THD* thd,
  SPIDER_TRX *trx,
  XID* xid
);

int spider_internal_xa_rollback_by_xid(
  THD* thd,
  SPIDER_TRX *trx,
  XID* xid
);

int spider_start_consistent_snapshot(
  handlerton *hton,
  THD* thd
);

int spider_commit(
  handlerton *hton,
  THD *thd,
  bool all
);

int spider_rollback(
  handlerton *hton,
  THD *thd,
  bool all
);

int spider_xa_prepare(
  handlerton *hton,
  THD* thd,
  bool all
);

int spider_xa_recover(
  handlerton *hton,
  XID* xid_list,
  uint len
);

int spider_xa_commit_by_xid(
  handlerton *hton,
  XID* xid
);

int spider_xa_rollback_by_xid(
  handlerton *hton,
  XID* xid
);

void spider_copy_table_free_trx_conn(
  SPIDER_TRX *trx
);

int spider_end_trx(
  SPIDER_TRX *trx,
  SPIDER_CONN *conn
);

int spider_check_trx_and_get_conn(
  THD *thd,
  ha_spider *spider,
  bool use_conn_kind
);

THD *spider_create_tmp_thd();

void spider_free_tmp_thd(
  THD *thd
);

int spider_create_trx_ha(
  SPIDER_TRX *trx,
  ha_spider *spider,
  SPIDER_TRX_HA *trx_ha
);

SPIDER_TRX_HA *spider_check_trx_ha(
  SPIDER_TRX *trx,
  ha_spider *spider
);

void spider_free_trx_ha(
  SPIDER_TRX *trx
);

void spider_reuse_trx_ha(
  SPIDER_TRX *trx
);

void spider_trx_set_link_idx_for_all(
  ha_spider *spider
);

int spider_trx_check_link_idx_failed(
  ha_spider *spider
);

#ifdef HA_CAN_BULK_ACCESS
void spider_trx_add_bulk_access_conn(
  SPIDER_TRX *trx,
  SPIDER_CONN *conn
);
#endif