Commit f02f1eda authored by Eugene Kosov's avatar Eugene Kosov

review fixes

parent 6de8f79b
...@@ -49,7 +49,7 @@ flst_add_to_empty( ...@@ -49,7 +49,7 @@ flst_add_to_empty(
ut_ad(mtr_memo_contains_page_flagged(mtr, node, ut_ad(mtr_memo_contains_page_flagged(mtr, node,
MTR_MEMO_PAGE_X_FIX MTR_MEMO_PAGE_X_FIX
| MTR_MEMO_PAGE_SX_FIX)); | MTR_MEMO_PAGE_SX_FIX));
ut_ad(!flst_get_len(base)); ut_a(!flst_get_len(base));
buf_ptr_get_fsp_addr(node, &space, &node_addr); buf_ptr_get_fsp_addr(node, &space, &node_addr);
......
...@@ -37,6 +37,12 @@ Created 6/2/1994 Heikki Tuuri ...@@ -37,6 +37,12 @@ Created 6/2/1994 Heikki Tuuri
#include "btr0types.h" #include "btr0types.h"
#include "gis0type.h" #include "gis0type.h"
#define BTR_MAX_NODE_LEVEL 50 /*!< Maximum B-tree page level
(not really a hard limit).
Used in debug assertions
in btr_page_set_level and
btr_page_get_level */
/** Maximum record size which can be stored on a page, without using the /** Maximum record size which can be stored on a page, without using the
special big record storage structure */ special big record storage structure */
#define BTR_PAGE_MAX_REC_SIZE (UNIV_PAGE_SIZE / 2 - 200) #define BTR_PAGE_MAX_REC_SIZE (UNIV_PAGE_SIZE / 2 - 200)
...@@ -285,13 +291,22 @@ btr_page_get_index_id( ...@@ -285,13 +291,22 @@ btr_page_get_index_id(
MY_ATTRIBUTE((warn_unused_result)); MY_ATTRIBUTE((warn_unused_result));
/********************************************************//** /********************************************************//**
Gets the node level field in an index page. Gets the node level field in an index page.
@param[in] page index page
@return level, leaf level == 0 */ @return level, leaf level == 0 */
UNIV_INLINE UNIV_INLINE
ulint ulint
btr_page_get_level( btr_page_get_level(const page_t* page)
/*===================*/ {
const page_t* page) /*!< in: index page */ ulint level;
MY_ATTRIBUTE((warn_unused_result));
ut_ad(page);
level = mach_read_from_2(page + PAGE_HEADER + PAGE_LEVEL);
ut_ad(level <= BTR_MAX_NODE_LEVEL);
return(level);
} MY_ATTRIBUTE((warn_unused_result))
/********************************************************//** /********************************************************//**
Gets the next index page number. Gets the next index page number.
@return next page number */ @return next page number */
......
...@@ -29,12 +29,6 @@ Created 6/2/1994 Heikki Tuuri ...@@ -29,12 +29,6 @@ Created 6/2/1994 Heikki Tuuri
#include "mtr0log.h" #include "mtr0log.h"
#include "page0zip.h" #include "page0zip.h"
#define BTR_MAX_NODE_LEVEL 50 /*!< Maximum B-tree page level
(not really a hard limit).
Used in debug assertions
in btr_page_set_level and
btr_page_get_level */
/** Gets a buffer page and declares its latching order level. /** Gets a buffer page and declares its latching order level.
@param[in] page_id page id @param[in] page_id page id
@param[in] mode latch mode @param[in] mode latch mode
...@@ -143,26 +137,6 @@ btr_page_get_index_id( ...@@ -143,26 +137,6 @@ btr_page_get_index_id(
return(mach_read_from_8(page + PAGE_HEADER + PAGE_INDEX_ID)); return(mach_read_from_8(page + PAGE_HEADER + PAGE_INDEX_ID));
} }
/********************************************************//**
Gets the node level field in an index page.
@return level, leaf level == 0 */
UNIV_INLINE
ulint
btr_page_get_level(
/*===================*/
const page_t* page) /*!< in: index page */
{
ulint level;
ut_ad(page);
level = mach_read_from_2(page + PAGE_HEADER + PAGE_LEVEL);
ut_ad(level <= BTR_MAX_NODE_LEVEL);
return(level);
}
/********************************************************//** /********************************************************//**
Sets the node level field in an index page. */ Sets the node level field in an index page. */
UNIV_INLINE UNIV_INLINE
......
...@@ -2351,8 +2351,9 @@ Use these instead of accessing buf_pool->mutex directly. */ ...@@ -2351,8 +2351,9 @@ Use these instead of accessing buf_pool->mutex directly. */
/** Get appropriate page_hash_lock. */ /** Get appropriate page_hash_lock. */
inline rw_lock_t* UNIV_INLINE
buf_page_hash_lock_get(const buf_pool_t* buf_pool, page_id_t page_id) rw_lock_t*
buf_page_hash_lock_get(const buf_pool_t* buf_pool, const page_id_t& page_id)
{ {
return hash_get_lock(buf_pool->page_hash, page_id.fold()); return hash_get_lock(buf_pool->page_hash, page_id.fold());
} }
......
...@@ -555,7 +555,7 @@ lock_rec_find_set_bit( ...@@ -555,7 +555,7 @@ lock_rec_find_set_bit(
/*********************************************************************//** /*********************************************************************//**
Checks if a lock request lock1 has to wait for request lock2. Checks if a lock request lock1 has to wait for request lock2.
@return true if lock1 has to wait for lock2 to be removed */ @return whether lock1 has to wait for lock2 to be removed */
bool bool
lock_has_to_wait( lock_has_to_wait(
/*=============*/ /*=============*/
......
...@@ -765,7 +765,7 @@ lock_rec_has_to_wait( ...@@ -765,7 +765,7 @@ lock_rec_has_to_wait(
|| lock_mode_compatible( || lock_mode_compatible(
static_cast<lock_mode>(LOCK_MODE_MASK & type_mode), static_cast<lock_mode>(LOCK_MODE_MASK & type_mode),
lock_get_mode(lock2))) { lock_get_mode(lock2))) {
return(false); return false;
} }
/* We have somewhat complex rules when gap type record locks /* We have somewhat complex rules when gap type record locks
...@@ -779,7 +779,7 @@ lock_rec_has_to_wait( ...@@ -779,7 +779,7 @@ lock_rec_has_to_wait(
different users can have conflicting lock types different users can have conflicting lock types
on gaps. */ on gaps. */
return(false); return false;
} }
if (!(type_mode & LOCK_INSERT_INTENTION) && lock_rec_get_gap(lock2)) { if (!(type_mode & LOCK_INSERT_INTENTION) && lock_rec_get_gap(lock2)) {
...@@ -787,7 +787,7 @@ lock_rec_has_to_wait( ...@@ -787,7 +787,7 @@ lock_rec_has_to_wait(
/* Record lock (LOCK_ORDINARY or LOCK_REC_NOT_GAP /* Record lock (LOCK_ORDINARY or LOCK_REC_NOT_GAP
does not need to wait for a gap type lock */ does not need to wait for a gap type lock */
return(false); return false;
} }
if ((type_mode & LOCK_GAP) && lock_rec_get_rec_not_gap(lock2)) { if ((type_mode & LOCK_GAP) && lock_rec_get_rec_not_gap(lock2)) {
...@@ -795,7 +795,7 @@ lock_rec_has_to_wait( ...@@ -795,7 +795,7 @@ lock_rec_has_to_wait(
/* Lock on gap does not need to wait for /* Lock on gap does not need to wait for
a LOCK_REC_NOT_GAP type lock */ a LOCK_REC_NOT_GAP type lock */
return(false); return false;
} }
if (lock_rec_get_insert_intention(lock2)) { if (lock_rec_get_insert_intention(lock2)) {
...@@ -811,7 +811,7 @@ lock_rec_has_to_wait( ...@@ -811,7 +811,7 @@ lock_rec_has_to_wait(
Also, insert intention locks do not disturb each Also, insert intention locks do not disturb each
other. */ other. */
return(false); return false;
} }
if ((type_mode & LOCK_GAP || lock_rec_get_gap(lock2)) if ((type_mode & LOCK_GAP || lock_rec_get_gap(lock2))
...@@ -836,7 +836,7 @@ lock_rec_has_to_wait( ...@@ -836,7 +836,7 @@ lock_rec_has_to_wait(
transaction and retry it. But it can save some transaction and retry it. But it can save some
unnecessary rollbacks and retries. */ unnecessary rollbacks and retries. */
return(false); return false;
} }
#ifdef WITH_WSREP #ifdef WITH_WSREP
...@@ -881,7 +881,7 @@ lock_rec_has_to_wait( ...@@ -881,7 +881,7 @@ lock_rec_has_to_wait(
lock2->trx->mysql_thd); lock2->trx->mysql_thd);
if (for_locking) { if (for_locking) {
return FALSE; return false;
} }
} }
} else { } else {
...@@ -905,12 +905,12 @@ lock_rec_has_to_wait( ...@@ -905,12 +905,12 @@ lock_rec_has_to_wait(
<< wsrep_thd_query( << wsrep_thd_query(
lock2->trx->mysql_thd); lock2->trx->mysql_thd);
} }
return FALSE; return false;
} }
} }
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
return(true); return true;
} }
/*********************************************************************//** /*********************************************************************//**
...@@ -930,24 +930,24 @@ lock_has_to_wait( ...@@ -930,24 +930,24 @@ lock_has_to_wait(
if (lock1->trx == lock2->trx if (lock1->trx == lock2->trx
|| lock_mode_compatible(lock_get_mode(lock1), || lock_mode_compatible(lock_get_mode(lock1),
lock_get_mode(lock2))) { lock_get_mode(lock2))) {
return(false); return false;
} }
if (lock_get_type_low(lock1) != LOCK_REC) { if (lock_get_type_low(lock1) != LOCK_REC) {
return(true); return true;
} }
ut_ad(lock_get_type_low(lock2) == LOCK_REC); ut_ad(lock_get_type_low(lock2) == LOCK_REC);
if (lock1->type_mode & (LOCK_PREDICATE | LOCK_PRDT_PAGE)) { if (lock1->type_mode & (LOCK_PREDICATE | LOCK_PRDT_PAGE)) {
return(lock_prdt_has_to_wait(lock1->trx, lock1->type_mode, return lock_prdt_has_to_wait(lock1->trx, lock1->type_mode,
lock_get_prdt_from_lock(lock1), lock_get_prdt_from_lock(lock1),
lock2)); lock2);
} }
return(lock_rec_has_to_wait( return lock_rec_has_to_wait(
false, lock1->trx, lock1->type_mode, lock2, false, lock1->trx, lock1->type_mode, lock2,
lock_rec_get_nth_bit(lock1, PAGE_HEAP_NO_SUPREMUM))); lock_rec_get_nth_bit(lock1, PAGE_HEAP_NO_SUPREMUM));
} }
/*============== RECORD LOCK BASIC FUNCTIONS ============================*/ /*============== RECORD LOCK BASIC FUNCTIONS ============================*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment