~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/include/lock0priv.h

  • Committer: Brian Aker
  • Date: 2009-03-27 22:55:28 UTC
  • mto: This revision was merged to the branch mainline in revision 968.
  • Revision ID: brian@tangent.org-20090327225528-8y76cfx8a4oemqv9
Remove ref_count

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*****************************************************************************
 
2
 
 
3
Copyright (c) 2007, 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., 59 Temple
 
15
Place, Suite 330, Boston, MA 02111-1307 USA
 
16
 
 
17
*****************************************************************************/
 
18
 
 
19
/******************************************************
 
20
Lock module internal structures and methods.
 
21
 
 
22
Created July 12, 2007 Vasil Dimov
 
23
*******************************************************/
 
24
 
 
25
#ifndef lock0priv_h
 
26
#define lock0priv_h
 
27
 
 
28
#ifndef LOCK_MODULE_IMPLEMENTATION
 
29
/* If you need to access members of the structures defined in this
 
30
file, please write appropriate functions that retrieve them and put
 
31
those functions in lock/ */
 
32
#error Do not include lock0priv.h outside of the lock/ module
 
33
#endif
 
34
 
 
35
#include "univ.i"
 
36
#include "dict0types.h"
 
37
#include "hash0hash.h"
 
38
#include "trx0types.h"
 
39
#include "ut0lst.h"
 
40
 
 
41
/* A table lock */
 
42
typedef struct lock_table_struct        lock_table_t;
 
43
struct lock_table_struct {
 
44
        dict_table_t*   table;          /* database table in dictionary
 
45
                                        cache */
 
46
        UT_LIST_NODE_T(lock_t)
 
47
                        locks;          /* list of locks on the same
 
48
                                        table */
 
49
};
 
50
 
 
51
/* Record lock for a page */
 
52
typedef struct lock_rec_struct          lock_rec_t;
 
53
struct lock_rec_struct {
 
54
        ulint   space;                  /* space id */
 
55
        ulint   page_no;                /* page number */
 
56
        ulint   n_bits;                 /* number of bits in the lock
 
57
                                        bitmap; NOTE: the lock bitmap is
 
58
                                        placed immediately after the
 
59
                                        lock struct */
 
60
};
 
61
 
 
62
/* Lock struct */
 
63
struct lock_struct {
 
64
        trx_t*          trx;            /* transaction owning the
 
65
                                        lock */
 
66
        UT_LIST_NODE_T(lock_t)
 
67
                        trx_locks;      /* list of the locks of the
 
68
                                        transaction */
 
69
        ulint           type_mode;      /* lock type, mode, LOCK_GAP or
 
70
                                        LOCK_REC_NOT_GAP,
 
71
                                        LOCK_INSERT_INTENTION,
 
72
                                        wait flag, ORed */
 
73
        hash_node_t     hash;           /* hash chain node for a record
 
74
                                        lock */
 
75
        dict_index_t*   index;          /* index for a record lock */
 
76
        union {
 
77
                lock_table_t    tab_lock;/* table lock */
 
78
                lock_rec_t      rec_lock;/* record lock */
 
79
        } un_member;
 
80
};
 
81
 
 
82
/*************************************************************************
 
83
Gets the type of a lock. */
 
84
UNIV_INLINE
 
85
ulint
 
86
lock_get_type_low(
 
87
/*==============*/
 
88
                                /* out: LOCK_TABLE or LOCK_REC */
 
89
        const lock_t*   lock);  /* in: lock */
 
90
 
 
91
/*************************************************************************
 
92
Gets the previous record lock set on a record. */
 
93
 
 
94
const lock_t*
 
95
lock_rec_get_prev(
 
96
/*==============*/
 
97
                                /* out: previous lock on the same
 
98
                                record, NULL if none exists */
 
99
        const lock_t*   in_lock,/* in: record lock */
 
100
        ulint           heap_no);/* in: heap number of the record */
 
101
 
 
102
#ifndef UNIV_NONINL
 
103
#include "lock0priv.ic"
 
104
#endif
 
105
 
 
106
#endif /* lock0priv_h */