Drizzled Public API Documentation

fil0fil.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (C) 1995, 2010, Innobase Oy. All Rights Reserved.
4 
5 This program is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free Software
7 Foundation; version 2 of the License.
8 
9 This program is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 
13 You should have received a copy of the GNU General Public License along with
14 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15 St, Fifth Floor, Boston, MA 02110-1301 USA
16 
17 *****************************************************************************/
18 
19 /**************************************************/
26 #pragma once
27 #ifndef fil0fil_h
28 #define fil0fil_h
29 
30 #include "univ.i"
31 #include "dict0types.h"
32 #include "ut0byte.h"
33 #include "os0file.h"
34 #ifndef UNIV_HOTBACKUP
35 #include "sync0rw.h"
36 #include "ibuf0types.h"
37 #endif /* !UNIV_HOTBACKUP */
38 
42 extern const char* fil_path_to_mysql_datadir;
43 
45 #define FIL_IBD_FILE_INITIAL_SIZE 4
46 
48 #define FIL_NULL ULINT32_UNDEFINED
49 
50 /* Space address data type; this is intended to be used when
51 addresses accurate to a byte are stored in file pages. If the page part
52 of the address is FIL_NULL, the address is considered undefined. */
53 
54 typedef byte fil_faddr_t;
56 #define FIL_ADDR_PAGE 0 /* first in address is the page offset */
57 #define FIL_ADDR_BYTE 4 /* then comes 2-byte byte offset within page*/
58 
59 #define FIL_ADDR_SIZE 6 /* address size is 6 bytes */
60 
64 typedef struct fil_addr_struct fil_addr_t;
67  ulint page;
68  ulint boffset;
69 };
70 
73 
75 #define FIL_PAGE_SPACE_OR_CHKSUM 0
79 #define FIL_PAGE_OFFSET 4
80 #define FIL_PAGE_PREV 8
87 #define FIL_PAGE_NEXT 12
97 #define FIL_PAGE_LSN 16
99 #define FIL_PAGE_TYPE 24
114 #define FIL_PAGE_FILE_FLUSH_LSN 26
119 #define FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID 34
121 #define FIL_PAGE_DATA 38
122 /* @} */
123 
124 #define FIL_PAGE_END_LSN_OLD_CHKSUM 8
128 #define FIL_PAGE_DATA_END 8
129 /* @} */
130 
132 #define FIL_PAGE_INDEX 17855
133 #define FIL_PAGE_UNDO_LOG 2
134 #define FIL_PAGE_INODE 3
135 #define FIL_PAGE_IBUF_FREE_LIST 4
136 /* File page types introduced in MySQL/InnoDB 5.1.7 */
137 #define FIL_PAGE_TYPE_ALLOCATED 0
138 #define FIL_PAGE_IBUF_BITMAP 5
139 #define FIL_PAGE_TYPE_SYS 6
140 #define FIL_PAGE_TYPE_TRX_SYS 7
141 #define FIL_PAGE_TYPE_FSP_HDR 8
142 #define FIL_PAGE_TYPE_XDES 9
143 #define FIL_PAGE_TYPE_BLOB 10
144 #define FIL_PAGE_TYPE_ZBLOB 11
145 #define FIL_PAGE_TYPE_ZBLOB2 12
146 /* @} */
149 #define FIL_TABLESPACE 501
150 #define FIL_LOG 502
151 /* @} */
152 
154 extern ulint fil_n_log_flushes;
155 
157 extern ulint fil_n_pending_log_flushes;
160 
161 
162 #ifndef UNIV_HOTBACKUP
163 /*******************************************************************/
167 UNIV_INTERN
168 ib_int64_t
170 /*==================*/
171  ulint id);
172 /*******************************************************************/
175 UNIV_INTERN
178 /*================*/
179  ulint id,
180  ulint* zip_size);
182 /*******************************************************************/
185 UNIV_INTERN
186 ulint
188 /*===============*/
189  ulint id);
190 #endif /* !UNIV_HOTBACKUP */
191 /*******************************************************************/
193 UNIV_INTERN
194 void
196 /*============*/
197  const char* name,
198  ulint size,
200  ulint id,
201  ibool is_raw);
203 #ifdef UNIV_LOG_ARCHIVE
204 /****************************************************************/
207 UNIV_INTERN
208 void
209 fil_space_truncate_start(
210 /*=====================*/
211  ulint id,
212  ulint trunc_len);
215 #endif /* UNIV_LOG_ARCHIVE */
216 /*******************************************************************/
220 UNIV_INTERN
221 ibool
223 /*=============*/
224  const char* name,
225  ulint id,
226  ulint zip_size,
228  ulint purpose);
229 /*******************************************************************/
234 UNIV_INTERN
235 ibool
237 /*====================*/
238  ulint* space_id);
239 /*******************************************************************/
243 UNIV_INTERN
244 ulint
246 /*===============*/
247  ulint id);
248 /*******************************************************************/
252 UNIV_INTERN
253 ulint
255 /*================*/
256  ulint id);
257 /*******************************************************************/
261 UNIV_INTERN
262 ulint
264 /*===================*/
265  ulint id);
266 /*******************************************************************/
270 UNIV_INTERN
271 ibool
273 /*===========================*/
274  ulint id,
275  ulint page_no);
276 /****************************************************************/
278 UNIV_INTERN
279 void
280 fil_init(
281 /*=====*/
282  ulint hash_size,
283  ulint max_n_open);
284 /*******************************************************************/
286 UNIV_INTERN
287 void
288 fil_close(void);
289 /*===========*/
290 /*******************************************************************/
296 UNIV_INTERN
297 void
299 /*==========================================*/
300 /*******************************************************************/
303 UNIV_INTERN
304 void
305 fil_close_all_files(void);
306 /*=====================*/
307 /*******************************************************************/
310 UNIV_INTERN
311 void
313 /*===========================*/
314  ulint max_id);
315 #ifndef UNIV_HOTBACKUP
316 /****************************************************************/
320 UNIV_INTERN
321 ulint
323 /*================================*/
324  ib_uint64_t lsn,
325  ulint arch_log_no);
327 /*******************************************************************/
330 UNIV_INTERN
331 void
333 /*=================================*/
334  os_file_t data_file,
335  ibool one_read_already,
338 #ifdef UNIV_LOG_ARCHIVE
339  ulint* min_arch_log_no,
340  ulint* max_arch_log_no,
341 #endif /* UNIV_LOG_ARCHIVE */
342  ib_uint64_t* min_flushed_lsn,
343  ib_uint64_t* max_flushed_lsn);
344 /*******************************************************************/
348 UNIV_INTERN
349 ibool
351 /*========================*/
352  ulint id);
353 /*******************************************************************/
355 UNIV_INTERN
356 void
358 /*=========================*/
359  ulint id);
360 #endif /* !UNIV_HOTBACKUP */
361 /*******************************************************************/
375 UNIV_INTERN
376 byte*
378 /*=======================*/
379  byte* ptr,
382  byte* end_ptr,
383  ulint type,
384  ulint space_id,
387  ulint log_flags);
389 /*******************************************************************/
393 UNIV_INTERN
394 ibool
396 /*==================*/
397  ulint id);
398 #ifndef UNIV_HOTBACKUP
399 /*******************************************************************/
408 UNIV_INTERN
409 ibool
411 /*===================*/
412  ulint id);
413 #endif /* !UNIV_HOTBACKUP */
414 /*******************************************************************/
418 UNIV_INTERN
419 ibool
421 /*==================*/
422  const char* old_name,
426  ulint id,
427  const char* new_name);
431 /*******************************************************************/
438 UNIV_INTERN
439 ulint
441 /*===================================*/
442  ulint space_id,
443  const char* tablename,
447  ibool is_temp,
449  ulint flags,
450  ulint size);
453 #ifndef UNIV_HOTBACKUP
454 /********************************************************************/
464 UNIV_INTERN
465 ibool
467 /*=============================*/
468  ibool check_space_id,
475  ulint id,
476  ulint flags,
477  const char* name);
479 /********************************************************************/
489 UNIV_INTERN
490 ibool
492 /*====================*/
493  const char* name,
495  ib_uint64_t current_lsn);
498 #endif /* !UNIV_HOTBACKUP */
499 /********************************************************************/
507 UNIV_INTERN
508 ulint
510 /*===================================*/
511 /*******************************************************************/
515 UNIV_INTERN
516 ibool
518 /*===========================================*/
519  ulint id,
520  ib_int64_t version);
523 /*******************************************************************/
526 UNIV_INTERN
527 ibool
529 /*=========================*/
530  ulint id);
531 #ifndef UNIV_HOTBACKUP
532 /*******************************************************************/
537 UNIV_INTERN
538 ibool
540 /*==============================*/
541  ulint id,
542  const char* name,
545  ibool is_temp,
547  ibool mark_space,
553  ibool print_error_if_does_not_exist);
558 #else /* !UNIV_HOTBACKUP */
559 /********************************************************************/
564 UNIV_INTERN
565 void
566 fil_extend_tablespaces_to_stored_len(void);
567 /*======================================*/
568 #endif /* !UNIV_HOTBACKUP */
569 /**********************************************************************/
574 UNIV_INTERN
575 ibool
577 /*=============================*/
578  ulint* actual_size,
581  ulint space_id,
582  ulint size_after_extend);
585 /*******************************************************************/
588 UNIV_INTERN
589 ibool
591 /*===========================*/
592  ulint id,
593  ulint n_free_now,
594  ulint n_to_reserve);
595 /*******************************************************************/
597 UNIV_INTERN
598 void
600 /*===========================*/
601  ulint id,
602  ulint n_reserved);
603 /*******************************************************************/
606 UNIV_INTERN
607 ulint
609 /*=============================*/
610  ulint id);
611 /********************************************************************/
615 UNIV_INTERN
616 ulint
617 fil_io(
618 /*===*/
619  ulint type,
628  ibool sync,
629  ulint space_id,
630  ulint zip_size,
632  ulint block_offset,
633  ulint byte_offset,
636  ulint len,
639  void* buf,
642  void* message);
644 /********************************************************************/
646 UNIV_INTERN
647 bool
649 /*=========*/
650  ulint space_id,
651  ulint block_offset);
652  /**********************************************************************/
657 UNIV_INTERN
658 void
660 /*=========*/
661  ulint segment);
663 /**********************************************************************/
666 UNIV_INTERN
667 void
668 fil_flush(
669 /*======*/
670  ulint space_id);
672 /**********************************************************************/
675 UNIV_INTERN
676 void
678 /*==================*/
679  ulint purpose);
680 /******************************************************************/
683 UNIV_INTERN
684 ibool
685 fil_validate(void);
686 /*==============*/
687 /********************************************************************/
690 UNIV_INTERN
691 ibool
693 /*=============*/
694  fil_addr_t addr);
695 /********************************************************************/
698 UNIV_INTERN
699 ulint
701 /*==============*/
702  const byte* page);
703 /********************************************************************/
706 UNIV_INTERN
707 ulint
709 /*==============*/
710  const byte* page);
711 /*********************************************************************/
713 UNIV_INTERN
714 void
716 /*==============*/
717  byte* page,
718  ulint type);
719 /*********************************************************************/
723 UNIV_INTERN
724 ulint
726 /*==============*/
727  const byte* page);
729 /*******************************************************************/
732 UNIV_INTERN
733 ibool
735 /*============================*/
736  ulint id);
738 typedef struct fil_space_struct fil_space_t;
739 
740 #endif
int os_file_t
Definition: os0file.h:87
UNIV_INTERN ibool fil_extend_space_to_desired_size(ulint *actual_size, ulint space_id, ulint size_after_extend)
Definition: fil0fil.cc:3886
UNIV_INTERN ulint fil_io(ulint type, ibool sync, ulint space_id, ulint zip_size, ulint block_offset, ulint byte_offset, ulint len, void *buf, void *message)
Definition: fil0fil.cc:4287
UNIV_INTERN ibool fil_assign_new_space_id(ulint *space_id)
Definition: fil0fil.cc:1301
const char * fil_path_to_mysql_datadir
Definition: fil0fil.cc:112
UNIV_INTERN ibool fil_open_single_table_tablespace(ibool check_space_id, ulint id, ulint flags, const char *name)
Definition: fil0fil.cc:3047
UNIV_INTERN ib_int64_t fil_space_get_version(ulint id)
Definition: fil0fil.cc:488
UNIV_INTERN void fil_flush(ulint space_id)
Definition: fil0fil.cc:4634
byte fil_faddr_t
Definition: fil0fil.h:54
UNIV_INTERN byte * fil_op_log_parse_or_replay(byte *ptr, byte *end_ptr, ulint type, ulint space_id, ulint log_flags)
Definition: fil0fil.cc:2043
UNIV_INTERN void fil_node_create(const char *name, ulint size, ulint id, ibool is_raw)
Definition: fil0fil.cc:596
fil_addr_t fil_addr_null
Definition: fil0fil.cc:123
UNIV_INTERN ulint fil_space_get_zip_size(ulint id)
Definition: fil0fil.cc:1535
UNIV_INTERN ibool fil_rename_tablespace(const char *old_name, ulint id, const char *new_name)
Definition: fil0fil.cc:2518
UNIV_INTERN ulint fil_space_get_type(ulint id)
Definition: fil0fil.cc:544
UNIV_INTERN rw_lock_t * fil_space_get_latch(ulint id, ulint *zip_size)
Definition: fil0fil.cc:515
ulint boffset
Definition: fil0fil.h:68
UNIV_INTERN ulint fil_page_get_next(const byte *page)
Definition: fil0fil.cc:4888
UNIV_INTERN void fil_init(ulint hash_size, ulint max_n_open)
Definition: fil0fil.cc:1574
UNIV_INTERN void fil_close(void)
Definition: fil0fil.cc:4928
UNIV_INTERN void fil_page_set_type(byte *page, ulint type)
Definition: fil0fil.cc:4899
UNIV_INTERN ulint fil_page_get_prev(const byte *page)
Definition: fil0fil.cc:4876
UNIV_INTERN ibool fil_inc_pending_ibuf_merges(ulint id)
Definition: fil0fil.cc:1872
UNIV_INTERN ulint fil_space_get_flags(ulint id)
Definition: fil0fil.cc:1483
UNIV_INTERN void fil_read_flushed_lsn_and_arch_log_no(os_file_t data_file, ibool one_read_already, ib_uint64_t *min_flushed_lsn, ib_uint64_t *max_flushed_lsn)
Definition: fil0fil.cc:1810
UNIV_INTERN void fil_close_all_files(void)
Definition: fil0fil.cc:1661
UNIV_INTERN ulint fil_space_get_size(ulint id)
Definition: fil0fil.cc:1435
UNIV_INTERN ulint fil_create_new_single_table_tablespace(ulint space_id, const char *tablename, ibool is_temp, ulint flags, ulint size)
Definition: fil0fil.cc:2671
UNIV_INTERN void fil_set_max_space_id_if_bigger(ulint max_id)
Definition: fil0fil.cc:1696
UNIV_INTERN ulint fil_page_get_type(const byte *page)
Definition: fil0fil.cc:4915
ulint fil_n_log_flushes
Definition: fil0fil.cc:115
UNIV_INTERN ibool fil_tablespace_is_being_deleted(ulint id)
Definition: fil0fil.cc:2376
UNIV_INTERN void fil_space_release_free_extents(ulint id, ulint n_reserved)
Definition: fil0fil.cc:4116
ulint fil_n_pending_tablespace_flushes
Definition: fil0fil.cc:120
UNIV_INTERN ibool fil_space_create(const char *name, ulint id, ulint zip_size, ulint purpose)
Definition: fil0fil.cc:1140
UNIV_INTERN void fil_open_log_and_system_tablespace_files(void)
Definition: fil0fil.cc:1606
UNIV_INTERN void fil_flush_file_spaces(ulint purpose)
Definition: fil0fil.cc:4749
UNIV_INTERN ibool fil_space_reserve_free_extents(ulint id, ulint n_free_now, ulint n_to_reserve)
Definition: fil0fil.cc:4083
UNIV_INTERN ibool fil_reset_too_high_lsns(const char *name, ib_uint64_t current_lsn)
Definition: fil0fil.cc:2873
UNIV_INTERN ulint fil_write_flushed_lsn_to_data_files(ib_uint64_t lsn, ulint arch_log_no)
Definition: fil0fil.cc:1754
UNIV_INTERN void fil_aio_wait(ulint segment)
Definition: fil0fil.cc:4570
ulint page
Definition: fil0fil.h:67
UNIV_INTERN ibool fil_tablespace_deleted_or_being_deleted_in_mem(ulint id, ib_int64_t version)
Definition: fil0fil.cc:3647
UNIV_INTERN ibool fil_addr_is_null(fil_addr_t addr)
Definition: fil0fil.cc:4864
UNIV_INTERN bool fil_is_exist(ulint space_id, ulint block_offset)
Definition: fil0fil.cc:4502
UNIV_INTERN ibool fil_discard_tablespace(ulint id)
Definition: fil0fil.cc:2408
UNIV_INTERN ibool fil_space_for_table_exists_in_mem(ulint id, const char *name, ibool is_temp, ibool mark_space, ibool print_error_if_does_not_exist)
Definition: fil0fil.cc:3709
UNIV_INTERN ibool fil_check_adress_in_tablespace(ulint id, ulint page_no)
Definition: fil0fil.cc:1557
ulint fil_n_pending_log_flushes
Definition: fil0fil.cc:118
UNIV_INTERN ibool fil_delete_tablespace(ulint id)
Definition: fil0fil.cc:2203
UNIV_INTERN void fil_decr_pending_ibuf_merges(ulint id)
Definition: fil0fil.cc:1906
UNIV_INTERN ibool fil_validate(void)
Definition: fil0fil.cc:4802
UNIV_INTERN ulint fil_space_get_n_reserved_extents(ulint id)
Definition: fil0fil.cc:4142
UNIV_INTERN ulint fil_load_single_table_tablespaces(void)
Definition: fil0fil.cc:3522
UNIV_INTERN ibool fil_tablespace_exists_in_mem(ulint id)
Definition: fil0fil.cc:3685