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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
ea5a7a3d
Commit
ea5a7a3d
authored
Nov 04, 2003
by
ram@deer.(none)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix for r-tree code (memory overlap reported by valgrind)
new comments.
parent
669365b4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
83 additions
and
40 deletions
+83
-40
BitKeeper/etc/logging_ok
BitKeeper/etc/logging_ok
+1
-0
myisam/mi_open.c
myisam/mi_open.c
+1
-0
myisam/myisamdef.h
myisam/myisamdef.h
+1
-0
myisam/rt_index.c
myisam/rt_index.c
+80
-40
No files found.
BitKeeper/etc/logging_ok
View file @
ea5a7a3d
...
@@ -100,6 +100,7 @@ peter@linux.local
...
@@ -100,6 +100,7 @@ peter@linux.local
peter@mysql.com
peter@mysql.com
peterg@mysql.com
peterg@mysql.com
pgulutzan@linux.local
pgulutzan@linux.local
ram@deer.(none)
ram@gw.mysql.r18.ru
ram@gw.mysql.r18.ru
ram@gw.udmsearch.izhnet.ru
ram@gw.udmsearch.izhnet.ru
ram@mysql.r18.ru
ram@mysql.r18.ru
...
...
myisam/mi_open.c
View file @
ea5a7a3d
...
@@ -508,6 +508,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
...
@@ -508,6 +508,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
&
info
.
buff
,(
share
->
base
.
max_key_block_length
*
2
+
&
info
.
buff
,(
share
->
base
.
max_key_block_length
*
2
+
share
->
base
.
max_key_length
),
share
->
base
.
max_key_length
),
&
info
.
lastkey
,
share
->
base
.
max_key_length
*
3
+
1
,
&
info
.
lastkey
,
share
->
base
.
max_key_length
*
3
+
1
,
&
info
.
first_mbr_key
,
share
->
base
.
max_key_length
,
&
info
.
filename
,
strlen
(
org_name
)
+
1
,
&
info
.
filename
,
strlen
(
org_name
)
+
1
,
&
info
.
rtree_recursion_state
,
have_rtree
?
1024
:
0
,
&
info
.
rtree_recursion_state
,
have_rtree
?
1024
:
0
,
NullS
))
NullS
))
...
...
myisam/myisamdef.h
View file @
ea5a7a3d
...
@@ -229,6 +229,7 @@ struct st_myisam_info {
...
@@ -229,6 +229,7 @@ struct st_myisam_info {
char
*
filename
;
/* parameter to open filename */
char
*
filename
;
/* parameter to open filename */
uchar
*
buff
,
/* Temp area for key */
uchar
*
buff
,
/* Temp area for key */
*
lastkey
,
*
lastkey2
;
/* Last used search key */
*
lastkey
,
*
lastkey2
;
/* Last used search key */
uchar
*
first_mbr_key
;
/* Searhed spatial key */
byte
*
rec_buff
;
/* Tempbuff for recordpack */
byte
*
rec_buff
;
/* Tempbuff for recordpack */
uchar
*
int_keypos
,
/* Save position for next/previous */
uchar
*
int_keypos
,
/* Save position for next/previous */
*
int_maxpos
;
/* -""- */
*
int_maxpos
;
/* -""- */
...
...
myisam/rt_index.c
View file @
ea5a7a3d
...
@@ -86,7 +86,7 @@ static int rtree_find_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint search_flag,
...
@@ -86,7 +86,7 @@ static int rtree_find_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint search_flag,
if
(
nod_flag
)
if
(
nod_flag
)
{
{
/* this is an internal node in the tree */
/* this is an internal node in the tree */
if
(
!
(
res
=
rtree_key_cmp
(
keyinfo
->
seg
,
info
->
lastkey2
,
k
,
if
(
!
(
res
=
rtree_key_cmp
(
keyinfo
->
seg
,
info
->
first_mbr_key
,
k
,
info
->
last_rkey_length
,
nod_cmp_flag
)))
info
->
last_rkey_length
,
nod_cmp_flag
)))
{
{
switch
((
res
=
rtree_find_req
(
info
,
keyinfo
,
search_flag
,
nod_cmp_flag
,
switch
((
res
=
rtree_find_req
(
info
,
keyinfo
,
search_flag
,
nod_cmp_flag
,
...
@@ -107,7 +107,7 @@ static int rtree_find_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint search_flag,
...
@@ -107,7 +107,7 @@ static int rtree_find_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint search_flag,
else
else
{
{
/* this is a leaf */
/* this is a leaf */
if
(
!
rtree_key_cmp
(
keyinfo
->
seg
,
info
->
lastkey2
,
k
,
if
(
!
rtree_key_cmp
(
keyinfo
->
seg
,
info
->
first_mbr_key
,
k
,
info
->
last_rkey_length
,
search_flag
))
info
->
last_rkey_length
,
search_flag
))
{
{
uchar
*
after_key
=
rt_PAGE_NEXT_KEY
(
k
,
k_len
,
nod_flag
);
uchar
*
after_key
=
rt_PAGE_NEXT_KEY
(
k
,
k_len
,
nod_flag
);
...
@@ -180,7 +180,8 @@ int rtree_find_first(MI_INFO *info, uint keynr, uchar *key, uint key_length,
...
@@ -180,7 +180,8 @@ int rtree_find_first(MI_INFO *info, uint keynr, uchar *key, uint key_length,
}
}
/* Save searched key */
/* Save searched key */
memcpy
(
info
->
lastkey2
,
key
,
keyinfo
->
keylength
-
info
->
s
->
base
.
rec_reflength
);
memcpy
(
info
->
first_mbr_key
,
key
,
keyinfo
->
keylength
-
info
->
s
->
base
.
rec_reflength
);
info
->
last_rkey_length
=
key_length
;
info
->
last_rkey_length
=
key_length
;
info
->
rtree_recursion_depth
=
-
1
;
info
->
rtree_recursion_depth
=
-
1
;
...
@@ -195,6 +196,12 @@ int rtree_find_first(MI_INFO *info, uint keynr, uchar *key, uint key_length,
...
@@ -195,6 +196,12 @@ int rtree_find_first(MI_INFO *info, uint keynr, uchar *key, uint key_length,
/*
/*
Find next key in r-tree according to search_flag condition
Find next key in r-tree according to search_flag condition
SYNOPSIS
rtree_find_next()
info Handler to MyISAM file
uint keynr Key number to use
search_flag Bitmap of flags how to do the search
RETURN
RETURN
-1 Error
-1 Error
0 Found
0 Found
...
@@ -217,7 +224,7 @@ int rtree_find_next(MI_INFO *info, uint keynr, uint search_flag)
...
@@ -217,7 +224,7 @@ int rtree_find_next(MI_INFO *info, uint keynr, uint search_flag)
while
(
key
<
info
->
int_maxpos
)
while
(
key
<
info
->
int_maxpos
)
{
{
if
(
!
rtree_key_cmp
(
keyinfo
->
seg
,
info
->
lastkey2
,
key
,
if
(
!
rtree_key_cmp
(
keyinfo
->
seg
,
info
->
first_mbr_key
,
key
,
info
->
last_rkey_length
,
search_flag
))
info
->
last_rkey_length
,
search_flag
))
{
{
uchar
*
after_key
=
key
+
keyinfo
->
keylength
;
uchar
*
after_key
=
key
+
keyinfo
->
keylength
;
...
@@ -353,13 +360,16 @@ err1:
...
@@ -353,13 +360,16 @@ err1:
return
-
1
;
return
-
1
;
}
}
/*
/*
Get first key in r-tree
Get first key in r-tree
Result values:
-1 - error
RETURN
0 - found
-1 Error
1 - not found
0 Found
1 Not found
*/
*/
int
rtree_get_first
(
MI_INFO
*
info
,
uint
keynr
,
uint
key_length
)
int
rtree_get_first
(
MI_INFO
*
info
,
uint
keynr
,
uint
key_length
)
{
{
my_off_t
root
;
my_off_t
root
;
...
@@ -377,12 +387,16 @@ int rtree_get_first(MI_INFO *info, uint keynr, uint key_length)
...
@@ -377,12 +387,16 @@ int rtree_get_first(MI_INFO *info, uint keynr, uint key_length)
return
rtree_get_req
(
info
,
&
keyinfo
[
keynr
],
key_length
,
root
,
0
);
return
rtree_get_req
(
info
,
&
keyinfo
[
keynr
],
key_length
,
root
,
0
);
}
}
/* Get next key in r-tree
Result values:
/*
-1 - error
Get next key in r-tree
0 - found
1 - not found
RETURN
-1 Error
0 Found
1 Not found
*/
*/
int
rtree_get_next
(
MI_INFO
*
info
,
uint
keynr
,
uint
key_length
)
int
rtree_get_next
(
MI_INFO
*
info
,
uint
keynr
,
uint
key_length
)
{
{
my_off_t
root
;
my_off_t
root
;
...
@@ -421,13 +435,16 @@ int rtree_get_next(MI_INFO *info, uint keynr, uint key_length)
...
@@ -421,13 +435,16 @@ int rtree_get_next(MI_INFO *info, uint keynr, uint key_length)
}
}
}
}
/*
/*
Go down and insert key into tree
Go down and insert key into tree
Result values:
-1 - error
RETURN
0 - child was not split
-1 Error
1 - child was split
0 Child was not split
1 Child was split
*/
*/
static
int
rtree_insert_req
(
MI_INFO
*
info
,
MI_KEYDEF
*
keyinfo
,
uchar
*
key
,
static
int
rtree_insert_req
(
MI_INFO
*
info
,
MI_KEYDEF
*
keyinfo
,
uchar
*
key
,
uint
key_length
,
my_off_t
page
,
my_off_t
*
new_page
,
uint
key_length
,
my_off_t
page
,
my_off_t
*
new_page
,
int
ins_level
,
int
level
)
int
ins_level
,
int
level
)
...
@@ -504,13 +521,16 @@ err1:
...
@@ -504,13 +521,16 @@ err1:
return
-
1
;
return
-
1
;
}
}
/*
/*
Insert key into the tree
Insert key into the tree
Result values:
-1 - error
RETURN
0 - root was not split
-1 Error
1 - root was split
0 Root was not split
1 Root was split
*/
*/
static
int
rtree_insert_level
(
MI_INFO
*
info
,
uint
keynr
,
uchar
*
key
,
static
int
rtree_insert_level
(
MI_INFO
*
info
,
uint
keynr
,
uchar
*
key
,
uint
key_length
,
int
ins_level
)
uint
key_length
,
int
ins_level
)
{
{
...
@@ -594,20 +614,29 @@ err1:
...
@@ -594,20 +614,29 @@ err1:
return
res
;
return
res
;
}
}
/*
/*
Insert key into the tree - interface function
Insert key into the tree - interface function
Result values:
-1 - error
RETURN
0 - OK
-1 Error
0 OK
*/
*/
int
rtree_insert
(
MI_INFO
*
info
,
uint
keynr
,
uchar
*
key
,
uint
key_length
)
int
rtree_insert
(
MI_INFO
*
info
,
uint
keynr
,
uchar
*
key
,
uint
key_length
)
{
{
return
(
rtree_insert_level
(
info
,
keynr
,
key
,
key_length
,
-
1
)
==
-
1
)
?
-
1
:
0
;
return
(
rtree_insert_level
(
info
,
keynr
,
key
,
key_length
,
-
1
)
==
-
1
)
?
-
1
:
0
;
}
}
/*
/*
Fill reinsert page buffer
Fill reinsert page buffer
RETURN
-1 Error
0 OK
*/
*/
static
int
rtree_fill_reinsert_list
(
stPageList
*
ReinsertList
,
my_off_t
page
,
static
int
rtree_fill_reinsert_list
(
stPageList
*
ReinsertList
,
my_off_t
page
,
int
level
)
int
level
)
{
{
...
@@ -628,14 +657,17 @@ err1:
...
@@ -628,14 +657,17 @@ err1:
return
-
1
;
return
-
1
;
}
}
/*
/*
Go down and delete key from the tree
Go down and delete key from the tree
Result values:
-1 - error
RETURN
0 - deleted
-1 Error
1 - not found
0 Deleted
2 - empty leaf
1 Not found
2 Empty leaf
*/
*/
static
int
rtree_delete_req
(
MI_INFO
*
info
,
MI_KEYDEF
*
keyinfo
,
uchar
*
key
,
static
int
rtree_delete_req
(
MI_INFO
*
info
,
MI_KEYDEF
*
keyinfo
,
uchar
*
key
,
uint
key_length
,
my_off_t
page
,
uint
*
page_size
,
uint
key_length
,
my_off_t
page
,
uint
*
page_size
,
stPageList
*
ReinsertList
,
int
level
)
stPageList
*
ReinsertList
,
int
level
)
...
@@ -754,12 +786,15 @@ err1:
...
@@ -754,12 +786,15 @@ err1:
return
-
1
;
return
-
1
;
}
}
/*
/*
Delete key - interface function
Delete key - interface function
Result values:
-1 - error
RETURN
0 - deleted
-1 Error
0 Deleted
*/
*/
int
rtree_delete
(
MI_INFO
*
info
,
uint
keynr
,
uchar
*
key
,
uint
key_length
)
int
rtree_delete
(
MI_INFO
*
info
,
uint
keynr
,
uchar
*
key
,
uint
key_length
)
{
{
uint
page_size
;
uint
page_size
;
...
@@ -860,9 +895,14 @@ err1:
...
@@ -860,9 +895,14 @@ err1:
}
}
}
}
/*
/*
Estimate number of suitable keys in the tree
Estimate number of suitable keys in the tree
RETURN
estimated value
*/
*/
ha_rows
rtree_estimate
(
MI_INFO
*
info
,
uint
keynr
,
uchar
*
key
,
ha_rows
rtree_estimate
(
MI_INFO
*
info
,
uint
keynr
,
uchar
*
key
,
uint
key_length
,
uint
flag
)
uint
key_length
,
uint
flag
)
{
{
...
...
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