InnoDB Plugin  1.0
page0types.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (c) 1994, 2013, Oracle and/or its affiliates. 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 Street, Suite 500, Boston, MA 02110-1335 USA
16 
17 *****************************************************************************/
18 
19 /**************************************************/
26 #ifndef page0types_h
27 #define page0types_h
28 
29 using namespace std;
30 
31 #include <map>
32 
33 #include "univ.i"
34 #include "dict0types.h"
35 #include "mtr0types.h"
36 
38 #define page_t ib_page_t
39 
40 typedef byte page_t;
42 struct page_cur_t;
43 
45 typedef byte page_zip_t;
46 
47 /* The following definitions would better belong to page0zip.h,
48 but we cannot include page0zip.h from rem0rec.ic, because
49 page0*.h includes rem0rec.h and may include rem0rec.ic. */
50 
52 #define PAGE_ZIP_SSIZE_BITS 3
53 
55 #define PAGE_ZIP_SSIZE_MAX \
56  (UNIV_ZIP_SIZE_SHIFT_MAX - UNIV_ZIP_SIZE_SHIFT_MIN + 1)
57 
58 /* Make sure there are enough bits available to store the maximum zip
59 ssize, which is the number of shifts from 512. */
60 #if PAGE_ZIP_SSIZE_MAX >= (1 << PAGE_ZIP_SSIZE_BITS)
61 # error "PAGE_ZIP_SSIZE_MAX >= (1 << PAGE_ZIP_SSIZE_BITS)"
62 #endif
63 
66 {
69 #ifdef UNIV_DEBUG
70  unsigned m_start:16;
71  bool m_external;
73 #endif /* UNIV_DEBUG */
74  unsigned m_end:16;
75  unsigned m_nonempty:1;
77  unsigned n_blobs:12;
80  unsigned ssize:PAGE_ZIP_SSIZE_BITS;
84 };
85 
89  ulint compressed;
93  ulint decompressed;
95  ib_uint64_t compressed_usec;
97  ib_uint64_t decompressed_usec;
98  page_zip_stat_t() :
99  /* Initialize members to 0 so that when we do
100  stlmap[key].compressed++ and element with "key" does not
101  exist it gets inserted with zeroed members. */
102  compressed(0),
103  compressed_ok(0),
104  decompressed(0),
105  compressed_usec(0),
106  decompressed_usec(0)
107  { }
108 };
109 
111 typedef map<index_id_t, page_zip_stat_t> page_zip_stat_per_index_t;
112 
117 extern ib_mutex_t page_zip_stat_per_index_mutex;
118 #ifdef HAVE_PSI_INTERFACE
119 extern mysql_pfs_key_t page_zip_stat_per_index_mutex_key;
120 #endif /* HAVE_PSI_INTERFACE */
121 
122 /**********************************************************************/
125 UNIV_INTERN
126 void
128 /*=====================*/
129  page_zip_des_t* page_zip,
130  const byte* rec,
131  ulint flag)
132  __attribute__((nonnull));
133 
134 /**********************************************************************/
137 UNIV_INTERN
138 void
140 /*===================*/
141  page_zip_des_t* page_zip,
142  const byte* rec,
143  ulint flag)
144  __attribute__((nonnull));
145 
146 /**********************************************************************/
148 UNIV_INTERN
149 void
151 /*================*/
152  page_zip_des_t* page_zip,
153  byte* rec,
154  dict_index_t* index,
155  const ulint* offsets,
156  const byte* free)
157  __attribute__((nonnull(1,2,3,4)));
158 
159 /**********************************************************************/
161 UNIV_INTERN
162 void
164 /*==================*/
165  page_zip_des_t* page_zip,
166  ulint is_clustered)
168  __attribute__((nonnull));
169 #endif