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
3d218024
Commit
3d218024
authored
Oct 10, 2004
by
pekka@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NDB tux optim 16 - binary search on bounding node when adding entry
parent
e0c36040
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
23 deletions
+53
-23
ndb/src/kernel/blocks/dbtux/DbtuxDebug.cpp
ndb/src/kernel/blocks/dbtux/DbtuxDebug.cpp
+3
-2
ndb/src/kernel/blocks/dbtux/DbtuxMaint.cpp
ndb/src/kernel/blocks/dbtux/DbtuxMaint.cpp
+2
-2
ndb/src/kernel/blocks/dbtux/DbtuxSearch.cpp
ndb/src/kernel/blocks/dbtux/DbtuxSearch.cpp
+43
-19
ndb/src/kernel/blocks/dbtux/Times.txt
ndb/src/kernel/blocks/dbtux/Times.txt
+5
-0
No files found.
ndb/src/kernel/blocks/dbtux/DbtuxDebug.cpp
View file @
3d218024
...
@@ -424,8 +424,9 @@ operator<<(NdbOut& out, const Dbtux::NodeHandle& node)
...
@@ -424,8 +424,9 @@ operator<<(NdbOut& out, const Dbtux::NodeHandle& node)
}
}
data
=
(
const
Uint32
*
)
node
.
m_node
+
Dbtux
::
NodeHeadSize
+
tree
.
m_prefSize
;
data
=
(
const
Uint32
*
)
node
.
m_node
+
Dbtux
::
NodeHeadSize
+
tree
.
m_prefSize
;
const
Dbtux
::
TreeEnt
*
entList
=
(
const
Dbtux
::
TreeEnt
*
)
data
;
const
Dbtux
::
TreeEnt
*
entList
=
(
const
Dbtux
::
TreeEnt
*
)
data
;
for
(
unsigned
pos
=
0
;
pos
<
numpos
;
pos
++
)
// print entries in logical order
out
<<
" "
<<
entList
[
pos
];
for
(
unsigned
pos
=
1
;
pos
<=
numpos
;
pos
++
)
out
<<
" "
<<
entList
[
pos
%
numpos
];
out
<<
"]"
;
out
<<
"]"
;
}
}
out
<<
"]"
;
out
<<
"]"
;
...
...
ndb/src/kernel/blocks/dbtux/DbtuxMaint.cpp
View file @
3d218024
...
@@ -120,7 +120,7 @@ Dbtux::execTUX_MAINT_REQ(Signal* signal)
...
@@ -120,7 +120,7 @@ Dbtux::execTUX_MAINT_REQ(Signal* signal)
searchToAdd
(
signal
,
frag
,
c_searchKey
,
ent
,
treePos
);
searchToAdd
(
signal
,
frag
,
c_searchKey
,
ent
,
treePos
);
#ifdef VM_TRACE
#ifdef VM_TRACE
if
(
debugFlags
&
DebugMaint
)
{
if
(
debugFlags
&
DebugMaint
)
{
debugOut
<<
treePos
<<
endl
;
debugOut
<<
treePos
<<
(
treePos
.
m_match
?
" - error"
:
""
)
<<
endl
;
}
}
#endif
#endif
if
(
treePos
.
m_match
)
{
if
(
treePos
.
m_match
)
{
...
@@ -154,7 +154,7 @@ Dbtux::execTUX_MAINT_REQ(Signal* signal)
...
@@ -154,7 +154,7 @@ Dbtux::execTUX_MAINT_REQ(Signal* signal)
searchToRemove
(
signal
,
frag
,
c_searchKey
,
ent
,
treePos
);
searchToRemove
(
signal
,
frag
,
c_searchKey
,
ent
,
treePos
);
#ifdef VM_TRACE
#ifdef VM_TRACE
if
(
debugFlags
&
DebugMaint
)
{
if
(
debugFlags
&
DebugMaint
)
{
debugOut
<<
treePos
<<
endl
;
debugOut
<<
treePos
<<
(
!
treePos
.
m_match
?
" - error"
:
""
)
<<
endl
;
}
}
#endif
#endif
if
(
!
treePos
.
m_match
)
{
if
(
!
treePos
.
m_match
)
{
...
...
ndb/src/kernel/blocks/dbtux/DbtuxSearch.cpp
View file @
3d218024
...
@@ -31,10 +31,11 @@ Dbtux::searchToAdd(Signal* signal, Frag& frag, ConstData searchKey, TreeEnt sear
...
@@ -31,10 +31,11 @@ Dbtux::searchToAdd(Signal* signal, Frag& frag, ConstData searchKey, TreeEnt sear
const
unsigned
numAttrs
=
frag
.
m_numAttrs
;
const
unsigned
numAttrs
=
frag
.
m_numAttrs
;
NodeHandle
currNode
(
frag
);
NodeHandle
currNode
(
frag
);
currNode
.
m_loc
=
tree
.
m_root
;
currNode
.
m_loc
=
tree
.
m_root
;
// assume success
treePos
.
m_match
=
false
;
if
(
currNode
.
m_loc
==
NullTupLoc
)
{
if
(
currNode
.
m_loc
==
NullTupLoc
)
{
// empty tree
// empty tree
jam
();
jam
();
treePos
.
m_match
=
false
;
return
;
return
;
}
}
NodeHandle
glbNode
(
frag
);
// potential g.l.b of final node
NodeHandle
glbNode
(
frag
);
// potential g.l.b of final node
...
@@ -93,6 +94,7 @@ Dbtux::searchToAdd(Signal* signal, Frag& frag, ConstData searchKey, TreeEnt sear
...
@@ -93,6 +94,7 @@ Dbtux::searchToAdd(Signal* signal, Frag& frag, ConstData searchKey, TreeEnt sear
jam
();
jam
();
treePos
.
m_loc
=
currNode
.
m_loc
;
treePos
.
m_loc
=
currNode
.
m_loc
;
treePos
.
m_pos
=
0
;
treePos
.
m_pos
=
0
;
// failed
treePos
.
m_match
=
true
;
treePos
.
m_match
=
true
;
return
;
return
;
}
}
...
@@ -100,9 +102,16 @@ Dbtux::searchToAdd(Signal* signal, Frag& frag, ConstData searchKey, TreeEnt sear
...
@@ -100,9 +102,16 @@ Dbtux::searchToAdd(Signal* signal, Frag& frag, ConstData searchKey, TreeEnt sear
}
}
// access rest of current node
// access rest of current node
accessNode
(
signal
,
currNode
,
AccFull
);
accessNode
(
signal
,
currNode
,
AccFull
);
for
(
unsigned
j
=
0
,
occup
=
currNode
.
getOccup
();
j
<
occup
;
j
++
)
{
// anticipate
treePos
.
m_loc
=
currNode
.
m_loc
;
// binary search
int
lo
=
-
1
;
int
hi
=
currNode
.
getOccup
();
int
ret
;
while
(
1
)
{
jam
();
jam
();
int
ret
;
// hi - lo > 1 implies lo < j < hi
int
j
=
(
hi
+
lo
)
/
2
;
// read and compare attributes
// read and compare attributes
unsigned
start
=
0
;
unsigned
start
=
0
;
readKeyAttrs
(
frag
,
currNode
.
getEnt
(
j
),
start
,
c_entryKey
);
readKeyAttrs
(
frag
,
currNode
.
getEnt
(
j
),
start
,
c_entryKey
);
...
@@ -113,25 +122,38 @@ Dbtux::searchToAdd(Signal* signal, Frag& frag, ConstData searchKey, TreeEnt sear
...
@@ -113,25 +122,38 @@ Dbtux::searchToAdd(Signal* signal, Frag& frag, ConstData searchKey, TreeEnt sear
// keys are equal, compare entry values
// keys are equal, compare entry values
ret
=
searchEnt
.
cmp
(
currNode
.
getEnt
(
j
));
ret
=
searchEnt
.
cmp
(
currNode
.
getEnt
(
j
));
}
}
if
(
ret
<=
0
)
{
if
(
ret
<
0
)
jam
();
hi
=
j
;
treePos
.
m_loc
=
currNode
.
m_loc
;
else
if
(
ret
>
0
)
lo
=
j
;
else
{
treePos
.
m_pos
=
j
;
treePos
.
m_pos
=
j
;
treePos
.
m_match
=
(
ret
==
0
);
// failed
treePos
.
m_match
=
true
;
return
;
return
;
}
}
if
(
hi
-
lo
==
1
)
break
;
}
}
if
(
!
bottomNode
.
isNull
()
)
{
if
(
ret
<
0
)
{
jam
();
jam
();
// backwards compatible for now
treePos
.
m_pos
=
hi
;
treePos
.
m_loc
=
bottomNode
.
m_loc
;
treePos
.
m_pos
=
0
;
treePos
.
m_match
=
false
;
return
;
return
;
}
}
treePos
.
m_loc
=
currNode
.
m_loc
;
if
(
hi
<
currNode
.
getOccup
())
{
treePos
.
m_pos
=
currNode
.
getOccup
();
jam
();
treePos
.
m_match
=
false
;
treePos
.
m_pos
=
hi
;
return
;
}
if
(
bottomNode
.
isNull
())
{
jam
();
treePos
.
m_pos
=
hi
;
return
;
}
jam
();
// backwards compatible for now
treePos
.
m_loc
=
bottomNode
.
m_loc
;
treePos
.
m_pos
=
0
;
}
}
/*
/*
...
@@ -150,9 +172,12 @@ Dbtux::searchToRemove(Signal* signal, Frag& frag, ConstData searchKey, TreeEnt s
...
@@ -150,9 +172,12 @@ Dbtux::searchToRemove(Signal* signal, Frag& frag, ConstData searchKey, TreeEnt s
const
unsigned
numAttrs
=
frag
.
m_numAttrs
;
const
unsigned
numAttrs
=
frag
.
m_numAttrs
;
NodeHandle
currNode
(
frag
);
NodeHandle
currNode
(
frag
);
currNode
.
m_loc
=
tree
.
m_root
;
currNode
.
m_loc
=
tree
.
m_root
;
// assume success
treePos
.
m_match
=
true
;
if
(
currNode
.
m_loc
==
NullTupLoc
)
{
if
(
currNode
.
m_loc
==
NullTupLoc
)
{
// empty tree
// empty tree
jam
();
jam
();
// failed
treePos
.
m_match
=
false
;
treePos
.
m_match
=
false
;
return
;
return
;
}
}
...
@@ -206,27 +231,26 @@ Dbtux::searchToRemove(Signal* signal, Frag& frag, ConstData searchKey, TreeEnt s
...
@@ -206,27 +231,26 @@ Dbtux::searchToRemove(Signal* signal, Frag& frag, ConstData searchKey, TreeEnt s
jam
();
jam
();
treePos
.
m_loc
=
currNode
.
m_loc
;
treePos
.
m_loc
=
currNode
.
m_loc
;
treePos
.
m_pos
=
0
;
treePos
.
m_pos
=
0
;
treePos
.
m_match
=
true
;
return
;
return
;
}
}
break
;
break
;
}
}
// access rest of current node
// access rest of current node
accessNode
(
signal
,
currNode
,
AccFull
);
accessNode
(
signal
,
currNode
,
AccFull
);
// anticipate
treePos
.
m_loc
=
currNode
.
m_loc
;
// pos 0 was handled above
// pos 0 was handled above
for
(
unsigned
j
=
1
,
occup
=
currNode
.
getOccup
();
j
<
occup
;
j
++
)
{
for
(
unsigned
j
=
1
,
occup
=
currNode
.
getOccup
();
j
<
occup
;
j
++
)
{
jam
();
jam
();
// compare only the entry
// compare only the entry
if
(
searchEnt
.
eq
(
currNode
.
getEnt
(
j
)))
{
if
(
searchEnt
.
eq
(
currNode
.
getEnt
(
j
)))
{
jam
();
jam
();
treePos
.
m_loc
=
currNode
.
m_loc
;
treePos
.
m_pos
=
j
;
treePos
.
m_pos
=
j
;
treePos
.
m_match
=
true
;
return
;
return
;
}
}
}
}
treePos
.
m_loc
=
currNode
.
m_loc
;
treePos
.
m_pos
=
currNode
.
getOccup
();
treePos
.
m_pos
=
currNode
.
getOccup
();
// failed
treePos
.
m_match
=
false
;
treePos
.
m_match
=
false
;
}
}
...
...
ndb/src/kernel/blocks/dbtux/Times.txt
View file @
3d218024
...
@@ -115,4 +115,9 @@ optim 15 mc02/a 34 ms 60 ms 72 pct
...
@@ -115,4 +115,9 @@ optim 15 mc02/a 34 ms 60 ms 72 pct
[ corrected wasted space in index node ]
[ corrected wasted space in index node ]
optim 16 mc02/a 34 ms 53 ms 53 pct
mc02/b 42 ms 75 ms 75 pct
[ case a, b: binary search of bounding node when adding entry ]
vim: set et:
vim: set et:
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