Drizzled Public API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
lock0lock.h
Go to the documentation of this file.
1
/*****************************************************************************
2
3
Copyright (C) 1996, 2010, 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
/**************************************************/
26
#pragma once
27
#ifndef lock0lock_h
28
#define lock0lock_h
29
30
#include "univ.i"
31
#include "
buf0types.h
"
32
#include "
trx0types.h
"
33
#include "
mtr0types.h
"
34
#include "
rem0types.h
"
35
#include "
dict0types.h
"
36
#include "
que0types.h
"
37
#include "
lock0types.h
"
38
#include "
read0types.h
"
39
#include "
hash0hash.h
"
40
#include "
ut0vec.h
"
41
42
#ifdef UNIV_DEBUG
43
extern
ibool lock_print_waits;
44
#endif
/* UNIV_DEBUG */
45
/* Buffer for storing information about the most recent deadlock error */
46
extern
FILE* lock_latest_err_file;
47
48
/*********************************************************************/
51
UNIV_INTERN
52
ulint
53
lock_get_size
(
void
);
54
/*===============*/
55
/*********************************************************************/
57
UNIV_INTERN
58
void
59
lock_sys_create
(
60
/*============*/
61
ulint n_cells);
62
/*********************************************************************/
64
UNIV_INTERN
65
void
66
lock_sys_close
(
void
);
67
/*================*/
68
/*********************************************************************/
72
UNIV_INLINE
73
trx_t
*
74
lock_clust_rec_some_has_impl
(
75
/*=========================*/
76
const
rec_t* rec,
77
dict_index_t
* index,
78
const
ulint* offsets);
79
/*********************************************************************/
82
UNIV_INLINE
83
ulint
84
lock_get_min_heap_no
(
85
/*=================*/
86
const
buf_block_t
* block);
87
/*************************************************************/
92
UNIV_INTERN
93
void
94
lock_move_reorganize_page
(
95
/*======================*/
96
const
buf_block_t
* block,
98
const
buf_block_t
* oblock);
100
/*************************************************************/
103
UNIV_INTERN
104
void
105
lock_move_rec_list_end
(
106
/*===================*/
107
const
buf_block_t
* new_block,
108
const
buf_block_t
* block,
109
const
rec_t* rec);
111
/*************************************************************/
114
UNIV_INTERN
115
void
116
lock_move_rec_list_start
(
117
/*=====================*/
118
const
buf_block_t
* new_block,
119
const
buf_block_t
* block,
120
const
rec_t* rec,
123
const
rec_t* old_end);
128
/*************************************************************/
130
UNIV_INTERN
131
void
132
lock_update_split_right
(
133
/*====================*/
134
const
buf_block_t
* right_block,
135
const
buf_block_t
* left_block);
136
/*************************************************************/
138
UNIV_INTERN
139
void
140
lock_update_merge_right
(
141
/*====================*/
142
const
buf_block_t
* right_block,
144
const
rec_t* orig_succ,
148
const
buf_block_t
* left_block);
151
/*************************************************************/
158
UNIV_INTERN
159
void
160
lock_update_root_raise
(
161
/*===================*/
162
const
buf_block_t
* block,
163
const
buf_block_t
* root);
164
/*************************************************************/
167
UNIV_INTERN
168
void
169
lock_update_copy_and_discard
(
170
/*=========================*/
171
const
buf_block_t
* new_block,
173
const
buf_block_t
* block);
175
/*************************************************************/
177
UNIV_INTERN
178
void
179
lock_update_split_left
(
180
/*===================*/
181
const
buf_block_t
* right_block,
182
const
buf_block_t
* left_block);
183
/*************************************************************/
185
UNIV_INTERN
186
void
187
lock_update_merge_left
(
188
/*===================*/
189
const
buf_block_t
* left_block,
191
const
rec_t* orig_pred,
194
const
buf_block_t
* right_block);
196
/*************************************************************/
199
UNIV_INTERN
200
void
201
lock_rec_reset_and_inherit_gap_locks
(
202
/*=================================*/
203
const
buf_block_t
* heir_block,
205
const
buf_block_t
* block,
209
ulint heir_heap_no,
211
ulint heap_no);
213
/*************************************************************/
215
UNIV_INTERN
216
void
217
lock_update_discard
(
218
/*================*/
219
const
buf_block_t
* heir_block,
221
ulint heir_heap_no,
223
const
buf_block_t
* block);
225
/*************************************************************/
227
UNIV_INTERN
228
void
229
lock_update_insert
(
230
/*===============*/
231
const
buf_block_t
* block,
232
const
rec_t* rec);
233
/*************************************************************/
235
UNIV_INTERN
236
void
237
lock_update_delete
(
238
/*===============*/
239
const
buf_block_t
* block,
240
const
rec_t* rec);
241
/*********************************************************************/
248
UNIV_INTERN
249
void
250
lock_rec_store_on_page_infimum
(
251
/*===========================*/
252
const
buf_block_t
* block,
253
const
rec_t* rec);
258
/*********************************************************************/
261
UNIV_INTERN
262
void
263
lock_rec_restore_from_page_infimum
(
264
/*===============================*/
265
const
buf_block_t
* block,
266
const
rec_t* rec,
268
const
buf_block_t
* donator);
273
/*********************************************************************/
276
UNIV_INTERN
277
ibool
278
lock_rec_expl_exist_on_page
(
279
/*========================*/
280
ulint space,
281
ulint page_no);
282
/*********************************************************************/
289
UNIV_INTERN
290
ulint
291
lock_rec_insert_check_and_lock
(
292
/*===========================*/
293
ulint flags,
295
const
rec_t* rec,
296
buf_block_t
* block,
297
dict_index_t
* index,
298
que_thr_t
* thr,
299
mtr_t
* mtr,
300
ibool* inherit);
304
/*********************************************************************/
312
UNIV_INTERN
313
ulint
314
lock_clust_rec_modify_check_and_lock
(
315
/*=================================*/
316
ulint flags,
318
const
buf_block_t
* block,
319
const
rec_t* rec,
321
dict_index_t
* index,
322
const
ulint* offsets,
323
que_thr_t
* thr);
324
/*********************************************************************/
328
UNIV_INTERN
329
ulint
330
lock_sec_rec_modify_check_and_lock
(
331
/*===============================*/
332
ulint flags,
334
buf_block_t
* block,
335
const
rec_t* rec,
340
dict_index_t
* index,
341
que_thr_t
* thr,
342
mtr_t
* mtr);
343
/*********************************************************************/
348
UNIV_INTERN
349
enum
db_err
350
lock_sec_rec_read_check_and_lock
(
351
/*=============================*/
352
ulint flags,
354
const
buf_block_t
* block,
355
const
rec_t* rec,
359
dict_index_t
* index,
360
const
ulint* offsets,
361
enum
lock_mode mode,
366
ulint gap_mode,
368
que_thr_t
* thr);
369
/*********************************************************************/
378
UNIV_INTERN
379
enum
db_err
380
lock_clust_rec_read_check_and_lock
(
381
/*===============================*/
382
ulint flags,
384
const
buf_block_t
* block,
385
const
rec_t* rec,
389
dict_index_t
* index,
390
const
ulint* offsets,
391
enum
lock_mode mode,
396
ulint gap_mode,
398
que_thr_t
* thr);
399
/*********************************************************************/
409
UNIV_INTERN
410
ulint
411
lock_clust_rec_read_check_and_lock_alt
(
412
/*===================================*/
413
ulint flags,
415
const
buf_block_t
* block,
416
const
rec_t* rec,
420
dict_index_t
* index,
421
enum
lock_mode mode,
426
ulint gap_mode,
428
que_thr_t
* thr);
429
/*********************************************************************/
433
UNIV_INTERN
434
ibool
435
lock_clust_rec_cons_read_sees
(
436
/*==========================*/
437
const
rec_t* rec,
439
dict_index_t
* index,
440
const
ulint* offsets,
441
read_view_t
* view);
442
/*********************************************************************/
452
UNIV_INTERN
453
ulint
454
lock_sec_rec_cons_read_sees
(
455
/*========================*/
456
const
rec_t* rec,
459
const
read_view_t
* view);
460
/*********************************************************************/
464
UNIV_INTERN
465
ulint
466
lock_table
(
467
/*=======*/
468
ulint flags,
470
dict_table_t
* table,
471
enum
lock_mode mode,
472
que_thr_t
* thr);
473
/*************************************************************/
477
UNIV_INTERN
478
void
479
lock_rec_unlock
(
480
/*============*/
481
trx_t
* trx,
483
const
buf_block_t
* block,
484
const
rec_t* rec,
485
enum
lock_mode lock_mode);
486
/*********************************************************************/
489
UNIV_INTERN
490
void
491
lock_release_off_kernel
(
492
/*====================*/
493
trx_t
* trx);
494
/*********************************************************************/
497
UNIV_INTERN
498
void
499
lock_cancel_waiting_and_release
(
500
/*============================*/
501
lock_t
* lock);
503
/*********************************************************************/
508
UNIV_INTERN
509
void
510
lock_remove_all_on_table
(
511
/*=====================*/
512
dict_table_t
* table,
514
ibool remove_also_table_sx_locks);
517
/*********************************************************************/
521
UNIV_INLINE
522
ulint
523
lock_rec_fold
(
524
/*==========*/
525
ulint space,
526
ulint page_no)
527
__attribute__((
const
));
528
/*********************************************************************/
532
UNIV_INLINE
533
ulint
534
lock_rec_hash
(
535
/*==========*/
536
ulint space,
537
ulint page_no);
539
/**********************************************************************/
544
UNIV_INTERN
545
ulint
546
lock_rec_find_set_bit
(
547
/*==================*/
548
const
lock_t
* lock);
551
/*********************************************************************/
558
UNIV_INTERN
559
dict_table_t
*
560
lock_get_src_table
(
561
/*===============*/
562
trx_t
* trx,
563
dict_table_t
* dest,
564
enum
lock_mode* mode);
565
/*********************************************************************/
571
UNIV_INTERN
572
ibool
573
lock_is_table_exclusive
(
574
/*====================*/
575
dict_table_t
* table,
576
trx_t
* trx);
577
/*********************************************************************/
580
UNIV_INTERN
581
ibool
582
lock_has_to_wait
(
583
/*=============*/
584
const
lock_t
* lock1,
585
const
lock_t
* lock2);
589
/*********************************************************************/
592
UNIV_INTERN
593
ibool
594
lock_check_trx_id_sanity
(
595
/*=====================*/
596
trx_id_t
trx_id,
597
const
rec_t* rec,
598
dict_index_t
* index,
599
const
ulint* offsets,
600
ibool has_kernel_mutex);
602
/*********************************************************************/
604
UNIV_INTERN
605
void
606
lock_table_print
(
607
/*=============*/
608
FILE* file,
609
const
lock_t
* lock);
610
/*********************************************************************/
612
UNIV_INTERN
613
void
614
lock_rec_print
(
615
/*===========*/
616
FILE* file,
617
const
lock_t
* lock);
618
/*********************************************************************/
622
UNIV_INTERN
623
ibool
624
lock_print_info_summary
(
625
/*====================*/
626
FILE* file,
627
ibool nowait);
628
/*************************************************************************
629
Prints info of locks for each transaction. */
630
UNIV_INTERN
631
void
632
lock_print_info_all_transactions
(
633
/*=============================*/
634
FILE* file);
635
/*********************************************************************/
639
UNIV_INTERN
640
ulint
641
lock_number_of_rows_locked
(
642
/*=======================*/
643
const
trx_t
* trx);
644
/*******************************************************************/
647
UNIV_INTERN
648
ibool
649
lock_trx_holds_autoinc_locks
(
650
/*=========================*/
651
const
trx_t
* trx);
652
/*******************************************************************/
654
UNIV_INTERN
655
void
656
lock_release_autoinc_locks
(
657
/*=======================*/
658
trx_t
* trx);
660
/*******************************************************************/
664
UNIV_INTERN
665
ulint
666
lock_get_type
(
667
/*==========*/
668
const
lock_t
* lock);
670
/*******************************************************************/
673
UNIV_INTERN
674
trx_id_t
675
lock_get_trx_id
(
676
/*============*/
677
const
lock_t
* lock);
679
/*******************************************************************/
683
UNIV_INTERN
684
const
char
*
685
lock_get_mode_str
(
686
/*==============*/
687
const
lock_t
* lock);
689
/*******************************************************************/
693
UNIV_INTERN
694
const
char
*
695
lock_get_type_str
(
696
/*==============*/
697
const
lock_t
* lock);
699
/*******************************************************************/
702
UNIV_INTERN
703
table_id_t
704
lock_get_table_id
(
705
/*==============*/
706
const
lock_t
* lock);
708
/*******************************************************************/
712
UNIV_INTERN
713
const
char
*
714
lock_get_table_name
(
715
/*================*/
716
const
lock_t
* lock);
718
/*******************************************************************/
721
UNIV_INTERN
722
const
dict_index_t
*
723
lock_rec_get_index
(
724
/*===============*/
725
const
lock_t
* lock);
727
/*******************************************************************/
731
UNIV_INTERN
732
const
char
*
733
lock_rec_get_index_name
(
734
/*====================*/
735
const
lock_t
* lock);
737
/*******************************************************************/
740
UNIV_INTERN
741
ulint
742
lock_rec_get_space_id
(
743
/*==================*/
744
const
lock_t
* lock);
746
/*******************************************************************/
749
UNIV_INTERN
750
ulint
751
lock_rec_get_page_no
(
752
/*=================*/
753
const
lock_t
* lock);
756
/* @{ */
757
#define LOCK_MODE_MASK 0xFUL
760
/* @{ */
761
#define LOCK_TABLE 16
762
#define LOCK_REC 32
763
#define LOCK_TYPE_MASK 0xF0UL
765
#if LOCK_MODE_MASK & LOCK_TYPE_MASK
766
# error "LOCK_MODE_MASK & LOCK_TYPE_MASK"
767
#endif
768
769
#define LOCK_WAIT 256
773
/* Precise modes */
774
#define LOCK_ORDINARY 0
777
#define LOCK_GAP 512
784
#define LOCK_REC_NOT_GAP 1024
792
#define LOCK_INSERT_INTENTION 2048
800
#if (LOCK_WAIT|LOCK_GAP|LOCK_REC_NOT_GAP|LOCK_INSERT_INTENTION)&LOCK_MODE_MASK
801
# error
802
#endif
803
#if (LOCK_WAIT|LOCK_GAP|LOCK_REC_NOT_GAP|LOCK_INSERT_INTENTION)&LOCK_TYPE_MASK
804
# error
805
#endif
806
/* @} */
807
809
typedef
struct
lock_op_struct
lock_op_t
;
811
struct
lock_op_struct
{
812
dict_table_t
*
table
;
813
enum
lock_mode
mode
;
814
};
815
817
struct
lock_sys_struct
{
818
hash_table_t
*
rec_hash
;
819
};
820
822
extern
lock_sys_t
*
lock_sys
;
823
824
825
#ifndef UNIV_NONINL
826
#include "lock0lock.ic"
827
#endif
828
829
#endif
plugin
innobase
include
lock0lock.h
Generated on Tue Jun 19 2012 18:56:54 for drizzle by
1.8.1