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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
fc80e0a4
Commit
fc80e0a4
authored
Feb 02, 2005
by
joreland@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge joreland@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/jonas/src/mysql-4.1
parents
ea5c1f32
ebfa5269
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
313 additions
and
14 deletions
+313
-14
mysql-test/mysql-test-run.sh
mysql-test/mysql-test-run.sh
+3
-0
mysql-test/t/ndb_autodiscover.test
mysql-test/t/ndb_autodiscover.test
+5
-5
mysql-test/t/ndb_restore.test
mysql-test/t/ndb_restore.test
+3
-3
ndb/include/ndbapi/NdbConnection.hpp
ndb/include/ndbapi/NdbConnection.hpp
+2
-0
ndb/src/kernel/blocks/dbacc/DbaccMain.cpp
ndb/src/kernel/blocks/dbacc/DbaccMain.cpp
+2
-1
ndb/test/include/NDBT_Test.hpp
ndb/test/include/NDBT_Test.hpp
+3
-1
ndb/test/ndbapi/testOperations.cpp
ndb/test/ndbapi/testOperations.cpp
+283
-0
ndb/test/src/HugoOperations.cpp
ndb/test/src/HugoOperations.cpp
+4
-0
ndb/test/src/NDBT_Test.cpp
ndb/test/src/NDBT_Test.cpp
+8
-4
No files found.
mysql-test/mysql-test-run.sh
View file @
fc80e0a4
...
...
@@ -490,6 +490,7 @@ export MASTER_MYPORT MASTER_MYPORT1 SLAVE_MYPORT MYSQL_TCP_PORT MASTER_MYSOCK MA
NDBCLUSTER_BASE_PORT
=
`
expr
$NDBCLUSTER_PORT
+ 2
`
NDBCLUSTER_OPTS
=
"--port=
$NDBCLUSTER_PORT
--port-base=
$NDBCLUSTER_BASE_PORT
--data-dir=
$MYSQL_TEST_DIR
/var --ndb_mgm-extra-opts=
$NDB_MGM_EXTRA_OPTS
--ndb_mgmd-extra-opts=
$NDB_MGMD_EXTRA_OPTS
--ndbd-extra-opts=
$NDBD_EXTRA_OPTS
"
NDB_BACKUP_DIR
=
$MYSQL_TEST_DIR
/var/ndbcluster-
$NDBCLUSTER_PORT
NDB_TOOLS_OUTPUT
=
$MYSQL_TEST_DIR
/var/log/ndb_tools.log
if
[
x
$SOURCE_DIST
=
x1
]
;
then
MY_BASEDIR
=
$MYSQL_TEST_DIR
...
...
@@ -690,6 +691,7 @@ export CLIENT_BINDIR MYSQL_CLIENT_TEST CHARSETSDIR
export
NDB_TOOLS_DIR
export
NDB_MGM
export
NDB_BACKUP_DIR
export
NDB_TOOLS_OUTPUT
export
PURIFYOPTIONS
MYSQL_TEST_ARGS
=
"--no-defaults --socket=
$MASTER_MYSOCK
--database=
$DB
\
...
...
@@ -1043,6 +1045,7 @@ start_ndbcluster()
{
if
[
!
-z
"
$USE_NDBCLUSTER
"
]
then
rm
-f
$NDB_TOOLS_OUTPUT
if
[
-z
"
$USE_RUNNING_NDBCLUSTER
"
]
then
echo
"Starting ndbcluster"
...
...
mysql-test/t/ndb_autodiscover.test
View file @
fc80e0a4
...
...
@@ -199,7 +199,7 @@ insert into t4 values (1, "Automatic");
select
*
from
t4
;
# Remove the table from NDB
system
exec
$NDB_TOOLS_DIR
/
ndb_drop_table
--
no
-
defaults
-
d
test
t4
>
/
dev
/
null
;
system
exec
$NDB_TOOLS_DIR
/
ndb_drop_table
--
no
-
defaults
-
d
test
t4
>
>
$NDB_TOOLS_OUTPUT
;
#
# Test that correct error is returned
...
...
@@ -230,7 +230,7 @@ select * from t4;
flush
tables
;
# Remove the table from NDB
system
exec
$NDB_TOOLS_DIR
/
ndb_drop_table
--
no
-
defaults
-
d
test
t4
>
/
dev
/
null
;
system
exec
$NDB_TOOLS_DIR
/
ndb_drop_table
--
no
-
defaults
-
d
test
t4
>
>
$NDB_TOOLS_OUTPUT
;
SHOW
TABLES
;
...
...
@@ -264,8 +264,8 @@ insert into t8 values (8, "myisam table 8");
insert
into
t9
values
(
9
);
# Remove t3, t5 from NDB
system
exec
$NDB_TOOLS_DIR
/
ndb_drop_table
--
no
-
defaults
-
d
test
t3
>
/
dev
/
null
;
system
exec
$NDB_TOOLS_DIR
/
ndb_drop_table
--
no
-
defaults
-
d
test
t5
>
/
dev
/
null
;
system
exec
$NDB_TOOLS_DIR
/
ndb_drop_table
--
no
-
defaults
-
d
test
t3
>
>
$NDB_TOOLS_OUTPUT
;
system
exec
$NDB_TOOLS_DIR
/
ndb_drop_table
--
no
-
defaults
-
d
test
t5
>
>
$NDB_TOOLS_OUTPUT
;
# Remove t6, t7 from disk
system
rm
var
/
master
-
data
/
test
/
t6
.
frm
>
/
dev
/
null
;
system
rm
var
/
master
-
data
/
test
/
t7
.
frm
>
/
dev
/
null
;
...
...
@@ -479,4 +479,4 @@ create table t10 (
insert
into
t10
values
(
1
,
'kalle'
);
--
exec
$NDB_TOOLS_DIR
/
ndb_drop_table
--
no
-
defaults
-
d
test
`$NDB_TOOLS_DIR/ndb_show_tables --no-defaults | grep BLOB`
>
/
dev
/
null
2
>&
1
||
true
--
exec
$NDB_TOOLS_DIR
/
ndb_drop_table
--
no
-
defaults
-
d
test
`$NDB_TOOLS_DIR/ndb_show_tables --no-defaults | grep BLOB`
>
>
$NDB_TOOLS_OUTPUT
2
>&
1
||
true
mysql-test/t/ndb_restore.test
View file @
fc80e0a4
...
...
@@ -141,10 +141,10 @@ create table t8_c engine=ndbcluster as select * from t8;
create
table
t9_c
engine
=
ndbcluster
as
select
*
from
t9
;
--
exec
$NDB_MGM
--
no
-
defaults
-
e
"start backup"
>
/
dev
/
null
--
exec
$NDB_MGM
--
no
-
defaults
-
e
"start backup"
>
>
$NDB_TOOLS_OUTPUT
drop
table
t1_c
,
t2_c
,
t3_c
,
t4_c
,
t5_c
,
t6_c
,
t7_c
,
t8_c
,
t9_c
;
--
exec
$NDB_TOOLS_DIR
/
ndb_restore
--
no
-
defaults
-
b
1
-
n
1
-
m
-
r
--
print
--
print_meta
$NDB_BACKUP_DIR
/
BACKUP
/
BACKUP
-
1
>
/
tmp
/
ndb_restore
.
out
--
exec
$NDB_TOOLS_DIR
/
ndb_restore
--
no
-
defaults
-
b
1
-
n
2
-
r
--
print
--
print_meta
$NDB_BACKUP_DIR
/
BACKUP
/
BACKUP
-
1
>
/
tmp
/
ndb_restore
.
out
--
exec
$NDB_TOOLS_DIR
/
ndb_restore
--
no
-
defaults
-
b
1
-
n
1
-
m
-
r
--
print
--
print_meta
$NDB_BACKUP_DIR
/
BACKUP
/
BACKUP
-
1
>
>
$NDB_TOOLS_OUTPUT
--
exec
$NDB_TOOLS_DIR
/
ndb_restore
--
no
-
defaults
-
b
1
-
n
2
-
r
--
print
--
print_meta
$NDB_BACKUP_DIR
/
BACKUP
/
BACKUP
-
1
>
>
$NDB_TOOLS_OUTPUT
show
tables
;
...
...
ndb/include/ndbapi/NdbConnection.hpp
View file @
fc80e0a4
...
...
@@ -687,6 +687,8 @@ private:
void
remove_list
(
NdbOperation
*&
head
,
NdbOperation
*
);
void
define_scan_op
(
NdbIndexScanOperation
*
);
friend
int
runOperations
(
class
NDBT_Context
*
,
class
NDBT_Step
*
);
};
inline
...
...
ndb/src/kernel/blocks/dbacc/DbaccMain.cpp
View file @
fc80e0a4
...
...
@@ -5704,7 +5704,8 @@ void Dbacc::commitOperation(Signal* signal)
Uint32
tmp2Olq
;
if
((
operationRecPtr
.
p
->
commitDeleteCheckFlag
==
ZFALSE
)
&&
(
operationRecPtr
.
p
->
operation
!=
ZSCAN_OP
))
{
(
operationRecPtr
.
p
->
operation
!=
ZSCAN_OP
)
&&
(
operationRecPtr
.
p
->
operation
!=
ZREAD
))
{
jam
();
/* This method is used to check whether the end result of the transaction
will be to delete the tuple. In this case all operation will be marked
...
...
ndb/test/include/NDBT_Test.hpp
View file @
fc80e0a4
...
...
@@ -188,7 +188,7 @@ public:
NDBT_TestCase
(
NDBT_TestSuite
*
psuite
,
const
char
*
name
,
const
char
*
comment
);
virtual
~
NDBT_TestCase
(){}
virtual
~
NDBT_TestCase
()
{}
// This is the default executor of a test case
// When a test case is executed it will need to be suplied with a number of
...
...
@@ -225,6 +225,8 @@ protected:
void
stopTimer
(
NDBT_Context
*
);
void
printTimer
(
NDBT_Context
*
);
BaseString
_name
;
BaseString
_comment
;
const
char
*
name
;
const
char
*
comment
;
NDBT_TestSuite
*
suite
;
...
...
ndb/test/ndbapi/testOperations.cpp
View file @
fc80e0a4
...
...
@@ -98,6 +98,11 @@ OperationTestCase matrix[] = {
result = NDBT_FAILED; \
break; }
#define C3(b) if (!(b)) { \
g_err << "ERR: "<< step->getName() \
<< " failed on line " << __LINE__ << endl; \
abort(); return NDBT_FAILED; }
int
runOp
(
HugoOperations
&
hugoOps
,
Ndb
*
pNdb
,
...
...
@@ -228,11 +233,287 @@ runClearTable(NDBT_Context* ctx, NDBT_Step* step){
return
NDBT_OK
;
}
enum
OPS
{
o_DONE
=
0
,
o_INS
=
1
,
o_UPD
=
2
,
o_DEL
=
3
};
typedef
Vector
<
OPS
>
Sequence
;
static
bool
valid
(
const
Sequence
&
s
)
{
if
(
s
.
size
()
==
0
)
return
false
;
for
(
size_t
i
=
1
;
i
<
s
.
size
();
i
++
)
{
switch
(
s
[
i
]){
case
o_INS
:
if
(
s
[
i
-
1
]
!=
o_DEL
)
return
false
;
break
;
case
o_UPD
:
case
o_DEL
:
if
(
s
[
i
-
1
]
==
o_DEL
)
return
false
;
break
;
case
o_DONE
:
return
true
;
}
}
return
true
;
}
static
NdbOut
&
operator
<<
(
NdbOut
&
out
,
const
Sequence
&
s
)
{
out
<<
"[ "
;
for
(
size_t
i
=
0
;
i
<
s
.
size
();
i
++
)
{
switch
(
s
[
i
]){
case
o_INS
:
out
<<
"INS "
;
break
;
case
o_DEL
:
out
<<
"DEL "
;
break
;
case
o_UPD
:
out
<<
"UPD "
;
break
;
case
o_DONE
:
abort
();
}
}
out
<<
"]"
;
return
out
;
}
static
void
generate
(
Sequence
&
out
,
int
no
)
{
while
(
no
&
3
)
{
out
.
push_back
((
OPS
)(
no
&
3
));
no
>>=
2
;
}
}
static
void
generate
(
Vector
<
int
>&
out
,
size_t
len
)
{
int
max
=
1
;
while
(
len
)
{
max
<<=
2
;
len
--
;
}
len
=
1
;
for
(
int
i
=
0
;
i
<
max
;
i
++
)
{
Sequence
tmp
;
generate
(
tmp
,
i
);
if
(
tmp
.
size
()
>=
len
&&
valid
(
tmp
))
{
out
.
push_back
(
i
);
len
=
tmp
.
size
();
}
else
{
//ndbout << "DISCARD: " << tmp << endl;
}
}
}
int
runOperations
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
)
{
const
Uint32
DUMMY
=
0
;
const
Uint32
ROW
=
1
;
int
tmp
;
Ndb
*
pNdb
=
GETNDB
(
step
);
Uint32
seqNo
=
ctx
->
getProperty
(
"Sequence"
,
(
Uint32
)
0
);
Uint32
no_wait
=
NdbOperation
::
LM_CommittedRead
*
ctx
->
getProperty
(
"NoWait"
,
(
Uint32
)
1
);
if
(
seqNo
==
0
)
{
return
NDBT_FAILED
;
}
Sequence
seq
;
generate
(
seq
,
seqNo
);
{
// Dummy row
HugoOperations
hugoOps
(
*
ctx
->
getTab
());
C3
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
C3
(
hugoOps
.
pkInsertRecord
(
pNdb
,
DUMMY
,
1
,
0
)
==
0
);
C3
(
hugoOps
.
execute_Commit
(
pNdb
)
==
0
);
}
const
bool
inital_row
=
(
seq
[
0
]
!=
o_INS
);
if
(
inital_row
)
{
HugoOperations
hugoOps
(
*
ctx
->
getTab
());
C3
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
C3
(
hugoOps
.
pkInsertRecord
(
pNdb
,
ROW
,
1
,
0
)
==
0
);
C3
(
hugoOps
.
execute_Commit
(
pNdb
)
==
0
);
}
HugoOperations
trans1
(
*
ctx
->
getTab
());
C3
(
trans1
.
startTransaction
(
pNdb
)
==
0
);
for
(
size_t
i
=
0
;
i
<
seq
.
size
();
i
++
)
{
/**
* Perform operation
*/
switch
(
seq
[
i
]){
case
o_INS
:
C3
(
trans1
.
pkInsertRecord
(
pNdb
,
ROW
,
1
,
i
+
1
)
==
0
);
break
;
case
o_UPD
:
C3
(
trans1
.
pkUpdateRecord
(
pNdb
,
ROW
,
1
,
i
+
1
)
==
0
);
break
;
case
o_DEL
:
C3
(
trans1
.
pkDeleteRecord
(
pNdb
,
ROW
,
1
)
==
0
);
break
;
case
o_DONE
:
abort
();
}
C3
(
trans1
.
execute_NoCommit
(
pNdb
)
==
0
);
/**
* Verify other transaction
*/
for
(
size_t
j
=
no_wait
;
j
<
3
;
j
++
)
{
HugoOperations
other
(
*
ctx
->
getTab
());
C3
(
other
.
startTransaction
(
pNdb
)
==
0
);
C3
(
other
.
pkReadRecord
(
pNdb
,
ROW
,
1
,
(
NdbOperation
::
LockMode
)
j
)
==
0
);
tmp
=
other
.
execute_Commit
(
pNdb
);
if
(
j
==
NdbOperation
::
LM_CommittedRead
)
{
C3
(
inital_row
?
tmp
==
0
&&
other
.
verifyUpdatesValue
(
0
)
==
0
:
tmp
==
626
);
}
else
{
C3
(
tmp
==
266
);
}
}
/**
* Verify savepoint read
*/
Uint64
transactionId
=
trans1
.
getTransaction
()
->
getTransactionId
();
for
(
size_t
k
=
0
;
k
<=
i
+
1
;
k
++
)
{
for
(
size_t
j
=
0
;
j
<
3
;
j
++
)
{
const
NdbOperation
::
LockMode
lm
=
(
NdbOperation
::
LockMode
)
j
;
HugoOperations
same
(
*
ctx
->
getTab
());
C3
(
same
.
startTransaction
(
pNdb
)
==
0
);
same
.
getTransaction
()
->
setTransactionId
(
transactionId
);
// Cheat
/**
* Increase savepoint to <em>k</em>
*/
for
(
size_t
l
=
1
;
l
<=
k
;
l
++
)
{
C3
(
same
.
pkReadRecord
(
pNdb
,
DUMMY
,
1
,
lm
)
==
0
);
// Read dummy row
C3
(
same
.
execute_NoCommit
(
pNdb
)
==
0
);
g_info
<<
"savepoint: "
<<
l
<<
endl
;
}
g_info
<<
"op("
<<
k
<<
", "
<<
i
<<
"): "
<<
" lock mode "
<<
lm
<<
endl
;
C3
(
same
.
pkReadRecord
(
pNdb
,
ROW
,
1
,
lm
)
==
0
);
// Read real row
tmp
=
same
.
execute_Commit
(
pNdb
);
if
(
k
==
0
)
{
if
(
inital_row
)
{
C3
(
tmp
==
0
&&
same
.
verifyUpdatesValue
(
0
)
==
0
);
}
else
{
C3
(
tmp
==
626
);
}
}
else
{
switch
(
seq
[
k
-
1
]){
case
o_INS
:
case
o_UPD
:
C3
(
tmp
==
0
&&
same
.
verifyUpdatesValue
(
k
)
==
0
);
break
;
case
o_DEL
:
C3
(
tmp
==
626
);
break
;
case
o_DONE
:
abort
();
}
}
}
}
}
C3
(
trans1
.
execute_Commit
(
pNdb
)
==
0
);
return
NDBT_OK
;
}
int
main
(
int
argc
,
const
char
**
argv
){
ndb_init
();
Vector
<
int
>
tmp
;
generate
(
tmp
,
5
);
NDBT_TestSuite
ts
(
"testOperations"
);
for
(
size_t
i
=
0
;
i
<
tmp
.
size
();
i
++
)
{
BaseString
name
;
Sequence
s
;
generate
(
s
,
tmp
[
i
]);
for
(
size_t
j
=
0
;
j
<
s
.
size
();
j
++
){
switch
(
s
[
j
]){
case
o_INS
:
name
.
append
(
"_INS"
);
break
;
case
o_DEL
:
name
.
append
(
"_DEL"
);
break
;
case
o_UPD
:
name
.
append
(
"_UPD"
);
break
;
case
o_DONE
:
abort
();
}
}
NDBT_TestCaseImpl1
*
pt
=
new
NDBT_TestCaseImpl1
(
&
ts
,
name
.
c_str
()
+
1
,
""
);
pt
->
setProperty
(
"Sequence"
,
tmp
[
i
]);
pt
->
addInitializer
(
new
NDBT_Initializer
(
pt
,
"runClearTable"
,
runClearTable
));
pt
->
addStep
(
new
NDBT_ParallelStep
(
pt
,
name
.
c_str
()
+
1
,
runOperations
));
pt
->
addFinalizer
(
new
NDBT_Finalizer
(
pt
,
"runClearTable"
,
runClearTable
));
ts
.
addTest
(
pt
);
}
for
(
Uint32
i
=
0
;
i
<
sizeof
(
matrix
)
/
sizeof
(
matrix
[
0
]);
i
++
){
NDBT_TestCaseImpl1
*
pt
=
new
NDBT_TestCaseImpl1
(
&
ts
,
matrix
[
i
].
name
,
""
);
...
...
@@ -270,3 +551,5 @@ main(int argc, const char** argv){
return
ts
.
execute
(
argc
,
argv
);
}
template
class
Vector
<
OPS
>;
template
class
Vector
<
Sequence
>;
ndb/test/src/HugoOperations.cpp
View file @
fc80e0a4
...
...
@@ -401,6 +401,10 @@ HugoOperations::HugoOperations(const NdbDictionary::Table& _tab):
HugoOperations
::~
HugoOperations
(){
deallocRows
();
if
(
pTrans
!=
NULL
){
pTrans
->
close
();
pTrans
=
NULL
;
}
}
...
...
ndb/test/src/NDBT_Test.cpp
View file @
fc80e0a4
...
...
@@ -327,13 +327,17 @@ NDBT_Finalizer::NDBT_Finalizer(NDBT_TestCase* ptest,
NDBT_TestCase
::
NDBT_TestCase
(
NDBT_TestSuite
*
psuite
,
const
char
*
pname
,
const
char
*
pcomment
)
:
name
(
pname
)
,
comment
(
pcomment
),
suite
(
psuite
){
name
(
strdup
(
pname
))
,
comment
(
strdup
(
pcomment
)),
suite
(
psuite
)
{
_name
.
assign
(
pname
);
_comment
.
assign
(
pcomment
);
name
=
_name
.
c_str
();
comment
=
_comment
.
c_str
();
assert
(
suite
!=
NULL
);
}
NDBT_TestCaseImpl1
::
NDBT_TestCaseImpl1
(
NDBT_TestSuite
*
psuite
,
const
char
*
pname
,
const
char
*
pcomment
)
:
...
...
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