Skip to content

Commit c08e469

Browse files
dssanjudahlerlend
authored andcommitted
Bug #30444982 : BUG #30427675 WL#8426 : "TESTDICT -N BUG13416603 I2" FAILS
Problem ------- Function do_action() assumes that the nodelist containing the index stat nodes is ordered but the nodelist is not always ordered in the same way in all the nodes. The order could change if one or more data nodes restart. Hence, do_action() wrongly ignores an index stat update request in this case. Therefore, all the nodes ignore the request resulting in no update made to the index statistics tables. Solution -------- -> Make sure that the node list is ordered in the same way in all the nodes. Approved-by: Mauritz Sundell <[email protected]>
1 parent a4c8ed9 commit c08e469

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14800,11 +14800,31 @@ Dbdict::set_index_stat_frag(Signal* signal, TableRecordPtr indexPtr)
1480014800

1480114801
indexPtr.p->indexStatFragId = fragId;
1480214802
bzero(indexPtr.p->indexStatNodes, sizeof(indexPtr.p->indexStatNodes));
14803+
14804+
/**
14805+
* Use the bitmask for sorting, the order of node IDs in frag_data is
14806+
* not the same in all the data nodes.
14807+
*/
14808+
NdbNodeBitmask sortedNodes;
1480314809
for (Uint32 i = 0; i < noOfReplicas; i++)
1480414810
{
14805-
Uint32 idx = fragIndex + 1 + (nodeIndex + i) % noOfReplicas;
14806-
indexPtr.p->indexStatNodes[i] = frag_data[idx];
14811+
Uint32 idx = fragIndex + 1 + i;
14812+
sortedNodes.set(frag_data[idx]);
14813+
}
14814+
14815+
// clear list
14816+
memset(indexPtr.p->indexStatNodes, 0, sizeof(indexPtr.p->indexStatNodes) / sizeof(Uint16));
14817+
14818+
// rotate the sorted nodes into the list
14819+
for (Uint32 nodeId = sortedNodes.find_first(), i = 0;
14820+
nodeId != BitmaskImpl::NotFound;
14821+
nodeId = sortedNodes.find_next(nodeId + 1), i++)
14822+
{
14823+
ndbrequire(i < noOfReplicas);
14824+
Uint32 idx = (nodeIndex + i) % noOfReplicas;
14825+
indexPtr.p->indexStatNodes[idx] = nodeId;
1480714826
}
14827+
1480814828
D("set_index_stat_frag" << V(indexId) << V(fragId)
1480914829
<< V(indexPtr.p->indexStatNodes[0]));
1481014830
}

0 commit comments

Comments
 (0)