List:Commits« Previous MessageNext Message »
From:stewart Date:July 16 2007 9:26am
Subject:[NDB patch 2/2] Bug#26793 I_S query crashes in NDB
View as plain text  
If ::exteral_lock hadn't been called, we'd have no transaction
set up, and performing ::info would lead to segfault.

On ::info with no active transaction, set one up and close it
at end.

It looks like sql_show.cc is the only place that does this....
or at least the other places will be well hidden.

Index: ndb-work/sql/ha_ndbcluster.cc
===================================================================
--- ndb-work.orig/sql/ha_ndbcluster.cc	2007-07-16 16:32:31.504622889 +1000
+++ ndb-work/sql/ha_ndbcluster.cc	2007-07-16 16:32:36.664916958 +1000
@@ -3251,9 +3251,16 @@ void ha_ndbcluster::position(const byte 
 int ha_ndbcluster::info(uint flag)
 {
   int result= 0;
+  bool need_unlock= false;
   DBUG_ENTER("info");
   DBUG_PRINT("enter", ("flag: %d", flag));
-  
+
+  if(!m_active_trans)
+  {
+    need_unlock= true;
+    this->external_lock(current_thd, F_RDLCK);
+  }
+
   if (flag & HA_STATUS_POS)
     DBUG_PRINT("info", ("HA_STATUS_POS"));
   if (flag & HA_STATUS_NO_LOCK)
@@ -3329,6 +3336,9 @@ int ha_ndbcluster::info(uint flag)
   if(result == -1)
     result= HA_ERR_NO_CONNECTION;
 
+  if(need_unlock)
+    this->external_lock(current_thd, F_UNLCK);
+
   DBUG_RETURN(result);
 }
 

--
Stewart Smith
Thread
[NDB patch 2/2] Bug#26793 I_S query crashes in NDBstewart16 Jul