Skip to content

Commit e032b7f

Browse files
author
Ole John Aske
committed
Bug#35785927 testFK -n TransError -> CMVMI (Line: 1879) 0x00000006 Check cnt_inc > 0
Test used the CmvmiLongSignalMemorySnapshot dump codes to analyse if there were leaks of LongSignalMemory if a transaction failed. (Lack of cleanup...?) The amount of such free LongSignalMemory were stored in an array of snapshots, then later analyzed and require's triggered in Cmvmi::execDUMP_STATE_ORD() if leaks were belived to be found. That code had two flaws: 1) When analyzing the snapshots we skipped over every 2'nd snapshot, thus possibly missing some 'increases' and 'decreases' which were counted. 2) In case the snapshot array could not hold all the snapshots being taken it wrapped around, writing over the first ones. Patch fixes: - All snapshots between 'start' and 'stop' is now analyzed. - Size of the snapshot array is increased from 32 to 256 element. ( Note that 'testFK -n TransError' takes 50 snapshots with default args). - Removed the wrap around and instead write a warning to the log if snapshot array size is exceeded. (-> Code also simplified) Change-Id: I377e35b72e8d694646ed5a9e949c7c7dea981cd4
1 parent ed57a56 commit e032b7f

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

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

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,7 +1406,7 @@ cmp_event_buf(const void * ptr0, const void * ptr1)
14061406
}
14071407

14081408
#if defined VM_TRACE || defined ERROR_INSERT
1409-
static Uint32 f_free_segments[32];
1409+
static Uint32 f_free_segments[256];
14101410
static Uint32 f_free_segment_pos = 0;
14111411
#endif
14121412

@@ -1564,32 +1564,40 @@ Cmvmi::execDUMP_STATE_ORD(Signal* signal)
15641564
if (arg == DumpStateOrd::CmvmiLongSignalMemorySnapshot)
15651565
{
15661566
#if defined VM_TRACE || defined ERROR_INSERT
1567-
f_free_segments[f_free_segment_pos] = g_sectionSegmentPool.getNoOfFree();
1568-
f_free_segment_pos = (f_free_segment_pos + 1) % NDB_ARRAY_SIZE(f_free_segments);
1567+
if (f_free_segment_pos < NDB_ARRAY_SIZE(f_free_segments))
1568+
{
1569+
f_free_segments[f_free_segment_pos++] = g_sectionSegmentPool.getNoOfFree();
1570+
}
1571+
else
1572+
{
1573+
g_eventLogger->warning("CmvmiLongSignalMemorySnapshot IGNORED"
1574+
", exceeded the max %lu snapshots",
1575+
NDB_ARRAY_SIZE(f_free_segments));
1576+
}
15691577
#endif
15701578
}
15711579

15721580
if (arg == DumpStateOrd::CmvmiLongSignalMemorySnapshotCheck)
15731581
{
15741582
#if defined VM_TRACE || defined ERROR_INSERT
1575-
Uint32 start = (f_free_segment_pos + 1)% NDB_ARRAY_SIZE(f_free_segments);
1576-
Uint32 stop = (f_free_segment_pos - 1) % NDB_ARRAY_SIZE(f_free_segments);
1583+
Uint32 start = 1;
1584+
Uint32 stop = f_free_segment_pos;
15771585
Uint32 cnt_dec = 0;
15781586
Uint32 cnt_inc = 0;
15791587
Uint32 cnt_same = 0;
1580-
for (Uint32 i = start; i != stop; i = (i + 1) % NDB_ARRAY_SIZE(f_free_segments))
1588+
for (Uint32 i = start; i < stop; i++)
15811589
{
1582-
Uint32 prev = (i - 1) % NDB_ARRAY_SIZE(f_free_segments);
1590+
Uint32 prev = (i - 1);
15831591
if (f_free_segments[prev] == f_free_segments[i])
15841592
cnt_same++;
15851593
else if (f_free_segments[prev] > f_free_segments[i])
15861594
cnt_dec++;
1587-
else if (f_free_segments[prev] < f_free_segments[i])
1595+
else
15881596
cnt_inc++;
15891597
}
15901598

15911599
printf("snapshots: ");
1592-
for (Uint32 i = start; i != stop; i = (i + 1) % NDB_ARRAY_SIZE(f_free_segments))
1600+
for (Uint32 i = 0; i < stop; i++)
15931601
{
15941602
printf("%u ", f_free_segments[i]);
15951603
}

0 commit comments

Comments
 (0)