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
405b3ff6
Commit
405b3ff6
authored
Mar 15, 2006
by
jonas@eel.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge joreland@bk-internal.mysql.com:/home/bk/mysql-5.1-new
into eel.(none):/home/jonas/src/51-ndb
parents
605d6f05
71e351d5
Changes
8
Hide 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 @
405b3ff6
...
@@ -44,6 +44,8 @@ public:
...
@@ -44,6 +44,8 @@ public:
static
const
NdbDictionary
::
Table
*
getTable
(
int
_num
);
static
const
NdbDictionary
::
Table
*
getTable
(
int
_num
);
static
int
getNumTables
();
static
int
getNumTables
();
static
int
create_default_tablespace
(
Ndb
*
pNdb
);
private:
private:
static
const
NdbDictionary
::
Table
*
tableWithPkSize
(
const
char
*
_nam
,
Uint32
pkSize
);
static
const
NdbDictionary
::
Table
*
tableWithPkSize
(
const
char
*
_nam
,
Uint32
pkSize
);
};
};
...
...
storage/ndb/test/ndbapi/bank/Bank.cpp
View file @
405b3ff6
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
#include <NdbSleep.h>
#include <NdbSleep.h>
#include <UtilTransactions.hpp>
#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_ndb
(
&
con
,
dbase
),
m_maxAccount
(
-
1
),
m_maxAccount
(
-
1
),
m_initialized
(
false
)
m_initialized
(
false
)
...
...
storage/ndb/test/ndbapi/bank/Bank.hpp
View file @
405b3ff6
...
@@ -27,9 +27,9 @@
...
@@ -27,9 +27,9 @@
class
Bank
{
class
Bank
{
public:
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
dropBank
();
int
performTransactions
(
int
maxSleepBetweenTrans
=
20
,
int
yield
=
0
);
int
performTransactions
(
int
maxSleepBetweenTrans
=
20
,
int
yield
=
0
);
...
@@ -121,8 +121,8 @@ private:
...
@@ -121,8 +121,8 @@ private:
int
prepareReadSystemValueOp
(
NdbConnection
*
,
SystemValueId
sysValId
,
Uint64
&
time
);
int
prepareReadSystemValueOp
(
NdbConnection
*
,
SystemValueId
sysValId
,
Uint64
&
time
);
int
prepareGetCurrTimeOp
(
NdbConnection
*
,
Uint64
&
time
);
int
prepareGetCurrTimeOp
(
NdbConnection
*
,
Uint64
&
time
);
int
createTables
();
int
createTables
(
bool
disk
);
int
createTable
(
const
char
*
tabName
);
int
createTable
(
const
char
*
tabName
,
bool
disk
);
int
dropTables
();
int
dropTables
();
int
dropTable
(
const
char
*
tabName
);
int
dropTable
(
const
char
*
tabName
);
...
...
storage/ndb/test/ndbapi/bank/BankLoad.cpp
View file @
405b3ff6
...
@@ -53,7 +53,7 @@ int Bank::getNumAccountTypes(){
...
@@ -53,7 +53,7 @@ int Bank::getNumAccountTypes(){
return
accountTypesSize
;
return
accountTypesSize
;
}
}
int
Bank
::
createAndLoadBank
(
bool
ovrWrt
,
int
num_accounts
){
int
Bank
::
createAndLoadBank
(
bool
ovrWrt
,
bool
disk
,
int
num_accounts
){
m_ndb
.
init
();
m_ndb
.
init
();
if
(
m_ndb
.
waitUntilReady
()
!=
0
)
if
(
m_ndb
.
waitUntilReady
()
!=
0
)
...
@@ -69,7 +69,7 @@ int Bank::createAndLoadBank(bool ovrWrt, int num_accounts){
...
@@ -69,7 +69,7 @@ int Bank::createAndLoadBank(bool ovrWrt, int num_accounts){
}
}
}
}
if
(
createTables
()
!=
NDBT_OK
)
if
(
createTables
(
disk
)
!=
NDBT_OK
)
return
NDBT_FAILED
;
return
NDBT_FAILED
;
if
(
clearTables
()
!=
NDBT_OK
)
if
(
clearTables
()
!=
NDBT_OK
)
...
@@ -104,9 +104,9 @@ int Bank::dropBank(){
...
@@ -104,9 +104,9 @@ int Bank::dropBank(){
}
}
int
Bank
::
createTables
(){
int
Bank
::
createTables
(
bool
disk
){
for
(
int
i
=
0
;
i
<
tableNamesSize
;
i
++
){
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_FAILED
;
}
}
return
NDBT_OK
;
return
NDBT_OK
;
...
@@ -136,7 +136,7 @@ int Bank::clearTable(const char* tabName){
...
@@ -136,7 +136,7 @@ int Bank::clearTable(const char* tabName){
return
NDBT_OK
;
return
NDBT_OK
;
}
}
int
Bank
::
createTable
(
const
char
*
tabName
){
int
Bank
::
createTable
(
const
char
*
tabName
,
bool
disk
){
ndbout
<<
"createTable "
<<
tabName
<<
endl
;
ndbout
<<
"createTable "
<<
tabName
<<
endl
;
const
NdbDictionary
::
Table
*
pTab
=
NDBT_Tables
::
getTable
(
tabName
);
const
NdbDictionary
::
Table
*
pTab
=
NDBT_Tables
::
getTable
(
tabName
);
...
@@ -146,7 +146,8 @@ int Bank::createTable(const char* tabName){
...
@@ -146,7 +146,8 @@ int Bank::createTable(const char* tabName){
const
NdbDictionary
::
Table
*
org
=
const
NdbDictionary
::
Table
*
org
=
m_ndb
.
getDictionary
()
->
getTable
(
tabName
);
m_ndb
.
getDictionary
()
->
getTable
(
tabName
);
if
(
org
!=
0
&&
pTab
->
equal
(
*
org
)){
if
(
org
!=
0
&&
(
disk
||
pTab
->
equal
(
*
org
)))
{
return
NDBT_OK
;
return
NDBT_OK
;
}
}
...
@@ -154,11 +155,31 @@ int Bank::createTable(const char* tabName){
...
@@ -154,11 +155,31 @@ int Bank::createTable(const char* tabName){
ndbout
<<
"Different table with same name exists"
<<
endl
;
ndbout
<<
"Different table with same name exists"
<<
endl
;
return
NDBT_FAILED
;
return
NDBT_FAILED
;
}
}
if
(
m_ndb
.
getDictionary
()
->
createTable
(
*
pTab
)
==
-
1
){
if
(
disk
)
ndbout
<<
"Failed to create table: "
<<
{
m_ndb
.
getNdbError
()
<<
endl
;
if
(
NDBT_Tables
::
create_default_tablespace
(
&
m_ndb
))
return
NDBT_FAILED
;
{
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
;
return
NDBT_OK
;
...
...
storage/ndb/test/ndbapi/bank/bankCreator.cpp
View file @
405b3ff6
...
@@ -30,9 +30,11 @@ int main(int argc, const char** argv){
...
@@ -30,9 +30,11 @@ int main(int argc, const char** argv){
ndb_init
();
ndb_init
();
int
_help
=
0
;
int
_help
=
0
;
char
*
_database
=
"BANK"
;
char
*
_database
=
"BANK"
;
int
disk
=
0
;
struct
getargs
args
[]
=
{
struct
getargs
args
[]
=
{
{
"database"
,
'd'
,
arg_string
,
&
_database
,
"Database name"
,
""
},
{
"database"
,
'd'
,
arg_string
,
&
_database
,
"Database name"
,
""
},
{
"disk"
,
0
,
arg_flag
,
&
disk
,
"Use disk tables"
,
""
},
{
"usage"
,
'?'
,
arg_flag
,
&
_help
,
"Print help"
,
""
}
{
"usage"
,
'?'
,
arg_flag
,
&
_help
,
"Print help"
,
""
}
};
};
int
num_args
=
sizeof
(
args
)
/
sizeof
(
args
[
0
]);
int
num_args
=
sizeof
(
args
)
/
sizeof
(
args
[
0
]);
...
@@ -53,7 +55,7 @@ int main(int argc, const char** argv){
...
@@ -53,7 +55,7 @@ int main(int argc, const char** argv){
Bank
bank
(
con
,
_database
);
Bank
bank
(
con
,
_database
);
int
overWriteExisting
=
true
;
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_FAILED
);
return
NDBT_ProgramExit
(
NDBT_OK
);
return
NDBT_ProgramExit
(
NDBT_OK
);
...
...
storage/ndb/test/ndbapi/bank/testBank.cpp
View file @
405b3ff6
...
@@ -31,8 +31,9 @@
...
@@ -31,8 +31,9 @@
#include "Bank.hpp"
#include "Bank.hpp"
const
char
*
_database
=
"BANK"
;
int
runCreateBank
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
){
int
runCreateBank
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
){
char
*
_database
=
"BANK"
;
Bank
bank
(
ctx
->
m_cluster_connection
,
_database
);
Bank
bank
(
ctx
->
m_cluster_connection
,
_database
);
int
overWriteExisting
=
true
;
int
overWriteExisting
=
true
;
if
(
bank
.
createAndLoadBank
(
overWriteExisting
)
!=
NDBT_OK
)
if
(
bank
.
createAndLoadBank
(
overWriteExisting
)
!=
NDBT_OK
)
...
@@ -41,7 +42,6 @@ int runCreateBank(NDBT_Context* ctx, NDBT_Step* step){
...
@@ -41,7 +42,6 @@ int runCreateBank(NDBT_Context* ctx, NDBT_Step* step){
}
}
int
runBankTimer
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
){
int
runBankTimer
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
){
char
*
_database
=
"BANK"
;
Bank
bank
(
ctx
->
m_cluster_connection
,
_database
);
Bank
bank
(
ctx
->
m_cluster_connection
,
_database
);
int
wait
=
30
;
// Max seconds between each "day"
int
wait
=
30
;
// Max seconds between each "day"
int
yield
=
1
;
// Loops before bank returns
int
yield
=
1
;
// Loops before bank returns
...
@@ -53,7 +53,6 @@ int runBankTimer(NDBT_Context* ctx, NDBT_Step* step){
...
@@ -53,7 +53,6 @@ int runBankTimer(NDBT_Context* ctx, NDBT_Step* step){
}
}
int
runBankTransactions
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
){
int
runBankTransactions
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
){
char
*
_database
=
"BANK"
;
Bank
bank
(
ctx
->
m_cluster_connection
,
_database
);
Bank
bank
(
ctx
->
m_cluster_connection
,
_database
);
int
wait
=
10
;
// Max ms between each transaction
int
wait
=
10
;
// Max ms between each transaction
int
yield
=
100
;
// Loops before bank returns
int
yield
=
100
;
// Loops before bank returns
...
@@ -65,7 +64,6 @@ int runBankTransactions(NDBT_Context* ctx, NDBT_Step* step){
...
@@ -65,7 +64,6 @@ int runBankTransactions(NDBT_Context* ctx, NDBT_Step* step){
}
}
int
runBankGL
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
){
int
runBankGL
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
){
char
*
_database
=
"BANK"
;
Bank
bank
(
ctx
->
m_cluster_connection
,
_database
);
Bank
bank
(
ctx
->
m_cluster_connection
,
_database
);
int
yield
=
20
;
// Loops before bank returns
int
yield
=
20
;
// Loops before bank returns
int
result
=
NDBT_OK
;
int
result
=
NDBT_OK
;
...
@@ -80,7 +78,6 @@ int runBankGL(NDBT_Context* ctx, NDBT_Step* step){
...
@@ -80,7 +78,6 @@ int runBankGL(NDBT_Context* ctx, NDBT_Step* step){
}
}
int
runBankSum
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
){
int
runBankSum
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
){
char
*
_database
=
"BANK"
;
Bank
bank
(
ctx
->
m_cluster_connection
,
_database
);
Bank
bank
(
ctx
->
m_cluster_connection
,
_database
);
int
wait
=
2000
;
// Max ms between each sum of accounts
int
wait
=
2000
;
// Max ms between each sum of accounts
int
yield
=
1
;
// Loops before bank returns
int
yield
=
1
;
// Loops before bank returns
...
@@ -96,7 +93,6 @@ int runBankSum(NDBT_Context* ctx, NDBT_Step* step){
...
@@ -96,7 +93,6 @@ int runBankSum(NDBT_Context* ctx, NDBT_Step* step){
}
}
int
runDropBank
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
){
int
runDropBank
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
){
char
*
_database
=
"BANK"
;
Bank
bank
(
ctx
->
m_cluster_connection
,
_database
);
Bank
bank
(
ctx
->
m_cluster_connection
,
_database
);
if
(
bank
.
dropBank
()
!=
NDBT_OK
)
if
(
bank
.
dropBank
()
!=
NDBT_OK
)
return
NDBT_FAILED
;
return
NDBT_FAILED
;
...
...
storage/ndb/test/ndbapi/testSRBank.cpp
View file @
405b3ff6
...
@@ -22,10 +22,12 @@
...
@@ -22,10 +22,12 @@
#include "bank/Bank.hpp"
#include "bank/Bank.hpp"
bool
disk
=
false
;
int
runCreateBank
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
){
int
runCreateBank
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
){
Bank
bank
(
ctx
->
m_cluster_connection
);
Bank
bank
(
ctx
->
m_cluster_connection
);
int
overWriteExisting
=
true
;
int
overWriteExisting
=
true
;
if
(
bank
.
createAndLoadBank
(
overWriteExisting
,
10
)
!=
NDBT_OK
)
if
(
bank
.
createAndLoadBank
(
overWriteExisting
,
disk
,
10
)
!=
NDBT_OK
)
return
NDBT_FAILED
;
return
NDBT_FAILED
;
return
NDBT_OK
;
return
NDBT_OK
;
}
}
...
@@ -406,8 +408,20 @@ TESTCASE("Mix",
...
@@ -406,8 +408,20 @@ TESTCASE("Mix",
}
}
NDBT_TESTSUITE_END
(
testSRBank
);
NDBT_TESTSUITE_END
(
testSRBank
);
int
main
(
int
argc
,
const
char
**
argv
){
int
main
(
int
argc
,
const
char
**
argv
){
ndb_init
();
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
);
return
testSRBank
.
execute
(
argc
,
argv
);
}
}
...
...
storage/ndb/test/src/NDBT_Tables.cpp
View file @
405b3ff6
...
@@ -848,9 +848,8 @@ NDBT_Tables::createAllTables(Ndb* pNdb){
...
@@ -848,9 +848,8 @@ NDBT_Tables::createAllTables(Ndb* pNdb){
return
createAllTables
(
pNdb
,
false
);
return
createAllTables
(
pNdb
,
false
);
}
}
static
int
int
create_default_tablespace
(
Ndb
*
pNdb
)
NDBT_Tables
::
create_default_tablespace
(
Ndb
*
pNdb
)
{
{
NdbDictionary
::
Dictionary
*
pDict
=
pNdb
->
getDictionary
();
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