~drizzle-trunk/drizzle/development

641.2.2 by Monty Taylor
InnoDB Plugin 1.0.3
1
/*****************************************************************************
2
1999.6.1 by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file
3
Copyright (C) 2007, 2009, Innobase Oy. All Rights Reserved.
641.2.2 by Monty Taylor
InnoDB Plugin 1.0.3
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
1802.10.2 by Monty Taylor
Update all of the copyright headers to include the correct address.
14
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15
St, Fifth Floor, Boston, MA 02110-1301 USA
641.2.2 by Monty Taylor
InnoDB Plugin 1.0.3
16
17
*****************************************************************************/
18
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
19
/**************************************************//**
20
@file include/lock0priv.h
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
21
Lock module internal structures and methods.
22
23
Created July 12, 2007 Vasil Dimov
24
*******************************************************/
25
2234 by Brian Aker
Mass removal of ifdef/endif in favor of pragma once.
26
#pragma once
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
27
#ifndef lock0priv_h
28
#define lock0priv_h
29
30
#ifndef LOCK_MODULE_IMPLEMENTATION
31
/* If you need to access members of the structures defined in this
32
file, please write appropriate functions that retrieve them and put
33
those functions in lock/ */
34
#error Do not include lock0priv.h outside of the lock/ module
35
#endif
36
37
#include "univ.i"
38
#include "dict0types.h"
39
#include "hash0hash.h"
40
#include "trx0types.h"
41
#include "ut0lst.h"
42
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
43
/** A table lock */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
44
typedef struct lock_table_struct	lock_table_t;
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
45
/** A table lock */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
46
struct lock_table_struct {
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
47
	dict_table_t*	table;		/*!< database table in dictionary
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
48
					cache */
49
	UT_LIST_NODE_T(lock_t)
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
50
			locks;		/*!< list of locks on the same
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
51
					table */
52
};
53
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
54
/** Record lock for a page */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
55
typedef struct lock_rec_struct		lock_rec_t;
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
56
/** Record lock for a page */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
57
struct lock_rec_struct {
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
58
	ulint	space;			/*!< space id */
59
	ulint	page_no;		/*!< page number */
60
	ulint	n_bits;			/*!< number of bits in the lock
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
61
					bitmap; NOTE: the lock bitmap is
62
					placed immediately after the
63
					lock struct */
64
};
65
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
66
/** Lock struct */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
67
struct lock_struct {
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
68
	trx_t*		trx;		/*!< transaction owning the
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
69
					lock */
70
	UT_LIST_NODE_T(lock_t)
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
71
			trx_locks;	/*!< list of the locks of the
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
72
					transaction */
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
73
	ulint		type_mode;	/*!< lock type, mode, LOCK_GAP or
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
74
					LOCK_REC_NOT_GAP,
75
					LOCK_INSERT_INTENTION,
76
					wait flag, ORed */
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
77
	hash_node_t	hash;		/*!< hash chain node for a record
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
78
					lock */
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
79
	dict_index_t*	index;		/*!< index for a record lock */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
80
	union {
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
81
		lock_table_t	tab_lock;/*!< table lock */
82
		lock_rec_t	rec_lock;/*!< record lock */
83
	} un_member;			/*!< lock details */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
84
};
85
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
86
/*********************************************************************//**
87
Gets the type of a lock.
88
@return	LOCK_TABLE or LOCK_REC */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
89
UNIV_INLINE
90
ulint
91
lock_get_type_low(
92
/*==============*/
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
93
	const lock_t*	lock);	/*!< in: lock */
94
95
/*********************************************************************//**
96
Gets the previous record lock set on a record.
97
@return	previous lock on the same record, NULL if none exists */
98
UNIV_INTERN
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
99
const lock_t*
100
lock_rec_get_prev(
101
/*==============*/
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
102
	const lock_t*	in_lock,/*!< in: record lock */
103
	ulint		heap_no);/*!< in: heap number of the record */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
104
105
#ifndef UNIV_NONINL
106
#include "lock0priv.ic"
107
#endif
108
109
#endif /* lock0priv_h */