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
f805a870
Commit
f805a870
authored
Mar 04, 2006
by
jonas@eel.(none)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ndb test
add disk option to various bank tests
parent
a40d1af7
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
62 additions
and
28 deletions
+62
-28
storage/ndb/test/include/NDBT_Tables.hpp
storage/ndb/test/include/NDBT_Tables.hpp
+2
-0
storage/ndb/test/ndbapi/bank/Bank.cpp
storage/ndb/test/ndbapi/bank/Bank.cpp
+1
-1
storage/ndb/test/ndbapi/bank/Bank.hpp
storage/ndb/test/ndbapi/bank/Bank.hpp
+4
-4
storage/ndb/test/ndbapi/bank/BankLoad.cpp
storage/ndb/test/ndbapi/bank/BankLoad.cpp
+32
-11
storage/ndb/test/ndbapi/bank/bankCreator.cpp
storage/ndb/test/ndbapi/bank/bankCreator.cpp
+4
-2
storage/ndb/test/ndbapi/bank/testBank.cpp
storage/ndb/test/ndbapi/bank/testBank.cpp
+2
-6
storage/ndb/test/ndbapi/testSRBank.cpp
storage/ndb/test/ndbapi/testSRBank.cpp
+16
-2
storage/ndb/test/src/NDBT_Tables.cpp
storage/ndb/test/src/NDBT_Tables.cpp
+1
-2
No files found.
storage/ndb/test/include/NDBT_Tables.hpp
View file @
f805a870
...
...
@@ -44,6 +44,8 @@ public:
static
const
NdbDictionary
::
Table
*
getTable
(
int
_num
);
static
int
getNumTables
();
static
int
create_default_tablespace
(
Ndb
*
pNdb
);
private:
static
const
NdbDictionary
::
Table
*
tableWithPkSize
(
const
char
*
_nam
,
Uint32
pkSize
);
};
...
...
storage/ndb/test/ndbapi/bank/Bank.cpp
View file @
f805a870
...
...
@@ -19,7 +19,7 @@
#include <NdbSleep.h>
#include <UtilTransactions.hpp>
Bank
::
Bank
(
Ndb_cluster_connection
&
con
,
bool
_init
,
char
*
dbase
)
:
Bank
::
Bank
(
Ndb_cluster_connection
&
con
,
bool
_init
,
c
onst
c
har
*
dbase
)
:
m_ndb
(
&
con
,
dbase
),
m_maxAccount
(
-
1
),
m_initialized
(
false
)
...
...
storage/ndb/test/ndbapi/bank/Bank.hpp
View file @
f805a870
...
...
@@ -27,9 +27,9 @@
class
Bank
{
public:
Bank
(
Ndb_cluster_connection
&
,
bool
init
=
true
,
char
*
dbase
=
"BANK"
);
Bank
(
Ndb_cluster_connection
&
,
bool
init
=
true
,
c
onst
c
har
*
dbase
=
"BANK"
);
int
createAndLoadBank
(
bool
overWrite
,
int
num_accounts
=
10
);
int
createAndLoadBank
(
bool
overWrite
,
bool
disk
=
false
,
int
num_accounts
=
10
);
int
dropBank
();
int
performTransactions
(
int
maxSleepBetweenTrans
=
20
,
int
yield
=
0
);
...
...
@@ -121,8 +121,8 @@ private:
int
prepareReadSystemValueOp
(
NdbConnection
*
,
SystemValueId
sysValId
,
Uint64
&
time
);
int
prepareGetCurrTimeOp
(
NdbConnection
*
,
Uint64
&
time
);
int
createTables
();
int
createTable
(
const
char
*
tabName
);
int
createTables
(
bool
disk
);
int
createTable
(
const
char
*
tabName
,
bool
disk
);
int
dropTables
();
int
dropTable
(
const
char
*
tabName
);
...
...
storage/ndb/test/ndbapi/bank/BankLoad.cpp
View file @
f805a870
...
...
@@ -53,7 +53,7 @@ int Bank::getNumAccountTypes(){
return
accountTypesSize
;
}
int
Bank
::
createAndLoadBank
(
bool
ovrWrt
,
int
num_accounts
){
int
Bank
::
createAndLoadBank
(
bool
ovrWrt
,
bool
disk
,
int
num_accounts
){
m_ndb
.
init
();
if
(
m_ndb
.
waitUntilReady
()
!=
0
)
...
...
@@ -69,7 +69,7 @@ int Bank::createAndLoadBank(bool ovrWrt, int num_accounts){
}
}
if
(
createTables
()
!=
NDBT_OK
)
if
(
createTables
(
disk
)
!=
NDBT_OK
)
return
NDBT_FAILED
;
if
(
clearTables
()
!=
NDBT_OK
)
...
...
@@ -104,9 +104,9 @@ int Bank::dropBank(){
}
int
Bank
::
createTables
(){
int
Bank
::
createTables
(
bool
disk
){
for
(
int
i
=
0
;
i
<
tableNamesSize
;
i
++
){
if
(
createTable
(
tableNames
[
i
])
!=
NDBT_OK
)
if
(
createTable
(
tableNames
[
i
]
,
disk
)
!=
NDBT_OK
)
return
NDBT_FAILED
;
}
return
NDBT_OK
;
...
...
@@ -136,7 +136,7 @@ int Bank::clearTable(const char* tabName){
return
NDBT_OK
;
}
int
Bank
::
createTable
(
const
char
*
tabName
){
int
Bank
::
createTable
(
const
char
*
tabName
,
bool
disk
){
ndbout
<<
"createTable "
<<
tabName
<<
endl
;
const
NdbDictionary
::
Table
*
pTab
=
NDBT_Tables
::
getTable
(
tabName
);
...
...
@@ -146,7 +146,8 @@ int Bank::createTable(const char* tabName){
const
NdbDictionary
::
Table
*
org
=
m_ndb
.
getDictionary
()
->
getTable
(
tabName
);
if
(
org
!=
0
&&
pTab
->
equal
(
*
org
)){
if
(
org
!=
0
&&
(
disk
||
pTab
->
equal
(
*
org
)))
{
return
NDBT_OK
;
}
...
...
@@ -155,11 +156,31 @@ int Bank::createTable(const char* tabName){
return
NDBT_FAILED
;
}
if
(
disk
)
{
if
(
NDBT_Tables
::
create_default_tablespace
(
&
m_ndb
))
{
ndbout
<<
"Failed to create tablespaces"
<<
endl
;
return
NDBT_FAILED
;
}
NdbDictionary
::
Table
copy
(
*
pTab
);
copy
.
setTablespace
(
"DEFAULT-TS"
);
for
(
Uint32
i
=
0
;
i
<
copy
.
getNoOfColumns
();
i
++
)
copy
.
getColumn
(
i
)
->
setStorageType
(
NdbDictionary
::
Column
::
StorageTypeDisk
);
if
(
m_ndb
.
getDictionary
()
->
createTable
(
copy
)
==
-
1
){
ndbout
<<
"Failed to create table: "
<<
m_ndb
.
getNdbError
()
<<
endl
;
return
NDBT_FAILED
;
}
}
else
{
if
(
m_ndb
.
getDictionary
()
->
createTable
(
*
pTab
)
==
-
1
){
ndbout
<<
"Failed to create table: "
<<
m_ndb
.
getNdbError
()
<<
endl
;
return
NDBT_FAILED
;
}
}
return
NDBT_OK
;
}
...
...
storage/ndb/test/ndbapi/bank/bankCreator.cpp
View file @
f805a870
...
...
@@ -30,9 +30,11 @@ int main(int argc, const char** argv){
ndb_init
();
int
_help
=
0
;
char
*
_database
=
"BANK"
;
int
disk
=
0
;
struct
getargs
args
[]
=
{
{
"database"
,
'd'
,
arg_string
,
&
_database
,
"Database name"
,
""
},
{
"disk"
,
0
,
arg_flag
,
&
disk
,
"Use disk tables"
,
""
},
{
"usage"
,
'?'
,
arg_flag
,
&
_help
,
"Print help"
,
""
}
};
int
num_args
=
sizeof
(
args
)
/
sizeof
(
args
[
0
]);
...
...
@@ -53,7 +55,7 @@ int main(int argc, const char** argv){
Bank
bank
(
con
,
_database
);
int
overWriteExisting
=
true
;
if
(
bank
.
createAndLoadBank
(
overWriteExisting
)
!=
NDBT_OK
)
if
(
bank
.
createAndLoadBank
(
overWriteExisting
,
disk
)
!=
NDBT_OK
)
return
NDBT_ProgramExit
(
NDBT_FAILED
);
return
NDBT_ProgramExit
(
NDBT_OK
);
...
...
storage/ndb/test/ndbapi/bank/testBank.cpp
View file @
f805a870
...
...
@@ -31,8 +31,9 @@
#include "Bank.hpp"
const
char
*
_database
=
"BANK"
;
int
runCreateBank
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
){
char
*
_database
=
"BANK"
;
Bank
bank
(
ctx
->
m_cluster_connection
,
_database
);
int
overWriteExisting
=
true
;
if
(
bank
.
createAndLoadBank
(
overWriteExisting
)
!=
NDBT_OK
)
...
...
@@ -41,7 +42,6 @@ int runCreateBank(NDBT_Context* ctx, NDBT_Step* step){
}
int
runBankTimer
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
){
char
*
_database
=
"BANK"
;
Bank
bank
(
ctx
->
m_cluster_connection
,
_database
);
int
wait
=
30
;
// Max seconds between each "day"
int
yield
=
1
;
// Loops before bank returns
...
...
@@ -53,7 +53,6 @@ int runBankTimer(NDBT_Context* ctx, NDBT_Step* step){
}
int
runBankTransactions
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
){
char
*
_database
=
"BANK"
;
Bank
bank
(
ctx
->
m_cluster_connection
,
_database
);
int
wait
=
10
;
// Max ms between each transaction
int
yield
=
100
;
// Loops before bank returns
...
...
@@ -65,7 +64,6 @@ int runBankTransactions(NDBT_Context* ctx, NDBT_Step* step){
}
int
runBankGL
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
){
char
*
_database
=
"BANK"
;
Bank
bank
(
ctx
->
m_cluster_connection
,
_database
);
int
yield
=
20
;
// Loops before bank returns
int
result
=
NDBT_OK
;
...
...
@@ -80,7 +78,6 @@ int runBankGL(NDBT_Context* ctx, NDBT_Step* step){
}
int
runBankSum
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
){
char
*
_database
=
"BANK"
;
Bank
bank
(
ctx
->
m_cluster_connection
,
_database
);
int
wait
=
2000
;
// Max ms between each sum of accounts
int
yield
=
1
;
// Loops before bank returns
...
...
@@ -96,7 +93,6 @@ int runBankSum(NDBT_Context* ctx, NDBT_Step* step){
}
int
runDropBank
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
){
char
*
_database
=
"BANK"
;
Bank
bank
(
ctx
->
m_cluster_connection
,
_database
);
if
(
bank
.
dropBank
()
!=
NDBT_OK
)
return
NDBT_FAILED
;
...
...
storage/ndb/test/ndbapi/testSRBank.cpp
View file @
f805a870
...
...
@@ -22,10 +22,12 @@
#include "bank/Bank.hpp"
bool
disk
=
false
;
int
runCreateBank
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
){
Bank
bank
(
ctx
->
m_cluster_connection
);
int
overWriteExisting
=
true
;
if
(
bank
.
createAndLoadBank
(
overWriteExisting
,
10
)
!=
NDBT_OK
)
if
(
bank
.
createAndLoadBank
(
overWriteExisting
,
disk
,
10
)
!=
NDBT_OK
)
return
NDBT_FAILED
;
return
NDBT_OK
;
}
...
...
@@ -406,8 +408,20 @@ TESTCASE("Mix",
}
NDBT_TESTSUITE_END
(
testSRBank
);
int
main
(
int
argc
,
const
char
**
argv
){
int
main
(
int
argc
,
const
char
**
argv
){
ndb_init
();
for
(
int
i
=
0
;
i
<
argc
;
i
++
)
{
if
(
strcmp
(
argv
[
i
],
"--disk"
)
==
0
)
{
argc
--
;
disk
=
true
;
for
(;
i
<
argc
;
i
++
)
argv
[
i
]
=
argv
[
i
+
1
];
break
;
}
}
return
testSRBank
.
execute
(
argc
,
argv
);
}
...
...
storage/ndb/test/src/NDBT_Tables.cpp
View file @
f805a870
...
...
@@ -848,9 +848,8 @@ NDBT_Tables::createAllTables(Ndb* pNdb){
return
createAllTables
(
pNdb
,
false
);
}
static
int
create_default_tablespace
(
Ndb
*
pNdb
)
NDBT_Tables
::
create_default_tablespace
(
Ndb
*
pNdb
)
{
NdbDictionary
::
Dictionary
*
pDict
=
pNdb
->
getDictionary
();
...
...
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