Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
65e4391f
Commit
65e4391f
authored
Oct 26, 2006
by
marko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
branches/zip: lock0lock.c: Add const qualifiers to and assertions
about block->frame matching rec.
parent
3a3d4469
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
57 deletions
+56
-57
lock/lock0lock.c
lock/lock0lock.c
+56
-57
No files found.
lock/lock0lock.c
View file @
65e4391f
...
@@ -415,7 +415,7 @@ ulint
...
@@ -415,7 +415,7 @@ ulint
lock_get_type
(
lock_get_type
(
/*==========*/
/*==========*/
/* out: LOCK_TABLE or LOCK_REC */
/* out: LOCK_TABLE or LOCK_REC */
lock_t
*
lock
)
/* in: lock */
const
lock_t
*
lock
)
/* in: lock */
{
{
ut_ad
(
lock
);
ut_ad
(
lock
);
...
@@ -429,7 +429,7 @@ ibool
...
@@ -429,7 +429,7 @@ ibool
lock_rec_get_nth_bit
(
lock_rec_get_nth_bit
(
/*=================*/
/*=================*/
/* out: TRUE if bit set */
/* out: TRUE if bit set */
lock_t
*
lock
,
/* in: record lock */
const
lock_t
*
lock
,
/* in: record lock */
ulint
i
)
/* in: index of the bit */
ulint
i
)
/* in: index of the bit */
{
{
ulint
byte_index
;
ulint
byte_index
;
...
@@ -617,7 +617,7 @@ ulint
...
@@ -617,7 +617,7 @@ ulint
lock_get_mode
(
lock_get_mode
(
/*==========*/
/*==========*/
/* out: mode */
/* out: mode */
lock_t
*
lock
)
/* in: lock */
const
lock_t
*
lock
)
/* in: lock */
{
{
ut_ad
(
lock
);
ut_ad
(
lock
);
...
@@ -631,7 +631,7 @@ ibool
...
@@ -631,7 +631,7 @@ ibool
lock_get_wait
(
lock_get_wait
(
/*==========*/
/*==========*/
/* out: TRUE if waiting */
/* out: TRUE if waiting */
lock_t
*
lock
)
/* in: lock */
const
lock_t
*
lock
)
/* in: lock */
{
{
ut_ad
(
lock
);
ut_ad
(
lock
);
...
@@ -729,7 +729,7 @@ lock_is_table_exclusive(
...
@@ -729,7 +729,7 @@ lock_is_table_exclusive(
dict_table_t
*
table
,
/* in: table */
dict_table_t
*
table
,
/* in: table */
trx_t
*
trx
)
/* in: transaction */
trx_t
*
trx
)
/* in: transaction */
{
{
lock_t
*
lock
;
const
lock_t
*
lock
;
ibool
ok
=
FALSE
;
ibool
ok
=
FALSE
;
ut_ad
(
table
&&
trx
);
ut_ad
(
table
&&
trx
);
...
@@ -778,7 +778,7 @@ lock_set_lock_and_trx_wait(
...
@@ -778,7 +778,7 @@ lock_set_lock_and_trx_wait(
ut_ad
(
trx
->
wait_lock
==
NULL
);
ut_ad
(
trx
->
wait_lock
==
NULL
);
trx
->
wait_lock
=
lock
;
trx
->
wait_lock
=
lock
;
lock
->
type_mode
=
lock
->
type_mode
|
LOCK_WAIT
;
lock
->
type_mode
|=
LOCK_WAIT
;
}
}
/**************************************************************************
/**************************************************************************
...
@@ -796,7 +796,7 @@ lock_reset_lock_and_trx_wait(
...
@@ -796,7 +796,7 @@ lock_reset_lock_and_trx_wait(
/* Reset the back pointer in trx to this waiting lock request */
/* Reset the back pointer in trx to this waiting lock request */
(
lock
->
trx
)
->
wait_lock
=
NULL
;
(
lock
->
trx
)
->
wait_lock
=
NULL
;
lock
->
type_mode
=
lock
->
type_mode
&
~
LOCK_WAIT
;
lock
->
type_mode
&=
~
LOCK_WAIT
;
}
}
/*************************************************************************
/*************************************************************************
...
@@ -806,7 +806,7 @@ ibool
...
@@ -806,7 +806,7 @@ ibool
lock_rec_get_gap
(
lock_rec_get_gap
(
/*=============*/
/*=============*/
/* out: TRUE if gap flag set */
/* out: TRUE if gap flag set */
lock_t
*
lock
)
/* in: record lock */
const
lock_t
*
lock
)
/* in: record lock */
{
{
ut_ad
(
lock
);
ut_ad
(
lock
);
ut_ad
(
lock_get_type
(
lock
)
==
LOCK_REC
);
ut_ad
(
lock_get_type
(
lock
)
==
LOCK_REC
);
...
@@ -826,7 +826,7 @@ ibool
...
@@ -826,7 +826,7 @@ ibool
lock_rec_get_rec_not_gap
(
lock_rec_get_rec_not_gap
(
/*=====================*/
/*=====================*/
/* out: TRUE if LOCK_REC_NOT_GAP flag set */
/* out: TRUE if LOCK_REC_NOT_GAP flag set */
lock_t
*
lock
)
/* in: record lock */
const
lock_t
*
lock
)
/* in: record lock */
{
{
ut_ad
(
lock
);
ut_ad
(
lock
);
ut_ad
(
lock_get_type
(
lock
)
==
LOCK_REC
);
ut_ad
(
lock_get_type
(
lock
)
==
LOCK_REC
);
...
@@ -846,7 +846,7 @@ ibool
...
@@ -846,7 +846,7 @@ ibool
lock_rec_get_insert_intention
(
lock_rec_get_insert_intention
(
/*==========================*/
/*==========================*/
/* out: TRUE if gap flag set */
/* out: TRUE if gap flag set */
lock_t
*
lock
)
/* in: record lock */
const
lock_t
*
lock
)
/* in: record lock */
{
{
ut_ad
(
lock
);
ut_ad
(
lock
);
ut_ad
(
lock_get_type
(
lock
)
==
LOCK_REC
);
ut_ad
(
lock_get_type
(
lock
)
==
LOCK_REC
);
...
@@ -945,19 +945,21 @@ UNIV_INLINE
...
@@ -945,19 +945,21 @@ UNIV_INLINE
ibool
ibool
lock_rec_has_to_wait
(
lock_rec_has_to_wait
(
/*=================*/
/*=================*/
/* out: TRUE if new lock has to wait for lock2 to be
/* out: TRUE if new lock has to wait
removed */
for lock2 to be removed */
trx_t
*
trx
,
/* in: trx of new lock */
const
trx_t
*
trx
,
/* in: trx of new lock */
ulint
type_mode
,
/* in: precise mode of the new lock to set:
ulint
type_mode
,
/* in: precise mode of the new lock
LOCK_S or LOCK_X, possibly ORed to
to set: LOCK_S or LOCK_X, possibly
LOCK_GAP or LOCK_REC_NOT_GAP, LOCK_INSERT_INTENTION */
ORed to LOCK_GAP or LOCK_REC_NOT_GAP,
lock_t
*
lock2
,
/* in: another record lock; NOTE that it is assumed
LOCK_INSERT_INTENTION */
that this has a lock bit set on the same record as
const
lock_t
*
lock2
,
/* in: another record lock; NOTE that
in the new lock we are setting */
it is assumed that this has a lock bit
ibool
lock_is_on_supremum
)
/* in: TRUE if we are setting the lock
set on the same record as in the new
on the 'supremum' record of an index
lock we are setting */
page: we know then that the lock request
ibool
lock_is_on_supremum
)
/* in: TRUE if we are setting the
is really for a 'gap' type lock */
lock on the 'supremum' record of an
index page: we know then that the lock
request is really for a 'gap' type lock */
{
{
ut_ad
(
trx
&&
lock2
);
ut_ad
(
trx
&&
lock2
);
ut_ad
(
lock_get_type
(
lock2
)
==
LOCK_REC
);
ut_ad
(
lock_get_type
(
lock2
)
==
LOCK_REC
);
...
@@ -1026,12 +1028,13 @@ static
...
@@ -1026,12 +1028,13 @@ static
ibool
ibool
lock_has_to_wait
(
lock_has_to_wait
(
/*=============*/
/*=============*/
/* out: TRUE if lock1 has to wait for lock2 to be
/* out: TRUE if lock1 has to wait for
removed */
lock2 to be removed */
lock_t
*
lock1
,
/* in: waiting lock */
const
lock_t
*
lock1
,
/* in: waiting lock */
lock_t
*
lock2
)
/* in: another lock; NOTE that it is assumed that this
const
lock_t
*
lock2
)
/* in: another lock; NOTE that it is
has a lock bit set on the same record as in lock1 if
assumed that this has a lock bit set
the locks are record locks */
on the same record as in lock1 if the
locks are record locks */
{
{
ut_ad
(
lock1
&&
lock2
);
ut_ad
(
lock1
&&
lock2
);
...
@@ -1065,7 +1068,7 @@ ulint
...
@@ -1065,7 +1068,7 @@ ulint
lock_rec_get_n_bits
(
lock_rec_get_n_bits
(
/*================*/
/*================*/
/* out: number of bits */
/* out: number of bits */
lock_t
*
lock
)
/* in: record lock */
const
lock_t
*
lock
)
/* in: record lock */
{
{
return
(
lock
->
un_member
.
rec_lock
.
n_bits
);
return
(
lock
->
un_member
.
rec_lock
.
n_bits
);
}
}
...
@@ -1107,9 +1110,9 @@ static
...
@@ -1107,9 +1110,9 @@ static
ulint
ulint
lock_rec_find_set_bit
(
lock_rec_find_set_bit
(
/*==================*/
/*==================*/
/* out: bit index == heap number of the record, or
/* out: bit index == heap number of
ULINT_UNDEFINED if none found */
the record, or
ULINT_UNDEFINED if none found */
lock_t
*
lock
)
/* in: record lock with at least one bit set */
const
lock_t
*
lock
)
/* in: record lock with at least one bit set */
{
{
ulint
i
;
ulint
i
;
...
@@ -1347,26 +1350,18 @@ lock_rec_bitmap_reset(
...
@@ -1347,26 +1350,18 @@ lock_rec_bitmap_reset(
/*==================*/
/*==================*/
lock_t
*
lock
)
/* in: record lock */
lock_t
*
lock
)
/* in: record lock */
{
{
byte
*
ptr
;
ulint
n_bytes
;
ulint
n_bytes
;
ulint
i
;
ut_ad
(
lock_get_type
(
lock
)
==
LOCK_REC
);
ut_ad
(
lock_get_type
(
lock
)
==
LOCK_REC
);
/* Reset to zero the bitmap which resides immediately after the lock
/* Reset to zero the bitmap which resides immediately after the lock
struct */
struct */
ptr
=
(
byte
*
)
lock
+
sizeof
(
lock_t
);
n_bytes
=
lock_rec_get_n_bits
(
lock
)
/
8
;
n_bytes
=
lock_rec_get_n_bits
(
lock
)
/
8
;
ut_ad
((
lock_rec_get_n_bits
(
lock
)
%
8
)
==
0
);
ut_ad
((
lock_rec_get_n_bits
(
lock
)
%
8
)
==
0
);
for
(
i
=
0
;
i
<
n_bytes
;
i
++
)
{
memset
((
byte
*
)
lock
+
sizeof
(
lock_t
),
0
,
n_bytes
);
*
ptr
=
0
;
ptr
++
;
}
}
}
/*************************************************************************
/*************************************************************************
...
@@ -1376,7 +1371,7 @@ lock_t*
...
@@ -1376,7 +1371,7 @@ lock_t*
lock_rec_copy
(
lock_rec_copy
(
/*==========*/
/*==========*/
/* out: copy of lock */
/* out: copy of lock */
lock_t
*
lock
,
/* in: record lock */
const
lock_t
*
lock
,
/* in: record lock */
mem_heap_t
*
heap
)
/* in: memory heap */
mem_heap_t
*
heap
)
/* in: memory heap */
{
{
lock_t
*
dupl_lock
;
lock_t
*
dupl_lock
;
...
@@ -5022,13 +5017,13 @@ lock_rec_insert_check_and_lock(
...
@@ -5022,13 +5017,13 @@ lock_rec_insert_check_and_lock(
ulint
err
;
ulint
err
;
ulint
next_rec_heap_no
;
ulint
next_rec_heap_no
;
ut_ad
(
block
->
frame
==
page_align
(
rec
));
if
(
flags
&
BTR_NO_LOCKING_FLAG
)
{
if
(
flags
&
BTR_NO_LOCKING_FLAG
)
{
return
(
DB_SUCCESS
);
return
(
DB_SUCCESS
);
}
}
ut_ad
(
rec
);
trx
=
thr_get_trx
(
thr
);
trx
=
thr_get_trx
(
thr
);
next_rec
=
page_rec_get_next
(
rec
);
next_rec
=
page_rec_get_next
(
rec
);
...
@@ -5184,6 +5179,7 @@ lock_clust_rec_modify_check_and_lock(
...
@@ -5184,6 +5179,7 @@ lock_clust_rec_modify_check_and_lock(
ut_ad
(
rec_offs_validate
(
rec
,
index
,
offsets
));
ut_ad
(
rec_offs_validate
(
rec
,
index
,
offsets
));
ut_ad
(
dict_index_is_clust
(
index
));
ut_ad
(
dict_index_is_clust
(
index
));
ut_ad
(
block
->
frame
==
page_align
((
rec_t
*
)
rec
));
if
(
flags
&
BTR_NO_LOCKING_FLAG
)
{
if
(
flags
&
BTR_NO_LOCKING_FLAG
)
{
...
@@ -5236,13 +5232,14 @@ lock_sec_rec_modify_check_and_lock(
...
@@ -5236,13 +5232,14 @@ lock_sec_rec_modify_check_and_lock(
ulint
err
;
ulint
err
;
ulint
heap_no
;
ulint
heap_no
;
ut_ad
(
!
dict_index_is_clust
(
index
));
ut_ad
(
block
->
frame
==
page_align
(
rec
));
if
(
flags
&
BTR_NO_LOCKING_FLAG
)
{
if
(
flags
&
BTR_NO_LOCKING_FLAG
)
{
return
(
DB_SUCCESS
);
return
(
DB_SUCCESS
);
}
}
ut_ad
(
!
dict_index_is_clust
(
index
));
heap_no
=
page_rec_get_heap_no
(
rec
);
heap_no
=
page_rec_get_heap_no
(
rec
);
/* Another transaction cannot have an implicit lock on the record,
/* Another transaction cannot have an implicit lock on the record,
...
@@ -5317,6 +5314,7 @@ lock_sec_rec_read_check_and_lock(
...
@@ -5317,6 +5314,7 @@ lock_sec_rec_read_check_and_lock(
ulint
heap_no
;
ulint
heap_no
;
ut_ad
(
!
dict_index_is_clust
(
index
));
ut_ad
(
!
dict_index_is_clust
(
index
));
ut_ad
(
block
->
frame
==
page_align
((
rec_t
*
)
rec
));
ut_ad
(
page_rec_is_user_rec
(
rec
)
||
page_rec_is_supremum
(
rec
));
ut_ad
(
page_rec_is_user_rec
(
rec
)
||
page_rec_is_supremum
(
rec
));
ut_ad
(
rec_offs_validate
(
rec
,
index
,
offsets
));
ut_ad
(
rec_offs_validate
(
rec
,
index
,
offsets
));
...
@@ -5392,6 +5390,7 @@ lock_clust_rec_read_check_and_lock(
...
@@ -5392,6 +5390,7 @@ lock_clust_rec_read_check_and_lock(
ulint
heap_no
;
ulint
heap_no
;
ut_ad
(
dict_index_is_clust
(
index
));
ut_ad
(
dict_index_is_clust
(
index
));
ut_ad
(
block
->
frame
==
page_align
((
rec_t
*
)
rec
));
ut_ad
(
page_rec_is_user_rec
(
rec
)
||
page_rec_is_supremum
(
rec
));
ut_ad
(
page_rec_is_user_rec
(
rec
)
||
page_rec_is_supremum
(
rec
));
ut_ad
(
gap_mode
==
LOCK_ORDINARY
||
gap_mode
==
LOCK_GAP
ut_ad
(
gap_mode
==
LOCK_ORDINARY
||
gap_mode
==
LOCK_GAP
||
gap_mode
==
LOCK_REC_NOT_GAP
);
||
gap_mode
==
LOCK_REC_NOT_GAP
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment