List:Commits« Previous MessageNext Message »
From:tomas Date:July 7 2006 3:50pm
Subject:bk commit into 5.1 tree (tomas:1.2237) BUG#20897
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of tomas. When tomas 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.2237 06/07/07 17:50:45 tomas@stripped +3 -0
  Bug #20897 race condition between drop table and suma drop trigger
  - keep accounting for aoutstanding drop trigger requests
  - also lock table object in suma while doing that (should be impossible right now though since dict serializes all requests)

  storage/ndb/src/ndbapi/ndberror.c
    1.67 06/07/07 17:50:25 tomas@stripped +2 -0
    Bug #20897 race condition between drop table and suma drop trigger
    - keep accounting for aoutstanding drop trigger requests
    - also lock table object in suma while doing that (should be impossible right now though since dict serializes all requests)

  storage/ndb/src/kernel/blocks/suma/Suma.hpp
    1.17 06/07/07 17:50:25 tomas@stripped +2 -1
    Bug #20897 race condition between drop table and suma drop trigger
    - keep accounting for aoutstanding drop trigger requests
    - also lock table object in suma while doing that (should be impossible right now though since dict serializes all requests)

  storage/ndb/src/kernel/blocks/suma/Suma.cpp
    1.47 06/07/07 17:50:23 tomas@stripped +37 -16
    Bug #20897 race condition between drop table and suma drop trigger
    - keep accounting for aoutstanding drop trigger requests
    - also lock table object in suma while doing that (should be impossible right now though since dict serializes all requests)

# 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:	tomas
# Host:	poseidon.ndb.mysql.com
# Root:	/home/tomas/mysql-5.1-ndb

--- 1.46/storage/ndb/src/kernel/blocks/suma/Suma.cpp	2006-07-05 16:30:04 +02:00
+++ 1.47/storage/ndb/src/kernel/blocks/suma/Suma.cpp	2006-07-07 17:50:23 +02:00
@@ -1445,12 +1445,13 @@
     tabPtr.p->m_error         = 0;
     tabPtr.p->m_schemaVersion = RNIL;
     tabPtr.p->m_state = Table::DEFINING;
-    tabPtr.p->m_hasTriggerDefined[0] = 0;
-    tabPtr.p->m_hasTriggerDefined[1] = 0;
-    tabPtr.p->m_hasTriggerDefined[2] = 0;
-    tabPtr.p->m_triggerIds[0] = ILLEGAL_TRIGGER_ID;
-    tabPtr.p->m_triggerIds[1] = ILLEGAL_TRIGGER_ID;
-    tabPtr.p->m_triggerIds[2] = ILLEGAL_TRIGGER_ID;
+    tabPtr.p->m_drop_subbPtr.p = 0;
+    for (int j= 0; j < 3; j++)
+    {
+      tabPtr.p->m_hasTriggerDefined[j] = 0;
+      tabPtr.p->m_hasOutstandingTriggerReq[j] = 0;
+      tabPtr.p->m_triggerIds[j] = ILLEGAL_TRIGGER_ID;
+    }
 
     c_tables.add(tabPtr);
 
@@ -2491,6 +2492,13 @@
     DBUG_VOID_RETURN;
   }
 
+  if (tabPtr.p->m_drop_subbPtr.p != 0) {
+    jam();
+    DBUG_PRINT("error", ("table locked"));
+    sendSubStopRef(signal, 1420);
+    DBUG_VOID_RETURN;
+  }
+
   DBUG_PRINT("info",("subscription: %u tableId: %u[i=%u] id: %u key: %u",
 		     subPtr.i, subPtr.p->m_tableId, tabPtr.i,
 		     subPtr.p->m_subscriptionId,subPtr.p->m_subscriptionKey));
@@ -2543,7 +2551,7 @@
   subPtr.p->m_senderRef  = senderRef; // store ref to requestor
   subPtr.p->m_senderData = senderData; // store ref to requestor
 
-  tabPtr.p->m_drop_subbPtr= subbPtr;
+  tabPtr.p->m_drop_subbPtr = subbPtr;
 
   if (subPtr.p->m_state == Subscription::DEFINED)
   {
@@ -2560,6 +2568,7 @@
 		       tabPtr.p->m_tableId, tabPtr.p->n_subscribers));
     tabPtr.p->checkRelease(*this);
     sendSubStopComplete(signal, tabPtr.p->m_drop_subbPtr);
+    tabPtr.p->m_drop_subbPtr.p = 0;
   }
   else
   {
@@ -2894,6 +2903,9 @@
   jam();
   DBUG_ENTER("Suma::dropTrigger");
   
+  m_hasOutstandingTriggerReq[0] =
+    m_hasOutstandingTriggerReq[1] =
+    m_hasOutstandingTriggerReq[2] = 1;
   for(Uint32 j = 0; j<3; j++){
     jam();
     suma.suma_ndbrequire(m_triggerIds[j] != ILLEGAL_TRIGGER_ID);
@@ -2972,14 +2984,18 @@
 
   suma.suma_ndbrequire(type < 3);
   suma.suma_ndbrequire(m_triggerIds[type] == triggerId);
+  suma.suma_ndbrequire(m_hasTriggerDefined[type] > 0);
+  suma.suma_ndbrequire(m_hasOutstandingTriggerReq[type] == 1);
   m_hasTriggerDefined[type]--;
+  m_hasOutstandingTriggerReq[type] = 0;
   if (m_hasTriggerDefined[type] == 0)
   {
     jam();
     m_triggerIds[type] = ILLEGAL_TRIGGER_ID;
   }
-  if( m_hasTriggerDefined[0] != m_hasTriggerDefined[1] ||
-      m_hasTriggerDefined[0] != m_hasTriggerDefined[2])
+  if( m_hasOutstandingTriggerReq[0] ||
+      m_hasOutstandingTriggerReq[1] ||
+      m_hasOutstandingTriggerReq[2])
   {
     // more to come
     jam();
@@ -2997,6 +3013,7 @@
   checkRelease(suma);
 
   suma.sendSubStopComplete(signal, m_drop_subbPtr);
+  m_drop_subbPtr.p = 0;
 }
 
 void Suma::suma_ndbrequire(bool v) { ndbrequire(v); }
@@ -3551,13 +3568,17 @@
   DBUG_PRINT("info",("drop table id: %d[i=%u]", tableId, tabPtr.i));
 
   tabPtr.p->m_state = Table::DROPPED;
-  tabPtr.p->m_hasTriggerDefined[0] = 0;
-  tabPtr.p->m_hasTriggerDefined[1] = 0;
-  tabPtr.p->m_hasTriggerDefined[2] = 0;
-  tabPtr.p->m_triggerIds[0] = ILLEGAL_TRIGGER_ID;
-  tabPtr.p->m_triggerIds[1] = ILLEGAL_TRIGGER_ID;
-  tabPtr.p->m_triggerIds[2] = ILLEGAL_TRIGGER_ID;
-
+  for (int j= 0; j < 3; j++)
+  {
+    if (!tabPtr.p->m_hasOutstandingTriggerReq[j])
+    {
+      tabPtr.p->m_hasTriggerDefined[j] = 0;
+      tabPtr.p->m_hasOutstandingTriggerReq[j] = 0;
+      tabPtr.p->m_triggerIds[j] = ILLEGAL_TRIGGER_ID;
+    }
+    else
+      tabPtr.p->m_hasTriggerDefined[j] = 1;
+  }
   if (senderRef == 0)
   {
     DBUG_VOID_RETURN;

--- 1.16/storage/ndb/src/kernel/blocks/suma/Suma.hpp	2006-07-05 16:30:04 +02:00
+++ 1.17/storage/ndb/src/kernel/blocks/suma/Suma.hpp	2006-07-07 17:50:25 +02:00
@@ -301,7 +301,8 @@
     
     union { Uint32 m_tableId; Uint32 key; };
     Uint32 m_schemaVersion;
-    Uint32 m_hasTriggerDefined[3]; // Insert/Update/Delete
+    Uint8  m_hasTriggerDefined[3]; // Insert/Update/Delete
+    Uint8  m_hasOutstandingTriggerReq[3]; // Insert/Update/Delete
     Uint32 m_triggerIds[3]; // Insert/Update/Delete
 
     Uint32 m_error;

--- 1.66/storage/ndb/src/ndbapi/ndberror.c	2006-06-30 14:08:18 +02:00
+++ 1.67/storage/ndb/src/ndbapi/ndberror.c	2006-07-07 17:50:25 +02:00
@@ -484,6 +484,8 @@
   { 1418, DMEC, SE, "Subscription dropped, no new subscribers allowed" },
   { 1419, DMEC, SE, "Subscription already dropped" },
 
+  { 1420, DMEC, TR, "Subscriber manager busy with adding/removing a table" },
+
   { 4004, DMEC, AE, "Attribute name not found in the Table" },
   
   { 4100, DMEC, AE, "Status Error in NDB" },
Thread
bk commit into 5.1 tree (tomas:1.2237) BUG#20897tomas7 Jul