Bug#19203, Different error reports for similar cases - unable allocate memory

parent c10719c6
......@@ -51,7 +51,8 @@ void Dbacc::initRecords()
page8 = (Page8*)allocRecord("Page8",
sizeof(Page8),
cpagesize,
false);
false,
CFG_DB_INDEX_MEM);
operationrec = (Operationrec*)allocRecord("Operationrec",
sizeof(Operationrec),
......
......@@ -342,6 +342,7 @@ void Dbtup::initRecords()
{
unsigned i;
Uint32 tmp;
Uint32 tmp1 = 0;
const ndb_mgm_configuration_iterator * p =
m_ctx.m_config.getOwnConfigIterator();
ndbrequire(p != 0);
......@@ -349,7 +350,7 @@ void Dbtup::initRecords()
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUP_PAGE, &tmp));
// Records with dynamic sizes
Page* ptr =(Page*)allocRecord("Page", sizeof(Page), tmp, false);
Page* ptr =(Page*)allocRecord("Page", sizeof(Page), tmp, false, CFG_DB_DATA_MEM);
c_page_pool.set(ptr, tmp);
attrbufrec = (Attrbufrec*)allocRecord("Attrbufrec",
......@@ -373,7 +374,9 @@ void Dbtup::initRecords()
cnoOfTabDescrRec);
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUP_OP_RECS, &tmp));
c_operation_pool.setSize(tmp);
ndb_mgm_get_int_parameter(p, CFG_DB_NO_LOCAL_OPS, &tmp1);
c_operation_pool.setSize(tmp, false, true, true,
tmp1 == 0 ? CFG_DB_NO_OPS : CFG_DB_NO_LOCAL_OPS);
pageRange = (PageRange*)allocRecord("PageRange",
sizeof(PageRange),
......
......@@ -257,7 +257,7 @@ ArrayPool<T>::setSize(Uint32 noOfElements,
if(0 != paramId && 0 == ndb_mgm_get_db_parameter_info(paramId, &param_info, &size)) {
BaseString::snprintf(errmsg, sizeof(errmsg),
"ArrayPool<T>::setSize malloc parameter %s failed", param_info.m_name);
"Malloc memory for %s failed", param_info.m_name);
}
ErrorReporter::handleAssert(errmsg,
......
......@@ -657,7 +657,7 @@ SimulatedBlock::getBatSize(Uint16 blockNo){
}
void*
SimulatedBlock::allocRecord(const char * type, size_t s, size_t n, bool clear)
SimulatedBlock::allocRecord(const char * type, size_t s, size_t n, bool clear, Uint32 paramId)
{
void * p = NULL;
......@@ -678,8 +678,16 @@ SimulatedBlock::allocRecord(const char * type, size_t s, size_t n, bool clear)
if (p == NULL){
char buf1[255];
char buf2[255];
BaseString::snprintf(buf1, sizeof(buf1), "%s could not allocate memory for %s",
getBlockName(number()), type);
struct ndb_mgm_param_info param_info;
size_t size = sizeof(ndb_mgm_param_info);
if(0 != paramId && 0 == ndb_mgm_get_db_parameter_info(paramId, &param_info, &size)) {
BaseString::snprintf(buf1, sizeof(buf1), "%s could not allocate memory for parameter %s",
getBlockName(number()), param_info.m_name);
} else {
BaseString::snprintf(buf1, sizeof(buf1), "%s could not allocate memory for %s",
getBlockName(number()), type);
}
BaseString::snprintf(buf2, sizeof(buf2), "Requested: %ux%u = %llu bytes",
(Uint32)s, (Uint32)n, (Uint64)real_size);
ERROR_SET(fatal, NDBD_EXIT_MEMALLOC, buf1, buf2);
......
......@@ -377,7 +377,7 @@ protected:
* Allocates memory for the datastructures where ndb keeps the data
*
*/
void* allocRecord(const char * type, size_t s, size_t n, bool clear = true);
void* allocRecord(const char * type, size_t s, size_t n, bool clear = true, Uint32 paramId = 0);
/**
* Deallocate record
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment