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
5ed830f6
Commit
5ed830f6
authored
Jul 25, 2004
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tux optim 13 - replace read keys & query th signals tux->tup by methods
parent
6c73e4d9
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
471 additions
and
283 deletions
+471
-283
ndb/src/kernel/blocks/dbtup/Dbtup.hpp
ndb/src/kernel/blocks/dbtup/Dbtup.hpp
+8
-2
ndb/src/kernel/blocks/dbtup/DbtupIndex.cpp
ndb/src/kernel/blocks/dbtup/DbtupIndex.cpp
+75
-6
ndb/src/kernel/blocks/dbtux/Dbtux.hpp
ndb/src/kernel/blocks/dbtux/Dbtux.hpp
+1
-76
ndb/src/kernel/blocks/dbtux/DbtuxGen.cpp
ndb/src/kernel/blocks/dbtux/DbtuxGen.cpp
+7
-30
ndb/src/kernel/blocks/dbtux/DbtuxMaint.cpp
ndb/src/kernel/blocks/dbtux/DbtuxMaint.cpp
+0
-86
ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp
ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp
+17
-31
ndb/src/kernel/blocks/dbtux/Times.txt
ndb/src/kernel/blocks/dbtux/Times.txt
+29
-7
ndb/test/ndbapi/testOIBasic.cpp
ndb/test/ndbapi/testOIBasic.cpp
+334
-45
No files found.
ndb/src/kernel/blocks/dbtup/Dbtup.hpp
View file @
5ed830f6
...
@@ -1014,9 +1014,15 @@ public:
...
@@ -1014,9 +1014,15 @@ public:
void
tuxReadAttrs
(
Uint32
fragPtrI
,
Uint32
pageId
,
Uint32
pageOffset
,
Uint32
tupVersion
,
Uint32
numAttrs
,
const
Uint32
*
attrIds
,
const
Uint32
**
attrData
);
void
tuxReadAttrs
(
Uint32
fragPtrI
,
Uint32
pageId
,
Uint32
pageOffset
,
Uint32
tupVersion
,
Uint32
numAttrs
,
const
Uint32
*
attrIds
,
const
Uint32
**
attrData
);
/*
/*
* TUX reads primary key for md5 summing and when returning keyinfo.
* TUX reads primary key without headers into an array of words. Used
* for md5 summing and when returning keyinfo.
*/
*/
void
tuxReadKeys
();
// under construction
void
tuxReadKeys
(
Uint32
fragPtrI
,
Uint32
pageId
,
Uint32
pageOffset
,
Uint32
*
pkSize
,
Uint32
*
pkData
);
/*
* TUX checks if tuple is visible to scan.
*/
bool
tuxQueryTh
(
Uint32
fragPtrI
,
Uint32
tupAddr
,
Uint32
tupVersion
,
Uint32
transId1
,
Uint32
transId2
,
Uint32
savePointId
);
private
:
private
:
BLOCK_DEFINES
(
Dbtup
);
BLOCK_DEFINES
(
Dbtup
);
...
...
ndb/src/kernel/blocks/dbtup/DbtupIndex.cpp
View file @
5ed830f6
...
@@ -152,10 +152,10 @@ Dbtup::tuxReadAttrs(Uint32 fragPtrI, Uint32 pageId, Uint32 pageOffset, Uint32 tu
...
@@ -152,10 +152,10 @@ Dbtup::tuxReadAttrs(Uint32 fragPtrI, Uint32 pageId, Uint32 pageOffset, Uint32 tu
const
Uint32
*
tupleHeader
=
&
pagePtr
.
p
->
pageWord
[
pageOffset
];
const
Uint32
*
tupleHeader
=
&
pagePtr
.
p
->
pageWord
[
pageOffset
];
for
(
Uint32
i
=
0
;
i
<
numAttrs
;
i
++
)
{
for
(
Uint32
i
=
0
;
i
<
numAttrs
;
i
++
)
{
AttributeHeader
ah
(
attrIds
[
i
]);
AttributeHeader
ah
(
attrIds
[
i
]);
Uint32
attrId
=
ah
.
getAttributeId
();
const
Uint32
attrId
=
ah
.
getAttributeId
();
Uint32
index
=
tabDescriptor
+
(
attrId
<<
ZAD_LOG_SIZE
);
const
Uint32
index
=
tabDescriptor
+
(
attrId
<<
ZAD_LOG_SIZE
);
Uint32
desc1
=
tableDescriptor
[
index
].
tabDescr
;
const
Uint32
desc1
=
tableDescriptor
[
index
].
tabDescr
;
Uint32
desc2
=
tableDescriptor
[
index
+
1
].
tabDescr
;
const
Uint32
desc2
=
tableDescriptor
[
index
+
1
].
tabDescr
;
if
(
AttributeDescriptor
::
getNullable
(
desc1
))
{
if
(
AttributeDescriptor
::
getNullable
(
desc1
))
{
Uint32
offset
=
AttributeOffset
::
getNullFlagOffset
(
desc2
);
Uint32
offset
=
AttributeOffset
::
getNullFlagOffset
(
desc2
);
ndbrequire
(
offset
<
tablePtr
.
p
->
tupNullWords
);
ndbrequire
(
offset
<
tablePtr
.
p
->
tupNullWords
);
...
@@ -171,9 +171,78 @@ Dbtup::tuxReadAttrs(Uint32 fragPtrI, Uint32 pageId, Uint32 pageOffset, Uint32 tu
...
@@ -171,9 +171,78 @@ Dbtup::tuxReadAttrs(Uint32 fragPtrI, Uint32 pageId, Uint32 pageOffset, Uint32 tu
}
}
}
}
void
// under construction
void
Dbtup
::
tuxReadKeys
()
Dbtup
::
tuxReadKeys
(
Uint32
fragPtrI
,
Uint32
pageId
,
Uint32
pageOffset
,
Uint32
*
pkSize
,
Uint32
*
pkData
)
{
{
ljamEntry
();
FragrecordPtr
fragPtr
;
fragPtr
.
i
=
fragPtrI
;
ptrCheckGuard
(
fragPtr
,
cnoOfFragrec
,
fragrecord
);
TablerecPtr
tablePtr
;
tablePtr
.
i
=
fragPtr
.
p
->
fragTableId
;
ptrCheckGuard
(
tablePtr
,
cnoOfTablerec
,
tablerec
);
PagePtr
pagePtr
;
pagePtr
.
i
=
pageId
;
ptrCheckGuard
(
pagePtr
,
cnoOfPage
,
page
);
const
Uint32
tabDescriptor
=
tablePtr
.
p
->
tabDescriptor
;
const
Uint32
numAttrs
=
tablePtr
.
p
->
noOfKeyAttr
;
const
Uint32
*
attrIds
=
&
tableDescriptor
[
tablePtr
.
p
->
readKeyArray
].
tabDescr
;
const
Uint32
*
tupleHeader
=
&
pagePtr
.
p
->
pageWord
[
pageOffset
];
Uint32
size
=
0
;
for
(
Uint32
i
=
0
;
i
<
numAttrs
;
i
++
)
{
AttributeHeader
ah
(
attrIds
[
i
]);
const
Uint32
attrId
=
ah
.
getAttributeId
();
const
Uint32
index
=
tabDescriptor
+
(
attrId
<<
ZAD_LOG_SIZE
);
const
Uint32
desc1
=
tableDescriptor
[
index
].
tabDescr
;
const
Uint32
desc2
=
tableDescriptor
[
index
+
1
].
tabDescr
;
ndbrequire
(
!
AttributeDescriptor
::
getNullable
(
desc1
));
const
Uint32
attrSize
=
AttributeDescriptor
::
getSizeInWords
(
desc1
);
const
Uint32
*
attrData
=
tupleHeader
+
AttributeOffset
::
getOffset
(
desc2
);
for
(
Uint32
j
=
0
;
j
<
attrSize
;
j
++
)
{
pkData
[
size
+
j
]
=
attrData
[
j
];
}
size
+=
attrSize
;
}
*
pkSize
=
size
;
}
bool
Dbtup
::
tuxQueryTh
(
Uint32
fragPtrI
,
Uint32
tupAddr
,
Uint32
tupVersion
,
Uint32
transId1
,
Uint32
transId2
,
Uint32
savePointId
)
{
ljamEntry
();
FragrecordPtr
fragPtr
;
fragPtr
.
i
=
fragPtrI
;
ptrCheckGuard
(
fragPtr
,
cnoOfFragrec
,
fragrecord
);
TablerecPtr
tablePtr
;
tablePtr
.
i
=
fragPtr
.
p
->
fragTableId
;
ptrCheckGuard
(
tablePtr
,
cnoOfTablerec
,
tablerec
);
// get page
PagePtr
pagePtr
;
Uint32
fragPageId
=
tupAddr
>>
MAX_TUPLES_BITS
;
Uint32
pageIndex
=
tupAddr
&
((
1
<<
MAX_TUPLES_BITS
)
-
1
);
// use temp op rec
Operationrec
tempOp
;
tempOp
.
fragPageId
=
fragPageId
;
tempOp
.
pageIndex
=
pageIndex
;
tempOp
.
transid1
=
transId1
;
tempOp
.
transid2
=
transId2
;
tempOp
.
savePointId
=
savePointId
;
tempOp
.
optype
=
ZREAD
;
tempOp
.
dirtyOp
=
1
;
if
(
getPage
(
pagePtr
,
&
tempOp
,
fragPtr
.
p
,
tablePtr
.
p
))
{
/*
* We use the normal getPage which will return the tuple to be used
* for this transaction and savepoint id. If its tuple version
* equals the requested then we have a visible tuple otherwise not.
*/
ljam
();
Uint32
read_tupVersion
=
pagePtr
.
p
->
pageWord
[
tempOp
.
pageOffset
+
1
];
if
(
read_tupVersion
==
tupVersion
)
{
ljam
();
return
true
;
}
}
return
false
;
}
}
// deprecated signal interfaces
// deprecated signal interfaces
...
...
ndb/src/kernel/blocks/dbtux/Dbtux.hpp
View file @
5ed830f6
...
@@ -542,49 +542,6 @@ private:
...
@@ -542,49 +542,6 @@ private:
void
progError
(
int
line
,
int
cause
,
const
char
*
file
);
void
progError
(
int
line
,
int
cause
,
const
char
*
file
);
};
};
// parameters for methods
/*
* Copy attribute data.
*/
struct
CopyPar
{
unsigned
m_items
;
// number of attributes
bool
m_headers
;
// copy headers flag (default true)
unsigned
m_maxwords
;
// limit size (default no limit)
// output
unsigned
m_numitems
;
// number of attributes fully copied
unsigned
m_numwords
;
// number of words copied
CopyPar
();
};
/*
* Read index key attributes.
*/
struct
ReadPar
;
friend
struct
ReadPar
;
struct
ReadPar
{
TreeEnt
m_ent
;
// tuple to read
unsigned
m_first
;
// first index attribute
unsigned
m_count
;
// number of consecutive index attributes
Data
m_data
;
// set pointer if 0 else copy result to it
unsigned
m_size
;
// number of words (set in read keys only)
ReadPar
();
};
/*
* Scan bound comparison.
*/
struct
BoundPar
;
friend
struct
BoundPar
;
struct
BoundPar
{
ConstData
m_data1
;
// full bound data
ConstData
m_data2
;
// full or prefix data
unsigned
m_count1
;
// number of bounds
unsigned
m_len2
;
// words in data2 buffer
unsigned
m_dir
;
// 0-lower bound 1-upper bound
BoundPar
();
};
// methods
// methods
/*
/*
...
@@ -596,7 +553,7 @@ private:
...
@@ -596,7 +553,7 @@ private:
// utils
// utils
void
setKeyAttrs
(
const
Frag
&
frag
);
void
setKeyAttrs
(
const
Frag
&
frag
);
void
readKeyAttrs
(
const
Frag
&
frag
,
TreeEnt
ent
,
unsigned
start
,
TableData
keyData
);
void
readKeyAttrs
(
const
Frag
&
frag
,
TreeEnt
ent
,
unsigned
start
,
TableData
keyData
);
void
copyAttrs
(
Data
dst
,
ConstData
src
,
CopyPar
&
copyPar
);
void
readTablePk
(
const
Frag
&
frag
,
TreeEnt
ent
,
unsigned
&
pkSize
,
Data
pkData
);
void
copyAttrs
(
const
Frag
&
frag
,
TableData
data1
,
Data
data2
,
unsigned
maxlen2
=
MaxAttrDataSize
);
void
copyAttrs
(
const
Frag
&
frag
,
TableData
data1
,
Data
data2
,
unsigned
maxlen2
=
MaxAttrDataSize
);
/*
/*
...
@@ -614,8 +571,6 @@ private:
...
@@ -614,8 +571,6 @@ private:
* DbtuxMaint.cpp
* DbtuxMaint.cpp
*/
*/
void
execTUX_MAINT_REQ
(
Signal
*
signal
);
void
execTUX_MAINT_REQ
(
Signal
*
signal
);
void
tupReadAttrs
(
Signal
*
signal
,
const
Frag
&
frag
,
ReadPar
&
readPar
);
void
tupReadKeys
(
Signal
*
signal
,
const
Frag
&
frag
,
ReadPar
&
readPar
);
/*
/*
* DbtuxNode.cpp
* DbtuxNode.cpp
...
@@ -1225,36 +1180,6 @@ Dbtux::NodeHandle::getMinMax(unsigned i)
...
@@ -1225,36 +1180,6 @@ Dbtux::NodeHandle::getMinMax(unsigned i)
// parameters for methods
// parameters for methods
inline
Dbtux
::
CopyPar
::
CopyPar
()
:
m_items
(
0
),
m_headers
(
true
),
m_maxwords
(
~
0
),
// max unsigned
// output
m_numitems
(
0
),
m_numwords
(
0
)
{
}
inline
Dbtux
::
ReadPar
::
ReadPar
()
:
m_first
(
0
),
m_count
(
0
),
m_data
(
0
),
m_size
(
0
)
{
}
inline
Dbtux
::
BoundPar
::
BoundPar
()
:
m_data1
(
0
),
m_data2
(
0
),
m_count1
(
0
),
m_len2
(
0
),
m_dir
(
255
)
{
}
#ifdef VM_TRACE
#ifdef VM_TRACE
inline
inline
Dbtux
::
PrintPar
::
PrintPar
()
:
Dbtux
::
PrintPar
::
PrintPar
()
:
...
...
ndb/src/kernel/blocks/dbtux/DbtuxGen.cpp
View file @
5ed830f6
...
@@ -246,37 +246,14 @@ Dbtux::readKeyAttrs(const Frag& frag, TreeEnt ent, unsigned start, TableData key
...
@@ -246,37 +246,14 @@ Dbtux::readKeyAttrs(const Frag& frag, TreeEnt ent, unsigned start, TableData key
}
}
void
void
Dbtux
::
copyAttrs
(
Data
dst
,
ConstData
src
,
CopyPar
&
copyPar
)
Dbtux
::
readTablePk
(
const
Frag
&
frag
,
TreeEnt
ent
,
unsigned
&
pkSize
,
Data
pkData
)
{
{
CopyPar
c
=
copyPar
;
const
Uint32
tableFragPtrI
=
frag
.
m_tupTableFragPtrI
[
ent
.
m_fragBit
];
c
.
m_numitems
=
0
;
const
TupLoc
tupLoc
=
ent
.
m_tupLoc
;
c
.
m_numwords
=
0
;
Uint32
size
=
0
;
while
(
c
.
m_numitems
<
c
.
m_items
)
{
c_tup
->
tuxReadKeys
(
tableFragPtrI
,
tupLoc
.
m_pageId
,
tupLoc
.
m_pageOffset
,
&
size
,
pkData
);
jam
();
ndbrequire
(
size
!=
0
);
if
(
c
.
m_headers
)
{
pkSize
=
size
;
unsigned
i
=
0
;
while
(
i
<
AttributeHeaderSize
)
{
if
(
c
.
m_numwords
>=
c
.
m_maxwords
)
{
copyPar
=
c
;
return
;
}
dst
[
c
.
m_numwords
++
]
=
src
[
i
++
];
}
}
unsigned
size
=
src
.
ah
().
getDataSize
();
src
+=
AttributeHeaderSize
;
unsigned
i
=
0
;
while
(
i
<
size
)
{
if
(
c
.
m_numwords
>=
c
.
m_maxwords
)
{
copyPar
=
c
;
return
;
}
dst
[
c
.
m_numwords
++
]
=
src
[
i
++
];
}
src
+=
size
;
c
.
m_numitems
++
;
}
copyPar
=
c
;
}
}
/*
/*
...
...
ndb/src/kernel/blocks/dbtux/DbtuxMaint.cpp
View file @
5ed830f6
...
@@ -180,89 +180,3 @@ Dbtux::execTUX_MAINT_REQ(Signal* signal)
...
@@ -180,89 +180,3 @@ Dbtux::execTUX_MAINT_REQ(Signal* signal)
// copy back
// copy back
*
sig
=
*
req
;
*
sig
=
*
req
;
}
}
/*
* Read index key attributes from TUP. If buffer is provided the data
* is copied to it. Otherwise pointer is set to signal data.
*/
void
Dbtux
::
tupReadAttrs
(
Signal
*
signal
,
const
Frag
&
frag
,
ReadPar
&
readPar
)
{
// define the direct signal
const
TreeEnt
ent
=
readPar
.
m_ent
;
TupReadAttrs
*
const
req
=
(
TupReadAttrs
*
)
signal
->
getDataPtrSend
();
req
->
errorCode
=
RNIL
;
req
->
requestInfo
=
0
;
req
->
tableId
=
frag
.
m_tableId
;
req
->
fragId
=
frag
.
m_fragId
|
(
ent
.
m_fragBit
<<
frag
.
m_fragOff
);
req
->
fragPtrI
=
frag
.
m_tupTableFragPtrI
[
ent
.
m_fragBit
];
req
->
tupAddr
=
(
Uint32
)
-
1
;
req
->
tupVersion
=
ent
.
m_tupVersion
;
req
->
pageId
=
ent
.
m_tupLoc
.
m_pageId
;
req
->
pageOffset
=
ent
.
m_tupLoc
.
m_pageOffset
;
req
->
bufferId
=
0
;
// add count and list of attribute ids
Data
data
=
(
Uint32
*
)
req
+
TupReadAttrs
::
SignalLength
;
data
[
0
]
=
readPar
.
m_count
;
data
+=
1
;
const
DescEnt
&
descEnt
=
getDescEnt
(
frag
.
m_descPage
,
frag
.
m_descOff
);
for
(
Uint32
i
=
0
;
i
<
readPar
.
m_count
;
i
++
)
{
jam
();
const
DescAttr
&
descAttr
=
descEnt
.
m_descAttr
[
readPar
.
m_first
+
i
];
data
.
ah
()
=
AttributeHeader
(
descAttr
.
m_primaryAttrId
,
0
);
data
+=
1
;
}
// execute
EXECUTE_DIRECT
(
DBTUP
,
GSN_TUP_READ_ATTRS
,
signal
,
TupReadAttrs
::
SignalLength
);
jamEntry
();
ndbrequire
(
req
->
errorCode
==
0
);
// data is at output
if
(
readPar
.
m_data
==
0
)
{
readPar
.
m_data
=
data
;
}
else
{
jam
();
CopyPar
copyPar
;
copyPar
.
m_items
=
readPar
.
m_count
;
copyPar
.
m_headers
=
true
;
copyAttrs
(
readPar
.
m_data
,
data
,
copyPar
);
}
}
/*
* Read primary keys. Copy the data without attribute headers into the
* given buffer. Number of words is returned in ReadPar argument.
*/
void
Dbtux
::
tupReadKeys
(
Signal
*
signal
,
const
Frag
&
frag
,
ReadPar
&
readPar
)
{
// define the direct signal
const
TreeEnt
ent
=
readPar
.
m_ent
;
TupReadAttrs
*
const
req
=
(
TupReadAttrs
*
)
signal
->
getDataPtrSend
();
req
->
errorCode
=
RNIL
;
req
->
requestInfo
=
TupReadAttrs
::
ReadKeys
;
req
->
tableId
=
frag
.
m_tableId
;
req
->
fragId
=
frag
.
m_fragId
|
(
ent
.
m_fragBit
<<
frag
.
m_fragOff
);
req
->
fragPtrI
=
frag
.
m_tupTableFragPtrI
[
ent
.
m_fragBit
];
req
->
tupAddr
=
(
Uint32
)
-
1
;
req
->
tupVersion
=
RNIL
;
// not used
req
->
pageId
=
ent
.
m_tupLoc
.
m_pageId
;
req
->
pageOffset
=
ent
.
m_tupLoc
.
m_pageOffset
;
req
->
bufferId
=
0
;
// execute
EXECUTE_DIRECT
(
DBTUP
,
GSN_TUP_READ_ATTRS
,
signal
,
TupReadAttrs
::
SignalLength
);
jamEntry
();
ndbrequire
(
req
->
errorCode
==
0
);
// copy out in special format
ConstData
data
=
(
Uint32
*
)
req
+
TupReadAttrs
::
SignalLength
;
const
Uint32
numKeys
=
data
[
0
];
data
+=
1
+
numKeys
;
// copy out without headers
ndbrequire
(
readPar
.
m_data
!=
0
);
CopyPar
copyPar
;
copyPar
.
m_items
=
numKeys
;
copyPar
.
m_headers
=
false
;
copyAttrs
(
readPar
.
m_data
,
data
,
copyPar
);
// return counts
readPar
.
m_count
=
numKeys
;
readPar
.
m_size
=
copyPar
.
m_numwords
;
}
ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp
View file @
5ed830f6
...
@@ -379,8 +379,8 @@ Dbtux::execACC_CHECK_SCAN(Signal* signal)
...
@@ -379,8 +379,8 @@ Dbtux::execACC_CHECK_SCAN(Signal* signal)
scanNext
(
signal
,
scanPtr
);
scanNext
(
signal
,
scanPtr
);
}
}
// for reading tuple key in Current or Locked state
// for reading tuple key in Current or Locked state
ReadPar
keyPa
r
;
Data
pkData
=
c_dataBuffe
r
;
keyPar
.
m_data
=
0
;
// indicates not yet done
unsigned
pkSize
=
0
;
// indicates not yet done
if
(
scan
.
m_state
==
ScanOp
::
Current
)
{
if
(
scan
.
m_state
==
ScanOp
::
Current
)
{
// found an entry to return
// found an entry to return
jam
();
jam
();
...
@@ -389,9 +389,7 @@ Dbtux::execACC_CHECK_SCAN(Signal* signal)
...
@@ -389,9 +389,7 @@ Dbtux::execACC_CHECK_SCAN(Signal* signal)
jam
();
jam
();
const
TreeEnt
ent
=
scan
.
m_scanPos
.
m_ent
;
const
TreeEnt
ent
=
scan
.
m_scanPos
.
m_ent
;
// read tuple key
// read tuple key
keyPar
.
m_ent
=
ent
;
readTablePk
(
frag
,
ent
,
pkSize
,
pkData
);
keyPar
.
m_data
=
c_dataBuffer
;
tupReadKeys
(
signal
,
frag
,
keyPar
);
// get read lock or exclusive lock
// get read lock or exclusive lock
AccLockReq
*
const
lockReq
=
(
AccLockReq
*
)
signal
->
getDataPtrSend
();
AccLockReq
*
const
lockReq
=
(
AccLockReq
*
)
signal
->
getDataPtrSend
();
lockReq
->
returnCode
=
RNIL
;
lockReq
->
returnCode
=
RNIL
;
...
@@ -403,9 +401,9 @@ Dbtux::execACC_CHECK_SCAN(Signal* signal)
...
@@ -403,9 +401,9 @@ Dbtux::execACC_CHECK_SCAN(Signal* signal)
lockReq
->
tableId
=
scan
.
m_tableId
;
lockReq
->
tableId
=
scan
.
m_tableId
;
lockReq
->
fragId
=
frag
.
m_fragId
|
(
ent
.
m_fragBit
<<
frag
.
m_fragOff
);
lockReq
->
fragId
=
frag
.
m_fragId
|
(
ent
.
m_fragBit
<<
frag
.
m_fragOff
);
lockReq
->
fragPtrI
=
frag
.
m_accTableFragPtrI
[
ent
.
m_fragBit
];
lockReq
->
fragPtrI
=
frag
.
m_accTableFragPtrI
[
ent
.
m_fragBit
];
const
Uint32
*
const
buf32
=
static_cast
<
Uint32
*>
(
keyPar
.
m_d
ata
);
const
Uint32
*
const
buf32
=
static_cast
<
Uint32
*>
(
pkD
ata
);
const
Uint64
*
const
buf64
=
reinterpret_cast
<
const
Uint64
*>
(
buf32
);
const
Uint64
*
const
buf64
=
reinterpret_cast
<
const
Uint64
*>
(
buf32
);
lockReq
->
hashValue
=
md5_hash
(
buf64
,
keyPar
.
m_s
ize
);
lockReq
->
hashValue
=
md5_hash
(
buf64
,
pkS
ize
);
lockReq
->
tupAddr
=
getTupAddr
(
frag
,
ent
);
lockReq
->
tupAddr
=
getTupAddr
(
frag
,
ent
);
lockReq
->
transId1
=
scan
.
m_transId1
;
lockReq
->
transId1
=
scan
.
m_transId1
;
lockReq
->
transId2
=
scan
.
m_transId2
;
lockReq
->
transId2
=
scan
.
m_transId2
;
...
@@ -480,11 +478,9 @@ Dbtux::execACC_CHECK_SCAN(Signal* signal)
...
@@ -480,11 +478,9 @@ Dbtux::execACC_CHECK_SCAN(Signal* signal)
const
TreeEnt
ent
=
scan
.
m_scanPos
.
m_ent
;
const
TreeEnt
ent
=
scan
.
m_scanPos
.
m_ent
;
if
(
scan
.
m_keyInfo
)
{
if
(
scan
.
m_keyInfo
)
{
jam
();
jam
();
if
(
keyPar
.
m_data
==
0
)
{
if
(
pkSize
==
0
)
{
jam
();
jam
();
keyPar
.
m_ent
=
ent
;
readTablePk
(
frag
,
ent
,
pkSize
,
pkData
);
keyPar
.
m_data
=
c_dataBuffer
;
tupReadKeys
(
signal
,
frag
,
keyPar
);
}
}
}
}
// conf signal
// conf signal
...
@@ -510,10 +506,10 @@ Dbtux::execACC_CHECK_SCAN(Signal* signal)
...
@@ -510,10 +506,10 @@ Dbtux::execACC_CHECK_SCAN(Signal* signal)
// add key info
// add key info
if
(
scan
.
m_keyInfo
)
{
if
(
scan
.
m_keyInfo
)
{
jam
();
jam
();
conf
->
keyLength
=
keyPar
.
m_s
ize
;
conf
->
keyLength
=
pkS
ize
;
// piggy-back first 4 words of key data
// piggy-back first 4 words of key data
for
(
unsigned
i
=
0
;
i
<
4
;
i
++
)
{
for
(
unsigned
i
=
0
;
i
<
4
;
i
++
)
{
conf
->
key
[
i
]
=
i
<
keyPar
.
m_size
?
keyPar
.
m_d
ata
[
i
]
:
0
;
conf
->
key
[
i
]
=
i
<
pkSize
?
pkD
ata
[
i
]
:
0
;
}
}
signalLength
=
11
;
signalLength
=
11
;
}
}
...
@@ -525,18 +521,18 @@ Dbtux::execACC_CHECK_SCAN(Signal* signal)
...
@@ -525,18 +521,18 @@ Dbtux::execACC_CHECK_SCAN(Signal* signal)
EXECUTE_DIRECT
(
blockNo
,
GSN_NEXT_SCANCONF
,
signal
,
signalLength
);
EXECUTE_DIRECT
(
blockNo
,
GSN_NEXT_SCANCONF
,
signal
,
signalLength
);
}
}
// send rest of key data
// send rest of key data
if
(
scan
.
m_keyInfo
&&
keyPar
.
m_s
ize
>
4
)
{
if
(
scan
.
m_keyInfo
&&
pkS
ize
>
4
)
{
unsigned
total
=
4
;
unsigned
total
=
4
;
while
(
total
<
keyPar
.
m_s
ize
)
{
while
(
total
<
pkS
ize
)
{
jam
();
jam
();
unsigned
length
=
keyPar
.
m_s
ize
-
total
;
unsigned
length
=
pkS
ize
-
total
;
if
(
length
>
20
)
if
(
length
>
20
)
length
=
20
;
length
=
20
;
signal
->
theData
[
0
]
=
scan
.
m_userPtr
;
signal
->
theData
[
0
]
=
scan
.
m_userPtr
;
signal
->
theData
[
1
]
=
0
;
signal
->
theData
[
1
]
=
0
;
signal
->
theData
[
2
]
=
0
;
signal
->
theData
[
2
]
=
0
;
signal
->
theData
[
3
]
=
length
;
signal
->
theData
[
3
]
=
length
;
memcpy
(
&
signal
->
theData
[
4
],
&
keyPar
.
m_d
ata
[
total
],
length
<<
2
);
memcpy
(
&
signal
->
theData
[
4
],
&
pkD
ata
[
total
],
length
<<
2
);
sendSignal
(
scan
.
m_userRef
,
GSN_ACC_SCAN_INFO24
,
sendSignal
(
scan
.
m_userRef
,
GSN_ACC_SCAN_INFO24
,
signal
,
4
+
length
,
JBB
);
signal
,
4
+
length
,
JBB
);
total
+=
length
;
total
+=
length
;
...
@@ -895,35 +891,25 @@ Dbtux::scanNext(Signal* signal, ScanOpPtr scanPtr)
...
@@ -895,35 +891,25 @@ Dbtux::scanNext(Signal* signal, ScanOpPtr scanPtr)
bool
bool
Dbtux
::
scanVisible
(
Signal
*
signal
,
ScanOpPtr
scanPtr
,
TreeEnt
ent
)
Dbtux
::
scanVisible
(
Signal
*
signal
,
ScanOpPtr
scanPtr
,
TreeEnt
ent
)
{
{
TupQueryTh
*
const
req
=
(
TupQueryTh
*
)
signal
->
getDataPtrSend
();
const
ScanOp
&
scan
=
*
scanPtr
.
p
;
const
ScanOp
&
scan
=
*
scanPtr
.
p
;
const
Frag
&
frag
=
*
c_fragPool
.
getPtr
(
scan
.
m_fragPtrI
);
const
Frag
&
frag
=
*
c_fragPool
.
getPtr
(
scan
.
m_fragPtrI
);
/* Assign table, fragment, tuple address + version */
Uint32
tableId
=
frag
.
m_tableId
;
Uint32
fragBit
=
ent
.
m_fragBit
;
Uint32
fragBit
=
ent
.
m_fragBit
;
Uint32
tableFragPtrI
=
frag
.
m_tupTableFragPtrI
[
fragBit
];
Uint32
fragId
=
frag
.
m_fragId
|
(
fragBit
<<
frag
.
m_fragOff
);
Uint32
fragId
=
frag
.
m_fragId
|
(
fragBit
<<
frag
.
m_fragOff
);
Uint32
tupAddr
=
getTupAddr
(
frag
,
ent
);
Uint32
tupAddr
=
getTupAddr
(
frag
,
ent
);
Uint32
tupVersion
=
ent
.
m_tupVersion
;
Uint32
tupVersion
=
ent
.
m_tupVersion
;
/
* Check for same tuple twice in row */
/
/ check for same tuple twice in row
if
(
scan
.
m_lastEnt
.
m_tupLoc
==
ent
.
m_tupLoc
&&
if
(
scan
.
m_lastEnt
.
m_tupLoc
==
ent
.
m_tupLoc
&&
scan
.
m_lastEnt
.
m_fragBit
==
fragBit
)
{
scan
.
m_lastEnt
.
m_fragBit
==
fragBit
)
{
jam
();
jam
();
return
false
;
return
false
;
}
}
req
->
tableId
=
tableId
;
req
->
fragId
=
fragId
;
req
->
tupAddr
=
tupAddr
;
req
->
tupVersion
=
tupVersion
;
/* Assign transaction info, trans id + savepoint id */
Uint32
transId1
=
scan
.
m_transId1
;
Uint32
transId1
=
scan
.
m_transId1
;
Uint32
transId2
=
scan
.
m_transId2
;
Uint32
transId2
=
scan
.
m_transId2
;
Uint32
savePointId
=
scan
.
m_savePointId
;
Uint32
savePointId
=
scan
.
m_savePointId
;
req
->
transId1
=
transId1
;
bool
ret
=
c_tup
->
tuxQueryTh
(
tableFragPtrI
,
tupAddr
,
tupVersion
,
transId1
,
transId2
,
savePointId
);
req
->
transId2
=
transId2
;
req
->
savePointId
=
savePointId
;
EXECUTE_DIRECT
(
DBTUP
,
GSN_TUP_QUERY_TH
,
signal
,
TupQueryTh
::
SignalLength
);
jamEntry
();
jamEntry
();
return
(
bool
)
req
->
returnCode
;
return
ret
;
}
}
/*
/*
...
...
ndb/src/kernel/blocks/dbtux/Times.txt
View file @
5ed830f6
index maintenance overhead
ordered index performance
=========================
=
=========================
"mc02" 2x1700 MHz linux-2.4.9 gcc-2.96 -O3 one db-node
"mc02" 2x1700 MHz linux-2.4.9 gcc-2.96 -O3 one db-node
case a: index on Unsigned
case a:
maintenance:
index on Unsigned
testOIBasic -case u -table 1 -index
1
-fragtype small -threads 10 -rows 100000 -subloop 1 -nologging
testOIBasic -case u -table 1 -index
2
-fragtype small -threads 10 -rows 100000 -subloop 1 -nologging
case b: index on Varchar(5) + Varchar(5) + Varchar(20) + Unsigned
case b:
maintenance:
index on Varchar(5) + Varchar(5) + Varchar(20) + Unsigned
testOIBasic -case u -table 2 -index
4
-fragtype small -threads 10 -rows 100000 -subloop 1 -nologging
testOIBasic -case u -table 2 -index
5
-fragtype small -threads 10 -rows 100000 -subloop 1 -nologging
case c: full scan: index on PK Unsigned
testOIBasic -case v -table 1 -index 1 -fragtype small -threads 10 -rows 100000 -subloop 1 -nologging
case d: scan 1 tuple via EQ: index on PK Unsigned
testOIBasic -case w -table 1 -index 1 -fragtype small -threads 10 -rows 100000 -samples 10000 -subloop 1 -nologging -v2
a, b
1 million rows, pk update without index, pk update with index
1 million rows, pk update without index, pk update with index
shows ms / 1000 rows for each and pct overhead
shows ms / 1000 rows for each and pct overhead
the figures are based on single run on idle machine
c
1 million rows, index on PK, full table scan, full index scan
shows ms / 1000 rows for each and index time pct
d
1 million rows, index on PK, read table via each pk, scan index for each pk
shows ms / 1000 rows for each and index time pct
samples 10% of all PKs (100,000 pk reads, 100,000 scans)
040616 mc02/a 40 ms 87 ms 114 pct
040616 mc02/a 40 ms 87 ms 114 pct
mc02/b 51 ms 128 ms 148 pct
mc02/b 51 ms 128 ms 148 pct
...
@@ -51,5 +66,12 @@ optim 11 mc02/a 43 ms 63 ms 46 pct
...
@@ -51,5 +66,12 @@ optim 11 mc02/a 43 ms 63 ms 46 pct
optim 12 mc02/a 38 ms 55 ms 43 pct
optim 12 mc02/a 38 ms 55 ms 43 pct
mc02/b 47 ms 77 ms 63 pct
mc02/b 47 ms 77 ms 63 pct
mc02/c 10 ms 14 ms 147 pct
mc02/d 176 ms 281 ms 159 pct
optim 13 mc02/a 40 ms 57 ms 42 pct
mc02/b 47 ms 77 ms 61 pct
mc02/c 9 ms 13 ms 150 pct
mc02/d 170 ms 256 ms 150 pct
vim: set et:
vim: set et:
ndb/test/ndbapi/testOIBasic.cpp
View file @
5ed830f6
This diff is collapsed.
Click to expand it.
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