Skip to content

Commit e17e774

Browse files
committed
Bug#37006547 Unused node management in TRIX
Patch for 7.6 Only Problem: TRIX has boilerplate signal handers and cluster state structures which have never been used and so are not valid. Solution: To avoid confusion, these are removed. Change-Id: I49587a44e63221afeefa868ef2909e3b2299630c
1 parent cac4b47 commit e17e774

File tree

2 files changed

+3
-203
lines changed

2 files changed

+3
-203
lines changed

storage/ndb/src/kernel/blocks/trix/Trix.cpp

Lines changed: 2 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -72,25 +72,13 @@ check_timeout(Uint32 errCode)
7272
/**
7373
*
7474
*/
75-
Trix::Trix(Block_context& ctx) :
76-
SimulatedBlock(TRIX, ctx),
77-
c_theNodes(c_theNodeRecPool),
78-
c_masterNodeId(0),
79-
c_masterTrixRef(0),
80-
c_noNodesFailed(0),
81-
c_noActiveNodes(0),
82-
c_theSubscriptions(c_theSubscriptionRecPool)
83-
{
75+
Trix::Trix(Block_context &ctx)
76+
: SimulatedBlock(TRIX, ctx), c_theSubscriptions(c_theSubscriptionRecPool) {
8477
BLOCK_CONSTRUCTOR(Trix);
8578

8679
// Add received signals
8780
addRecSignal(GSN_READ_CONFIG_REQ, &Trix::execREAD_CONFIG_REQ);
8881
addRecSignal(GSN_STTOR, &Trix::execSTTOR);
89-
addRecSignal(GSN_NDB_STTOR, &Trix::execNDB_STTOR); // Forwarded from DICT
90-
addRecSignal(GSN_READ_NODESCONF, &Trix::execREAD_NODESCONF);
91-
addRecSignal(GSN_READ_NODESREF, &Trix::execREAD_NODESREF);
92-
addRecSignal(GSN_NODE_FAILREP, &Trix::execNODE_FAILREP);
93-
addRecSignal(GSN_INCL_NODEREQ, &Trix::execINCL_NODEREQ);
9482
addRecSignal(GSN_DUMP_STATE_ORD, &Trix::execDUMP_STATE_ORD);
9583
addRecSignal(GSN_DBINFO_SCANREQ, &Trix::execDBINFO_SCANREQ);
9684

@@ -144,7 +132,6 @@ void
144132
Trix::execREAD_CONFIG_REQ(Signal* signal)
145133
{
146134
jamEntry();
147-
148135
const ReadConfigReq * req = (ReadConfigReq*)signal->getDataPtr();
149136

150137
Uint32 ref = req->senderRef;
@@ -191,8 +178,6 @@ Trix::execREAD_CONFIG_REQ(Signal* signal)
191178
void Trix::execSTTOR(Signal* signal)
192179
{
193180
jamEntry();
194-
195-
//const Uint32 startphase = signal->theData[1];
196181
const Uint32 theSignalKey = signal->theData[6];
197182

198183
signal->theData[0] = theSignalKey;
@@ -202,143 +187,6 @@ void Trix::execSTTOR(Signal* signal)
202187
return;
203188
}//Trix::execSTTOR()
204189

205-
/**
206-
*
207-
*/
208-
void Trix::execNDB_STTOR(Signal* signal)
209-
{
210-
jamEntry();
211-
BlockReference ndbcntrRef = signal->theData[0];
212-
Uint16 startphase = signal->theData[2]; /* RESTART PHASE */
213-
Uint16 mynode = signal->theData[1];
214-
//Uint16 restarttype = signal->theData[3];
215-
//UintR configInfo1 = signal->theData[6]; /* CONFIGRATION INFO PART 1 */
216-
//UintR configInfo2 = signal->theData[7]; /* CONFIGRATION INFO PART 2 */
217-
switch (startphase) {
218-
case 3:
219-
jam();
220-
/* SYMBOLIC START PHASE 4 */
221-
/* ABSOLUTE PHASE 5 */
222-
/* REQUEST NODE IDENTITIES FROM DBDIH */
223-
signal->theData[0] = calcTrixBlockRef(mynode);
224-
sendSignal(ndbcntrRef, GSN_READ_NODESREQ, signal, 1, JBB);
225-
return;
226-
break;
227-
case 6:
228-
break;
229-
default:
230-
break;
231-
}
232-
}
233-
234-
/**
235-
*
236-
*/
237-
void Trix::execREAD_NODESCONF(Signal* signal)
238-
{
239-
jamEntry();
240-
241-
ReadNodesConf * const readNodes = (ReadNodesConf *)signal->getDataPtr();
242-
//Uint32 noOfNodes = readNodes->noOfNodes;
243-
NodeRecPtr nodeRecPtr;
244-
245-
c_masterNodeId = readNodes->masterNodeId;
246-
c_masterTrixRef = RNIL;
247-
c_noNodesFailed = 0;
248-
249-
for(unsigned i = 0; i < MAX_NDB_NODES; i++) {
250-
jam();
251-
if(NdbNodeBitmask::get(readNodes->allNodes, i)) {
252-
// Node is defined
253-
jam();
254-
ndbrequire(c_theNodes.getPool().seizeId(nodeRecPtr, i));
255-
c_theNodes.addFirst(nodeRecPtr);
256-
nodeRecPtr.p->trixRef = calcTrixBlockRef(i);
257-
if (i == c_masterNodeId) {
258-
c_masterTrixRef = nodeRecPtr.p->trixRef;
259-
}
260-
if(NdbNodeBitmask::get(readNodes->inactiveNodes, i)){
261-
// Node is not active
262-
jam();
263-
/**-----------------------------------------------------------------
264-
* THIS NODE IS DEFINED IN THE CLUSTER BUT IS NOT ALIVE CURRENTLY.
265-
* WE ADD THE NODE TO THE SET OF FAILED NODES AND ALSO SET THE
266-
* BLOCKSTATE TO BUSY TO AVOID ADDING TRIGGERS OR INDEXES WHILE
267-
* NOT ALL NODES ARE ALIVE.
268-
*------------------------------------------------------------------*/
269-
arrGuard(c_noNodesFailed, MAX_NDB_NODES);
270-
nodeRecPtr.p->alive = false;
271-
c_noNodesFailed++;
272-
c_blockState = Trix::NODE_FAILURE;
273-
}
274-
else {
275-
// Node is active
276-
jam();
277-
c_noActiveNodes++;
278-
nodeRecPtr.p->alive = true;
279-
}
280-
}
281-
}
282-
if (c_noNodesFailed == 0) {
283-
c_blockState = Trix::STARTED;
284-
}
285-
}
286-
287-
/**
288-
*
289-
*/
290-
void Trix::execREAD_NODESREF(Signal* signal)
291-
{
292-
// NYI
293-
}
294-
295-
/**
296-
*
297-
*/
298-
void Trix::execNODE_FAILREP(Signal* signal)
299-
{
300-
jamEntry();
301-
NodeFailRep * const nodeFail = (NodeFailRep *) signal->getDataPtr();
302-
303-
//Uint32 failureNr = nodeFail->failNo;
304-
//Uint32 numberNodes = nodeFail->noOfNodes;
305-
Uint32 masterNodeId = nodeFail->masterNodeId;
306-
307-
NodeRecPtr nodeRecPtr;
308-
309-
for(c_theNodes.first(nodeRecPtr);
310-
nodeRecPtr.i != RNIL;
311-
c_theNodes.next(nodeRecPtr)) {
312-
if(NdbNodeBitmask::get(nodeFail->theNodes, nodeRecPtr.i)) {
313-
nodeRecPtr.p->alive = false;
314-
c_noNodesFailed++;
315-
c_noActiveNodes--;
316-
}
317-
}
318-
if (c_masterNodeId != masterNodeId) {
319-
c_masterNodeId = masterNodeId;
320-
NodeRecord* nodeRec = c_theNodes.getPtr(masterNodeId);
321-
c_masterTrixRef = nodeRec->trixRef;
322-
}
323-
}
324-
325-
/**
326-
*
327-
*/
328-
void Trix::execINCL_NODEREQ(Signal* signal)
329-
{
330-
jamEntry();
331-
UintR node_id = signal->theData[1];
332-
NodeRecord* nodeRec = c_theNodes.getPtr(node_id);
333-
nodeRec->alive = true;
334-
c_noNodesFailed--;
335-
c_noActiveNodes++;
336-
nodeRec->trixRef = calcTrixBlockRef(node_id);
337-
if (c_noNodesFailed == 0) {
338-
c_blockState = Trix::STARTED;
339-
}
340-
}
341-
342190
// Debugging
343191
void
344192
Trix::execDUMP_STATE_ORD(Signal* signal)

storage/ndb/src/kernel/blocks/trix/Trix.hpp

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2003, 2021, Oracle and/or its affiliates.
2+
Copyright (c) 2003, 2024, Oracle and/or its affiliates.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License, version 2.0,
@@ -78,48 +78,6 @@ class Trix : public SimulatedBlock
7878
//DBtrix(const Trix &obj);
7979
//void operator = (const Trix &);
8080

81-
// Block state
82-
enum BlockState {
83-
NOT_STARTED,
84-
STARTED,
85-
NODE_FAILURE,
86-
IDLE,
87-
BUSY
88-
};
89-
90-
BlockState c_blockState;
91-
92-
// Node data needed when communicating with remote TRIX:es
93-
struct NodeRecord {
94-
NodeRecord() {}
95-
bool alive;
96-
BlockReference trixRef;
97-
union {
98-
Uint32 nextPool;
99-
Uint32 nextList;
100-
};
101-
Uint32 prevList;
102-
};
103-
104-
typedef Ptr<NodeRecord> NodeRecPtr;
105-
typedef ArrayPool<NodeRecord> NodeRecord_pool;
106-
typedef DLList<NodeRecord_pool> NodeRecord_list;
107-
108-
/**
109-
* The pool of node records
110-
*/
111-
NodeRecord_pool c_theNodeRecPool;
112-
113-
/**
114-
* The list of other NDB nodes
115-
*/
116-
NodeRecord_list c_theNodes;
117-
118-
Uint32 c_masterNodeId;
119-
BlockReference c_masterTrixRef;
120-
Uint16 c_noNodesFailed;
121-
Uint16 c_noActiveNodes;
122-
12381
AttrOrderBuffer::DataBufferPool c_theAttrOrderBufferPool;
12482

12583
struct SubscriptionRecord {
@@ -308,13 +266,7 @@ class Trix : public SimulatedBlock
308266
// System start
309267
void execREAD_CONFIG_REQ(Signal* signal);
310268
void execSTTOR(Signal* signal);
311-
void execNDB_STTOR(Signal* signal);
312269

313-
// Node management
314-
void execREAD_NODESCONF(Signal* signal);
315-
void execREAD_NODESREF(Signal* signal);
316-
void execNODE_FAILREP(Signal* signal);
317-
void execINCL_NODEREQ(Signal* signal);
318270
// Debugging
319271
void execDUMP_STATE_ORD(Signal* signal);
320272

0 commit comments

Comments
 (0)