| 1 | /* Copyright (C) 2008 Sun AB & Michael Widenius |
| 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ |
| 15 | |
| 16 | /* Struct to store tables in use by one transaction */ |
| 17 | |
| 18 | typedef struct st_maria_status_info |
| 19 | { |
| 20 | ha_rows records; /* Rows in table */ |
| 21 | ha_rows del; /* Removed rows */ |
| 22 | my_off_t empty; /* lost space in datafile */ |
| 23 | my_off_t key_empty; /* lost space in indexfile */ |
| 24 | my_off_t key_file_length; |
| 25 | my_off_t data_file_length; |
| 26 | ha_checksum checksum; |
| 27 | uint32 changed:1, /* Set if table was changed */ |
| 28 | no_transid:1; /* Set if no transid was set on rows */ |
| 29 | } MARIA_STATUS_INFO; |
| 30 | |
| 31 | |
| 32 | typedef struct st_used_tables { |
| 33 | struct st_used_tables *next; |
| 34 | struct st_maria_share *share; |
| 35 | MARIA_STATUS_INFO state_current; |
| 36 | MARIA_STATUS_INFO state_start; |
| 37 | uint use_count; |
| 38 | } MARIA_USED_TABLES; |
| 39 | |
| 40 | |
| 41 | /* Struct to store commit state at different times */ |
| 42 | |
| 43 | typedef struct st_state_history { |
| 44 | struct st_state_history *next; |
| 45 | TrID trid; |
| 46 | MARIA_STATUS_INFO state; |
| 47 | } MARIA_STATE_HISTORY; |
| 48 | |
| 49 | |
| 50 | /* struct to remember history for closed tables */ |
| 51 | |
| 52 | typedef struct st_state_history_closed { |
| 53 | LSN create_rename_lsn; |
| 54 | MARIA_STATE_HISTORY *state_history; |
| 55 | } MARIA_STATE_HISTORY_CLOSED; |
| 56 | |
| 57 | |
| 58 | my_bool _ma_setup_live_state(MARIA_HA *info); |
| 59 | MARIA_STATE_HISTORY *_ma_remove_not_visible_states(MARIA_STATE_HISTORY |
| 60 | *org_history, |
| 61 | my_bool all, |
| 62 | my_bool trman_is_locked); |
| 63 | void _ma_reset_state(MARIA_HA *info); |
| 64 | void _ma_get_status(void* param, my_bool concurrent_insert); |
| 65 | void _ma_update_status(void* param); |
| 66 | void _ma_update_status_with_lock(MARIA_HA *info); |
| 67 | void _ma_restore_status(void *param); |
| 68 | void _ma_copy_status(void* to, void *from); |
| 69 | void _ma_reset_update_flag(void *param, my_bool concurrent_insert); |
| 70 | my_bool _ma_start_trans(void* param); |
| 71 | my_bool _ma_check_status(void *param); |
| 72 | void _ma_block_get_status(void* param, my_bool concurrent_insert); |
| 73 | void _ma_block_update_status(void *param); |
| 74 | void _ma_block_restore_status(void *param); |
| 75 | my_bool _ma_block_check_status(void *param); |
| 76 | void maria_versioning(MARIA_HA *info, my_bool versioning); |
| 77 | void _ma_set_share_data_file_length(struct st_maria_share *share, |
| 78 | ulonglong new_length); |
| 79 | void _ma_copy_nontrans_state_information(MARIA_HA *info); |
| 80 | my_bool _ma_trnman_end_trans_hook(TRN *trn, my_bool commit, |
| 81 | my_bool active_transactions); |
| 82 | my_bool _ma_row_visible_always(MARIA_HA *info); |
| 83 | my_bool _ma_row_visible_non_transactional_table(MARIA_HA *info); |
| 84 | my_bool _ma_row_visible_transactional_table(MARIA_HA *info); |
| 85 | void _ma_remove_not_visible_states_with_lock(struct st_maria_share *share, |
| 86 | my_bool all); |
| 87 | void _ma_remove_table_from_trnman(struct st_maria_share *share, TRN *trn); |
| 88 | void _ma_reset_history(struct st_maria_share *share); |
| 89 | |