Skip to content

Commit c8bdd7d

Browse files
committed
Bug#36235275 test_event -n Bug44915 T1, error insert 13031, 13044, 13045 are never hit
Various issues here : 1. Those error inserts are not hit as they are in SUMA execSUB_CREATE_REQ() which is only executed on SUMA when a Subscriber (aka EventOperation) is created. Just creating the Event is not enough to trigger them, so the test covers nothing and naturally they would be left behind when it finishes. Solution : - Add create EventOperation and check that it fails 2. The other error inserts (error2) are related to SUMA Scans, where it asks DIH to get distribution info. The error inserts are intended to give code coverage of some 'many fragments' continueB cases. a) This has nothing to do with Events b) Creating and Dropping events does not involve scanning Solution : - Split into separate testcase - Add index creation which *will* trigger a SUMA scan and will cause these error insertions to be hit. 3. Error insert 13049 causes a crash when hit. This error insert triggers a CONTINUEB, but then carries on with the scan. When the CONTINUEB arrives, the scan is not in the correct state causing a crash. Fix by having the code return after queueing the CONTINUEB. Summary : Testcase was a mess, testing nothing. Error insert being left behind was a good indicator of a problem. New test : test_event -n SumaScanGetNodesContinueB T1 added to daily-basic--03 Change-Id: I4c4470cc6ef2a53dd470a4e4ac90ca1085504140
1 parent e4a61d4 commit c8bdd7d

File tree

3 files changed

+88
-12
lines changed

3 files changed

+88
-12
lines changed

storage/ndb/src/kernel/blocks/suma/Suma.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2966,6 +2966,7 @@ Suma::sendDIGETNODESREQ(Signal *signal,
29662966
signal->theData[3] = fragNo + 1;
29672967
sendSignal(reference(), GSN_CONTINUEB, signal,
29682968
4, JBB);
2969+
return;
29692970
}
29702971
}
29712972
jam();

storage/ndb/test/ndbapi/test_event.cpp

Lines changed: 82 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4905,26 +4905,93 @@ runBug44915(NDBT_Context* ctx, NDBT_Step* step)
49054905
int result = NDBT_OK;
49064906

49074907
NdbRestarter res;
4908-
int error[] = { 13031, 13044, 13045, 13031, 0 };
4909-
int error2[] = { 13049, 13050, 13049, 13050, 0 };
49104908
/**
4911-
* error2 is used to test CONTINUEB handling when reading table
4912-
* fragmentation, it is not expected to give any faults.
4909+
* Test various failures in SUMA::SUB_CREATE_REQ which
4910+
* is invoked when a subscription is setup
4911+
* (A side effect of the first subscriber (EventOperation)
4912+
* being created)
49134913
*/
4914+
int error[] = {13031, /* SUMA SUB_CREATE_REQ Table::UNDEFINED */
4915+
13044, /* SUMA SUB_CREATE_REQ Out of op records */
4916+
13045, /* SUMA SUB_CREATE_REQ Out of table records */
4917+
13031, /* SUMA SUB_CREATE_REQ Table::UNDEFINED */
4918+
0};
49144919
for (int i = 0; error[i] && result == NDBT_OK; i++)
49154920
{
49164921
Uint32 nodeId = res.getDbNodeId(rand() % res.getNumDbNodes());
4917-
ndbout_c("error: %d", error[i]);
4918-
res.insertErrorInNode(nodeId, error[i]);
4919-
4920-
result = runCreateEvent(ctx, step); // should fail due to error insert
4921-
res.insertErrorInNode(nodeId, error2[i]);
4922-
result = runCreateEvent(ctx, step); // should pass
4923-
result = runDropEvent(ctx, step);
4922+
{
4923+
ndbout_c("error: %d on node %u", error[i], nodeId);
4924+
res.insertErrorInNode(nodeId, error[i]);
4925+
result = runCreateEvent(ctx, step);
4926+
NdbEventOperation *pOp = createEventOperation(
4927+
GETNDB(step), *ctx->getTab(), 1); /* report errors */
4928+
/* Expect failure */
4929+
if (pOp != 0) {
4930+
ndbout_c("Expected failure, but succeeded.");
4931+
return NDBT_FAILED;
4932+
}
4933+
result = runDropEvent(ctx, step);
4934+
}
49244935
}
49254936
return result;
49264937
}
49274938

4939+
int runTestSumaScanGetNodesContinueB(NDBT_Context *ctx, NDBT_Step *step) {
4940+
int result = NDBT_OK;
4941+
4942+
NdbRestarter res;
4943+
const NdbDictionary::Table *pTab = ctx->getTab();
4944+
Ndb *pNdb = GETNDB(step);
4945+
4946+
/**
4947+
* Get code coverage of a SUMA-internal CONTINUEB path
4948+
* when requesting distribution info for table fragments
4949+
* being scanned
4950+
*/
4951+
int error[] = {13049, /* SUMA CONTINUEB::WAIT_GET_FRAGMENT (last fragment) */
4952+
13050, /* SUMA CONTINUEB::WAIT_GET_FRAGMENT (first fragment) */
4953+
13049, 13050, 0};
4954+
/**
4955+
* error is used to test CONTINUEB handling when reading table
4956+
* fragmentation, it is not expected to give any faults.
4957+
*/
4958+
for (int i = 0; error[i] && result == NDBT_OK; i++) {
4959+
Uint32 nodeId = res.getDbNodeId(rand() % res.getNumDbNodes());
4960+
{
4961+
ndbout_c("error: %d on node %u", error[i], nodeId);
4962+
res.insertErrorInNode(nodeId, error[i]);
4963+
4964+
/* Cause a SUMA scan to occur, hitting path */
4965+
/* Build an ordered index on the pk cols */
4966+
{
4967+
ndbout_c("Defining index on table");
4968+
const char *indexName = "SUMAIDX";
4969+
NdbDictionary::Index idxDef(indexName);
4970+
idxDef.setTable(pTab->getName());
4971+
idxDef.setType(NdbDictionary::Index::OrderedIndex);
4972+
for (int c = 0; c < pTab->getNoOfColumns(); c++) {
4973+
const NdbDictionary::Column *col = pTab->getColumn(c);
4974+
if (col->getPrimaryKey()) {
4975+
ndbout_c(" Adding column %s", col->getName());
4976+
idxDef.addIndexColumn(col->getName());
4977+
}
4978+
}
4979+
idxDef.setStoredIndex(false);
4980+
4981+
if (pNdb->getDictionary()->createIndex(idxDef) != 0) {
4982+
ndbout_c("Failed to create index with error %u %s",
4983+
pNdb->getDictionary()->getNdbError().code,
4984+
pNdb->getDictionary()->getNdbError().message);
4985+
return NDBT_FAILED;
4986+
}
4987+
ndbout_c("Created index ok, dropping it");
4988+
pNdb->getDictionary()->dropIndex(indexName, pTab->getName());
4989+
}
4990+
}
4991+
}
4992+
return NDBT_OK;
4993+
}
4994+
49284995
int
49294996
runBug56579(NDBT_Context* ctx, NDBT_Step* step)
49304997
{
@@ -7412,6 +7479,10 @@ TESTCASE("Bug44915", "")
74127479
{
74137480
INITIALIZER(runBug44915);
74147481
}
7482+
TESTCASE("SumaScanGetNodesContinueB", "")
7483+
{
7484+
STEP(runTestSumaScanGetNodesContinueB);
7485+
}
74157486
TESTCASE("Bug56579", "")
74167487
{
74177488
INITIALIZER(runCreateEvent);

storage/ndb/test/run-test/daily-basic--03-tests.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License as published by
@@ -19,6 +19,10 @@ cmd: test_event
1919
args: -n Bug44915 T1
2020
max-time: 180
2121

22+
cmd: test_event
23+
args: -n SumaScanGetNodesContinueB T1
24+
max-time: 180
25+
2226
cmd: testNdbApi
2327
args: -n ExecuteAsynch T1
2428
max-time: 180

0 commit comments

Comments
 (0)