00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00026 #pragma once
00027 #ifndef page0zip_h
00028 #define page0zip_h
00029
00030 #ifdef UNIV_MATERIALIZE
00031 # undef UNIV_INLINE
00032 # define UNIV_INLINE
00033 #endif
00034
00035 #include "mtr0types.h"
00036 #include "page0types.h"
00037 #include "buf0types.h"
00038 #include "dict0types.h"
00039 #include "trx0types.h"
00040 #include "mem0mem.h"
00041
00042
00045 UNIV_INLINE
00046 ulint
00047 page_zip_get_size(
00048
00049 const page_zip_des_t* page_zip)
00050 __attribute__((nonnull, pure));
00051
00053 UNIV_INLINE
00054 void
00055 page_zip_set_size(
00056
00057 page_zip_des_t* page_zip,
00058 ulint size);
00060 #ifndef UNIV_HOTBACKUP
00061
00064 UNIV_INLINE
00065 ibool
00066 page_zip_rec_needs_ext(
00067
00068 ulint rec_size,
00069 ulint comp,
00070 ulint n_fields,
00072 ulint zip_size)
00073 __attribute__((const));
00074
00075
00078 UNIV_INTERN
00079 ulint
00080 page_zip_empty_size(
00081
00082 ulint n_fields,
00083 ulint zip_size)
00084 __attribute__((const));
00085 #endif
00086
00087
00089 UNIV_INLINE
00090 void
00091 page_zip_des_init(
00092
00093 page_zip_des_t* page_zip);
00096
00098 UNIV_INTERN
00099 void
00100 page_zip_set_alloc(
00101
00102 void* stream,
00103 mem_heap_t* heap);
00105
00109 UNIV_INTERN
00110 ibool
00111 page_zip_compress(
00112
00113 page_zip_des_t* page_zip,
00115 const page_t* page,
00116 dict_index_t* index,
00117 mtr_t* mtr)
00118 __attribute__((nonnull(1,2,3)));
00119
00120
00125 UNIV_INTERN
00126 ibool
00127 page_zip_decompress(
00128
00129 page_zip_des_t* page_zip,
00131 page_t* page,
00132 ibool all)
00136 __attribute__((nonnull(1,2)));
00137
00138 #ifdef UNIV_DEBUG
00139
00142 UNIV_INLINE
00143 ibool
00144 page_zip_simple_validate(
00145
00146 const page_zip_des_t* page_zip);
00148 #endif
00149
00150 #ifdef UNIV_ZIP_DEBUG
00151
00154 UNIV_INTERN
00155 ibool
00156 page_zip_validate_low(
00157
00158 const page_zip_des_t* page_zip,
00159 const page_t* page,
00160 ibool sloppy)
00162 __attribute__((nonnull));
00163
00165 UNIV_INTERN
00166 ibool
00167 page_zip_validate(
00168
00169 const page_zip_des_t* page_zip,
00170 const page_t* page)
00171 __attribute__((nonnull));
00172 #endif
00173
00174
00178 UNIV_INLINE
00179 lint
00180 page_zip_max_ins_size(
00181
00182 const page_zip_des_t* page_zip,
00183 ibool is_clust)
00184 __attribute__((nonnull, pure));
00185
00186
00189 UNIV_INLINE
00190 ibool
00191 page_zip_available(
00192
00193 const page_zip_des_t* page_zip,
00194 ibool is_clust,
00195 ulint length,
00196 ulint create)
00198 __attribute__((nonnull, pure));
00199
00200
00203 UNIV_INLINE
00204 void
00205 page_zip_write_header(
00206
00207 page_zip_des_t* page_zip,
00208 const byte* str,
00209 ulint length,
00210 mtr_t* mtr)
00211 __attribute__((nonnull(1,2)));
00212
00213
00216 UNIV_INTERN
00217 void
00218 page_zip_write_rec(
00219
00220 page_zip_des_t* page_zip,
00221 const byte* rec,
00222 dict_index_t* index,
00223 const ulint* offsets,
00224 ulint create)
00225 __attribute__((nonnull));
00226
00227
00230 UNIV_INTERN
00231 byte*
00232 page_zip_parse_write_blob_ptr(
00233
00234 byte* ptr,
00235 byte* end_ptr,
00236 page_t* page,
00237 page_zip_des_t* page_zip);
00239
00242 UNIV_INTERN
00243 void
00244 page_zip_write_blob_ptr(
00245
00246 page_zip_des_t* page_zip,
00247 const byte* rec,
00249 dict_index_t* index,
00250 const ulint* offsets,
00251 ulint n,
00252 mtr_t* mtr)
00254 __attribute__((nonnull(1,2,3,4)));
00255
00256
00259 UNIV_INTERN
00260 byte*
00261 page_zip_parse_write_node_ptr(
00262
00263 byte* ptr,
00264 byte* end_ptr,
00265 page_t* page,
00266 page_zip_des_t* page_zip);
00268
00270 UNIV_INTERN
00271 void
00272 page_zip_write_node_ptr(
00273
00274 page_zip_des_t* page_zip,
00275 byte* rec,
00276 ulint size,
00277 ulint ptr,
00278 mtr_t* mtr)
00279 __attribute__((nonnull(1,2)));
00280
00281
00283 UNIV_INTERN
00284 void
00285 page_zip_write_trx_id_and_roll_ptr(
00286
00287 page_zip_des_t* page_zip,
00288 byte* rec,
00289 const ulint* offsets,
00290 ulint trx_id_col,
00291 trx_id_t trx_id,
00292 roll_ptr_t roll_ptr)
00293 __attribute__((nonnull));
00294
00295
00296
00298 UNIV_INTERN
00299 void
00300 page_zip_dir_insert(
00301
00302 page_zip_des_t* page_zip,
00303 const byte* prev_rec,
00304 const byte* free_rec,
00306 byte* rec);
00308 UNIV_INTERN
00309 byte*
00310 page_zip_parse_write_header(
00311
00312 byte* ptr,
00313 byte* end_ptr,
00314 page_t* page,
00315 page_zip_des_t* page_zip);
00318
00329 UNIV_INTERN
00330 ibool
00331 page_zip_reorganize(
00332
00333 buf_block_t* block,
00337 dict_index_t* index,
00338 mtr_t* mtr)
00339 __attribute__((nonnull));
00340 #ifndef UNIV_HOTBACKUP
00341
00346 UNIV_INTERN
00347 void
00348 page_zip_copy_recs(
00349
00350 page_zip_des_t* page_zip,
00353 page_t* page,
00354 const page_zip_des_t* src_zip,
00355 const page_t* src,
00356 dict_index_t* index,
00357 mtr_t* mtr)
00358 __attribute__((nonnull(1,2,3,4)));
00359 #endif
00360
00361
00364 UNIV_INTERN
00365 byte*
00366 page_zip_parse_compress(
00367
00368 byte* ptr,
00369 byte* end_ptr,
00370 page_t* page,
00371 page_zip_des_t* page_zip)
00372 __attribute__((nonnull(1,2)));
00373
00374
00377 UNIV_INTERN
00378 ulint
00379 page_zip_calc_checksum(
00380
00381 const void* data,
00382 ulint size)
00383 __attribute__((nonnull));
00384
00385 #ifndef UNIV_HOTBACKUP
00386
00390 # define PAGE_ZIP_MATCH(ptr, page_zip) \
00391 (buf_frame_get_page_zip(ptr) == (page_zip))
00392 #else
00393
00397 # define PAGE_ZIP_MATCH(ptr, page_zip) \
00398 (page_align(ptr) + UNIV_PAGE_SIZE == (page_zip)->data)
00399 #endif
00400
00401 #ifdef UNIV_MATERIALIZE
00402 # undef UNIV_INLINE
00403 # define UNIV_INLINE UNIV_INLINE_ORIGINAL
00404 #endif
00405
00406 #ifndef UNIV_NONINL
00407 # include "page0zip.ic"
00408 #endif
00409
00410 #endif