1/* Copyright (C) 2006 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
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/*
17 WL#3234 Maria control file
18 First version written by Guilhem Bichot on 2006-04-27.
19*/
20
21#ifndef _ma_control_file_h
22#define _ma_control_file_h
23
24#define CONTROL_FILE_BASE_NAME "aria_log_control"
25/*
26 Major version for control file. Should only be changed when doing
27 big changes that made the new control file incompatible with all
28 older versions of Maria.
29*/
30#define CONTROL_FILE_VERSION 1
31
32/* Here is the interface of this module */
33
34/*
35 LSN of the last checkoint
36 (if last_checkpoint_lsn == LSN_IMPOSSIBLE then there was never a checkpoint)
37*/
38extern LSN last_checkpoint_lsn;
39/*
40 Last log number (if last_logno == FILENO_IMPOSSIBLE then there is no log
41 file yet)
42*/
43extern uint32 last_logno;
44
45extern TrID max_trid_in_control_file;
46
47extern uint8 recovery_failures;
48
49extern my_bool maria_multi_threaded, maria_in_recovery;
50
51typedef enum enum_control_file_error {
52 CONTROL_FILE_OK= 0,
53 CONTROL_FILE_TOO_SMALL,
54 CONTROL_FILE_TOO_BIG,
55 CONTROL_FILE_BAD_MAGIC_STRING,
56 CONTROL_FILE_BAD_VERSION,
57 CONTROL_FILE_BAD_CHECKSUM,
58 CONTROL_FILE_BAD_HEAD_CHECKSUM,
59 CONTROL_FILE_MISSING,
60 CONTROL_FILE_INCONSISTENT_INFORMATION,
61 CONTROL_FILE_WRONG_BLOCKSIZE,
62 CONTROL_FILE_UNKNOWN_ERROR /* any other error */
63} CONTROL_FILE_ERROR;
64
65C_MODE_START
66CONTROL_FILE_ERROR ma_control_file_open(my_bool create_if_missing,
67 my_bool print_error);
68int ma_control_file_write_and_force(LSN last_checkpoint_lsn_arg,
69 uint32 last_logno_arg, TrID max_trid_arg,
70 uint8 recovery_failures_arg);
71int ma_control_file_end(void);
72my_bool ma_control_file_inited(void);
73C_MODE_END
74#endif
75