Skip to content

Commit e0a1b45

Browse files
Mikael RonströmHery Ramilison
authored andcommitted
BUG#27625172 Step 4
------------------- To enable this test to run in autotest it is necessary to set TimeBetweenGlobalCheckpoints to 200 while running the test. Also ensured that the ERROR injection wasn't cleared and decreased the amount of rows updated per loop. Finally increased the number of loops to ensure we reach a critical state. (cherry picked from commit 7f235b0ae90a84fc5ebdfaf481a1145e6ec5536d)
1 parent 56f78c3 commit e0a1b45

File tree

2 files changed

+64
-48
lines changed

2 files changed

+64
-48
lines changed

storage/ndb/src/kernel/blocks/backup/Backup.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12393,6 +12393,7 @@ Backup::calculate_number_of_parts(BackupRecordPtr ptr)
1239312393
* 2048 LCPs to restore a LCP.
1239412394
*/
1239512395
jam();
12396+
g_eventLogger->info("Set to 1 part by ERROR 10048 injection");
1239612397
parts = 1;
1239712398
}
1239812399
#ifdef DEBUG_LCP_STAT
@@ -14166,11 +14167,6 @@ Backup::execEND_LCPREQ(Signal* signal)
1416614167
ptr.p->slaveState.setState(DEFINING);
1416714168
ptr.p->slaveState.setState(DEFINED);
1416814169

14169-
if (ERROR_INSERTED(10048))
14170-
{
14171-
CLEAR_ERROR_INSERT_VALUE;
14172-
}
14173-
1417414170
DEB_LCP(("(%u)TAGE Send SYNC_EXTENT_PAGES_REQ", instance()));
1417514171
/**
1417614172
* As part of ending the LCP we need to ensure that the extent pages

storage/ndb/test/ndbapi/testNodeRestart.cpp

Lines changed: 63 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -8738,18 +8738,34 @@ int runTestStartNode(NDBT_Context* ctx, NDBT_Step* step){
87388738
int run_PLCP_many_parts(NDBT_Context *ctx, NDBT_Step *step)
87398739
{
87408740
Ndb *pNdb = GETNDB(step);
8741-
int loops = 2108;
8742-
int result = NDBT_OK;
8741+
int loops = 2800;
87438742
int records = ctx->getNumRecords();
87448743
HugoTransactions hugoTrans(*ctx->getTab());
87458744
NdbRestarter restarter;
8746-
int i = 0;
87478745
const Uint32 nodeCount = restarter.getNumDbNodes();
87488746
int nodeId = 2;
87498747
HugoOperations hugoOps(*ctx->getTab());
8750-
if (nodeCount < 2)
8748+
NdbMgmd mgmd;
8749+
if (nodeCount != 2)
87518750
{
8752-
return NDBT_OK; /* Requires at least 2 nodes to run */
8751+
return NDBT_OK; /* Requires exact 2 nodes to run */
8752+
}
8753+
if (!mgmd.connect())
8754+
{
8755+
g_err << "Failed to connect to ndb_mgmd." << endl;
8756+
return NDBT_FAILED;
8757+
}
8758+
if (setConfigValueAndRestartNode(&mgmd, CFG_DB_GCP_INTERVAL,
8759+
200, 1, &restarter) == NDBT_FAILED)
8760+
{
8761+
g_err << "Failed to set TimeBetweenGlobalCheckpoints to 200" << endl;
8762+
return NDBT_FAILED;
8763+
}
8764+
if (setConfigValueAndRestartNode(&mgmd, CFG_DB_GCP_INTERVAL,
8765+
200, 2, &restarter) == NDBT_FAILED)
8766+
{
8767+
g_err << "Failed to set TimeBetweenGlobalCheckpoints to 200" << endl;
8768+
return NDBT_FAILED;
87538769
}
87548770
if (hugoTrans.loadTable(pNdb, records) != NDBT_OK)
87558771
{
@@ -8758,16 +8774,18 @@ int run_PLCP_many_parts(NDBT_Context *ctx, NDBT_Step *step)
87588774
}
87598775

87608776
g_err << "Executing " << loops << " loops" << endl;
8761-
while(++i <= loops && result != NDBT_FAILED)
8777+
if (restarter.insertErrorInNode(nodeId, 10048) != 0)
8778+
{
8779+
g_err << "ERROR: Error insert 10048 failed" << endl;
8780+
return NDBT_FAILED;
8781+
}
8782+
int i = 0;
8783+
int result = NDBT_OK;
8784+
while (++i <= loops && result != NDBT_FAILED)
87628785
{
87638786
g_err << "Start loop " << i << endl;
87648787
ndbout << "Start an LCP" << endl;
87658788
{
8766-
if (restarter.insertErrorInNode(nodeId, 10048) != 0)
8767-
{
8768-
g_err << "ERROR: Error insert 10048 failed" << endl;
8769-
return NDBT_FAILED;
8770-
}
87718789
int val = DumpStateOrd::DihStartLcpImmediately;
87728790
if(restarter.dumpStateAllNodes(&val, 1) != 0)
87738791
{
@@ -8776,42 +8794,31 @@ int run_PLCP_many_parts(NDBT_Context *ctx, NDBT_Step *step)
87768794
return NDBT_FAILED;
87778795
}
87788796
}
8779-
bool skip = false;
8780-
if ((i % 50) == 0)
8781-
{
8782-
skip = true;
8783-
}
8784-
Uint32 batch = 4;
8797+
Uint32 batch = 8;
87858798
Uint32 row;
8786-
if (!skip)
8787-
{
8788-
row = rand() % records;
8789-
if(row + batch > (Uint32)records)
8790-
batch = records - row;
8799+
row = rand() % records;
8800+
if(row + batch > (Uint32)records)
8801+
row = records - batch;
87918802

8792-
if ((hugoOps.startTransaction(pNdb) != 0) ||
8793-
(hugoOps.pkUpdateRecord(pNdb, row, batch, rand()) != 0) ||
8794-
(hugoOps.execute_Commit(pNdb)) ||
8795-
(hugoOps.closeTransaction(pNdb)))
8796-
{
8797-
g_err << "Update failed" << endl;
8798-
//return NDBT_FAILED;
8799-
}
8803+
if ((hugoOps.startTransaction(pNdb) != 0) ||
8804+
(hugoOps.pkUpdateRecord(pNdb, row, batch, rand()) != 0) ||
8805+
(hugoOps.execute_Commit(pNdb)) ||
8806+
(hugoOps.closeTransaction(pNdb)))
8807+
{
8808+
g_err << "Update failed" << endl;
8809+
//return NDBT_FAILED;
88008810
}
88018811
NdbSleep_SecSleep(1);
8802-
if (!skip)
8803-
{
8804-
row = rand() % records;
8805-
if(row + batch > (Uint32)records)
8806-
batch = records - row;
8807-
if ((hugoOps.startTransaction(pNdb) != 0) ||
8808-
(hugoOps.pkUpdateRecord(pNdb, row, batch, rand()) != 0) ||
8809-
(hugoOps.execute_Commit(pNdb)) ||
8810-
(hugoOps.closeTransaction(pNdb)))
8811-
{
8812-
g_err << "Update failed" << endl;
8813-
//return NDBT_FAILED;
8814-
}
8812+
row = rand() % records;
8813+
if(row + batch > (Uint32)records)
8814+
row = records - batch;
8815+
if ((hugoOps.startTransaction(pNdb) != 0) ||
8816+
(hugoOps.pkUpdateRecord(pNdb, row, batch, rand()) != 0) ||
8817+
(hugoOps.execute_Commit(pNdb)) ||
8818+
(hugoOps.closeTransaction(pNdb)))
8819+
{
8820+
g_err << "Update failed" << endl;
8821+
//return NDBT_FAILED;
88158822
}
88168823
}
88178824
/**
@@ -8843,6 +8850,19 @@ int run_PLCP_many_parts(NDBT_Context *ctx, NDBT_Step *step)
88438850
g_err << "Wait node start failed" << endl;
88448851
return NDBT_FAILED;
88458852
}
8853+
ndbout << "Reset TimeBetweenGlobalCheckpoints to 2000" << endl;
8854+
if (setConfigValueAndRestartNode(&mgmd, CFG_DB_GCP_INTERVAL,
8855+
2000, 1, &restarter) == NDBT_FAILED)
8856+
{
8857+
g_err << "Failed to set TimeBetweenGlobalCheckpoints to 2000" << endl;
8858+
return NDBT_FAILED;
8859+
}
8860+
if (setConfigValueAndRestartNode(&mgmd, CFG_DB_GCP_INTERVAL,
8861+
2000, 2, &restarter) == NDBT_FAILED)
8862+
{
8863+
g_err << "Failed to set TimeBetweenGlobalCheckpoints to 2000" << endl;
8864+
return NDBT_FAILED;
8865+
}
88468866
ndbout << "Test complete" << endl;
88478867
return NDBT_OK;
88488868
}

0 commit comments

Comments
 (0)