Commit 89507ae2 authored by unknown's avatar unknown

Default = memset(0)


ndb/src/kernel/blocks/dbacc/DbaccInit.cpp:
  Don't memset pages
ndb/src/kernel/blocks/dblqh/DblqhInit.cpp:
  Don't memset pages
ndb/src/kernel/blocks/dbtup/DbtupGen.cpp:
  Don't memset pages
parent ef0d6d35
...@@ -94,7 +94,8 @@ void Dbacc::initRecords() ...@@ -94,7 +94,8 @@ void Dbacc::initRecords()
page8 = (Page8*)allocRecord("Page8", page8 = (Page8*)allocRecord("Page8",
sizeof(Page8), sizeof(Page8),
cpagesize); cpagesize,
false);
rootfragmentrec = (Rootfragmentrec*)allocRecord("Rootfragmentrec", rootfragmentrec = (Rootfragmentrec*)allocRecord("Rootfragmentrec",
sizeof(Rootfragmentrec), sizeof(Rootfragmentrec),
...@@ -114,7 +115,8 @@ void Dbacc::initRecords() ...@@ -114,7 +115,8 @@ void Dbacc::initRecords()
undopage = (Undopage*)allocRecord("Undopage", undopage = (Undopage*)allocRecord("Undopage",
sizeof(Undopage), sizeof(Undopage),
cundopagesize); cundopagesize,
false);
// Initialize BAT for interface to file system // Initialize BAT for interface to file system
......
...@@ -121,7 +121,8 @@ void Dblqh::initRecords() ...@@ -121,7 +121,8 @@ void Dblqh::initRecords()
logPageRecord = (LogPageRecord*)allocRecord("LogPageRecord", logPageRecord = (LogPageRecord*)allocRecord("LogPageRecord",
sizeof(LogPageRecord), sizeof(LogPageRecord),
clogPageFileSize); clogPageFileSize,
false);
pageRefRecord = (PageRefRecord*)allocRecord("PageRefRecord", pageRefRecord = (PageRefRecord*)allocRecord("PageRefRecord",
sizeof(PageRefRecord), sizeof(PageRefRecord),
......
...@@ -698,7 +698,8 @@ void Dbtup::initRecords() ...@@ -698,7 +698,8 @@ void Dbtup::initRecords()
page = (Page*)allocRecord("Page", page = (Page*)allocRecord("Page",
sizeof(Page), sizeof(Page),
cnoOfPage); cnoOfPage,
false);
pageRange = (PageRange*)allocRecord("PageRange", pageRange = (PageRange*)allocRecord("PageRange",
sizeof(PageRange), sizeof(PageRange),
......
...@@ -636,7 +636,7 @@ SimulatedBlock::getBatSize(Uint16 blockNo){ ...@@ -636,7 +636,7 @@ SimulatedBlock::getBatSize(Uint16 blockNo){
} }
void* void*
SimulatedBlock::allocRecord(const char * type, size_t s, size_t n) SimulatedBlock::allocRecord(const char * type, size_t s, size_t n, bool clear)
{ {
void* p = NULL; void* p = NULL;
...@@ -656,17 +656,21 @@ SimulatedBlock::allocRecord(const char * type, size_t s, size_t n) ...@@ -656,17 +656,21 @@ SimulatedBlock::allocRecord(const char * type, size_t s, size_t n)
char buf1[255]; char buf1[255];
char buf2[255]; char buf2[255];
snprintf(buf1, sizeof(buf1), "%s could not allocate memory for %s", snprintf(buf1, sizeof(buf1), "%s could not allocate memory for %s",
getBlockName(number()), type); getBlockName(number()), type);
snprintf(buf2, sizeof(buf2), "Requested: %ux%u = %u bytes", (Uint32)s, (Uint32)n, (Uint32)size); snprintf(buf2, sizeof(buf2), "Requested: %ux%u = %u bytes",
(Uint32)s, (Uint32)n, (Uint32)size);
ERROR_SET(fatal, ERR_MEMALLOC, buf1, buf2); ERROR_SET(fatal, ERR_MEMALLOC, buf1, buf2);
} }
if(clear)
memset(p, 0, size);
} }
return p; return p;
} }
void void
SimulatedBlock::deallocRecord(void ** ptr, SimulatedBlock::deallocRecord(void ** ptr,
const char * type, size_t s, size_t n) const { const char * type, size_t s, size_t n){
(void)type; (void)type;
(void)s; (void)s;
(void)n; (void)n;
......
...@@ -350,14 +350,14 @@ protected: ...@@ -350,14 +350,14 @@ protected:
* Allocates memory for the datastructures where ndb keeps the data * Allocates memory for the datastructures where ndb keeps the data
* *
*/ */
void* allocRecord(const char * type, size_t s, size_t n); void* allocRecord(const char * type, size_t s, size_t n, bool clear = true);
/** /**
* Deallocate record * Deallocate record
* *
* NOTE: Also resets pointer * NOTE: Also resets pointer
*/ */
void deallocRecord(void **, const char * type, size_t s, size_t n) const ; void deallocRecord(void **, const char * type, size_t s, size_t n);
/** /**
* General info event (sent to cluster log) * General info event (sent to cluster log)
......
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