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
18typedef 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
32typedef 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
43typedef 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
52typedef struct st_state_history_closed {
53 LSN create_rename_lsn;
54 MARIA_STATE_HISTORY *state_history;
55} MARIA_STATE_HISTORY_CLOSED;
56
57
58my_bool _ma_setup_live_state(MARIA_HA *info);
59MARIA_STATE_HISTORY *_ma_remove_not_visible_states(MARIA_STATE_HISTORY
60 *org_history,
61 my_bool all,
62 my_bool trman_is_locked);
63void _ma_reset_state(MARIA_HA *info);
64void _ma_get_status(void* param, my_bool concurrent_insert);
65void _ma_update_status(void* param);
66void _ma_update_status_with_lock(MARIA_HA *info);
67void _ma_restore_status(void *param);
68void _ma_copy_status(void* to, void *from);
69void _ma_reset_update_flag(void *param, my_bool concurrent_insert);
70my_bool _ma_start_trans(void* param);
71my_bool _ma_check_status(void *param);
72void _ma_block_get_status(void* param, my_bool concurrent_insert);
73void _ma_block_update_status(void *param);
74void _ma_block_restore_status(void *param);
75my_bool _ma_block_check_status(void *param);
76void maria_versioning(MARIA_HA *info, my_bool versioning);
77void _ma_set_share_data_file_length(struct st_maria_share *share,
78 ulonglong new_length);
79void _ma_copy_nontrans_state_information(MARIA_HA *info);
80my_bool _ma_trnman_end_trans_hook(TRN *trn, my_bool commit,
81 my_bool active_transactions);
82my_bool _ma_row_visible_always(MARIA_HA *info);
83my_bool _ma_row_visible_non_transactional_table(MARIA_HA *info);
84my_bool _ma_row_visible_transactional_table(MARIA_HA *info);
85void _ma_remove_not_visible_states_with_lock(struct st_maria_share *share,
86 my_bool all);
87void _ma_remove_table_from_trnman(struct st_maria_share *share, TRN *trn);
88void _ma_reset_history(struct st_maria_share *share);
89