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
abcd2994
Commit
abcd2994
authored
Oct 17, 2004
by
pekka@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NDB wl-1942 dbtux - move scans correctly at index tree re-org
parent
a04f98d3
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
265 additions
and
152 deletions
+265
-152
ndb/src/kernel/blocks/dbtux/Dbtux.hpp
ndb/src/kernel/blocks/dbtux/Dbtux.hpp
+11
-4
ndb/src/kernel/blocks/dbtux/DbtuxNode.cpp
ndb/src/kernel/blocks/dbtux/DbtuxNode.cpp
+233
-135
ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp
ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp
+5
-3
ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp
ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp
+13
-10
ndb/src/kernel/blocks/dbtux/Times.txt
ndb/src/kernel/blocks/dbtux/Times.txt
+3
-0
No files found.
ndb/src/kernel/blocks/dbtux/Dbtux.hpp
View file @
abcd2994
...
...
@@ -587,12 +587,19 @@ private:
void
deleteNode
(
Signal
*
signal
,
NodeHandle
&
node
);
void
setNodePref
(
Signal
*
signal
,
NodeHandle
&
node
);
// node operations
void
nodePushUp
(
Signal
*
signal
,
NodeHandle
&
node
,
unsigned
pos
,
const
TreeEnt
&
ent
);
void
nodePopDown
(
Signal
*
signal
,
NodeHandle
&
node
,
unsigned
pos
,
TreeEnt
&
ent
);
void
nodePushDown
(
Signal
*
signal
,
NodeHandle
&
node
,
unsigned
pos
,
TreeEnt
&
ent
);
void
nodePopUp
(
Signal
*
signal
,
NodeHandle
&
node
,
unsigned
pos
,
TreeEnt
&
ent
);
void
nodePushUp
(
Signal
*
signal
,
NodeHandle
&
node
,
unsigned
pos
,
const
TreeEnt
&
ent
,
Uint32
scanList
);
void
nodePushUpScans
(
Signal
*
signal
,
NodeHandle
&
node
,
unsigned
pos
);
void
nodePopDown
(
Signal
*
signal
,
NodeHandle
&
node
,
unsigned
pos
,
TreeEnt
&
en
,
Uint32
*
scanList
);
void
nodePopDownScans
(
Signal
*
signal
,
NodeHandle
&
node
,
unsigned
pos
);
void
nodePushDown
(
Signal
*
signal
,
NodeHandle
&
node
,
unsigned
pos
,
TreeEnt
&
ent
,
Uint32
&
scanList
);
void
nodePushDownScans
(
Signal
*
signal
,
NodeHandle
&
node
,
unsigned
pos
);
void
nodePopUp
(
Signal
*
signal
,
NodeHandle
&
node
,
unsigned
pos
,
TreeEnt
&
ent
,
Uint32
scanList
);
void
nodePopUpScans
(
Signal
*
signal
,
NodeHandle
&
node
,
unsigned
pos
);
void
nodeSlide
(
Signal
*
signal
,
NodeHandle
&
dstNode
,
NodeHandle
&
srcNode
,
unsigned
cnt
,
unsigned
i
);
// scans linked to node
void
addScanList
(
NodeHandle
&
node
,
unsigned
pos
,
Uint32
scanList
);
void
removeScanList
(
NodeHandle
&
node
,
unsigned
pos
,
Uint32
&
scanList
);
void
moveScanList
(
Signal
*
signal
,
NodeHandle
&
node
,
unsigned
pos
);
void
linkScan
(
NodeHandle
&
node
,
ScanOpPtr
scanPtr
);
void
unlinkScan
(
NodeHandle
&
node
,
ScanOpPtr
scanPtr
);
bool
islinkScan
(
NodeHandle
&
node
,
ScanOpPtr
scanPtr
);
...
...
ndb/src/kernel/blocks/dbtux/DbtuxNode.cpp
View file @
abcd2994
This diff is collapsed.
Click to expand it.
ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp
View file @
abcd2994
...
...
@@ -716,7 +716,7 @@ Dbtux::scanFirst(Signal* signal, ScanOpPtr scanPtr)
/*
* Move to next entry. The scan is already linked to some node. When
* we leave, if an
y
entry was found, it will be linked to a possibly
* we leave, if an entry was found, it will be linked to a possibly
* different node. The scan has a position, and a direction which tells
* from where we came to this position. This is one of:
*
...
...
@@ -725,6 +725,9 @@ Dbtux::scanFirst(Signal* signal, ScanOpPtr scanPtr)
* 2 - up from root (the scan ends)
* 3 - left to right within node (at end proceed to right child)
* 4 - down from parent (proceed to left child)
*
* If an entry was found, scan direction is 3. Therefore tree
* re-organizations need not worry about scan direction.
*/
void
Dbtux
::
scanNext
(
Signal
*
signal
,
ScanOpPtr
scanPtr
)
...
...
@@ -739,9 +742,7 @@ Dbtux::scanNext(Signal* signal, ScanOpPtr scanPtr)
if
(
scan
.
m_state
==
ScanOp
::
Locked
)
{
jam
();
// version of a tuple locked by us cannot disappear (assert only)
#ifdef dbtux_wl_1942_is_done
ndbassert
(
false
);
#endif
AccLockReq
*
const
lockReq
=
(
AccLockReq
*
)
signal
->
getDataPtrSend
();
lockReq
->
returnCode
=
RNIL
;
lockReq
->
requestInfo
=
AccLockReq
::
Unlock
;
...
...
@@ -864,6 +865,7 @@ Dbtux::scanNext(Signal* signal, ScanOpPtr scanPtr)
scan
.
m_scanPos
=
pos
;
// relink
if
(
scan
.
m_state
==
ScanOp
::
Current
)
{
ndbrequire
(
pos
.
m_match
==
true
&&
pos
.
m_dir
==
3
);
ndbrequire
(
pos
.
m_loc
==
node
.
m_loc
);
if
(
origNode
.
m_loc
!=
node
.
m_loc
)
{
jam
();
...
...
ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp
View file @
abcd2994
...
...
@@ -34,7 +34,7 @@ Dbtux::treeAdd(Signal* signal, Frag& frag, TreePos treePos, TreeEnt ent)
if
(
node
.
getOccup
()
<
tree
.
m_maxOccup
)
{
// node has room
jam
();
nodePushUp
(
signal
,
node
,
pos
,
ent
);
nodePushUp
(
signal
,
node
,
pos
,
ent
,
RNIL
);
return
;
}
treeAddFull
(
signal
,
frag
,
node
,
pos
,
ent
);
...
...
@@ -42,7 +42,7 @@ Dbtux::treeAdd(Signal* signal, Frag& frag, TreePos treePos, TreeEnt ent)
}
jam
();
insertNode
(
signal
,
node
);
nodePushUp
(
signal
,
node
,
0
,
ent
);
nodePushUp
(
signal
,
node
,
0
,
ent
,
RNIL
);
node
.
setSide
(
2
);
tree
.
m_root
=
node
.
m_loc
;
}
...
...
@@ -68,13 +68,14 @@ Dbtux::treeAddFull(Signal* signal, Frag& frag, NodeHandle lubNode, unsigned pos,
if
(
glbNode
.
getOccup
()
<
tree
.
m_maxOccup
)
{
// g.l.b node has room
jam
();
Uint32
scanList
=
RNIL
;
if
(
pos
!=
0
)
{
jam
();
// add the new entry and return min entry
nodePushDown
(
signal
,
lubNode
,
pos
-
1
,
ent
);
nodePushDown
(
signal
,
lubNode
,
pos
-
1
,
ent
,
scanList
);
}
// g.l.b node receives min entry from l.u.b node
nodePushUp
(
signal
,
glbNode
,
glbNode
.
getOccup
(),
ent
);
nodePushUp
(
signal
,
glbNode
,
glbNode
.
getOccup
(),
ent
,
scanList
);
return
;
}
treeAddNode
(
signal
,
frag
,
lubNode
,
pos
,
ent
,
glbNode
,
1
);
...
...
@@ -97,13 +98,14 @@ Dbtux::treeAddNode(Signal* signal, Frag& frag, NodeHandle lubNode, unsigned pos,
parentNode
.
setLink
(
i
,
glbNode
.
m_loc
);
glbNode
.
setLink
(
2
,
parentNode
.
m_loc
);
glbNode
.
setSide
(
i
);
Uint32
scanList
=
RNIL
;
if
(
pos
!=
0
)
{
jam
();
// add the new entry and return min entry
nodePushDown
(
signal
,
lubNode
,
pos
-
1
,
ent
);
nodePushDown
(
signal
,
lubNode
,
pos
-
1
,
ent
,
scanList
);
}
// g.l.b node receives min entry from l.u.b node
nodePushUp
(
signal
,
glbNode
,
0
,
ent
);
nodePushUp
(
signal
,
glbNode
,
0
,
ent
,
scanList
);
// re-balance the tree
treeAddRebalance
(
signal
,
frag
,
parentNode
,
i
);
}
...
...
@@ -179,7 +181,7 @@ Dbtux::treeRemove(Signal* signal, Frag& frag, TreePos treePos)
if
(
node
.
getOccup
()
>
tree
.
m_minOccup
)
{
// no underflow in any node type
jam
();
nodePopDown
(
signal
,
node
,
pos
,
ent
);
nodePopDown
(
signal
,
node
,
pos
,
ent
,
0
);
return
;
}
if
(
node
.
getChilds
()
==
2
)
{
...
...
@@ -189,7 +191,7 @@ Dbtux::treeRemove(Signal* signal, Frag& frag, TreePos treePos)
return
;
}
// remove entry in semi/leaf
nodePopDown
(
signal
,
node
,
pos
,
ent
);
nodePopDown
(
signal
,
node
,
pos
,
ent
,
0
);
if
(
node
.
getLink
(
0
)
!=
NullTupLoc
)
{
jam
();
treeRemoveSemi
(
signal
,
frag
,
node
,
0
);
...
...
@@ -222,8 +224,9 @@ Dbtux::treeRemoveInner(Signal* signal, Frag& frag, NodeHandle lubNode, unsigned
loc
=
glbNode
.
getLink
(
1
);
}
while
(
loc
!=
NullTupLoc
);
// borrow max entry from semi/leaf
nodePopDown
(
signal
,
glbNode
,
glbNode
.
getOccup
()
-
1
,
ent
);
nodePopUp
(
signal
,
lubNode
,
pos
,
ent
);
Uint32
scanList
=
RNIL
;
nodePopDown
(
signal
,
glbNode
,
glbNode
.
getOccup
()
-
1
,
ent
,
&
scanList
);
nodePopUp
(
signal
,
lubNode
,
pos
,
ent
,
scanList
);
if
(
glbNode
.
getLink
(
0
)
!=
NullTupLoc
)
{
jam
();
treeRemoveSemi
(
signal
,
frag
,
glbNode
,
0
);
...
...
ndb/src/kernel/blocks/dbtux/Times.txt
View file @
abcd2994
...
...
@@ -129,4 +129,7 @@ optim 17 mc02/a 35 ms 52 ms 49 pct
[ allow slack (2) in interior nodes - almost no effect?? ]
wl-1942 mc02/a 35 ms 52 ms 49 pct
mc02/b 42 ms 75 ms 76 pct
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