List:Commits« Previous MessageNext Message »
From:pekka Date:February 16 2006 2:54pm
Subject:bk commit into 5.1 tree (pekka:1.2120)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of pekka. When pekka 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.2120 06/02/16 14:54:30 pekka@stripped +5 -0
  ndb - wl#3023 : pass tables per GCI to injector at epoch start

  storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp
    1.15 06/02/16 14:52:11 pekka@stripped +22 -2
    getGCIEventOperations: return distinct event ops at epoch start

  storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp
    1.42 06/02/16 14:52:11 pekka@stripped +43 -1
    getGCIEventOperations: return distinct event ops at epoch start

  storage/ndb/src/ndbapi/Ndb.cpp
    1.62 06/02/16 14:52:11 pekka@stripped +10 -0
    getGCIEventOperations: return distinct event ops at epoch start

  storage/ndb/include/ndbapi/Ndb.hpp
    1.47 06/02/16 14:52:11 pekka@stripped +12 -0
    getGCIEventOperations: return distinct event ops at epoch start

  sql/ha_ndbcluster_binlog.cc
    1.18 06/02/16 14:49:44 pekka@stripped +31 -0
    use_table at beginning of epoch

# 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:	pekka
# Host:	orca.ndb.mysql.com
# Root:	/space/pekka/ndb/version/my51-mats

--- 1.46/storage/ndb/include/ndbapi/Ndb.hpp	2005-10-06 10:49:54 +02:00
+++ 1.47/storage/ndb/include/ndbapi/Ndb.hpp	2006-02-16 14:52:11 +01:00
@@ -1240,6 +1240,18 @@
    */
   NdbEventOperation *nextEvent();
 
+  /**
+   * Iterate over distinct event operations which are part of current
+   * GCI.  Valid after nextEvent.  Used to get summary information for
+   * the epoch (e.g. list of all tables) before processing event data.
+   *
+   * Set *iter=0 to start.  Returns NULL when no more.  If event_types
+   * is not NULL, it returns bitmask of received event types.
+   */
+  const NdbEventOperation*
+    getGCIEventOperations(Uint32* iter, Uint32* event_types);
+  
+
 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
   NdbEventOperation *getEventOperation(NdbEventOperation* eventOp= 0);
   Uint64 getLatestGCI();

--- 1.61/storage/ndb/src/ndbapi/Ndb.cpp	2006-01-12 19:50:35 +01:00
+++ 1.62/storage/ndb/src/ndbapi/Ndb.cpp	2006-02-16 14:52:11 +01:00
@@ -1293,6 +1293,16 @@
   return theEventBuffer->nextEvent();
 }
 
+const NdbEventOperation*
+Ndb::getGCIEventOperations(Uint32* iter, Uint32* event_types)
+{
+  NdbEventOperationImpl* op =
+    theEventBuffer->getGCIEventOperations(iter, event_types);
+  if (op != NULL)
+    return op->m_facade;
+  return NULL;
+}
+
 Uint64 Ndb::getLatestGCI()
 {
   return theEventBuffer->getLatestGCI();

--- 1.41/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp	2006-02-05 19:04:50 +01:00
+++ 1.42/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp	2006-02-16 14:52:11 +01:00
@@ -1081,6 +1081,19 @@
   DBUG_RETURN_EVENT(0);
 }
 
+NdbEventOperationImpl*
+NdbEventBuffer::getGCIEventOperations(Uint32* iter, Uint32* event_types)
+{
+  if (*iter < m_available_data.m_gci_op_count)
+  {
+    EventBufData_list::Gci_op g = m_available_data.m_gci_op_list[(*iter)++];
+    if (event_types != NULL)
+      *event_types = g.event_types;
+    return g.op;
+  }
+  return NULL;
+}
+
 void
 NdbEventBuffer::lock()
 {
@@ -2061,7 +2074,36 @@
   }
 
   // list returned to m_free_data
-  new (&list) EventBufData_list;
+  list.m_head = list.m_tail = NULL;
+  list.m_count = list.m_sz = 0;
+}
+
+void
+EventBufData_list::add_gci_op(Gci_op g)
+{
+  assert(g.op != NULL);
+  Uint32 i;
+  for (i = 0; i < m_gci_op_count; i++) {
+    if (m_gci_op_list[i].op == g.op)
+      break;
+  }
+  if (i < m_gci_op_count) {
+    m_gci_op_list[i].event_types |= g.event_types;
+  } else {
+    if (m_gci_op_count == m_gci_op_alloc) {
+      Uint32 n = 1 + 2 * m_gci_op_alloc;
+      Gci_op* old_list = m_gci_op_list;
+      m_gci_op_list = new Gci_op [n];
+      if (m_gci_op_alloc != 0) {
+        Uint32 bytes = m_gci_op_alloc * sizeof(Gci_op);
+        memcpy(m_gci_op_list, old_list, bytes);
+        delete [] old_list;
+      }
+      m_gci_op_alloc = n;
+    }
+    assert(m_gci_op_count < m_gci_op_alloc);
+    m_gci_op_list[m_gci_op_count++] = g;
+  }
 }
 
 NdbEventOperation*

--- 1.14/storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp	2006-01-31 23:35:18 +01:00
+++ 1.15/storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp	2006-02-16 14:52:11 +01:00
@@ -76,19 +76,31 @@
   EventBufData *m_head, *m_tail;
   unsigned m_count;
   unsigned m_sz;
+
+  // distinct ops per gci (assume no hash needed)
+  struct Gci_op { NdbEventOperationImpl* op; Uint32 event_types; };
+  Gci_op* m_gci_op_list;
+  Uint32 m_gci_op_count;
+  Uint32 m_gci_op_alloc;
+private:
+  void add_gci_op(Gci_op g);
 };
 
 inline
 EventBufData_list::EventBufData_list()
   : m_head(0), m_tail(0),
     m_count(0),
-    m_sz(0)
+    m_sz(0),
+    m_gci_op_list(NULL),
+    m_gci_op_count(0),
+    m_gci_op_alloc(0)
 {
 }
 
 inline
 EventBufData_list::~EventBufData_list()
 {
+  delete [] m_gci_op_list;
 }
 
 inline
@@ -110,6 +122,9 @@
 inline
 void EventBufData_list::append(EventBufData *data)
 {
+  Gci_op g = { data->m_event_op, 1 << (Uint32)data->sdata->operation };
+  add_gci_op(g);
+
   data->m_next= 0;
   if (m_tail)
     m_tail->m_next= data;
@@ -130,6 +145,10 @@
 inline
 void EventBufData_list::append(const EventBufData_list &list)
 {
+  Uint32 i;
+  for (i = 0; i < list.m_gci_op_count; i++)
+    add_gci_op(list.m_gci_op_list[i]);
+
   if (m_tail)
     m_tail->m_next= list.m_head;
   else
@@ -265,7 +284,6 @@
   void receive_data(NdbRecAttr *r, const Uint32 *data, Uint32 sz);
 };
 
-
 class NdbEventBuffer {
 public:
   NdbEventBuffer(Ndb*);
@@ -303,6 +321,8 @@
 
   int pollEvents(int aMillisecondNumber, Uint64 *latestGCI= 0);
   NdbEventOperation *nextEvent();
+  NdbEventOperationImpl* getGCIEventOperations(Uint32* iter,
+                                               Uint32* event_types);
 
   NdbEventOperationImpl *move_data();
 

--- 1.17/sql/ha_ndbcluster_binlog.cc	2006-02-16 03:24:44 +01:00
+++ 1.18/sql/ha_ndbcluster_binlog.cc	2006-02-16 14:49:44 +01:00
@@ -2829,10 +2829,41 @@
         assert(pOp->getGCI() <= ndb_latest_received_binlog_epoch);
         bzero((char*) &row, sizeof(row));
         injector::transaction trans= inj->new_trans(thd);
+        { // pass table map before epoch
+          Uint32 iter=0;
+          const NdbEventOperation* gci_op;
+          Uint32 event_types;
+          while ((gci_op=ndb->getGCIEventOperations(&iter, &event_types))
+              != NULL)
+          {
+            NDB_SHARE* share=(NDB_SHARE*)gci_op->getCustomData();
+            DBUG_PRINT("info", ("per gci op %p share %p event types 0x%x",
+                                gci_op, share, event_types));
+            // this should not happen
+            if (share == NULL || share->table == NULL)
+            {
+              DBUG_PRINT("info", ("no share or table !"));
+              continue;
+            }
+            TABLE* table=share->table;
+            const LEX_STRING& name=table->s->table_name;
+            DBUG_PRINT("info", ("use_table: %.*s", name.length, name.str));
+            injector::transaction::table tbl(table, true);
+            // TODO enable when mats patch pushed
+            //trans.use_table(::server_id, tbl);
+          }
+        }
         gci= pOp->getGCI();
         if (apply_status_share)
         {
           TABLE *table= apply_status_share->table;
+
+          const LEX_STRING& name=table->s->table_name;
+          DBUG_PRINT("info", ("use_table: %.*s", name.length, name.str));
+          injector::transaction::table tbl(table, true);
+          // TODO enable when mats patch pushed
+          //trans.use_table(::server_id, tbl);
+
           MY_BITMAP b;
           uint32 bitbuf;
           DBUG_ASSERT(table->s->fields <= sizeof(bitbuf) * 8);
Thread
bk commit into 5.1 tree (pekka:1.2120)pekka16 Feb