List:Commits« Previous MessageNext Message »
From:Pekka Nousiainen Date:May 28 2012 12:58pm
Subject:bzr push into mysql-5.5-cluster-7.3-fk branch (pekka.nousiainen:3904 to
3905) Bug#14119592 WL#6244
View as plain text  
 3905 Pekka Nousiainen	2012-05-28
      wl#6244 bug14119592a.diff
      bug#14119592: set error to avoid mysqld crash

    modified:
      sql/ha_ndb_ddl_fk.cc
      sql/ha_ndbcluster.cc
 3904 Pekka Nousiainen	2012-05-23
      wl#6244 bug14095785a.diff
      bug#14095785: (a) fix via ha_ndb

    added:
      mysql-test/suite/ndb/r/ndb_fk_bugs.result
      mysql-test/suite/ndb/t/ndb_fk_bugs.test
    modified:
      sql/ha_ndb_ddl_fk.cc
=== modified file 'sql/ha_ndb_ddl_fk.cc'
--- a/sql/ha_ndb_ddl_fk.cc	2012-05-23 18:35:12 +0000
+++ b/sql/ha_ndb_ddl_fk.cc	2012-05-28 12:57:40 +0000
@@ -194,6 +194,8 @@ ha_ndbcluster::create_fks(THD *thd, Ndb
 {
   DBUG_ENTER("ha_ndbcluster::create_fks");
 
+  // return real mysql error to avoid total randomness..
+  const int er_default= ER_CANNOT_ADD_FOREIGN;
   char tmpbuf[FN_REFLEN];
 
   /**
@@ -236,7 +238,7 @@ ha_ndbcluster::create_fks(THD *thd, Ndb
                                                       tmpbuf, sizeof(tmpbuf)));
         if (ndbcol == 0)
         {
-          DBUG_RETURN(1); // TODO suitable error code
+          DBUG_RETURN(er_default); // TODO suitable error code
         }
         childcols[pos++]= ndbcol;
       }
@@ -251,7 +253,7 @@ ha_ndbcluster::create_fks(THD *thd, Ndb
 
     if (!child_primary_key && child_index == 0)
     {
-      DBUG_RETURN(1); // TODO suitable error code
+      DBUG_RETURN(er_default); // TODO suitable error code
     }
 
     char parent_name[FN_REFLEN];
@@ -276,7 +278,7 @@ ha_ndbcluster::create_fks(THD *thd, Ndb
                                                       tmpbuf, sizeof(tmpbuf)));
         if (ndbcol == 0)
         {
-          DBUG_RETURN(1); // TODO suitable error code
+          DBUG_RETURN(er_default); // TODO suitable error code
         }
         parentcols[pos++]= ndbcol;
       }
@@ -291,7 +293,7 @@ ha_ndbcluster::create_fks(THD *thd, Ndb
 
     if (!parent_primary_key && parent_index == 0)
     {
-      DBUG_RETURN(1); // TODO suitable error code
+      DBUG_RETURN(er_default); // TODO suitable error code
     }
 
     NdbDictionary::ForeignKey ndbfk;

=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2012-05-22 11:09:07 +0000
+++ b/sql/ha_ndbcluster.cc	2012-05-28 12:57:40 +0000
@@ -16063,12 +16063,8 @@ int ha_ndbcluster::alter_table_phase1(TH
     int res= create_fks(thd, ndb, 0);
     if (res != 0)
     {
-      const NdbError err= dict->getNdbError();
-#if MYSQL_VERSION_ID < 50501
-      set_ndb_err(thd, err);
-#endif
-      my_errno= error= ndb_to_mysql_error(&err);
-      error= ndb_to_mysql_error(&err);
+      /* dict error has been mapped already by create_fks */
+      my_errno= error= res;
       my_error(error, MYF(0), 0);
       goto abort;
     }

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.5-cluster-7.3-fk branch (pekka.nousiainen:3904 to3905) Bug#14119592 WL#6244Pekka Nousiainen28 May