1
/*****************************************************************************
3
Copyright (C) 2006, 2009, Innobase Oy. All Rights Reserved.
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.
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.
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
17
*****************************************************************************/
19
/**************************************************//**
1
/******************************************************
21
2
Caching of externally stored column prefixes
23
6
Created September 2006 Marko Makela
24
7
*******************************************************/
32
15
#include "btr0cur.h"
34
/********************************************************************//**
17
/************************************************************************
35
18
Fills the column prefix cache of an externally stored column. */
38
21
row_ext_cache_fill(
39
22
/*===============*/
40
row_ext_t* ext, /*!< in/out: column prefix cache */
41
ulint i, /*!< in: index of ext->ext[] */
42
ulint zip_size,/*!< compressed page size in bytes, or 0 */
43
const dfield_t* dfield) /*!< in: data field */
23
row_ext_t* ext, /* in/out: column prefix cache */
24
ulint i, /* in: index of ext->ext[] */
25
ulint zip_size,/* compressed page size in bytes, or 0 */
26
const dfield_t* dfield) /* in: data field */
45
const byte* field = static_cast<const byte *>(dfield_get_data(dfield));
28
const byte* field = dfield_get_data(dfield);
46
29
ulint f_len = dfield_get_len(dfield);
47
30
byte* buf = ext->buf + i * REC_MAX_INDEX_COL_LEN;
70
/********************************************************************//**
71
Creates a cache of column prefixes of externally stored columns.
72
@return own: column prefix cache */
53
/************************************************************************
54
Creates a cache of column prefixes of externally stored columns. */
77
ulint n_ext, /*!< in: number of externally stored columns */
78
const ulint* ext, /*!< in: col_no's of externally stored columns
59
/* out,own: column prefix cache */
60
ulint n_ext, /* in: number of externally stored columns */
61
const ulint* ext, /* in: col_no's of externally stored columns
79
62
in the InnoDB table object, as reported by
80
63
dict_col_get_no(); NOT relative to the records
81
64
in the clustered index */
82
const dtuple_t* tuple, /*!< in: data tuple containing the field
65
const dtuple_t* tuple, /* in: data tuple containing the field
83
66
references of the externally stored
84
67
columns; must be indexed by col_no;
85
68
the clustered index record must be
86
69
covered by a lock or a page latch
87
70
to prevent deletion (rollback or purge). */
88
ulint zip_size,/*!< compressed page size in bytes, or 0 */
89
mem_heap_t* heap) /*!< in: heap where created */
71
ulint zip_size,/* compressed page size in bytes, or 0 */
72
mem_heap_t* heap) /* in: heap where created */
92
row_ext_t* ret = static_cast<row_ext_t *>(mem_heap_alloc(heap, (sizeof *ret)
93
+ (n_ext - 1) * sizeof ret->len));
75
row_ext_t* ret = mem_heap_alloc(heap, (sizeof *ret)
76
+ (n_ext - 1) * sizeof ret->len);
95
78
ut_ad(ut_is_2pow(zip_size));
96
79
ut_ad(zip_size <= UNIV_PAGE_SIZE);
98
81
ret->n_ext = n_ext;
100
ret->buf = static_cast<byte *>(mem_heap_alloc(heap, n_ext * REC_MAX_INDEX_COL_LEN));
83
ret->buf = mem_heap_alloc(heap, n_ext * REC_MAX_INDEX_COL_LEN);
102
85
memset(ret->buf, 0xaa, n_ext * REC_MAX_INDEX_COL_LEN);
103
86
UNIV_MEM_ALLOC(ret->buf, n_ext * REC_MAX_INDEX_COL_LEN);