MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:pekka Date:June 12 2006 4:00pm
Subject:bk commit into 5.1 tree (pekka:1.2182) BUG#19872
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.2182 06/06/12 18:00:06 pekka@stripped +3 -0
  ndb - bug#19872 fix (sufficient for replication)

  storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp
    1.60 06/06/12 17:57:27 pekka@stripped +32 -3
    allow idempotency INSoINS or DELoDEL
    does NOT check data section 2 (before data)

  storage/ndb/test/run-test/daily-devel-tests.txt
    1.28 06/06/12 17:55:39 pekka@stripped +5 -0
    add: test_event -n MergeEventOperationApplier_NR

  storage/ndb/test/ndbapi/test_event.cpp
    1.21 06/06/12 17:54:16 pekka@stripped +40 -3
    test applier under merge events
    also fix run in 5.1 (check for data event)

# 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-bug19872

--- 1.27/storage/ndb/test/run-test/daily-devel-tests.txt	2006-03-27 18:53:16 +02:00
+++ 1.28/storage/ndb/test/run-test/daily-devel-tests.txt	2006-06-12 17:55:39 +02:00
@@ -216,6 +216,11 @@ args: -n EventOperationApplier_NR -l 2
 #
 max-time: 2500
 cmd: test_event
+args: -n MergeEventOperationApplier_NR -l 2
+
+#
+max-time: 2500
+cmd: test_event
 args: -n Multi
 
 #

--- 1.59/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp	2006-05-19 12:54:04 +02:00
+++ 1.60/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp	2006-06-12 17:57:27 +02:00
@@ -1933,15 +1933,16 @@ static struct Ev_t {
     enum_DEL = NdbDictionary::Event::_TE_DELETE,
     enum_UPD = NdbDictionary::Event::_TE_UPDATE,
     enum_NUL = NdbDictionary::Event::_TE_NUL,
-    enum_ERR = 255
+    enum_IDM = 254,     // idempotent op possibly allowed on NF
+    enum_ERR = 255      // always impossible
   };
   int t1, t2, t3;
 } ev_t[] = {
-  { Ev_t::enum_INS, Ev_t::enum_INS, Ev_t::enum_ERR },
+  { Ev_t::enum_INS, Ev_t::enum_INS, Ev_t::enum_IDM },
   { Ev_t::enum_INS, Ev_t::enum_DEL, Ev_t::enum_NUL }, //ok
   { Ev_t::enum_INS, Ev_t::enum_UPD, Ev_t::enum_INS }, //ok
   { Ev_t::enum_DEL, Ev_t::enum_INS, Ev_t::enum_UPD }, //ok
-  { Ev_t::enum_DEL, Ev_t::enum_DEL, Ev_t::enum_ERR },
+  { Ev_t::enum_DEL, Ev_t::enum_DEL, Ev_t::enum_IDM },
   { Ev_t::enum_DEL, Ev_t::enum_UPD, Ev_t::enum_ERR },
   { Ev_t::enum_UPD, Ev_t::enum_INS, Ev_t::enum_ERR },
   { Ev_t::enum_UPD, Ev_t::enum_DEL, Ev_t::enum_DEL }, //ok
@@ -2009,6 +2010,34 @@ NdbEventBuffer::merge_data(const SubTabl
     }
   }
   assert(tp != 0 && tp->t3 != Ev_t::enum_ERR);
+
+  if (tp->t3 == Ev_t::enum_IDM) {
+    LinearSectionPtr (&ptr1)[3] = data->ptr;
+
+    /*
+     * TODO
+     * - can get data in INS ptr2[2] which is supposed to be empty
+     * - can get extra data in DEL ptr2[2]
+     * - why does DBUG_PRINT not work in this file ???
+     *
+     * replication + bug#19872 can ignore this since merge is on
+     * only for tables with explicit PK and before data is not used
+     */
+    const int maxsec = 1; // ignore section 2
+
+    int i;
+    for (i = 0; i <= maxsec; i++) {
+      if (ptr1[i].sz != ptr2[i].sz ||
+          memcmp(ptr1[i].p, ptr2[i].p, ptr1[i].sz << 2) != 0) {
+        DBUG_PRINT("info", ("idempotent op %d*%d data differs in sec %d",
+                             tp->t1, tp->t2, i));
+        assert(false);
+        DBUG_RETURN_EVENT(-1);
+      }
+    }
+    DBUG_PRINT("info", ("idempotent op %d*%d data ok", tp->t1, tp->t2));
+    DBUG_RETURN_EVENT(0);
+  }
 
   // save old data
   EventBufData olddata = *data;

--- 1.20/storage/ndb/test/ndbapi/test_event.cpp	2006-03-28 11:51:16 +02:00
+++ 1.21/storage/ndb/test/ndbapi/test_event.cpp	2006-06-12 17:54:16 +02:00
@@ -25,7 +25,8 @@
 
 #define GETNDB(ps) ((NDBT_NdbApiStep*)ps)->getNdb()
 
-static int createEvent(Ndb *pNdb, const NdbDictionary::Table &tab)
+static int createEvent(Ndb *pNdb, const NdbDictionary::Table &tab,
+                       bool merge_events = false)
 {
   char eventName[1024];
   sprintf(eventName,"%s_EVENT",tab.getName());
@@ -45,6 +46,7 @@ static int createEvent(Ndb *pNdb, const 
   for(int a = 0; a < tab.getNoOfColumns(); a++){
     myEvent.addEventColumn(a);
   }
+  myEvent.mergeEvents(merge_events);
 
   int res = myDict->createEvent(myEvent); // Add event to database
 
@@ -137,7 +139,8 @@ NdbEventOperation *createEventOperation(
 
 static int runCreateEvent(NDBT_Context* ctx, NDBT_Step* step)
 {
-  if (createEvent(GETNDB(step),* ctx->getTab()) != 0){
+  bool merge_events = ctx->getProperty("MergeEvents");
+  if (createEvent(GETNDB(step),* ctx->getTab(), merge_events) != 0){
     return NDBT_FAILED;
   }
   return NDBT_OK;
@@ -584,6 +587,8 @@ int runEventApplier(NDBT_Context* ctx, N
     g_err << "Event operation creation failed on %s" << buf << endl;
     DBUG_RETURN(NDBT_FAILED);
   }
+  bool merge_events = ctx->getProperty("MergeEvents");
+  pOp->mergeEvents(merge_events);
 
   int i;
   int n_columns= table->getNoOfColumns();
@@ -616,6 +621,11 @@ int runEventApplier(NDBT_Context* ctx, N
       while ((pOp= ndb->nextEvent()) != 0)
       {
 	assert(pOp == pCreate);
+      
+        if (pOp->getEventType() >=
+            NdbDictionary::Event::TE_FIRST_NON_DATA_EVENT)
+          continue;
+
 	int noRetries= 0;
 	do
 	{
@@ -640,7 +650,7 @@ int runEventApplier(NDBT_Context* ctx, N
 	    goto end;
 
 	  }
-	
+
 	  switch (pOp->getEventType()) {
 	  case NdbDictionary::Event::TE_INSERT:
 	    if (op->writeTuple())
@@ -1598,6 +1608,33 @@ TESTCASE("EventOperationApplier_NR", 
 	 "Verify that if we apply the data we get from event "
 	 "operation is the same as the original table"
 	 "NOTE! No errors are allowed!" ){
+  INITIALIZER(runCreateEvent);
+  INITIALIZER(runCreateShadowTable);
+  STEP(runEventApplier);
+  STEP(runEventMixedLoad);
+  STEP(runRestarter);
+  FINALIZER(runDropEvent);
+  FINALIZER(runVerify);
+  FINALIZER(runDropShadowTable);
+}
+TESTCASE("MergeEventOperationApplier", 
+	 "Verify that if we apply the data we get from merged event "
+	 "operation is the same as the original table"
+	 "NOTE! No errors are allowed!" ){
+  TC_PROPERTY("MergeEvents", 1);
+  INITIALIZER(runCreateEvent);
+  INITIALIZER(runCreateShadowTable);
+  STEP(runEventApplier);
+  STEP(runEventMixedLoad);
+  FINALIZER(runDropEvent);
+  FINALIZER(runVerify);
+  FINALIZER(runDropShadowTable);
+}
+TESTCASE("MergeEventOperationApplier_NR", 
+	 "Verify that if we apply the data we get from merged event "
+	 "operation is the same as the original table"
+	 "NOTE! No errors are allowed!" ){
+  TC_PROPERTY("MergeEvents", 1);
   INITIALIZER(runCreateEvent);
   INITIALIZER(runCreateShadowTable);
   STEP(runEventApplier);
Thread
bk commit into 5.1 tree (pekka:1.2182) BUG#19872pekka12 Jun