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
0ecfc4ce
Commit
0ecfc4ce
authored
Sep 15, 2004
by
tomas@poseidon.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge tulin@bk-internal.mysql.com:/home/bk/mysql-4.1-ndb
into poseidon.(none):/home/tomas/mysql-4.1-ndb
parents
27a4e6e2
d5627f53
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
102 additions
and
96 deletions
+102
-96
ndb/src/kernel/blocks/backup/restore/main.cpp
ndb/src/kernel/blocks/backup/restore/main.cpp
+2
-2
ndb/test/ndbapi/bank/Bank.cpp
ndb/test/ndbapi/bank/Bank.cpp
+52
-53
ndb/test/ndbapi/bank/Bank.hpp
ndb/test/ndbapi/bank/Bank.hpp
+4
-1
ndb/test/ndbapi/bank/BankLoad.cpp
ndb/test/ndbapi/bank/BankLoad.cpp
+2
-2
ndb/test/ndbapi/testBackup.cpp
ndb/test/ndbapi/testBackup.cpp
+10
-1
ndb/test/run-test/daily-basic-tests.txt
ndb/test/run-test/daily-basic-tests.txt
+15
-0
ndb/test/run-test/daily-devel-tests.txt
ndb/test/run-test/daily-devel-tests.txt
+4
-19
ndb/test/src/NdbBackup.cpp
ndb/test/src/NdbBackup.cpp
+13
-18
No files found.
ndb/src/kernel/blocks/backup/restore/main.cpp
View file @
0ecfc4ce
...
@@ -357,7 +357,7 @@ main(int argc, const char** argv)
...
@@ -357,7 +357,7 @@ main(int argc, const char** argv)
}
}
}
}
clearConsumers
();
clearConsumers
();
return
1
;
return
0
;
}
// main
}
// main
template
class
Vector
<
BackupConsumer
*
>;
template
class
Vector
<
BackupConsumer
*
>;
ndb/test/ndbapi/bank/Bank.cpp
View file @
0ecfc4ce
...
@@ -156,7 +156,14 @@ int Bank::performTransactionImpl1(int fromAccountId,
...
@@ -156,7 +156,14 @@ int Bank::performTransactionImpl1(int fromAccountId,
int
check
;
int
check
;
// Ok, all clear to do the transaction
Uint64
transId
;
if
(
getNextTransactionId
(
transId
)
!=
NDBT_OK
){
return
NDBT_FAILED
;
}
NdbConnection
*
pTrans
=
m_ndb
.
startTransaction
();
NdbConnection
*
pTrans
=
m_ndb
.
startTransaction
();
if
(
pTrans
==
NULL
)
{
if
(
pTrans
==
NULL
)
{
const
NdbError
err
=
m_ndb
.
getNdbError
();
const
NdbError
err
=
m_ndb
.
getNdbError
();
if
(
err
.
status
==
NdbError
::
TemporaryError
){
if
(
err
.
status
==
NdbError
::
TemporaryError
){
...
@@ -167,6 +174,13 @@ int Bank::performTransactionImpl1(int fromAccountId,
...
@@ -167,6 +174,13 @@ int Bank::performTransactionImpl1(int fromAccountId,
return
NDBT_FAILED
;
return
NDBT_FAILED
;
}
}
Uint64
currTime
;
if
(
prepareGetCurrTimeOp
(
pTrans
,
currTime
)
!=
NDBT_OK
){
ERR
(
pTrans
->
getNdbError
());
m_ndb
.
closeTransaction
(
pTrans
);
return
NDBT_FAILED
;
}
/**
/**
* Check balance on from account
* Check balance on from account
*/
*/
...
@@ -205,29 +219,6 @@ int Bank::performTransactionImpl1(int fromAccountId,
...
@@ -205,29 +219,6 @@ int Bank::performTransactionImpl1(int fromAccountId,
return
NDBT_FAILED
;
return
NDBT_FAILED
;
}
}
check
=
pTrans
->
execute
(
NoCommit
);
if
(
check
==
-
1
)
{
const
NdbError
err
=
pTrans
->
getNdbError
();
m_ndb
.
closeTransaction
(
pTrans
);
if
(
err
.
status
==
NdbError
::
TemporaryError
){
ERR
(
err
);
return
NDBT_TEMPORARY
;
}
ERR
(
err
);
return
NDBT_FAILED
;
}
Uint32
balanceFrom
=
balanceFromRec
->
u_32_value
();
// ndbout << "balanceFrom: " << balanceFrom << endl;
if
(((
Int64
)
balanceFrom
-
amount
)
<
0
){
m_ndb
.
closeTransaction
(
pTrans
);
//ndbout << "Not enough funds" << endl;
return
NOT_ENOUGH_FUNDS
;
}
Uint32
fromAccountType
=
fromAccountTypeRec
->
u_32_value
();
/**
/**
* Read balance on to account
* Read balance on to account
*/
*/
...
@@ -278,21 +269,22 @@ int Bank::performTransactionImpl1(int fromAccountId,
...
@@ -278,21 +269,22 @@ int Bank::performTransactionImpl1(int fromAccountId,
return
NDBT_FAILED
;
return
NDBT_FAILED
;
}
}
Uint32
balanceTo
=
balanceToRec
->
u_32_value
();
// ndbout << "balanceTo: " << balanceTo << endl;
Uint32
toAccountType
=
toAccountTypeRec
->
u_32_value
();
// Ok, all clear to do the transaction
Uint32
balanceFrom
=
balanceFromRec
->
u_32_value
();
Uint64
transId
;
// ndbout << "balanceFrom: " << balanceFrom << endl;
if
(
getNextTransactionId
(
transId
)
!=
NDBT_OK
){
return
NDBT_FAILED
;
}
Uint64
currTime
;
if
(((
Int64
)
balanceFrom
-
amount
)
<
0
){
if
(
getCurrTime
(
currTime
)
!=
NDBT_OK
){
m_ndb
.
closeTransaction
(
pTrans
);
return
NDBT_FAILED
;
//ndbout << "Not enough funds" << endl;
return
NOT_ENOUGH_FUNDS
;
}
}
Uint32
fromAccountType
=
fromAccountTypeRec
->
u_32_value
();
Uint32
balanceTo
=
balanceToRec
->
u_32_value
();
// ndbout << "balanceTo: " << balanceTo << endl;
Uint32
toAccountType
=
toAccountTypeRec
->
u_32_value
();
/**
/**
* Update balance on from account
* Update balance on from account
*/
*/
...
@@ -1989,46 +1981,49 @@ int Bank::readSystemValue(SystemValueId sysValId, Uint64 & value){
...
@@ -1989,46 +1981,49 @@ int Bank::readSystemValue(SystemValueId sysValId, Uint64 & value){
return
NDBT_FAILED
;
return
NDBT_FAILED
;
}
}
NdbOperation
*
pOp
=
pTrans
->
getNdbOperation
(
"SYSTEM_VALUES"
);
if
(
prepareReadSystemValueOp
(
pTrans
,
sysValId
,
value
)
!=
NDBT_OK
)
{
if
(
pOp
==
NULL
)
{
ERR
(
pTrans
->
getNdbError
());
ERR
(
pTrans
->
getNdbError
());
m_ndb
.
closeTransaction
(
pTrans
);
m_ndb
.
closeTransaction
(
pTrans
);
return
NDBT_FAILED
;
return
NDBT_FAILED
;
}
}
check
=
p
Op
->
readTuple
(
);
check
=
p
Trans
->
execute
(
Commit
);
if
(
check
==
-
1
)
{
if
(
check
==
-
1
)
{
ERR
(
pTrans
->
getNdbError
());
ERR
(
pTrans
->
getNdbError
());
m_ndb
.
closeTransaction
(
pTrans
);
m_ndb
.
closeTransaction
(
pTrans
);
return
NDBT_FAILED
;
return
NDBT_FAILED
;
}
}
check
=
pOp
->
equal
(
"SYSTEM_VALUES_ID"
,
sysValId
);
if
(
check
==
-
1
)
{
ERR
(
pTrans
->
getNdbError
());
m_ndb
.
closeTransaction
(
pTrans
);
m_ndb
.
closeTransaction
(
pTrans
);
return
NDBT_OK
;
}
int
Bank
::
prepareReadSystemValueOp
(
NdbConnection
*
pTrans
,
SystemValueId
sysValId
,
Uint64
&
value
){
int
check
;
NdbOperation
*
pOp
=
pTrans
->
getNdbOperation
(
"SYSTEM_VALUES"
);
if
(
pOp
==
NULL
)
{
return
NDBT_FAILED
;
return
NDBT_FAILED
;
}
}
NdbRecAttr
*
valueRec
=
pOp
->
getValue
(
"VALUE"
);
check
=
pOp
->
readTuple
();
if
(
valueRec
==
NULL
)
{
if
(
check
==
-
1
)
{
ERR
(
pTrans
->
getNdbError
());
m_ndb
.
closeTransaction
(
pTrans
);
return
NDBT_FAILED
;
return
NDBT_FAILED
;
}
}
check
=
p
Trans
->
execute
(
Commit
);
check
=
p
Op
->
equal
(
"SYSTEM_VALUES_ID"
,
sysValId
);
if
(
check
==
-
1
)
{
if
(
check
==
-
1
)
{
ERR
(
pTrans
->
getNdbError
());
m_ndb
.
closeTransaction
(
pTrans
);
return
NDBT_FAILED
;
return
NDBT_FAILED
;
}
}
value
=
valueRec
->
u_64_value
();
NdbRecAttr
*
valueRec
=
pOp
->
getValue
(
"VALUE"
,
(
char
*
)
&
value
);
if
(
valueRec
==
NULL
)
{
return
NDBT_FAILED
;
}
m_ndb
.
closeTransaction
(
pTrans
);
return
NDBT_OK
;
return
NDBT_OK
;
}
}
int
Bank
::
writeSystemValue
(
SystemValueId
sysValId
,
Uint64
value
){
int
Bank
::
writeSystemValue
(
SystemValueId
sysValId
,
Uint64
value
){
...
@@ -2307,6 +2302,10 @@ int Bank::getCurrTime(Uint64 &time){
...
@@ -2307,6 +2302,10 @@ int Bank::getCurrTime(Uint64 &time){
return
readSystemValue
(
CurrentTime
,
time
);
return
readSystemValue
(
CurrentTime
,
time
);
}
}
int
Bank
::
prepareGetCurrTimeOp
(
NdbConnection
*
pTrans
,
Uint64
&
time
){
return
prepareReadSystemValueOp
(
pTrans
,
CurrentTime
,
time
);
}
int
Bank
::
performSumAccounts
(
int
maxSleepBetweenSums
,
int
yield
){
int
Bank
::
performSumAccounts
(
int
maxSleepBetweenSums
,
int
yield
){
if
(
init
()
!=
NDBT_OK
)
if
(
init
()
!=
NDBT_OK
)
...
...
ndb/test/ndbapi/bank/Bank.hpp
View file @
0ecfc4ce
...
@@ -29,7 +29,7 @@ public:
...
@@ -29,7 +29,7 @@ public:
Bank
();
Bank
();
int
createAndLoadBank
(
bool
overWrite
);
int
createAndLoadBank
(
bool
overWrite
,
int
num_accounts
=
10
);
int
dropBank
();
int
dropBank
();
int
performTransactions
(
int
maxSleepBetweenTrans
=
20
,
int
yield
=
0
);
int
performTransactions
(
int
maxSleepBetweenTrans
=
20
,
int
yield
=
0
);
...
@@ -118,6 +118,9 @@ private:
...
@@ -118,6 +118,9 @@ private:
int
incCurrTime
(
Uint64
&
value
);
int
incCurrTime
(
Uint64
&
value
);
int
getCurrTime
(
Uint64
&
time
);
int
getCurrTime
(
Uint64
&
time
);
int
prepareReadSystemValueOp
(
NdbConnection
*
,
SystemValueId
sysValId
,
Uint64
&
time
);
int
prepareGetCurrTimeOp
(
NdbConnection
*
,
Uint64
&
time
);
int
createTables
();
int
createTables
();
int
createTable
(
const
char
*
tabName
);
int
createTable
(
const
char
*
tabName
);
...
...
ndb/test/ndbapi/bank/BankLoad.cpp
View file @
0ecfc4ce
...
@@ -53,7 +53,7 @@ int Bank::getNumAccountTypes(){
...
@@ -53,7 +53,7 @@ int Bank::getNumAccountTypes(){
return
accountTypesSize
;
return
accountTypesSize
;
}
}
int
Bank
::
createAndLoadBank
(
bool
ovrWrt
){
int
Bank
::
createAndLoadBank
(
bool
ovrWrt
,
int
num_accounts
){
m_ndb
.
init
();
m_ndb
.
init
();
if
(
m_ndb
.
waitUntilReady
()
!=
0
)
if
(
m_ndb
.
waitUntilReady
()
!=
0
)
...
@@ -78,7 +78,7 @@ int Bank::createAndLoadBank(bool ovrWrt){
...
@@ -78,7 +78,7 @@ int Bank::createAndLoadBank(bool ovrWrt){
if
(
loadAccountType
()
!=
NDBT_OK
)
if
(
loadAccountType
()
!=
NDBT_OK
)
return
NDBT_FAILED
;
return
NDBT_FAILED
;
if
(
loadAccount
(
10
)
!=
NDBT_OK
)
if
(
loadAccount
(
num_accounts
)
!=
NDBT_OK
)
return
NDBT_FAILED
;
return
NDBT_FAILED
;
if
(
loadSystemValues
()
!=
NDBT_OK
)
if
(
loadSystemValues
()
!=
NDBT_OK
)
...
...
ndb/test/ndbapi/testBackup.cpp
View file @
0ecfc4ce
...
@@ -215,7 +215,7 @@ int runDropTable(NDBT_Context* ctx, NDBT_Step* step){
...
@@ -215,7 +215,7 @@ int runDropTable(NDBT_Context* ctx, NDBT_Step* step){
int
runCreateBank
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
){
int
runCreateBank
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
){
Bank
bank
;
Bank
bank
;
int
overWriteExisting
=
true
;
int
overWriteExisting
=
true
;
if
(
bank
.
createAndLoadBank
(
overWriteExisting
)
!=
NDBT_OK
)
if
(
bank
.
createAndLoadBank
(
overWriteExisting
,
10
)
!=
NDBT_OK
)
return
NDBT_FAILED
;
return
NDBT_FAILED
;
return
NDBT_OK
;
return
NDBT_OK
;
}
}
...
@@ -428,6 +428,15 @@ TESTCASE("BackupBank",
...
@@ -428,6 +428,15 @@ TESTCASE("BackupBank",
INITIALIZER
(
runCreateBank
);
INITIALIZER
(
runCreateBank
);
STEP
(
runBankTimer
);
STEP
(
runBankTimer
);
STEP
(
runBankTransactions
);
STEP
(
runBankTransactions
);
STEP
(
runBankTransactions
);
STEP
(
runBankTransactions
);
STEP
(
runBankTransactions
);
STEP
(
runBankTransactions
);
STEP
(
runBankTransactions
);
STEP
(
runBankTransactions
);
STEP
(
runBankTransactions
);
STEP
(
runBankTransactions
);
STEP
(
runBankTransactions
);
STEP
(
runBankGL
);
STEP
(
runBankGL
);
// TODO STEP(runBankSum);
// TODO STEP(runBankSum);
STEP
(
runBackupBank
);
STEP
(
runBackupBank
);
...
...
ndb/test/run-test/daily-basic-tests.txt
View file @
0ecfc4ce
...
@@ -1006,3 +1006,18 @@ max-time: 1500
...
@@ -1006,3 +1006,18 @@ max-time: 1500
cmd: testSystemRestart
cmd: testSystemRestart
args: -n SR2 T7
args: -n SR2 T7
max-time: 1500
cmd: testSystemRestart
args: -n SR_UNDO T1
max-time: 1500
cmd: testSystemRestart
args: -n SR_UNDO T6
max-time: 1500
cmd: testSystemRestart
args: -n SR_UNDO T7
max-time: 1500
cmd: testSystemRestart
args: -n SR_UNDO T8
ndb/test/run-test/daily-devel-tests.txt
View file @
0ecfc4ce
...
@@ -26,10 +26,10 @@ max-time: 600
...
@@ -26,10 +26,10 @@ max-time: 600
cmd: atrt-testBackup
cmd: atrt-testBackup
args: -n BackupOne T1 T6 T3 I3
args: -n BackupOne T1 T6 T3 I3
#max-time: 6
00
max-time: 10
00
#
cmd: testBackup
cmd: testBackup
#
args: -n BackupBank T6
args: -n BackupBank T6
#
#
#
# MGMAPI AND MGSRV
# MGMAPI AND MGSRV
#
#
...
@@ -41,21 +41,6 @@ args: -n SingleUserMode T1
...
@@ -41,21 +41,6 @@ args: -n SingleUserMode T1
#
#
# SYSTEM RESTARTS
# SYSTEM RESTARTS
#
#
max-time: 1500
cmd: testSystemRestart
args: -n SR_UNDO T1
max-time: 1500
cmd: testSystemRestart
args: -n SR_UNDO T6
max-time: 1500
cmd: testSystemRestart
args: -n SR_UNDO T7
max-time: 1500
cmd: testSystemRestart
args: -n SR_UNDO T8
max-time: 1500
max-time: 1500
cmd: testSystemRestart
cmd: testSystemRestart
...
...
ndb/test/src/NdbBackup.cpp
View file @
0ecfc4ce
...
@@ -140,14 +140,16 @@ NdbBackup::execRestore(bool _restore_data,
...
@@ -140,14 +140,16 @@ NdbBackup::execRestore(bool _restore_data,
*/
*/
snprintf
(
buf
,
buf_len
,
snprintf
(
buf
,
buf_len
,
"scp %s:%s/BACKUP/BACKUP-%d/* ."
,
"scp %s:%s/BACKUP/BACKUP-%d/
BACKUP-%d*.%d.
* ."
,
host
,
path
,
host
,
path
,
_backup_id
);
_backup_id
,
_backup_id
,
_node_id
);
ndbout
<<
"buf: "
<<
buf
<<
endl
;
ndbout
<<
"buf: "
<<
buf
<<
endl
;
int
res
=
system
(
buf
);
int
res
=
system
(
buf
);
ndbout
<<
"res: "
<<
res
<<
endl
;
ndbout
<<
"
scp
res: "
<<
res
<<
endl
;
snprintf
(
buf
,
255
,
"%sndb_restore -c
\"
host=%s
\"
-n %d -b %d %s %s ."
,
snprintf
(
buf
,
255
,
"%sndb_restore -c
\"
host=%s
\"
-n %d -b %d %s %s ."
,
#if 1
#if 1
...
@@ -164,7 +166,7 @@ NdbBackup::execRestore(bool _restore_data,
...
@@ -164,7 +166,7 @@ NdbBackup::execRestore(bool _restore_data,
ndbout
<<
"buf: "
<<
buf
<<
endl
;
ndbout
<<
"buf: "
<<
buf
<<
endl
;
res
=
system
(
buf
);
res
=
system
(
buf
);
ndbout
<<
"res: "
<<
res
<<
endl
;
ndbout
<<
"
ndb_restore
res: "
<<
res
<<
endl
;
return
res
;
return
res
;
...
@@ -180,21 +182,14 @@ NdbBackup::restore(unsigned _backup_id){
...
@@ -180,21 +182,14 @@ NdbBackup::restore(unsigned _backup_id){
return
-
1
;
return
-
1
;
int
res
;
int
res
;
if
(
ndbNodes
.
size
()
==
1
)
{
// restore metadata and data in one call
res
=
execRestore
(
true
,
true
,
ndbNodes
[
0
].
node_id
,
_backup_id
);
}
else
{
assert
(
ndbNodes
.
size
()
>
1
);
// restore metadata first
res
=
execRestore
(
false
,
true
,
ndbNodes
[
0
].
node_id
,
_backup_id
);
// restore metadata first and data for first node
res
=
execRestore
(
true
,
true
,
ndbNodes
[
0
].
node_id
,
_backup_id
);
// Restore data once for each node
// Restore data once for each node
for
(
size_t
i
=
0
;
i
<
ndbNodes
.
size
();
i
++
){
for
(
size_t
i
=
1
;
i
<
ndbNodes
.
size
();
i
++
){
res
=
execRestore
(
true
,
false
,
ndbNodes
[
i
].
node_id
,
_backup_id
);
res
=
execRestore
(
true
,
false
,
ndbNodes
[
i
].
node_id
,
_backup_id
);
}
}
}
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