1 | /***************************************************************************** |
2 | |
3 | Copyright (C) 2013, 2017, MariaDB Corporation. 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., |
15 | 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
16 | |
17 | *****************************************************************************/ |
18 | |
19 | /******************************************************************//** |
20 | @file include/dict0pagecompress.ic |
21 | Inline implementation for helper functions for extracting/storing |
22 | page compression and atomic writes information to dictionary. |
23 | |
24 | Created 11/12/2013 Jan Lindström jan.lindstrom@skysql.com |
25 | ***********************************************************************/ |
26 | |
27 | /********************************************************************//** |
28 | Extract the page compression level from dict_table_t::flags. |
29 | These flags are in memory, so assert that they are valid. |
30 | @return page compression level, or 0 if not compressed */ |
31 | UNIV_INLINE |
32 | ulint |
33 | dict_tf_get_page_compression_level( |
34 | /*===============================*/ |
35 | ulint flags) /*!< in: flags */ |
36 | { |
37 | ulint page_compression_level = DICT_TF_GET_PAGE_COMPRESSION_LEVEL(flags); |
38 | |
39 | ut_ad(page_compression_level <= 9); |
40 | |
41 | return(page_compression_level); |
42 | } |
43 | |
44 | /********************************************************************//** |
45 | Check whether the table uses the page compression page format. |
46 | @return page compression level, or 0 if not compressed */ |
47 | UNIV_INLINE |
48 | ulint |
49 | dict_table_page_compression_level( |
50 | /*==============================*/ |
51 | const dict_table_t* table) /*!< in: table */ |
52 | { |
53 | ut_ad(table); |
54 | ut_ad(dict_tf_get_page_compression(table->flags)); |
55 | |
56 | return(dict_tf_get_page_compression_level(table->flags)); |
57 | } |
58 | |
59 | /********************************************************************//** |
60 | Check whether the table uses the page compression page format. |
61 | @return true if page compressed, false if not */ |
62 | UNIV_INLINE |
63 | ibool |
64 | dict_tf_get_page_compression( |
65 | /*=========================*/ |
66 | ulint flags) /*!< in: flags */ |
67 | { |
68 | return(DICT_TF_GET_PAGE_COMPRESSION(flags)); |
69 | } |
70 | |
71 | /********************************************************************//** |
72 | Check whether the table uses the page compression page format. |
73 | @return true if page compressed, false if not */ |
74 | UNIV_INLINE |
75 | ibool |
76 | dict_table_is_page_compressed( |
77 | /*==========================*/ |
78 | const dict_table_t* table) /*!< in: table */ |
79 | { |
80 | return (dict_tf_get_page_compression(table->flags)); |
81 | } |
82 | |