Commit 9cd15740 authored by unknown's avatar unknown

Merge gni@bk-internal.mysql.com:/home/bk/mysql-4.1

into  ts3-168.ts.cn.tlan:/home/ngb/mysql/mysql-4.1/mysql-4.1-ndb

parents 7c9c5409 4db3e9e1
...@@ -123,13 +123,25 @@ bool ...@@ -123,13 +123,25 @@ bool
File_class::close() File_class::close()
{ {
bool rc = true; bool rc = true;
int retval = 0;
if (m_file != NULL) if (m_file != NULL)
{ {
::fflush(m_file); ::fflush(m_file);
rc = (::fclose(m_file) == 0 ? true : false); retval = ::fclose(m_file);
m_file = NULL; // Try again? while ( (retval != 0) && (errno == EINTR) ){
retval = ::fclose(m_file);
}
if( retval == 0){
rc = true;
}
else {
rc = false;
ndbout_c("ERROR: Close file error in File.cpp for %s",strerror(errno));
}
} }
m_file = NULL;
return rc; return rc;
} }
......
...@@ -658,24 +658,26 @@ SimulatedBlock::allocRecord(const char * type, size_t s, size_t n, bool clear) ...@@ -658,24 +658,26 @@ SimulatedBlock::allocRecord(const char * type, size_t s, size_t n, bool clear)
void * p = NULL; void * p = NULL;
size_t size = n*s; size_t size = n*s;
Uint64 real_size = (Uint64)((Uint64)n)*((Uint64)s);
refresh_watch_dog(); refresh_watch_dog();
if (size > 0){ if (real_size > 0){
#ifdef VM_TRACE_MEM #ifdef VM_TRACE_MEM
ndbout_c("%s::allocRecord(%s, %u, %u) = %u bytes", ndbout_c("%s::allocRecord(%s, %u, %u) = %llu bytes",
getBlockName(number()), getBlockName(number()),
type, type,
s, s,
n, n,
size); real_size);
#endif #endif
p = NdbMem_Allocate(size); if( real_size == (Uint64)size )
p = NdbMem_Allocate(size);
if (p == NULL){ if (p == NULL){
char buf1[255]; char buf1[255];
char buf2[255]; char buf2[255];
BaseString::snprintf(buf1, sizeof(buf1), "%s could not allocate memory for %s", BaseString::snprintf(buf1, sizeof(buf1), "%s could not allocate memory for %s",
getBlockName(number()), type); getBlockName(number()), type);
BaseString::snprintf(buf2, sizeof(buf2), "Requested: %ux%u = %u bytes", BaseString::snprintf(buf2, sizeof(buf2), "Requested: %ux%u = %llu bytes",
(Uint32)s, (Uint32)n, (Uint32)size); (Uint32)s, (Uint32)n, (Uint64)real_size);
ERROR_SET(fatal, ERR_MEMALLOC, buf1, buf2); ERROR_SET(fatal, ERR_MEMALLOC, buf1, buf2);
} }
......
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