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
b9c920ba
Commit
b9c920ba
authored
Nov 25, 2004
by
joreland@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wl2126 - ndb - bug fix in set_new_bound & testScanPerf
parent
047a3d12
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
56 deletions
+38
-56
ndb/src/ndbapi/NdbScanOperation.cpp
ndb/src/ndbapi/NdbScanOperation.cpp
+2
-2
ndb/test/ndbapi/testScanPerf.cpp
ndb/test/ndbapi/testScanPerf.cpp
+36
-54
No files found.
ndb/src/ndbapi/NdbScanOperation.cpp
View file @
b9c920ba
...
@@ -1631,6 +1631,6 @@ NdbIndexScanOperation::set_new_bound()
...
@@ -1631,6 +1631,6 @@ NdbIndexScanOperation::set_new_bound()
bound_head
|=
(
theTupKeyLen
-
m_this_bound_start
)
<<
16
;
bound_head
|=
(
theTupKeyLen
-
m_this_bound_start
)
<<
16
;
*
m_first_bound_word
=
bound_head
;
*
m_first_bound_word
=
bound_head
;
m_first_bound_word
=
theKEYINFOptr
;
m_first_bound_word
=
theKEYINFOptr
+
theTotalNrOfKeyWordInSignal
;
;
m_this_bound_start
=
theTupKeyLen
;
m_this_bound_start
=
theTupKeyLen
;
}
}
ndb/test/ndbapi/testScanPerf.cpp
View file @
b9c920ba
...
@@ -38,10 +38,10 @@ struct Parameter {
...
@@ -38,10 +38,10 @@ struct Parameter {
#define P_ROWS 7
#define P_ROWS 7
#define P_LOOPS 8
#define P_LOOPS 8
#define P_CREATE 9
#define P_CREATE 9
#define P_LOAD 10
#define P_RESET 11
#define P_RESET 11
#define P_MULTI 12
#define P_MAX 1
2
#define P_MAX 1
3
static
static
Parameter
Parameter
...
@@ -57,7 +57,8 @@ g_paramters[] = {
...
@@ -57,7 +57,8 @@ g_paramters[] = {
{
"iterations"
,
3
,
1
,
~
0
},
{
"iterations"
,
3
,
1
,
~
0
},
{
"create_drop"
,
1
,
0
,
1
},
{
"create_drop"
,
1
,
0
,
1
},
{
"data"
,
1
,
0
,
1
},
{
"data"
,
1
,
0
,
1
},
{
"q-reset bounds"
,
0
,
1
,
0
}
{
"q-reset bounds"
,
0
,
1
,
0
},
{
"multi read range"
,
1000
,
1
,
~
0
}
};
};
static
Ndb
*
g_ndb
=
0
;
static
Ndb
*
g_ndb
=
0
;
...
@@ -67,10 +68,7 @@ static char g_tablename[256];
...
@@ -67,10 +68,7 @@ static char g_tablename[256];
static
char
g_indexname
[
256
];
static
char
g_indexname
[
256
];
int
create_table
();
int
create_table
();
int
load_table
();
int
run_scan
();
int
run_scan
();
int
clear_table
();
int
drop_table
();
int
int
main
(
int
argc
,
const
char
**
argv
){
main
(
int
argc
,
const
char
**
argv
){
...
@@ -117,14 +115,8 @@ main(int argc, const char** argv){
...
@@ -117,14 +115,8 @@ main(int argc, const char** argv){
BaseString
::
snprintf
(
g_indexname
,
sizeof
(
g_indexname
),
"IDX_%s"
,
T
);
BaseString
::
snprintf
(
g_indexname
,
sizeof
(
g_indexname
),
"IDX_%s"
,
T
);
if
(
create_table
())
if
(
create_table
())
goto
error
;
goto
error
;
if
(
load_table
())
goto
error
;
if
(
run_scan
())
if
(
run_scan
())
goto
error
;
goto
error
;
if
(
clear_table
())
goto
error
;
if
(
drop_table
())
goto
error
;
}
}
if
(
g_ndb
)
delete
g_ndb
;
if
(
g_ndb
)
delete
g_ndb
;
...
@@ -139,6 +131,7 @@ create_table(){
...
@@ -139,6 +131,7 @@ create_table(){
NdbDictionary
::
Dictionary
*
dict
=
g_ndb
->
getDictionary
();
NdbDictionary
::
Dictionary
*
dict
=
g_ndb
->
getDictionary
();
assert
(
dict
);
assert
(
dict
);
if
(
g_paramters
[
P_CREATE
].
value
){
if
(
g_paramters
[
P_CREATE
].
value
){
g_ndb
->
getDictionary
()
->
dropTable
(
g_tablename
);
const
NdbDictionary
::
Table
*
pTab
=
NDBT_Tables
::
getTable
(
g_tablename
);
const
NdbDictionary
::
Table
*
pTab
=
NDBT_Tables
::
getTable
(
g_tablename
);
assert
(
pTab
);
assert
(
pTab
);
NdbDictionary
::
Table
copy
=
*
pTab
;
NdbDictionary
::
Table
copy
=
*
pTab
;
...
@@ -167,46 +160,18 @@ create_table(){
...
@@ -167,46 +160,18 @@ create_table(){
g_index
=
dict
->
getIndex
(
g_indexname
,
g_tablename
);
g_index
=
dict
->
getIndex
(
g_indexname
,
g_tablename
);
assert
(
g_table
);
assert
(
g_table
);
assert
(
g_index
);
assert
(
g_index
);
return
0
;
}
int
drop_table
(){
if
(
!
g_paramters
[
P_CREATE
].
value
)
return
0
;
if
(
g_ndb
->
getDictionary
()
->
dropTable
(
g_table
->
getName
())
!=
0
){
g_err
<<
"Failed to drop table: "
<<
g_table
->
getName
()
<<
endl
;
return
-
1
;
}
g_table
=
0
;
return
0
;
}
int
load_table
(){
if
(
!
g_paramters
[
P_LOAD
].
value
)
return
0
;
if
(
g_paramters
[
P_CREATE
].
value
)
{
int
rows
=
g_paramters
[
P_ROWS
].
value
;
int
rows
=
g_paramters
[
P_ROWS
].
value
;
HugoTransactions
hugoTrans
(
*
g_table
);
HugoTransactions
hugoTrans
(
*
g_table
);
if
(
hugoTrans
.
loadTable
(
g_ndb
,
rows
)){
if
(
hugoTrans
.
loadTable
(
g_ndb
,
rows
)){
g_err
.
println
(
"Failed to load %s with %d rows"
,
g_table
->
getName
(),
rows
);
g_err
.
println
(
"Failed to load %s with %d rows"
,
g_table
->
getName
(),
rows
);
return
-
1
;
return
-
1
;
}
}
return
0
;
}
int
clear_table
(){
if
(
!
g_paramters
[
P_LOAD
].
value
)
return
0
;
int
rows
=
g_paramters
[
P_ROWS
].
value
;
UtilTransactions
utilTrans
(
*
g_table
);
if
(
utilTrans
.
clearTable
(
g_ndb
,
rows
)
!=
0
){
g_err
.
println
(
"Failed to clear table %s"
,
g_table
->
getName
());
return
-
1
;
}
}
return
0
;
return
0
;
}
}
...
@@ -226,7 +191,7 @@ run_scan(){
...
@@ -226,7 +191,7 @@ run_scan(){
Uint32
tot
=
g_paramters
[
P_ROWS
].
value
;
Uint32
tot
=
g_paramters
[
P_ROWS
].
value
;
if
(
g_paramters
[
P_BOUND
].
value
=
=
2
||
g_paramters
[
P_FILT
].
value
==
2
)
if
(
g_paramters
[
P_BOUND
].
value
>
=
2
||
g_paramters
[
P_FILT
].
value
==
2
)
iter
*=
g_paramters
[
P_ROWS
].
value
;
iter
*=
g_paramters
[
P_ROWS
].
value
;
NdbScanOperation
*
pOp
=
0
;
NdbScanOperation
*
pOp
=
0
;
...
@@ -293,11 +258,24 @@ run_scan(){
...
@@ -293,11 +258,24 @@ run_scan(){
#else
#else
pIOp
->
setBound
((
Uint32
)
0
,
NdbIndexScanOperation
::
BoundEQ
,
&
row
);
pIOp
->
setBound
((
Uint32
)
0
,
NdbIndexScanOperation
::
BoundEQ
,
&
row
);
#endif
#endif
if
(
g_paramters
[
P_RESET
].
value
==
2
)
goto
execute
;
break
;
break
;
}
}
case
3
:
{
// read multi
int
multi
=
g_paramters
[
P_MULTI
].
value
;
int
tot
=
g_paramters
[
P_ROWS
].
value
;
for
(;
multi
>
0
&&
i
<
iter
;
--
multi
,
i
++
)
{
int
row
=
rand
()
%
tot
;
pIOp
->
setBound
((
Uint32
)
0
,
NdbIndexScanOperation
::
BoundEQ
,
&
row
);
pIOp
->
set_new_bound
();
}
}
if
(
g_paramters
[
P_RESET
].
value
==
1
)
if
(
g_paramters
[
P_RESET
].
value
==
2
)
goto
execute
;
goto
execute
;
break
;
}
}
}
}
assert
(
pOp
);
assert
(
pOp
);
assert
(
rs
);
assert
(
rs
);
...
@@ -333,6 +311,9 @@ run_scan(){
...
@@ -333,6 +311,9 @@ run_scan(){
for
(
int
i
=
0
;
i
<
g_table
->
getNoOfColumns
();
i
++
){
for
(
int
i
=
0
;
i
<
g_table
->
getNoOfColumns
();
i
++
){
pOp
->
getValue
(
i
);
pOp
->
getValue
(
i
);
}
}
if
(
g_paramters
[
P_RESET
].
value
==
1
)
g_paramters
[
P_RESET
].
value
=
2
;
execute:
execute:
int
rows
=
0
;
int
rows
=
0
;
check
=
pTrans
->
execute
(
NoCommit
);
check
=
pTrans
->
execute
(
NoCommit
);
...
@@ -376,7 +357,8 @@ execute:
...
@@ -376,7 +357,8 @@ execute:
}
}
}
}
g_err
.
println
(
"Avg time: %d ms = %u rows/sec"
,
sum_time
/
iter
,
g_err
.
println
(
"Avg time: %d ms = %u rows/sec"
,
(
1000
*
tot
*
iter
)
/
sum_time
);
sum_time
/
iter
,
(
1000
*
iter
)
/
sum_time
);
return
0
;
return
0
;
}
}
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