~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/row/row0ext.c

  • Committer: Mark Atwood
  • Date: 2009-03-04 01:02:00 UTC
  • mto: (968.2.20 mordred)
  • mto: This revision was merged to the branch mainline in revision 971.
  • Revision ID: me@mark.atwood.name-20090304010200-t1n4xxdoil2yae9a
add gearman logging plugin

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*****************************************************************************
2
 
 
3
 
Copyright (C) 2006, 2009, 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
 
/**************************************************//**
20
 
@file row/row0ext.c
 
1
/******************************************************
21
2
Caching of externally stored column prefixes
22
3
 
 
4
(c) 2006 Innobase Oy
 
5
 
23
6
Created September 2006 Marko Makela
24
7
*******************************************************/
25
8
 
31
14
 
32
15
#include "btr0cur.h"
33
16
 
34
 
/********************************************************************//**
 
17
/************************************************************************
35
18
Fills the column prefix cache of an externally stored column. */
36
19
static
37
20
void
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 */
44
27
{
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;
48
31
 
67
50
        }
68
51
}
69
52
 
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. */
73
55
UNIV_INTERN
74
56
row_ext_t*
75
57
row_ext_create(
76
58
/*===========*/
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 */
90
73
{
91
74
        ulint           i;
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);
94
77
 
95
78
        ut_ad(ut_is_2pow(zip_size));
96
79
        ut_ad(zip_size <= UNIV_PAGE_SIZE);
97
80
 
98
81
        ret->n_ext = n_ext;
99
82
        ret->ext = 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);
101
84
#ifdef UNIV_DEBUG
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);