Skip to content

Commit

Permalink
review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kevgs committed Feb 16, 2018
1 parent 6de8f79 commit f02f1ed
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 50 deletions.
2 changes: 1 addition & 1 deletion storage/innobase/fut/fut0lst.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ flst_add_to_empty(
ut_ad(mtr_memo_contains_page_flagged(mtr, node,
MTR_MEMO_PAGE_X_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);

Expand Down
23 changes: 19 additions & 4 deletions storage/innobase/include/btr0btr.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ Created 6/2/1994 Heikki Tuuri
#include "btr0types.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
special big record storage structure */
#define BTR_PAGE_MAX_REC_SIZE (UNIV_PAGE_SIZE / 2 - 200)
Expand Down Expand Up @@ -285,13 +291,22 @@ btr_page_get_index_id(
MY_ATTRIBUTE((warn_unused_result));
/********************************************************//**
Gets the node level field in an index page.
@param[in] page index page
@return level, leaf level == 0 */
UNIV_INLINE
ulint
btr_page_get_level(
/*===================*/
const page_t* page) /*!< in: index page */
MY_ATTRIBUTE((warn_unused_result));
btr_page_get_level(const page_t* 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);
} MY_ATTRIBUTE((warn_unused_result))
/********************************************************//**
Gets the next index page number.
@return next page number */
Expand Down
26 changes: 0 additions & 26 deletions storage/innobase/include/btr0btr.ic
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ Created 6/2/1994 Heikki Tuuri
#include "mtr0log.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.
@param[in] page_id page id
@param[in] mode latch mode
Expand Down Expand Up @@ -143,26 +137,6 @@ btr_page_get_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. */
UNIV_INLINE
Expand Down
5 changes: 3 additions & 2 deletions storage/innobase/include/buf0buf.h
Original file line number Diff line number Diff line change
Expand Up @@ -2351,8 +2351,9 @@ Use these instead of accessing buf_pool->mutex directly. */


/** Get appropriate page_hash_lock. */
inline rw_lock_t*
buf_page_hash_lock_get(const buf_pool_t* buf_pool, page_id_t page_id)
UNIV_INLINE
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());
}
Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/include/lock0lock.h
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ lock_rec_find_set_bit(

/*********************************************************************//**
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
lock_has_to_wait(
/*=============*/
Expand Down
32 changes: 16 additions & 16 deletions storage/innobase/lock/lock0lock.cc
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ lock_rec_has_to_wait(
|| lock_mode_compatible(
static_cast<lock_mode>(LOCK_MODE_MASK & type_mode),
lock_get_mode(lock2))) {
return(false);
return false;
}

/* We have somewhat complex rules when gap type record locks
Expand All @@ -779,23 +779,23 @@ lock_rec_has_to_wait(
different users can have conflicting lock types
on gaps. */

return(false);
return false;
}

if (!(type_mode & LOCK_INSERT_INTENTION) && lock_rec_get_gap(lock2)) {

/* Record lock (LOCK_ORDINARY or LOCK_REC_NOT_GAP
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)) {

/* Lock on gap does not need to wait for
a LOCK_REC_NOT_GAP type lock */

return(false);
return false;
}

if (lock_rec_get_insert_intention(lock2)) {
Expand All @@ -811,7 +811,7 @@ lock_rec_has_to_wait(
Also, insert intention locks do not disturb each
other. */

return(false);
return false;
}

if ((type_mode & LOCK_GAP || lock_rec_get_gap(lock2))
Expand All @@ -836,7 +836,7 @@ lock_rec_has_to_wait(
transaction and retry it. But it can save some
unnecessary rollbacks and retries. */

return(false);
return false;
}

#ifdef WITH_WSREP
Expand Down Expand Up @@ -881,7 +881,7 @@ lock_rec_has_to_wait(
lock2->trx->mysql_thd);

if (for_locking) {
return FALSE;
return false;
}
}
} else {
Expand All @@ -905,12 +905,12 @@ lock_rec_has_to_wait(
<< wsrep_thd_query(
lock2->trx->mysql_thd);
}
return FALSE;
return false;
}
}
#endif /* WITH_WSREP */

return(true);
return true;
}

/*********************************************************************//**
Expand All @@ -930,24 +930,24 @@ lock_has_to_wait(
if (lock1->trx == lock2->trx
|| lock_mode_compatible(lock_get_mode(lock1),
lock_get_mode(lock2))) {
return(false);
return false;
}

if (lock_get_type_low(lock1) != LOCK_REC) {
return(true);
return true;
}

ut_ad(lock_get_type_low(lock2) == LOCK_REC);

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),
lock2));
lock2);
}

return(lock_rec_has_to_wait(
false, lock1->trx, lock1->type_mode, lock2,
lock_rec_get_nth_bit(lock1, PAGE_HEAP_NO_SUPREMUM)));
return lock_rec_has_to_wait(
false, lock1->trx, lock1->type_mode, lock2,
lock_rec_get_nth_bit(lock1, PAGE_HEAP_NO_SUPREMUM));
}

/*============== RECORD LOCK BASIC FUNCTIONS ============================*/
Expand Down

0 comments on commit f02f1ed

Please sign in to comment.