1
/*****************************************************************************
3
Copyright (C) 1996, 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
/**************************************************//**
20
@file include/lock0lock.ic
1
/******************************************************
21
2
The transaction lock system
23
6
Created 5/7/1996 Heikki Tuuri
24
7
*******************************************************/
38
21
#include "read0read.h"
39
22
#include "log0recv.h"
41
/*********************************************************************//**
24
/*************************************************************************
42
25
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 */
26
searching for a lock in the hash table. */
49
ulint space, /*!< in: space */
50
ulint page_no)/*!< in: page number */
31
/* out: folded value */
32
ulint space, /* in: space */
33
ulint page_no)/* in: page number */
52
35
return(ut_fold_ulint_pair(space, page_no));
55
/*********************************************************************//**
38
/*************************************************************************
56
39
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 */
40
searching for a lock in the hash table. */
63
ulint space, /*!< in: space */
64
ulint page_no)/*!< in: page number */
45
/* out: hashed value */
46
ulint space, /* in: space */
47
ulint page_no)/* in: page number */
66
49
return(hash_calc_hash(lock_rec_fold(space, page_no),
67
50
lock_sys->rec_hash));
70
/*********************************************************************//**
53
/*************************************************************************
71
54
Checks if some transaction has an implicit x-lock on a record in a clustered
73
@return transaction which has the x-lock, or NULL */
76
58
lock_clust_rec_some_has_impl(
77
59
/*=========================*/
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) */
60
/* out: transaction which has the x-lock, or
62
const rec_t* rec, /* in: user record */
63
dict_index_t* index, /* in: clustered index */
64
const ulint* offsets)/* in: rec_get_offsets(rec, index) */
84
68
ut_ad(mutex_own(&kernel_mutex));
85
69
ut_ad(dict_index_is_clust(index));
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 */
83
/*************************************************************************
84
Gets the heap_no of the smallest user record on a page. */
104
87
lock_get_min_heap_no(
105
88
/*=================*/
106
const buf_block_t* block) /*!< in: buffer block */
89
/* out: heap_no of smallest
91
PAGE_HEAP_NO_SUPREMUM */
92
const buf_block_t* block) /* in: buffer block */
108
94
const page_t* page = block->frame;