MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:jonas Date:April 21 2006 4:40am
Subject:bk commit into 5.1 tree (jonas:1.2373)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of jonas. When jonas 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
  1.2373 06/04/21 06:40:47 jonas@stripped +2 -0
  ndb -
    fix memory corruption in event-api
    maybe bug fix for 18621, 19154, 19172, 19174

  storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp
    1.20 06/04/21 06:40:43 jonas@stripped +6 -1
    Make sure that nasty c++ features arent run on Gci_container as it's supposed to be POD!

  storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp
    1.52 06/04/21 06:40:43 jonas@stripped +23 -11
    Make sure that nasty c++ features arent run on Gci_container as it's supposed to be POD!

# 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:	jonas
# Host:	perch.ndb.mysql.com
# Root:	/home/jonas/src/51-work

--- 1.51/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp	2006-04-18 10:41:54 +02:00
+++ 1.52/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp	2006-04-21 06:40:43 +02:00
@@ -46,7 +46,7 @@
 #include <EventLogger.hpp>
 extern EventLogger g_eventLogger;
 
-static Gci_container g_empty_gci_container;
+static Gci_container_pod g_empty_gci_container;
 static const Uint32 ACTIVE_GCI_DIRECTORY_SIZE = 4;
 static const Uint32 ACTIVE_GCI_MASK = ACTIVE_GCI_DIRECTORY_SIZE - 1;
 
@@ -1224,11 +1224,21 @@
 }
 
 static
+NdbOut&
+operator<<(NdbOut& out, const Gci_container_pod& gci)
+{
+  Gci_container* ptr = (Gci_container*)&gci;
+  out << *ptr;
+  return out;
+}
+
+
+static
 Gci_container*
-find_bucket_chained(Vector<Gci_container> * active, Uint64 gci)
+find_bucket_chained(Vector<Gci_container_pod> * active, Uint64 gci)
 {
   Uint32 pos = (gci & ACTIVE_GCI_MASK);
-  Gci_container *bucket= active->getBase() + pos;
+  Gci_container *bucket= ((Gci_container*)active->getBase()) + pos;
 
   if(gci > bucket->m_gci)
   {
@@ -1237,8 +1247,9 @@
     do 
     {
       active->fill(move_pos, g_empty_gci_container);
-      bucket = active->getBase() + pos; // Needs to recomputed after fill
-      move = active->getBase() + move_pos;
+      // Needs to recomputed after fill
+      bucket = ((Gci_container*)active->getBase()) + pos; 
+      move = ((Gci_container*)active->getBase()) + move_pos;
       if(move->m_gcp_complete_rep_count == 0)
       {
 	memcpy(move, bucket, sizeof(Gci_container));
@@ -1269,10 +1280,10 @@
 
 inline
 Gci_container*
-find_bucket(Vector<Gci_container> * active, Uint64 gci)
+find_bucket(Vector<Gci_container_pod> * active, Uint64 gci)
 {
   Uint32 pos = (gci & ACTIVE_GCI_MASK);
-  Gci_container *bucket= active->getBase() + pos;
+  Gci_container *bucket= ((Gci_container*)active->getBase()) + pos;
   if(likely(gci == bucket->m_gci))
     return bucket;
 
@@ -1370,7 +1381,8 @@
     {
       /** out of order something */
       ndbout_c("out of order bucket: %d gci: %lld m_latestGCI: %lld", 
-	       bucket-m_active_gci.getBase(), gci, m_latestGCI);
+	       bucket-(Gci_container*)m_active_gci.getBase(), 
+	       gci, m_latestGCI);
       bucket->m_state = Gci_container::GC_COMPLETE;
       bucket->m_gcp_complete_rep_count = 1; // Prevent from being reused
       m_latest_complete_GCI = gci;
@@ -1387,7 +1399,7 @@
   Uint64 stop_gci = m_latest_complete_GCI;
   
   const Uint32 size = m_active_gci.size();
-  Gci_container* array= m_active_gci.getBase();
+  Gci_container* array= (Gci_container*)m_active_gci.getBase();
   
   ndbout_c("complete_outof_order_gcis");
   for(Uint32 i = 0; i<size; i++)
@@ -1490,7 +1502,7 @@
   Uint32 sz= m_active_gci.size();
   Uint64 gci= ~0;
   Gci_container* bucket = 0;
-  Gci_container* array = m_active_gci.getBase();
+  Gci_container* array = (Gci_container*)m_active_gci.getBase();
   for(Uint32 i = 0; i<sz; i++)
   {
     if(array[i].m_gcp_complete_rep_count && array[i].m_gci < gci)
@@ -2538,5 +2550,5 @@
   DBUG_VOID_RETURN_EVENT;
 }
 
-template class Vector<Gci_container>;
+template class Vector<Gci_container_pod>;
 template class Vector<NdbEventBuffer::EventBufData_chunk*>;

--- 1.19/storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp	2006-03-29 16:03:56 +02:00
+++ 1.20/storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp	2006-04-21 06:40:43 +02:00
@@ -272,6 +272,11 @@
   EventBufData_hash m_data_hash;
 };
 
+struct Gci_container_pod
+{
+  char data[sizeof(Gci_container)];
+};
+
 class NdbEventOperationImpl : public NdbEventOperation {
 public:
   NdbEventOperationImpl(NdbEventOperation &f,
@@ -365,7 +370,7 @@
   ~NdbEventBuffer();
 
   const Uint32 &m_system_nodes;
-  Vector<Gci_container> m_active_gci;
+  Vector<Gci_container_pod> m_active_gci;
   NdbEventOperation *createEventOperation(const char* eventName,
 					  NdbError &);
   NdbEventOperationImpl *createEventOperation(NdbEventImpl& evnt,
Thread
bk commit into 5.1 tree (jonas:1.2373)jonas21 Apr