| 1 |
/***************************************************************************** |
| 2 |
|
| 3 |
Copyright (c) 1996, 2026, Oracle and/or its affiliates. |
| 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, version 2.0, as published by the |
| 7 |
Free Software Foundation. |
| 8 |
|
| 9 |
This program is designed to work with certain software (including |
| 10 |
but not limited to OpenSSL) that is licensed under separate terms, |
| 11 |
as designated in a particular file or component or in included license |
| 12 |
documentation. The authors of MySQL hereby grant you an additional |
| 13 |
permission to link the program and your derivative works with the |
| 14 |
separately licensed software that they have either included with |
| 15 |
the program or referenced in the documentation. |
| 16 |
|
| 17 |
This program is distributed in the hope that it will be useful, but WITHOUT |
| 18 |
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 19 |
FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0, |
| 20 |
for more details. |
| 21 |
|
| 22 |
You should have received a copy of the GNU General Public License along with |
| 23 |
this program; if not, write to the Free Software Foundation, Inc., |
| 24 |
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 25 |
|
| 26 |
*****************************************************************************/ |
| 27 |
|
| 28 |
/** @file include/lock0lock.ic |
| 29 |
The transaction lock system |
| 30 |
|
| 31 |
Created 5/7/1996 Heikki Tuuri |
| 32 |
*******************************************************/ |
| 33 |
|
| 34 |
#include "btr0cur.h" |
| 35 |
#include "buf0buf.h" |
| 36 |
#include "dict0dict.h" |
| 37 |
#include "log0recv.h" |
| 38 |
#include "page0cur.h" |
| 39 |
#include "page0page.h" |
| 40 |
#include "que0que.h" |
| 41 |
#include "read0read.h" |
| 42 |
#include "row0row.h" |
| 43 |
#include "row0vers.h" |
| 44 |
#include "srv0srv.h" |
| 45 |
#include "trx0sys.h" |
| 46 |
#include "trx0trx.h" |
| 47 |
|
| 48 |
static inline uint64_t lock_rec_hash_value(const page_id_t &page_id) { |
| 49 |
return page_id.hash(); |
| 50 |
} |
| 51 |
|
| 52 |
/** Gets the heap_no of the smallest user record on a page. |
| 53 |
@return heap_no of smallest user record, or PAGE_HEAP_NO_SUPREMUM */ |
| 54 |
static inline ulint lock_get_min_heap_no( |
| 55 |
const buf_block_t *block) /*!< in: buffer block */ |
| 56 |
{ |
| 57 |
const page_t *page = block->frame; |
| 58 |
|
| 59 |
if (page_is_comp(page)) { |
| 60 |
return (rec_get_heap_no_new( |
| 61 |
page + rec_get_next_offs(page + PAGE_NEW_INFIMUM, true))); |
| 62 |
} else { |
| 63 |
return (rec_get_heap_no_old( |
| 64 |
page + rec_get_next_offs(page + PAGE_OLD_INFIMUM, false))); |
| 65 |
} |
| 66 |
} |
| 67 |
|
| 68 |
/** Get the lock hash table */ |
| 69 |
static inline Locks_hashtable &lock_hash_get(ulint mode) /*!< in: lock mode */ |
| 70 |
{ |
| 71 |
if (mode & LOCK_PREDICATE) { |
| 72 |
return lock_sys->prdt_hash; |
| 73 |
} else if (mode & LOCK_PRDT_PAGE) { |
| 74 |
return lock_sys->prdt_page_hash; |
| 75 |
} else { |
| 76 |
return lock_sys->rec_hash; |
| 77 |
} |
| 78 |
} |