Skip to content

Commit a2183e6

Browse files
committed
Debug patch for Bug#17665497 DATANODE CRASH IN DBTUPDISKALLOC.CPP DBTUP (LINE: 848) 0X00000000
Add some checks and failure points in debug and test mode to see if we got some test cases that exercise a suspect code path.
1 parent af2f49f commit a2183e6

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
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 as published by
@@ -1959,6 +1959,24 @@ Dbtup::disk_restart_alloc_extent(EmulatedJamBuffer* jamBuf,
19591959
ndbassert(old.p->m_free_matrix_pos == RNIL);
19601960
Uint32 pos= alloc.calc_extent_pos(old.p);
19611961
Local_extent_info_list new_list(c_extent_pool, alloc.m_free_extents[pos]);
1962+
#if defined VM_TRACE || defined ERROR_INSERT
1963+
ndbrequire(!"Bug17665497: debugging suspect code path.");
1964+
/**
1965+
* old is already in list with head alloc.m_extent_list.
1966+
* Before adding it to new_list it should be removed from
1967+
* previous list. Otherwise that list will become corrupt
1968+
* and Dbtup::disk_page_get_allocated() will eventually
1969+
* calculate wrong free value. Possibly it could also end
1970+
* up with derefering a released Extent_info.
1971+
*
1972+
* Something like below should be added, but since list is
1973+
* single linked remove is harder, might need to make list
1974+
* double linked.
1975+
*
1976+
* Local_fragment_extent_list list1(c_extent_pool, alloc.m_extent_list);
1977+
* list1.remove(old);
1978+
*/
1979+
#endif
19621980
new_list.addFirst(old);
19631981
old.p->m_free_matrix_pos= pos;
19641982
}
@@ -2023,6 +2041,9 @@ Dbtup::disk_page_get_allocated(const Tablerec* tabPtrP,
20232041
Ptr<Extent_info> extentPtr;
20242042
for (list.first(extentPtr); !extentPtr.isNull(); list.next(extentPtr))
20252043
{
2044+
#if defined VM_TRACE || defined ERROR_INSERT
2045+
ndbrequire(extentPtr.p->m_free_matrix_pos == RNIL);
2046+
#endif
20262047
cnt++;
20272048
free += extentPtr.p->m_free_space;
20282049
}

0 commit comments

Comments
 (0)