Commit 6829605c authored by unknown's avatar unknown

fix to make transaction failure also affect select count() on other tables in thread

parent 0deb4c41
...@@ -147,6 +147,7 @@ Thd_ndb::Thd_ndb() ...@@ -147,6 +147,7 @@ Thd_ndb::Thd_ndb()
ndb= new Ndb(g_ndb_cluster_connection, ""); ndb= new Ndb(g_ndb_cluster_connection, "");
lock_count= 0; lock_count= 0;
count= 0; count= 0;
error= 0;
} }
Thd_ndb::~Thd_ndb() Thd_ndb::~Thd_ndb()
...@@ -179,6 +180,11 @@ void ha_ndbcluster::records_update() ...@@ -179,6 +180,11 @@ void ha_ndbcluster::records_update()
info->records= rows; info->records= rows;
} }
} }
{
THD *thd= current_thd;
if (((Thd_ndb*)(thd->transaction.thd_ndb))->error)
info->no_uncommitted_rows_count= 0;
}
records= info->records+ info->no_uncommitted_rows_count; records= info->records+ info->no_uncommitted_rows_count;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -186,8 +192,8 @@ void ha_ndbcluster::records_update() ...@@ -186,8 +192,8 @@ void ha_ndbcluster::records_update()
void ha_ndbcluster::no_uncommitted_rows_execute_failure() void ha_ndbcluster::no_uncommitted_rows_execute_failure()
{ {
DBUG_ENTER("ha_ndbcluster::no_uncommitted_rows_execute_failure"); DBUG_ENTER("ha_ndbcluster::no_uncommitted_rows_execute_failure");
struct Ndb_table_local_info *info= (struct Ndb_table_local_info *)m_table_info; THD *thd= current_thd;
info->no_uncommitted_rows_count= 0; ((Thd_ndb*)(thd->transaction.thd_ndb))->error= 1;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -223,6 +229,7 @@ void ha_ndbcluster::no_uncommitted_rows_reset(THD *thd) ...@@ -223,6 +229,7 @@ void ha_ndbcluster::no_uncommitted_rows_reset(THD *thd)
{ {
DBUG_ENTER("ha_ndbcluster::no_uncommitted_rows_reset"); DBUG_ENTER("ha_ndbcluster::no_uncommitted_rows_reset");
((Thd_ndb*)(thd->transaction.thd_ndb))->count++; ((Thd_ndb*)(thd->transaction.thd_ndb))->count++;
((Thd_ndb*)(thd->transaction.thd_ndb))->error= 0;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
......
...@@ -74,6 +74,7 @@ class Thd_ndb { ...@@ -74,6 +74,7 @@ class Thd_ndb {
Ndb *ndb; Ndb *ndb;
ulong count; ulong count;
uint lock_count; uint lock_count;
int error;
}; };
class ha_ndbcluster: public handler class ha_ndbcluster: public handler
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment