Skip to content

Commit c9b957a

Browse files
frazerclementvinc13e
authored andcommitted
Bug#36082229 [1/2] Check there are no active error inserts
set after NDBAPI test run Error insertion improvements - Have each block log when an error insertion is set - Indicates previous and new value - Gives visual indication of when error insert is set in log - Info for debugging problems - Add new ERROR 1 code which can be used to check that Error inserts are cleared, e.g. at the end of a test - Improve setting + clearing of error insert and extra value together. Change-Id: I18ee88a9a02cec7349a39a85aaec6d03f8df4002
1 parent c6754bd commit c9b957a

File tree

5 files changed

+43
-28
lines changed

5 files changed

+43
-28
lines changed

storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,9 @@ Cmvmi::~Cmvmi()
205205
void Cmvmi::execNDB_TAMPER(Signal* signal)
206206
{
207207
jamEntry();
208-
SET_ERROR_INSERT_VALUE(signal->theData[0]);
208+
209+
SimulatedBlock::execNDB_TAMPER(signal);
210+
209211
if(ERROR_INSERTED(9999)){
210212
CRASH_INSERTION(9999);
211213
}
@@ -1187,14 +1189,15 @@ void Cmvmi::execTAMPER_ORD(Signal* signal)
11871189
TamperOrd* const tamperOrd = (TamperOrd*)&signal->theData[0];
11881190
Uint32 errNo = tamperOrd->errorNo;
11891191

1190-
if (errNo == 0)
1192+
if (errNo <= 1)
11911193
{
11921194
jam();
1193-
signal->theData[0] = 0;
1195+
signal->theData[0] = errNo;
11941196
for (Uint32 i = 0; blocks[i] != 0; i++)
11951197
{
11961198
sendSignal(blocks[i], GSN_NDB_TAMPER, signal, 1, JBB);
11971199
}
1200+
sendSignal(CMVMI_REF, GSN_NDB_TAMPER, signal, 1, JBB);
11981201
return;
11991202
}
12001203

storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27396,16 +27396,7 @@ Dbdih::execNDB_TAMPER(Signal* signal)
2739627396
calculateKeepGciLab(signal, 0, 0);
2739727397
return;
2739827398
}//if
27399-
if (signal->getLength() == 1)
27400-
{
27401-
SET_ERROR_INSERT_VALUE2(signal->theData[0],
27402-
0);
27403-
}
27404-
else
27405-
{
27406-
SET_ERROR_INSERT_VALUE2(signal->theData[0],
27407-
signal->theData[1]);
27408-
}
27399+
SimulatedBlock::execNDB_TAMPER(signal);
2740927400
return;
2741027401
}//Dbdih::execNDB_TAMPER()
2741127402

storage/ndb/src/kernel/blocks/trpman.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -513,15 +513,8 @@ void
513513
Trpman::execNDB_TAMPER(Signal* signal)
514514
{
515515
jamEntry();
516+
SimulatedBlock::execNDB_TAMPER(signal);
516517
#ifdef ERROR_INSERT
517-
if (signal->getLength() == 1)
518-
{
519-
SET_ERROR_INSERT_VALUE(signal->theData[0]);
520-
}
521-
else
522-
{
523-
SET_ERROR_INSERT_VALUE2(signal->theData[0], signal->theData[1]);
524-
}
525518

526519
if (signal->theData[0] == 9003)
527520
{

storage/ndb/src/kernel/vm/SimulatedBlock.cpp

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2196,16 +2196,32 @@ SimulatedBlock::execCHANGE_NODE_STATE_REQ(Signal* signal){
21962196
ChangeNodeStateConf::SignalLength, JBB);
21972197
}
21982198

2199-
void
2200-
SimulatedBlock::execNDB_TAMPER(Signal * signal){
2201-
if (signal->getLength() == 1)
2202-
{
2199+
void SimulatedBlock::execNDB_TAMPER(Signal *signal) {
2200+
#ifdef ERROR_INSERT
2201+
g_eventLogger->info("NDB_TAMPER : block %s/%u error %u %u -> %u %u",
2202+
getBlockName(refToMain(reference()), "Unknown"),
2203+
instance(), ERROR_INSERT_VALUE, ERROR_INSERT_EXTRA,
2204+
signal->theData[0],
2205+
signal->getLength() > 1 ? signal->theData[1] : 0);
2206+
if (signal->theData[0] == 1) {
2207+
/* Check that error insert cleared everywhere */
2208+
if (ERROR_INSERT_VALUE != 0 || ERROR_INSERT_EXTRA != 0) {
2209+
g_eventLogger->info("NDB_TAMPER : ERROR_INSERT not cleared %u %u\n",
2210+
ERROR_INSERT_VALUE, ERROR_INSERT_EXTRA);
2211+
jam();
2212+
ndbrequire(false);
2213+
}
2214+
return;
2215+
}
2216+
2217+
if (signal->getLength() == 1) {
22032218
SET_ERROR_INSERT_VALUE(signal->theData[0]);
22042219
}
22052220
else
22062221
{
22072222
SET_ERROR_INSERT_VALUE2(signal->theData[0], signal->theData[1]);
22082223
}
2224+
#endif
22092225
}
22102226

22112227
void

storage/ndb/src/kernel/vm/pc.hpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,21 @@
187187
#define ERROR_INSERTED_CLEAR(x) (cerrorInsert == (x) ? (cerrorInsert = 0, true) : false)
188188
#define ERROR_INSERT_VALUE cerrorInsert
189189
#define ERROR_INSERT_EXTRA c_error_insert_extra
190-
#define SET_ERROR_INSERT_VALUE(x) cerrorInsert = x
191-
#define SET_ERROR_INSERT_VALUE2(x,y) cerrorInsert = x; c_error_insert_extra = y
192-
#define CLEAR_ERROR_INSERT_VALUE cerrorInsert = 0
190+
#define ERROR_INSERT_VALUE cerrorInsert
191+
#define ERROR_INSERT_EXTRA c_error_insert_extra
192+
#define SET_ERROR_INSERT_VALUE(x) \
193+
do { \
194+
cerrorInsert = x; \
195+
c_error_insert_extra = 0; \
196+
} while (0)
197+
#define SET_ERROR_INSERT_VALUE2(x, y) \
198+
cerrorInsert = x; \
199+
c_error_insert_extra = y
200+
#define CLEAR_ERROR_INSERT_VALUE \
201+
do { \
202+
cerrorInsert = 0; \
203+
c_error_insert_extra = 0; \
204+
} while (0)
193205
#define CLEAR_ERROR_INSERT_EXTRA c_error_insert_extra = 0
194206
#else
195207
#define ERROR_INSERT_VARIABLE typedef void * cerrorInsert // Will generate compiler error if used

0 commit comments

Comments
 (0)