MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:knielsen Date:October 23 2007 2:46pm
Subject:bk commit into 5.0 tree (knielsen:1.2487) BUG#31761
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of knielsen. When knielsen 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, 2007-10-23 16:45:56+02:00, knielsen@ymer.(none) +5 -0
  BUG#31761: Code for cluster is not safe for strict-alias optimization in new gcc
  
  Fix problem with AttributeHeader::init() seen with gcc 4.2.1.
  
  Using the same object as both Uint32 and class AttributeHeader violates
  strict aliasing rule.

  ndb/include/kernel/AttributeHeader.hpp@stripped, 2007-10-23 16:45:52+02:00, knielsen@ymer.(none) +5 -5
    BUG#31761: Code for cluster is not safe for strict-alias optimization in new gcc
    
    Fix problem with AttributeHeader::init() seen with gcc 4.2.1.
    
    Using the same object as both Uint32 and class AttributeHeader violates
    strict aliasing rule.

  ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp@stripped, 2007-10-23 16:45:53+02:00, knielsen@ymer.(none) +3 -2
    BUG#31761: Code for cluster is not safe for strict-alias optimization in new gcc
    
    Fix problem with AttributeHeader::init() seen with gcc 4.2.1.
    
    Using the same object as both Uint32 and class AttributeHeader violates
    strict aliasing rule.

  ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp@stripped, 2007-10-23 16:45:53+02:00, knielsen@ymer.(none) +5 -6
    BUG#31761: Code for cluster is not safe for strict-alias optimization in new gcc
    
    Fix problem with AttributeHeader::init() seen with gcc 4.2.1.
    
    Using the same object as both Uint32 and class AttributeHeader violates
    strict aliasing rule.

  ndb/src/kernel/blocks/dbutil/DbUtil.cpp@stripped, 2007-10-23 16:45:53+02:00, knielsen@ymer.(none) +2 -3
    BUG#31761: Code for cluster is not safe for strict-alias optimization in new gcc
    
    Fix problem with AttributeHeader::init() seen with gcc 4.2.1.
    
    Using the same object as both Uint32 and class AttributeHeader violates
    strict aliasing rule.

  ndb/src/ndbapi/NdbOperationDefine.cpp@stripped, 2007-10-23 16:45:53+02:00, knielsen@ymer.(none) +6 -8
    BUG#31761: Code for cluster is not safe for strict-alias optimization in new gcc
    
    Fix problem with AttributeHeader::init() seen with gcc 4.2.1.
    
    Using the same object as both Uint32 and class AttributeHeader violates
    strict aliasing rule.

# 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:	knielsen
# Host:	ymer.(none)
# Root:	/loke/home/knielsen/devel/mysql-5.0-ndb

--- 1.8/ndb/include/kernel/AttributeHeader.hpp	2007-10-23 16:46:03 +02:00
+++ 1.9/ndb/include/kernel/AttributeHeader.hpp	2007-10-23 16:46:03 +02:00
@@ -41,8 +41,7 @@ public:
   STATIC_CONST( FRAGMENT_MEMORY= 0xFFF9 );
 
   /** Initialize AttributeHeader at location aHeaderPtr */
-  static AttributeHeader& init(void* aHeaderPtr, Uint32 anAttributeId, 
-			       Uint32 aDataSize);
+  static void init(Uint32* aHeaderPtr, Uint32 anAttributeId, Uint32 aDataSize);
 
   /** Returns size of AttributeHeader (usually one or two words) */
   Uint32 getHeaderSize() const; // In 32-bit words
@@ -100,10 +99,11 @@ public:
  */
 
 inline
-AttributeHeader& AttributeHeader::init(void* aHeaderPtr, Uint32 anAttributeId, 
-				       Uint32 aDataSize)
+void AttributeHeader::init(Uint32* aHeaderPtr, Uint32 anAttributeId, 
+                           Uint32 aDataSize)
 {
-  return * new (aHeaderPtr) AttributeHeader(anAttributeId, aDataSize);
+  AttributeHeader ah(anAttributeId, aDataSize);
+  *aHeaderPtr = ah.m_value;
 }
 
 inline

--- 1.25/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp	2007-10-23 16:46:03 +02:00
+++ 1.26/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp	2007-10-23 16:46:03 +02:00
@@ -1577,8 +1577,8 @@ int Dbtup::interpreterNextLab(Signal* si
 	  Uint32 TdataForUpdate[3];
 	  Uint32 Tlen;
 
-	  AttributeHeader& ah = AttributeHeader::init(&TdataForUpdate[0], 
-						      TattrId, TattrNoOfWords);
+	  AttributeHeader ah(TattrId, TattrNoOfWords);
+          TdataForUpdate[0] = ah.m_value;
 	  TdataForUpdate[1] = TregMemBuffer[theRegister + 2];
 	  TdataForUpdate[2] = TregMemBuffer[theRegister + 3];
 	  Tlen = TattrNoOfWords + 1;
@@ -1594,6 +1594,7 @@ int Dbtup::interpreterNextLab(Signal* si
 		// Write a NULL value into the attribute
 		/* --------------------------------------------------------- */
 		ah.setNULL();
+                TdataForUpdate[0] = ah.m_value;
 		Tlen = 1;
 	      }//if
 	      int TnoDataRW= updateAttributes(pagePtr,

--- 1.20/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp	2007-10-23 16:46:03 +02:00
+++ 1.21/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp	2007-10-23 16:46:03 +02:00
@@ -676,8 +676,6 @@ bool
 Dbtup::checkUpdateOfPrimaryKey(Uint32* updateBuffer, Tablerec* const regTabPtr)
 {
   Uint32 keyReadBuffer[MAX_KEY_SIZE_IN_WORDS];
-  Uint32 attributeHeader;
-  AttributeHeader* ahOut = (AttributeHeader*)&attributeHeader;
   AttributeHeader ahIn(*updateBuffer);
   Uint32 attributeId = ahIn.getAttributeId();
   Uint32 attrDescriptorIndex = regTabPtr->tabDescriptor + (attributeId << ZAD_LOG_SIZE);
@@ -700,16 +698,17 @@ Dbtup::checkUpdateOfPrimaryKey(Uint32* u
 
   ReadFunction f = regTabPtr->readFunctionArray[attributeId];
 
-  AttributeHeader::init(&attributeHeader, attributeId, 0);
+  AttributeHeader attributeHeader(attributeId, 0);
   tOutBufIndex = 0;
   tMaxRead = MAX_KEY_SIZE_IN_WORDS;
 
   bool tmp = tXfrmFlag;
   tXfrmFlag = true;
-  ndbrequire((this->*f)(&keyReadBuffer[0], ahOut, attrDescriptor, attributeOffset));
+  ndbrequire((this->*f)(&keyReadBuffer[0], &attributeHeader, attrDescriptor,
+                        attributeOffset));
   tXfrmFlag = tmp;
-  ndbrequire(tOutBufIndex == ahOut->getDataSize());
-  if (ahIn.getDataSize() != ahOut->getDataSize()) {
+  ndbrequire(tOutBufIndex == attributeHeader.getDataSize());
+  if (ahIn.getDataSize() != attributeHeader.getDataSize()) {
     ljam();
     return true;
   }//if

--- 1.13/ndb/src/kernel/blocks/dbutil/DbUtil.cpp	2007-10-23 16:46:03 +02:00
+++ 1.14/ndb/src/kernel/blocks/dbutil/DbUtil.cpp	2007-10-23 16:46:03 +02:00
@@ -1168,9 +1168,7 @@ DbUtil::prepareOperation(Signal* signal,
     /**************************************************************
      * Attribute found - store in mapping  (AttributeId, Position)
      **************************************************************/
-    AttributeHeader & attrMap = 
-      AttributeHeader::init(attrMappingIt.data, 
-			    attrDesc.AttributeId,    // 1. Store AttrId
+    AttributeHeader attrMap(attrDesc.AttributeId,    // 1. Store AttrId
 			    0);
     
     if (attrDesc.AttributeKeyFlag) {
@@ -1199,6 +1197,7 @@ DbUtil::prepareOperation(Signal* signal,
 	return;
       }
     }
+    *(attrMappingIt.data) = attrMap.m_value;
 #if 0
     ndbout << "BEFORE: attrLength: " << attrLength << endl;
 #endif

--- 1.24/ndb/src/ndbapi/NdbOperationDefine.cpp	2007-10-23 16:46:03 +02:00
+++ 1.25/ndb/src/ndbapi/NdbOperationDefine.cpp	2007-10-23 16:46:03 +02:00
@@ -392,9 +392,8 @@ NdbOperation::getValue_impl(const NdbCol
 	return NULL;
       }//if
     }//if
-    Uint32 ah;
-    AttributeHeader::init(&ah, tAttrInfo->m_attrId, 0);
-    if (insertATTRINFO(ah) != -1) {	
+    AttributeHeader ah(tAttrInfo->m_attrId, 0);
+    if (insertATTRINFO(ah.m_value) != -1) {	
       // Insert Attribute Id into ATTRINFO part. 
       
       /************************************************************************
@@ -525,12 +524,11 @@ NdbOperation::setValue( const NdbColumnI
   
   tAttrId = tAttrInfo->m_attrId;
   const char *aValue = aValuePassed; 
-  Uint32 ahValue;
   if (aValue == NULL) {
     if (tAttrInfo->m_nullable) {
-      AttributeHeader& ah = AttributeHeader::init(&ahValue, tAttrId, 0);
+      AttributeHeader ah(tAttrId, 0);
       ah.setNULL();
-      insertATTRINFO(ahValue);
+      insertATTRINFO(ah.m_value);
       // Insert Attribute Id with the value
       // NULL into ATTRINFO part. 
       DBUG_RETURN(0);
@@ -563,8 +561,8 @@ NdbOperation::setValue( const NdbColumnI
   }//if
   const Uint32 totalSizeInWords = (sizeInBytes + 3)/4; // Including bits in last word
   const Uint32 sizeInWords = sizeInBytes / 4;          // Excluding bits in last word
-  (void) AttributeHeader::init(&ahValue, tAttrId, totalSizeInWords);
-  insertATTRINFO( ahValue );
+  AttributeHeader ah(tAttrId, totalSizeInWords);
+  insertATTRINFO( ah.m_value );
 
   /***********************************************************************
    * Check if the pointer of the value passed is aligned on a 4 byte boundary.
Thread
bk commit into 5.0 tree (knielsen:1.2487) BUG#31761knielsen23 Oct