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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
fae70d6b
Commit
fae70d6b
authored
Apr 28, 2020
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup: Declare rtr_get_father_node() statically
parent
fb7c1b94
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
117 additions
and
135 deletions
+117
-135
storage/innobase/gis/gis0sea.cc
storage/innobase/gis/gis0sea.cc
+116
-118
storage/innobase/include/gis0rtree.h
storage/innobase/include/gis0rtree.h
+1
-17
No files found.
storage/innobase/gis/gis0sea.cc
View file @
fae70d6b
/*****************************************************************************
Copyright (c) 2016, 2018, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 20
18
, MariaDB Corporation.
Copyright (c) 2017, 20
20
, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
...
...
@@ -686,6 +686,121 @@ rtr_page_get_father(
mem_heap_free
(
heap
);
}
/********************************************************************//**
Returns the upper level node pointer to a R-Tree page. It is assumed
that mtr holds an x-latch on the tree. */
static
void
rtr_get_father_node
(
dict_index_t
*
index
,
/*!< in: index */
ulint
level
,
/*!< in: the tree level of search */
const
dtuple_t
*
tuple
,
/*!< in: data tuple; NOTE: n_fields_cmp in
tuple must be set so that it cannot get
compared to the node ptr page number field! */
btr_cur_t
*
sea_cur
,
/*!< in: search cursor */
btr_cur_t
*
btr_cur
,
/*!< in/out: tree cursor; the cursor page is
s- or x-latched, but see also above! */
ulint
page_no
,
/*!< Current page no */
mtr_t
*
mtr
)
/*!< in: mtr */
{
mem_heap_t
*
heap
=
NULL
;
bool
ret
=
false
;
const
rec_t
*
rec
;
ulint
n_fields
;
bool
new_rtr
=
false
;
/* Try to optimally locate the parent node. Level should always
less than sea_cur->tree_height unless the root is splitting */
if
(
sea_cur
&&
sea_cur
->
tree_height
>
level
)
{
ut_ad
(
mtr_memo_contains_flagged
(
mtr
,
dict_index_get_lock
(
index
),
MTR_MEMO_X_LOCK
|
MTR_MEMO_SX_LOCK
));
ret
=
rtr_cur_restore_position
(
BTR_CONT_MODIFY_TREE
,
sea_cur
,
level
,
mtr
);
/* Once we block shrink tree nodes while there are
active search on it, this optimal locating should always
succeeds */
ut_ad
(
ret
);
if
(
ret
)
{
btr_pcur_t
*
r_cursor
=
rtr_get_parent_cursor
(
sea_cur
,
level
,
false
);
rec
=
btr_pcur_get_rec
(
r_cursor
);
ut_ad
(
r_cursor
->
rel_pos
==
BTR_PCUR_ON
);
page_cur_position
(
rec
,
btr_pcur_get_block
(
r_cursor
),
btr_cur_get_page_cur
(
btr_cur
));
btr_cur
->
rtr_info
=
sea_cur
->
rtr_info
;
btr_cur
->
tree_height
=
sea_cur
->
tree_height
;
ut_ad
(
rtr_compare_cursor_rec
(
index
,
btr_cur
,
page_no
,
&
heap
));
goto
func_exit
;
}
}
/* We arrive here in one of two scenario
1) check table and btr_valide
2) index root page being raised */
ut_ad
(
!
sea_cur
||
sea_cur
->
tree_height
==
level
);
if
(
btr_cur
->
rtr_info
)
{
rtr_clean_rtr_info
(
btr_cur
->
rtr_info
,
true
);
}
else
{
new_rtr
=
true
;
}
btr_cur
->
rtr_info
=
rtr_create_rtr_info
(
false
,
false
,
btr_cur
,
index
);
if
(
sea_cur
&&
sea_cur
->
tree_height
==
level
)
{
/* root split, and search the new root */
btr_cur_search_to_nth_level
(
index
,
level
,
tuple
,
PAGE_CUR_RTREE_LOCATE
,
BTR_CONT_MODIFY_TREE
,
btr_cur
,
0
,
__FILE__
,
__LINE__
,
mtr
);
}
else
{
/* btr_validate */
ut_ad
(
level
>=
1
);
ut_ad
(
!
sea_cur
);
btr_cur_search_to_nth_level
(
index
,
level
,
tuple
,
PAGE_CUR_RTREE_LOCATE
,
BTR_CONT_MODIFY_TREE
,
btr_cur
,
0
,
__FILE__
,
__LINE__
,
mtr
);
rec
=
btr_cur_get_rec
(
btr_cur
);
n_fields
=
dtuple_get_n_fields_cmp
(
tuple
);
if
(
page_rec_is_infimum
(
rec
)
||
(
btr_cur
->
low_match
!=
n_fields
))
{
ret
=
rtr_pcur_getnext_from_path
(
tuple
,
PAGE_CUR_RTREE_LOCATE
,
btr_cur
,
level
,
BTR_CONT_MODIFY_TREE
,
true
,
mtr
);
ut_ad
(
ret
&&
btr_cur
->
low_match
==
n_fields
);
}
}
ret
=
rtr_compare_cursor_rec
(
index
,
btr_cur
,
page_no
,
&
heap
);
ut_ad
(
ret
);
func_exit:
if
(
heap
)
{
mem_heap_free
(
heap
);
}
if
(
new_rtr
&&
btr_cur
->
rtr_info
)
{
rtr_clean_rtr_info
(
btr_cur
->
rtr_info
,
true
);
btr_cur
->
rtr_info
=
NULL
;
}
}
/** Returns the upper level node pointer to a R-Tree page. It is assumed
that mtr holds an SX-latch or X-latch on the tree.
@return rec_get_offsets() of the node pointer record */
...
...
@@ -806,123 +921,6 @@ rtr_page_get_father_block(
cursor
,
mtr
));
}
/********************************************************************//**
Returns the upper level node pointer to a R-Tree page. It is assumed
that mtr holds an x-latch on the tree. */
void
rtr_get_father_node
(
/*================*/
dict_index_t
*
index
,
/*!< in: index */
ulint
level
,
/*!< in: the tree level of search */
const
dtuple_t
*
tuple
,
/*!< in: data tuple; NOTE: n_fields_cmp in
tuple must be set so that it cannot get
compared to the node ptr page number field! */
btr_cur_t
*
sea_cur
,
/*!< in: search cursor */
btr_cur_t
*
btr_cur
,
/*!< in/out: tree cursor; the cursor page is
s- or x-latched, but see also above! */
ulint
page_no
,
/*!< Current page no */
mtr_t
*
mtr
)
/*!< in: mtr */
{
mem_heap_t
*
heap
=
NULL
;
bool
ret
=
false
;
const
rec_t
*
rec
;
ulint
n_fields
;
bool
new_rtr
=
false
;
/* Try to optimally locate the parent node. Level should always
less than sea_cur->tree_height unless the root is splitting */
if
(
sea_cur
&&
sea_cur
->
tree_height
>
level
)
{
ut_ad
(
mtr_memo_contains_flagged
(
mtr
,
dict_index_get_lock
(
index
),
MTR_MEMO_X_LOCK
|
MTR_MEMO_SX_LOCK
));
ret
=
rtr_cur_restore_position
(
BTR_CONT_MODIFY_TREE
,
sea_cur
,
level
,
mtr
);
/* Once we block shrink tree nodes while there are
active search on it, this optimal locating should always
succeeds */
ut_ad
(
ret
);
if
(
ret
)
{
btr_pcur_t
*
r_cursor
=
rtr_get_parent_cursor
(
sea_cur
,
level
,
false
);
rec
=
btr_pcur_get_rec
(
r_cursor
);
ut_ad
(
r_cursor
->
rel_pos
==
BTR_PCUR_ON
);
page_cur_position
(
rec
,
btr_pcur_get_block
(
r_cursor
),
btr_cur_get_page_cur
(
btr_cur
));
btr_cur
->
rtr_info
=
sea_cur
->
rtr_info
;
btr_cur
->
tree_height
=
sea_cur
->
tree_height
;
ut_ad
(
rtr_compare_cursor_rec
(
index
,
btr_cur
,
page_no
,
&
heap
));
goto
func_exit
;
}
}
/* We arrive here in one of two scenario
1) check table and btr_valide
2) index root page being raised */
ut_ad
(
!
sea_cur
||
sea_cur
->
tree_height
==
level
);
if
(
btr_cur
->
rtr_info
)
{
rtr_clean_rtr_info
(
btr_cur
->
rtr_info
,
true
);
}
else
{
new_rtr
=
true
;
}
btr_cur
->
rtr_info
=
rtr_create_rtr_info
(
false
,
false
,
btr_cur
,
index
);
if
(
sea_cur
&&
sea_cur
->
tree_height
==
level
)
{
/* root split, and search the new root */
btr_cur_search_to_nth_level
(
index
,
level
,
tuple
,
PAGE_CUR_RTREE_LOCATE
,
BTR_CONT_MODIFY_TREE
,
btr_cur
,
0
,
__FILE__
,
__LINE__
,
mtr
);
}
else
{
/* btr_validate */
ut_ad
(
level
>=
1
);
ut_ad
(
!
sea_cur
);
btr_cur_search_to_nth_level
(
index
,
level
,
tuple
,
PAGE_CUR_RTREE_LOCATE
,
BTR_CONT_MODIFY_TREE
,
btr_cur
,
0
,
__FILE__
,
__LINE__
,
mtr
);
rec
=
btr_cur_get_rec
(
btr_cur
);
n_fields
=
dtuple_get_n_fields_cmp
(
tuple
);
if
(
page_rec_is_infimum
(
rec
)
||
(
btr_cur
->
low_match
!=
n_fields
))
{
ret
=
rtr_pcur_getnext_from_path
(
tuple
,
PAGE_CUR_RTREE_LOCATE
,
btr_cur
,
level
,
BTR_CONT_MODIFY_TREE
,
true
,
mtr
);
ut_ad
(
ret
&&
btr_cur
->
low_match
==
n_fields
);
}
}
ret
=
rtr_compare_cursor_rec
(
index
,
btr_cur
,
page_no
,
&
heap
);
ut_ad
(
ret
);
func_exit:
if
(
heap
)
{
mem_heap_free
(
heap
);
}
if
(
new_rtr
&&
btr_cur
->
rtr_info
)
{
rtr_clean_rtr_info
(
btr_cur
->
rtr_info
,
true
);
btr_cur
->
rtr_info
=
NULL
;
}
}
/*******************************************************************//**
Create a RTree search info structure */
rtr_info_t
*
...
...
storage/innobase/include/gis0rtree.h
View file @
fae70d6b
/*****************************************************************************
Copyright (c) 2014, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 20
18
, MariaDB Corporation.
Copyright (c) 2017, 20
20
, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
...
...
@@ -166,22 +166,6 @@ rtr_ins_enlarge_mbr(
que_thr_t
*
thr
,
/*!< in: query thread */
mtr_t
*
mtr
);
/*!< in: mtr */
/********************************************************************//**
*/
void
rtr_get_father_node
(
/*================*/
dict_index_t
*
index
,
/*!< in: index */
ulint
level
,
/*!< in: the tree level of search */
const
dtuple_t
*
tuple
,
/*!< in: data tuple; NOTE: n_fields_cmp in
tuple must be set so that it cannot get
compared to the node ptr page number field! */
btr_cur_t
*
sea_cur
,
/*!< in: search cursor */
btr_cur_t
*
cursor
,
/*!< in/out: tree cursor; the cursor page is
s- or x-latched */
ulint
page_no
,
/*!< in: current page no */
mtr_t
*
mtr
);
/*!< in: mtr */
/**************************************************************//**
push a nonleaf index node to the search path */
UNIV_INLINE
...
...
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