List:Commits« Previous MessageNext Message »
From:Pekka Nousiainen Date:June 12 2011 4:52pm
Subject:bzr commit into mysql-5.1-telco-7.0-wl4124-new0 branch
(pekka.nousiainen:4395) WL#4124
View as plain text  
#At file:///export/space/pekka/ms/ms-wl4124-70/ based on revid:jonas@stripped

 4395 Pekka Nousiainen	2011-06-12
      wl#4124 d04_systab.diff
      use schema trans for create and drop

    modified:
      storage/ndb/src/ndbapi/NdbIndexStatImpl.cpp
=== modified file 'storage/ndb/src/ndbapi/NdbIndexStatImpl.cpp'
--- a/storage/ndb/src/ndbapi/NdbIndexStatImpl.cpp	2011-06-07 10:03:02 +0000
+++ b/storage/ndb/src/ndbapi/NdbIndexStatImpl.cpp	2011-06-12 16:51:59 +0000
@@ -101,6 +101,10 @@ NdbIndexStatImpl::Sys::~Sys()
 void
 NdbIndexStatImpl::sys_release(Sys& sys)
 {
+  // close schema trans if any exists
+  NdbDictionary::Dictionary* const dic = sys.m_dic;
+  (void)dic->endSchemaTrans(NdbDictionary::Dictionary::SchemaTransAbort);
+
   if (sys.m_headtable != 0)
   {
     sys.m_dic->removeTableGlobal(*sys.m_headtable, false);
@@ -382,7 +386,13 @@ NdbIndexStatImpl::create_systables(Ndb*
     return -1;
   }
 
-  NdbDictionary::Dictionary* const dic = ndb->getDictionary();
+  NdbDictionary::Dictionary* const dic = sys.m_dic;
+
+  if (dic->beginSchemaTrans() == -1)
+  {
+    setError(dic->getNdbError().code, __LINE__);
+    return -1;
+  }
 
   {
     NdbDictionary::Table tab;
@@ -406,6 +416,19 @@ NdbIndexStatImpl::create_systables(Ndb*
     NdbDictionary::Table tab;
     if (make_sampletable(tab) == -1)
       return -1;
+
+#ifdef VM_TRACE
+    // test of schema trans
+    {
+      const char* p = NdbEnv_GetEnv("NDB_INDEX_STAT_ABORT_SYS_CREATE", (char*)0, 0);
+      if (p != 0 && strchr("1Y", p[0]) != 0)
+      {
+        setError(9999, __LINE__);
+        return -1;
+      }
+    }
+#endif
+
     if (dic->createTable(tab) == -1)
     {
       setError(dic->getNdbError().code, __LINE__);
@@ -438,6 +461,12 @@ NdbIndexStatImpl::create_systables(Ndb*
     }
   }
 
+  if (dic->endSchemaTrans() == -1)
+  {
+    setError(dic->getNdbError().code, __LINE__);
+    return -1;
+  }
+
   return 0;
 }
 
@@ -450,7 +479,13 @@ NdbIndexStatImpl::drop_systables(Ndb* nd
       m_error.code != BadSysTables)
     return -1;
 
-  NdbDictionary::Dictionary* const dic = ndb->getDictionary();
+  NdbDictionary::Dictionary* const dic = sys.m_dic;
+
+  if (dic->beginSchemaTrans() == -1)
+  {
+    setError(dic->getNdbError().code, __LINE__);
+    return -1;
+  }
 
   if (sys.m_headtable != 0)
   {
@@ -463,12 +498,31 @@ NdbIndexStatImpl::drop_systables(Ndb* nd
 
   if (sys.m_sampletable != 0)
   {
+
+#ifdef VM_TRACE
+    // test of schema trans
+    {
+      const char* p = NdbEnv_GetEnv("NDB_INDEX_STAT_ABORT_SYS_DROP", (char*)0, 0);
+      if (p != 0 && strchr("1Y", p[0]) != 0)
+      {
+        setError(9999, __LINE__);
+        return -1;
+      }
+    }
+#endif
+
     if (dic->dropTableGlobal(*sys.m_sampletable) == -1)
     {
       setError(dic->getNdbError().code, __LINE__);
       return -1;
     }
   }
+
+  if (dic->endSchemaTrans() == -1)
+  {
+    setError(dic->getNdbError().code, __LINE__);
+    return -1;
+  }
     
   return 0;
 }


Attachment: [text/bzr-bundle] bzr/pekka.nousiainen@oracle.com-20110612165159-tyspq1d3zmetrbsp.bundle
Thread
bzr commit into mysql-5.1-telco-7.0-wl4124-new0 branch(pekka.nousiainen:4395) WL#4124Pekka Nousiainen13 Jun