summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <mskold/marty@mysql.com/linux.site>2006-08-15 15:58:02 +0200
committerunknown <mskold/marty@mysql.com/linux.site>2006-08-15 15:58:02 +0200
commit80684559c830da260676f56f11d931edc9d7cb82 (patch)
tree751716d3debd964059afee035dc1ccbf70c05b6f /sql
parentf2e1358bf6d847c102f428653462065b2771f36d (diff)
parent87b7363c5ca7dc0f1165a9460cbfd28b0ff23a61 (diff)
downloadmariadb-git-80684559c830da260676f56f11d931edc9d7cb82.tar.gz
Merge mskold@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/windows/Linux_space/MySQL/mysql-4.1
Diffstat (limited to 'sql')
-rw-r--r--sql/ha_ndbcluster.cc34
-rw-r--r--sql/ha_ndbcluster.h2
2 files changed, 36 insertions, 0 deletions
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 10240e597bf..e4c20de2390 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -161,6 +161,7 @@ int execute_no_commit(ha_ndbcluster *h, NdbConnection *trans)
if (m_batch_execute)
return 0;
#endif
+ h->release_completed_operations(trans);
return trans->execute(NoCommit,AbortOnError,h->m_force_send);
}
@@ -194,6 +195,7 @@ int execute_no_commit_ie(ha_ndbcluster *h, NdbConnection *trans)
if (m_batch_execute)
return 0;
#endif
+ h->release_completed_operations(trans);
return trans->execute(NoCommit, AO_IgnoreError,h->m_force_send);
}
@@ -2747,6 +2749,25 @@ int ha_ndbcluster::close_scan()
if (!cursor)
DBUG_RETURN(1);
+ if (m_lock_tuple)
+ {
+ /*
+ Lock level m_lock.type either TL_WRITE_ALLOW_WRITE
+ (SELECT FOR UPDATE) or TL_READ_WITH_SHARED_LOCKS (SELECT
+ LOCK WITH SHARE MODE) and row was not explictly unlocked
+ with unlock_row() call
+ */
+ NdbOperation *op;
+ // Lock row
+ DBUG_PRINT("info", ("Keeping lock on scanned row"));
+
+ if (!(op= m_active_cursor->lockTuple()))
+ {
+ m_lock_tuple= false;
+ ERR_RETURN(trans->getNdbError());
+ }
+ m_ops_pending++;
+ }
m_lock_tuple= false;
if (m_ops_pending)
{
@@ -5350,6 +5371,19 @@ int ha_ndbcluster::write_ndb_file()
DBUG_RETURN(error);
}
+void
+ha_ndbcluster::release_completed_operations(NdbConnection *trans)
+{
+ if (trans->hasBlobOperation())
+ {
+ /* We are reading/writing BLOB fields,
+ releasing operation records is unsafe
+ */
+ return;
+ }
+ trans->releaseCompletedOperations();
+}
+
int
ndbcluster_show_status(THD* thd)
{
diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h
index 313e497f9b5..4a53b4007fe 100644
--- a/sql/ha_ndbcluster.h
+++ b/sql/ha_ndbcluster.h
@@ -262,6 +262,8 @@ class ha_ndbcluster: public handler
void no_uncommitted_rows_init(THD *);
void no_uncommitted_rows_reset(THD *);
+ void release_completed_operations(NdbConnection*);
+
friend int execute_no_commit(ha_ndbcluster*, NdbConnection*);
friend int execute_commit(ha_ndbcluster*, NdbConnection*);
friend int execute_no_commit_ie(ha_ndbcluster*, NdbConnection*);