Skip to content

Commit f02f1ed

Browse files
committed
review fixes
1 parent 6de8f79 commit f02f1ed

File tree

6 files changed

+40
-50
lines changed

6 files changed

+40
-50
lines changed

storage/innobase/fut/fut0lst.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ flst_add_to_empty(
4949
ut_ad(mtr_memo_contains_page_flagged(mtr, node,
5050
MTR_MEMO_PAGE_X_FIX
5151
| MTR_MEMO_PAGE_SX_FIX));
52-
ut_ad(!flst_get_len(base));
52+
ut_a(!flst_get_len(base));
5353

5454
buf_ptr_get_fsp_addr(node, &space, &node_addr);
5555

storage/innobase/include/btr0btr.h

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ Created 6/2/1994 Heikki Tuuri
3737
#include "btr0types.h"
3838
#include "gis0type.h"
3939

40+
#define BTR_MAX_NODE_LEVEL 50 /*!< Maximum B-tree page level
41+
(not really a hard limit).
42+
Used in debug assertions
43+
in btr_page_set_level and
44+
btr_page_get_level */
45+
4046
/** Maximum record size which can be stored on a page, without using the
4147
special big record storage structure */
4248
#define BTR_PAGE_MAX_REC_SIZE (UNIV_PAGE_SIZE / 2 - 200)
@@ -285,13 +291,22 @@ btr_page_get_index_id(
285291
MY_ATTRIBUTE((warn_unused_result));
286292
/********************************************************//**
287293
Gets the node level field in an index page.
294+
@param[in] page index page
288295
@return level, leaf level == 0 */
289296
UNIV_INLINE
290297
ulint
291-
btr_page_get_level(
292-
/*===================*/
293-
const page_t* page) /*!< in: index page */
294-
MY_ATTRIBUTE((warn_unused_result));
298+
btr_page_get_level(const page_t* page)
299+
{
300+
ulint level;
301+
302+
ut_ad(page);
303+
304+
level = mach_read_from_2(page + PAGE_HEADER + PAGE_LEVEL);
305+
306+
ut_ad(level <= BTR_MAX_NODE_LEVEL);
307+
308+
return(level);
309+
} MY_ATTRIBUTE((warn_unused_result))
295310
/********************************************************//**
296311
Gets the next index page number.
297312
@return next page number */

storage/innobase/include/btr0btr.ic

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,6 @@ Created 6/2/1994 Heikki Tuuri
2929
#include "mtr0log.h"
3030
#include "page0zip.h"
3131

32-
#define BTR_MAX_NODE_LEVEL 50 /*!< Maximum B-tree page level
33-
(not really a hard limit).
34-
Used in debug assertions
35-
in btr_page_set_level and
36-
btr_page_get_level */
37-
3832
/** Gets a buffer page and declares its latching order level.
3933
@param[in] page_id page id
4034
@param[in] mode latch mode
@@ -143,26 +137,6 @@ btr_page_get_index_id(
143137
return(mach_read_from_8(page + PAGE_HEADER + PAGE_INDEX_ID));
144138
}
145139

146-
/********************************************************//**
147-
Gets the node level field in an index page.
148-
@return level, leaf level == 0 */
149-
UNIV_INLINE
150-
ulint
151-
btr_page_get_level(
152-
/*===================*/
153-
const page_t* page) /*!< in: index page */
154-
{
155-
ulint level;
156-
157-
ut_ad(page);
158-
159-
level = mach_read_from_2(page + PAGE_HEADER + PAGE_LEVEL);
160-
161-
ut_ad(level <= BTR_MAX_NODE_LEVEL);
162-
163-
return(level);
164-
}
165-
166140
/********************************************************//**
167141
Sets the node level field in an index page. */
168142
UNIV_INLINE

storage/innobase/include/buf0buf.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2351,8 +2351,9 @@ Use these instead of accessing buf_pool->mutex directly. */
23512351

23522352

23532353
/** Get appropriate page_hash_lock. */
2354-
inline rw_lock_t*
2355-
buf_page_hash_lock_get(const buf_pool_t* buf_pool, page_id_t page_id)
2354+
UNIV_INLINE
2355+
rw_lock_t*
2356+
buf_page_hash_lock_get(const buf_pool_t* buf_pool, const page_id_t& page_id)
23562357
{
23572358
return hash_get_lock(buf_pool->page_hash, page_id.fold());
23582359
}

storage/innobase/include/lock0lock.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ lock_rec_find_set_bit(
555555

556556
/*********************************************************************//**
557557
Checks if a lock request lock1 has to wait for request lock2.
558-
@return true if lock1 has to wait for lock2 to be removed */
558+
@return whether lock1 has to wait for lock2 to be removed */
559559
bool
560560
lock_has_to_wait(
561561
/*=============*/

storage/innobase/lock/lock0lock.cc

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ lock_rec_has_to_wait(
765765
|| lock_mode_compatible(
766766
static_cast<lock_mode>(LOCK_MODE_MASK & type_mode),
767767
lock_get_mode(lock2))) {
768-
return(false);
768+
return false;
769769
}
770770

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

782-
return(false);
782+
return false;
783783
}
784784

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

787787
/* Record lock (LOCK_ORDINARY or LOCK_REC_NOT_GAP
788788
does not need to wait for a gap type lock */
789789

790-
return(false);
790+
return false;
791791
}
792792

793793
if ((type_mode & LOCK_GAP) && lock_rec_get_rec_not_gap(lock2)) {
794794

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

798-
return(false);
798+
return false;
799799
}
800800

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

814-
return(false);
814+
return false;
815815
}
816816

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

839-
return(false);
839+
return false;
840840
}
841841

842842
#ifdef WITH_WSREP
@@ -881,7 +881,7 @@ lock_rec_has_to_wait(
881881
lock2->trx->mysql_thd);
882882

883883
if (for_locking) {
884-
return FALSE;
884+
return false;
885885
}
886886
}
887887
} else {
@@ -905,12 +905,12 @@ lock_rec_has_to_wait(
905905
<< wsrep_thd_query(
906906
lock2->trx->mysql_thd);
907907
}
908-
return FALSE;
908+
return false;
909909
}
910910
}
911911
#endif /* WITH_WSREP */
912912

913-
return(true);
913+
return true;
914914
}
915915

916916
/*********************************************************************//**
@@ -930,24 +930,24 @@ lock_has_to_wait(
930930
if (lock1->trx == lock2->trx
931931
|| lock_mode_compatible(lock_get_mode(lock1),
932932
lock_get_mode(lock2))) {
933-
return(false);
933+
return false;
934934
}
935935

936936
if (lock_get_type_low(lock1) != LOCK_REC) {
937-
return(true);
937+
return true;
938938
}
939939

940940
ut_ad(lock_get_type_low(lock2) == LOCK_REC);
941941

942942
if (lock1->type_mode & (LOCK_PREDICATE | LOCK_PRDT_PAGE)) {
943-
return(lock_prdt_has_to_wait(lock1->trx, lock1->type_mode,
943+
return lock_prdt_has_to_wait(lock1->trx, lock1->type_mode,
944944
lock_get_prdt_from_lock(lock1),
945-
lock2));
945+
lock2);
946946
}
947947

948-
return(lock_rec_has_to_wait(
949-
false, lock1->trx, lock1->type_mode, lock2,
950-
lock_rec_get_nth_bit(lock1, PAGE_HEAP_NO_SUPREMUM)));
948+
return lock_rec_has_to_wait(
949+
false, lock1->trx, lock1->type_mode, lock2,
950+
lock_rec_get_nth_bit(lock1, PAGE_HEAP_NO_SUPREMUM));
951951
}
952952

953953
/*============== RECORD LOCK BASIC FUNCTIONS ============================*/

0 commit comments

Comments
 (0)