List:Commits« Previous MessageNext Message »
From:jhe Date:August 29 2006 4:30am
Subject:bk commit into 5.0 tree (Justin.He:1.2253) BUG#19203
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of justin.he. When justin.he does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2006-08-29 10:30:38+08:00, Justin.He@stripped +1 -0
  BUG #19203, Different error reports for similar cases - unable to allocate memory

  ndb/src/kernel/vm/SimulatedBlock.cpp@stripped, 2006-08-29 10:30:33+08:00,
Justin.He@stripped +10 -7
    becuase size_t is unsigned 32bit when platform is 32bit, so when we allocate
memory>=4GB on 32bit platform,
    the variable 'size' will overflow, and the error information are different when
configuration 
    parameter's value is changed.
    
    So we need judge whether the size will overflow. Actually, there are already range
judgement of the 
    configuration parameters in src/mgmsrv/ConfigInfo.cpp, such as 'DataMemory',
    'MaxNoOfConcurrentOperations' and etc. But the range limitation sometimes is loose,
and just
    a theoretic value.
    
    To avoid changing the memory allocation interfaces such as ndbd_malloc functions, i
only add 
    a new 64bit 'real_size' variable and do some judgement, then modification is little.
After fix, segmentation 
    fault never occur again when allocate too large memory, and in err log file, the
detailed error information
    will be recorded.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	Justin.He
# Host:	qa3-104.qa.cn.tlan
# Root:	/mnt/sda7/justin.he/mysql/bug19203-mysql-5.0-ndb-bj

--- 1.25/ndb/src/kernel/vm/SimulatedBlock.cpp	2006-08-29 10:30:52 +08:00
+++ 1.26/ndb/src/kernel/vm/SimulatedBlock.cpp	2006-08-29 10:30:52 +08:00
@@ -657,25 +657,28 @@
 {
 
   void * p = NULL;
-  size_t size = n*s;
+  Uint64 real_size =((Uint64)s)*((Uint64)n);
+  size_t size = (size_t)real_size;
   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 ((Uint64)size == real_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, real_size);
       ERROR_SET(fatal, NDBD_EXIT_MEMALLOC, buf1, buf2);
     }
 
Thread
bk commit into 5.0 tree (Justin.He:1.2253) BUG#19203jhe29 Aug