| 1 | /* Copyright (C) 2008-2014 Kentoku Shiba |
| 2 | |
| 3 | This program is free software; you can redistribute it and/or modify |
| 4 | it under the terms of the GNU General Public License as published by |
| 5 | the Free Software Foundation; version 2 of the License. |
| 6 | |
| 7 | This program is distributed in the hope that it will be useful, |
| 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | GNU General Public License for more details. |
| 11 | |
| 12 | You should have received a copy of the GNU General Public License |
| 13 | along with this program; if not, write to the Free Software |
| 14 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ |
| 15 | |
| 16 | int spider_free_trx_conn( |
| 17 | SPIDER_TRX *trx, |
| 18 | bool trx_free |
| 19 | ); |
| 20 | |
| 21 | int spider_free_trx_another_conn( |
| 22 | SPIDER_TRX *trx, |
| 23 | bool lock |
| 24 | ); |
| 25 | |
| 26 | int spider_trx_another_lock_tables( |
| 27 | SPIDER_TRX *trx |
| 28 | ); |
| 29 | |
| 30 | int spider_trx_another_flush_tables( |
| 31 | SPIDER_TRX *trx |
| 32 | ); |
| 33 | |
| 34 | int spider_trx_all_flush_tables( |
| 35 | SPIDER_TRX *trx |
| 36 | ); |
| 37 | |
| 38 | int spider_trx_all_unlock_tables( |
| 39 | SPIDER_TRX *trx |
| 40 | ); |
| 41 | |
| 42 | int spider_trx_all_start_trx( |
| 43 | SPIDER_TRX *trx |
| 44 | ); |
| 45 | |
| 46 | int spider_trx_all_flush_logs( |
| 47 | SPIDER_TRX *trx |
| 48 | ); |
| 49 | |
| 50 | int spider_free_trx_alloc( |
| 51 | SPIDER_TRX *trx |
| 52 | ); |
| 53 | |
| 54 | void spider_free_trx_alter_table_alloc( |
| 55 | SPIDER_TRX *trx, |
| 56 | SPIDER_ALTER_TABLE *alter_table |
| 57 | ); |
| 58 | |
| 59 | int spider_free_trx_alter_table( |
| 60 | SPIDER_TRX *trx |
| 61 | ); |
| 62 | |
| 63 | int spider_create_trx_alter_table( |
| 64 | SPIDER_TRX *trx, |
| 65 | SPIDER_SHARE *share, |
| 66 | bool now_create |
| 67 | ); |
| 68 | |
| 69 | bool spider_cmp_trx_alter_table( |
| 70 | SPIDER_ALTER_TABLE *cmp1, |
| 71 | SPIDER_ALTER_TABLE *cmp2 |
| 72 | ); |
| 73 | |
| 74 | SPIDER_TRX *spider_get_trx( |
| 75 | THD *thd, |
| 76 | bool regist_allocated_thds, |
| 77 | int *error_num |
| 78 | ); |
| 79 | |
| 80 | int spider_free_trx( |
| 81 | SPIDER_TRX *trx, |
| 82 | bool need_lock |
| 83 | ); |
| 84 | |
| 85 | int spider_check_and_set_trx_isolation( |
| 86 | SPIDER_CONN *conn, |
| 87 | int *need_mon |
| 88 | ); |
| 89 | |
| 90 | int spider_check_and_set_autocommit( |
| 91 | THD *thd, |
| 92 | SPIDER_CONN *conn, |
| 93 | int *need_mon |
| 94 | ); |
| 95 | |
| 96 | int spider_check_and_set_sql_log_off( |
| 97 | THD *thd, |
| 98 | SPIDER_CONN *conn, |
| 99 | int *need_mon |
| 100 | ); |
| 101 | |
| 102 | int spider_check_and_set_time_zone( |
| 103 | THD *thd, |
| 104 | SPIDER_CONN *conn, |
| 105 | int *need_mon |
| 106 | ); |
| 107 | |
| 108 | int spider_xa_lock( |
| 109 | XID_STATE *xid_state |
| 110 | ); |
| 111 | |
| 112 | int spider_xa_unlock( |
| 113 | XID_STATE *xid_state |
| 114 | ); |
| 115 | |
| 116 | int spider_start_internal_consistent_snapshot( |
| 117 | SPIDER_TRX *trx, |
| 118 | SPIDER_CONN *conn, |
| 119 | int *need_mon |
| 120 | ); |
| 121 | |
| 122 | int spider_internal_start_trx( |
| 123 | ha_spider *spider, |
| 124 | SPIDER_CONN *conn, |
| 125 | int link_idx |
| 126 | ); |
| 127 | |
| 128 | int spider_internal_xa_commit( |
| 129 | THD* thd, |
| 130 | SPIDER_TRX *trx, |
| 131 | XID* xid, |
| 132 | TABLE *table_xa, |
| 133 | TABLE *table_xa_member |
| 134 | ); |
| 135 | |
| 136 | int spider_internal_xa_rollback( |
| 137 | THD* thd, |
| 138 | SPIDER_TRX *trx |
| 139 | ); |
| 140 | |
| 141 | int spider_internal_xa_prepare( |
| 142 | THD* thd, |
| 143 | SPIDER_TRX *trx, |
| 144 | TABLE *table_xa, |
| 145 | TABLE *table_xa_member, |
| 146 | bool internal_xa |
| 147 | ); |
| 148 | |
| 149 | int spider_internal_xa_recover( |
| 150 | THD* thd, |
| 151 | XID* xid_list, |
| 152 | uint len |
| 153 | ); |
| 154 | |
| 155 | int spider_initinal_xa_recover( |
| 156 | XID* xid_list, |
| 157 | uint len |
| 158 | ); |
| 159 | |
| 160 | int spider_internal_xa_commit_by_xid( |
| 161 | THD* thd, |
| 162 | SPIDER_TRX *trx, |
| 163 | XID* xid |
| 164 | ); |
| 165 | |
| 166 | int spider_internal_xa_rollback_by_xid( |
| 167 | THD* thd, |
| 168 | SPIDER_TRX *trx, |
| 169 | XID* xid |
| 170 | ); |
| 171 | |
| 172 | int spider_start_consistent_snapshot( |
| 173 | handlerton *hton, |
| 174 | THD* thd |
| 175 | ); |
| 176 | |
| 177 | int spider_commit( |
| 178 | handlerton *hton, |
| 179 | THD *thd, |
| 180 | bool all |
| 181 | ); |
| 182 | |
| 183 | int spider_rollback( |
| 184 | handlerton *hton, |
| 185 | THD *thd, |
| 186 | bool all |
| 187 | ); |
| 188 | |
| 189 | int spider_xa_prepare( |
| 190 | handlerton *hton, |
| 191 | THD* thd, |
| 192 | bool all |
| 193 | ); |
| 194 | |
| 195 | int spider_xa_recover( |
| 196 | handlerton *hton, |
| 197 | XID* xid_list, |
| 198 | uint len |
| 199 | ); |
| 200 | |
| 201 | int spider_xa_commit_by_xid( |
| 202 | handlerton *hton, |
| 203 | XID* xid |
| 204 | ); |
| 205 | |
| 206 | int spider_xa_rollback_by_xid( |
| 207 | handlerton *hton, |
| 208 | XID* xid |
| 209 | ); |
| 210 | |
| 211 | void spider_copy_table_free_trx_conn( |
| 212 | SPIDER_TRX *trx |
| 213 | ); |
| 214 | |
| 215 | int spider_end_trx( |
| 216 | SPIDER_TRX *trx, |
| 217 | SPIDER_CONN *conn |
| 218 | ); |
| 219 | |
| 220 | int spider_check_trx_and_get_conn( |
| 221 | THD *thd, |
| 222 | ha_spider *spider, |
| 223 | bool use_conn_kind |
| 224 | ); |
| 225 | |
| 226 | THD *spider_create_tmp_thd(); |
| 227 | |
| 228 | void spider_free_tmp_thd( |
| 229 | THD *thd |
| 230 | ); |
| 231 | |
| 232 | int spider_create_trx_ha( |
| 233 | SPIDER_TRX *trx, |
| 234 | ha_spider *spider, |
| 235 | SPIDER_TRX_HA *trx_ha |
| 236 | ); |
| 237 | |
| 238 | SPIDER_TRX_HA *spider_check_trx_ha( |
| 239 | SPIDER_TRX *trx, |
| 240 | ha_spider *spider |
| 241 | ); |
| 242 | |
| 243 | void spider_free_trx_ha( |
| 244 | SPIDER_TRX *trx |
| 245 | ); |
| 246 | |
| 247 | void spider_reuse_trx_ha( |
| 248 | SPIDER_TRX *trx |
| 249 | ); |
| 250 | |
| 251 | void spider_trx_set_link_idx_for_all( |
| 252 | ha_spider *spider |
| 253 | ); |
| 254 | |
| 255 | int spider_trx_check_link_idx_failed( |
| 256 | ha_spider *spider |
| 257 | ); |
| 258 | |
| 259 | #ifdef HA_CAN_BULK_ACCESS |
| 260 | void spider_trx_add_bulk_access_conn( |
| 261 | SPIDER_TRX *trx, |
| 262 | SPIDER_CONN *conn |
| 263 | ); |
| 264 | #endif |
| 265 | |