Commit 8e0f8a62 authored by unknown's avatar unknown

Merge ts3-168.ts.cn.tlan:/home/ngb/mysql/mysql-5.0/mysql-5.0-ndb-bj

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


ndb/src/mgmsrv/Services.cpp:
  Auto merged
parents 0be7d94d a446b5fe
......@@ -93,7 +93,7 @@ typedef ndberror_classification_enum ndberror_classification;
const char *ndberror_status_message(ndberror_status);
const char *ndberror_classification_message(ndberror_classification);
void ndberror_update(ndberror_struct *);
int ndb_error_string(int err_no, char *str, unsigned int size);
int ndb_error_string(int err_no, char *str, int size);
#endif /* doxygen skip internal*/
......
......@@ -123,13 +123,25 @@ bool
File_class::close()
{
bool rc = true;
int retval = 0;
if (m_file != NULL)
{
::fflush(m_file);
rc = (::fclose(m_file) == 0 ? true : false);
m_file = NULL; // Try again?
retval = ::fclose(m_file);
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;
}
......
......@@ -658,24 +658,26 @@ SimulatedBlock::allocRecord(const char * type, size_t s, size_t n, bool clear)
void * p = NULL;
size_t size = n*s;
Uint64 real_size = (Uint64)((Uint64)n)*((Uint64)s);
refresh_watch_dog();
if (size > 0){
if (real_size > 0){
#ifdef VM_TRACE_MEM
ndbout_c("%s::allocRecord(%s, %u, %u) = %u bytes",
ndbout_c("%s::allocRecord(%s, %u, %u) = %llu bytes",
getBlockName(number()),
type,
s,
n,
size);
real_size);
#endif
p = ndbd_malloc(size);
if( real_size == (Uint64)size )
p = ndbd_malloc(size);
if (p == NULL){
char buf1[255];
char buf2[255];
BaseString::snprintf(buf1, sizeof(buf1), "%s could not allocate memory for %s",
getBlockName(number()), type);
BaseString::snprintf(buf2, sizeof(buf2), "Requested: %ux%u = %u bytes",
(Uint32)s, (Uint32)n, (Uint32)size);
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);
}
......
......@@ -1337,7 +1337,7 @@ Ndb_mgmd_event_service::log(int eventType, const Uint32* theData, NodeId nodeId)
if (EventLoggerBase::event_lookup(eventType,cat,threshold,severity,textF))
DBUG_VOID_RETURN;
char m_text[256];
char m_text[512];
EventLogger::getText(m_text, sizeof(m_text),
textF, theData, nodeId);
......@@ -1353,6 +1353,15 @@ Ndb_mgmd_event_service::log(int eventType, const Uint32* theData, NodeId nodeId)
if (ndb_logevent_body[i].index_fn)
val= (*(ndb_logevent_body[i].index_fn))(val);
str.appfmt("%s=%d\n",ndb_logevent_body[i].token, val);
if(strcmp(ndb_logevent_body[i].token,"error") == 0)
{
int m_text_len= strlen(m_text);
if(sizeof(m_text)-m_text_len-3 > 0)
{
BaseString::snprintf(m_text+m_text_len, 4 , " - ");
ndb_error_string(val, m_text+(m_text_len+3), sizeof(m_text)-m_text_len-3);
}
}
}
Vector<NDB_SOCKET_TYPE> copy;
......
......@@ -680,11 +680,14 @@ const char *ndberror_classification_message(ndberror_classification classificati
return empty_string;
}
int ndb_error_string(int err_no, char *str, unsigned int size)
int ndb_error_string(int err_no, char *str, int size)
{
ndberror_struct error;
unsigned int len;
int len;
assert(size > 1);
if(size <= 1)
return 0;
error.code = err_no;
ndberror_update(&error);
......
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