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
e57f55d4
Commit
e57f55d4
authored
Feb 01, 2008
by
jmiller/root@mysql.com/ndbqa01.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NdbRepStress.cpp:
Updated with new support function from Magnus push to dbutil
parent
aa9a3a69
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
51 deletions
+29
-51
storage/ndb/test/ndbapi/acrt/NdbRepStress.cpp
storage/ndb/test/ndbapi/acrt/NdbRepStress.cpp
+29
-51
No files found.
storage/ndb/test/ndbapi/acrt/NdbRepStress.cpp
View file @
e57f55d4
...
...
@@ -58,8 +58,7 @@ syncSlaveWithMaster()
know when the slave has caught up
*/
MYSQL_RES
*
result
;
MYSQL_ROW
row
;
SqlResultSet
result
;
unsigned
int
masterEpoch
=
0
;
unsigned
int
slaveEpoch
=
0
;
unsigned
int
slaveEpochOld
=
0
;
...
...
@@ -76,14 +75,11 @@ syncSlaveWithMaster()
}
//Get max epoch from master
if
(
master
.
doQuery
(
"SELECT MAX(epoch) FROM mysql.ndb_binlog_index"
))
if
(
master
.
doQuery
(
"SELECT MAX(epoch) FROM mysql.ndb_binlog_index"
,
result
))
{
return
NDBT_FAILED
;
}
result
=
mysql_use_result
(
master
.
getMysql
());
row
=
mysql_fetch_row
(
result
);
masterEpoch
=
atoi
(
row
[
0
]);
mysql_free_result
(
result
);
masterEpoch
=
result
.
columnAsInt
(
"epoch"
);
/*
Now we will pull current epoch from slave. If not the
...
...
@@ -103,14 +99,11 @@ syncSlaveWithMaster()
while
(
slaveEpoch
!=
masterEpoch
&&
loopCnt
<
maxLoops
)
{
if
(
slave
.
doQuery
(
"SELECT epoch FROM mysql.ndb_apply_status"
))
if
(
slave
.
doQuery
(
"SELECT epoch FROM mysql.ndb_apply_status"
,
result
))
{
return
NDBT_FAILED
;
}
result
=
mysql_use_result
(
slave
.
getMysql
());
row
=
mysql_fetch_row
(
result
);
slaveEpoch
=
atoi
(
row
[
0
]);
mysql_free_result
(
result
);
slaveEpoch
=
result
.
columnAsInt
(
"epoch"
);
if
(
slaveEpoch
!=
slaveEpochOld
)
{
...
...
@@ -135,17 +128,15 @@ syncSlaveWithMaster()
}
int
verifySlaveLoad
(
BaseString
*
table
)
verifySlaveLoad
(
BaseString
&
table
)
{
BaseString
sqlStm
;
//
BaseString sqlStm;
BaseString
db
;
MYSQL_RES
*
result
;
MYSQL_ROW
row
;
unsigned
int
masterCount
=
0
;
unsigned
int
slaveCount
=
0
;
db
.
assign
(
"TEST_DB"
);
sqlStm
.
assfmt
(
"SELECT COUNT(*) FROM %s"
,
table
);
//
sqlStm.assfmt("SELECT COUNT(*) FROM %s", table);
//First thing to do is sync slave
if
(
syncSlaveWithMaster
())
...
...
@@ -163,14 +154,10 @@ verifySlaveLoad(BaseString *table)
return
NDBT_FAILED
;
}
if
(
master
.
doQuery
(
sqlStm
.
c_str
())
)
if
(
(
masterCount
=
master
.
selectCountTable
(
table
.
c_str
()))
==
0
)
{
return
NDBT_FAILED
;
}
result
=
mysql_use_result
(
master
.
getMysql
());
row
=
mysql_fetch_row
(
result
);
masterCount
=
atoi
(
row
[
0
]);
mysql_free_result
(
result
);
//Create a DB Object for slave
DbUtil
slave
(
db
.
c_str
(),
".slave"
);
...
...
@@ -181,14 +168,10 @@ verifySlaveLoad(BaseString *table)
return
NDBT_FAILED
;
}
if
(
slave
.
doQuery
(
sqlStm
.
c_str
())
)
if
(
(
slaveCount
=
slave
.
selectCountTable
(
table
.
c_str
()))
==
0
)
{
return
NDBT_FAILED
;
}
result
=
mysql_use_result
(
slave
.
getMysql
());
row
=
mysql_fetch_row
(
result
);
slaveCount
=
atoi
(
row
[
0
]);
mysql_free_result
(
result
);
if
(
slaveCount
!=
masterCount
)
{
...
...
@@ -245,10 +228,9 @@ dropTEST_DB(NDBT_Context* ctx, NDBT_Step* step)
}
int
verifySlave
(
BaseString
&
sqlStm
,
BaseString
&
db
)
verifySlave
(
BaseString
&
sqlStm
,
BaseString
&
db
,
BaseString
&
column
)
{
MYSQL_RES
*
resource
;
MYSQL_ROW
row
;
SqlResultSet
result
;
float
masterSum
;
float
slaveSum
;
...
...
@@ -269,14 +251,11 @@ verifySlave(BaseString& sqlStm, BaseString& db)
return
NDBT_FAILED
;
}
if
(
master
.
doQuery
(
sqlStm
.
c_str
())
!=
NDBT_OK
)
if
(
master
.
doQuery
(
sqlStm
.
c_str
()
,
result
)
!=
NDBT_OK
)
{
return
NDBT_FAILED
;
}
resource
=
mysql_use_result
(
master
.
getMysql
());
row
=
mysql_fetch_row
(
resource
);
masterSum
=
atoi
(
row
[
0
]);
mysql_free_result
(
resource
);
masterSum
=
result
.
columnAsInt
(
column
.
c_str
());
//Login to slave
if
(
!
slave
.
connect
())
...
...
@@ -284,14 +263,11 @@ verifySlave(BaseString& sqlStm, BaseString& db)
return
NDBT_FAILED
;
}
if
(
slave
.
doQuery
(
sqlStm
.
c_str
())
!=
NDBT_OK
)
if
(
slave
.
doQuery
(
sqlStm
.
c_str
()
,
result
)
!=
NDBT_OK
)
{
return
NDBT_FAILED
;
}
resource
=
mysql_use_result
(
slave
.
getMysql
());
row
=
mysql_fetch_row
(
resource
);
slaveSum
=
atoi
(
row
[
0
]);
mysql_free_result
(
resource
);
slaveSum
=
result
.
columnAsInt
(
column
.
c_str
());
if
(
masterSum
!=
slaveSum
)
{
...
...
@@ -364,7 +340,7 @@ createTable_rep1(NDBT_Context* ctx, NDBT_Step* step)
return
NDBT_FAILED
;
}
if
(
verifySlaveLoad
(
&
table
)
!=
NDBT_OK
)
if
(
verifySlaveLoad
(
table
)
!=
NDBT_OK
)
{
g_err
<<
"Create Table -> Failed on verify slave load!"
<<
endl
;
...
...
@@ -429,11 +405,13 @@ verifySlave_rep1(NDBT_Context* ctx, NDBT_Step* step)
{
BaseString
sql
;
BaseString
db
;
BaseString
column
;
sql
.
assign
(
"SELECT SUM(c3) FROM rep1"
);
db
.
assign
(
"TEST_DB"
);
column
.
assign
(
"c3"
);
if
(
verifySlave
(
sql
,
db
)
!=
NDBT_OK
)
if
(
verifySlave
(
sql
,
db
,
column
)
!=
NDBT_OK
)
return
NDBT_FAILED
;
return
NDBT_OK
;
}
...
...
@@ -452,7 +430,7 @@ verifySlave_rep1(NDBT_Context* ctx, NDBT_Step* step)
dropTEST_DB()
{Drops TEST_DB database on master}
verifySlave(BaseString& sql, BaseSting& db)
verifySlave(BaseString& sql, BaseSting& db
, BaseSting& column
)
{The SQL statement must sum a column and will verify
that the sum of the column is equal on master & slave}
*/
...
...
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