~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/include/lock0lock.ic

  • Committer: Vijay Samuel
  • Date: 2010-09-10 21:03:37 UTC
  • mto: (1757.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 1758.
  • Revision ID: vijay@vijay-20100910210337-rf7c2ymawtqj6tkv
Merge added utf 8 tamil test case suite and test case for creating a database in tamil.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*****************************************************************************
2
 
 
3
 
Copyright (c) 1996, 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 include/lock0lock.ic
21
 
The transaction lock system
22
 
 
23
 
Created 5/7/1996 Heikki Tuuri
24
 
*******************************************************/
25
 
 
26
 
#include "sync0sync.h"
27
 
#include "srv0srv.h"
28
 
#include "dict0dict.h"
29
 
#include "row0row.h"
30
 
#include "trx0sys.h"
31
 
#include "trx0trx.h"
32
 
#include "buf0buf.h"
33
 
#include "page0page.h"
34
 
#include "page0cur.h"
35
 
#include "row0vers.h"
36
 
#include "que0que.h"
37
 
#include "btr0cur.h"
38
 
#include "read0read.h"
39
 
#include "log0recv.h"
40
 
 
41
 
/*********************************************************************//**
42
 
Calculates the fold value of a page file address: used in inserting or
43
 
searching for a lock in the hash table.
44
 
@return folded value */
45
 
UNIV_INLINE
46
 
ulint
47
 
lock_rec_fold(
48
 
/*==========*/
49
 
        ulint   space,  /*!< in: space */
50
 
        ulint   page_no)/*!< in: page number */
51
 
{
52
 
        return(ut_fold_ulint_pair(space, page_no));
53
 
}
54
 
 
55
 
/*********************************************************************//**
56
 
Calculates the hash value of a page file address: used in inserting or
57
 
searching for a lock in the hash table.
58
 
@return hashed value */
59
 
UNIV_INLINE
60
 
ulint
61
 
lock_rec_hash(
62
 
/*==========*/
63
 
        ulint   space,  /*!< in: space */
64
 
        ulint   page_no)/*!< in: page number */
65
 
{
66
 
        return(hash_calc_hash(lock_rec_fold(space, page_no),
67
 
                              lock_sys->rec_hash));
68
 
}
69
 
 
70
 
/*********************************************************************//**
71
 
Checks if some transaction has an implicit x-lock on a record in a clustered
72
 
index.
73
 
@return transaction which has the x-lock, or NULL */
74
 
UNIV_INLINE
75
 
trx_t*
76
 
lock_clust_rec_some_has_impl(
77
 
/*=========================*/
78
 
        const rec_t*    rec,    /*!< in: user record */
79
 
        dict_index_t*   index,  /*!< in: clustered index */
80
 
        const ulint*    offsets)/*!< in: rec_get_offsets(rec, index) */
81
 
{
82
 
        trx_id_t        trx_id;
83
 
 
84
 
        ut_ad(mutex_own(&kernel_mutex));
85
 
        ut_ad(dict_index_is_clust(index));
86
 
        ut_ad(page_rec_is_user_rec(rec));
87
 
 
88
 
        trx_id = row_get_rec_trx_id(rec, index, offsets);
89
 
 
90
 
        if (trx_is_active(trx_id)) {
91
 
                /* The modifying or inserting transaction is active */
92
 
 
93
 
                return(trx_get_on_id(trx_id));
94
 
        }
95
 
 
96
 
        return(NULL);
97
 
}
98
 
 
99
 
/*********************************************************************//**
100
 
Gets the heap_no of the smallest user record on a page.
101
 
@return heap_no of smallest user record, or PAGE_HEAP_NO_SUPREMUM */
102
 
UNIV_INLINE
103
 
ulint
104
 
lock_get_min_heap_no(
105
 
/*=================*/
106
 
        const buf_block_t*      block)  /*!< in: buffer block */
107
 
{
108
 
        const page_t*   page    = block->frame;
109
 
 
110
 
        if (page_is_comp(page)) {
111
 
                return(rec_get_heap_no_new(
112
 
                               page
113
 
                               + rec_get_next_offs(page + PAGE_NEW_INFIMUM,
114
 
                                                   TRUE)));
115
 
        } else {
116
 
                return(rec_get_heap_no_old(
117
 
                               page
118
 
                               + rec_get_next_offs(page + PAGE_OLD_INFIMUM,
119
 
                                                   FALSE)));
120
 
        }
121
 
}