List:NDB Connectors« Previous MessageNext Message »
From:Monty Taylor Date:October 11 2007 7:36am
Subject:Rev 176: Fixed updateTuple transaction takeover problem. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/ndbjmerge
View as plain text  
At http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/ndbjmerge

------------------------------------------------------------
revno: 176
revision-id: mtaylor@stripped
parent: mtaylor@stripped
committer: Monty Taylor <mtaylor@stripped>
branch nick: ndbjmerge
timestamp: Thu 2007-10-11 00:35:31 -0700
message:
  Fixed updateTuple transaction takeover problem.
modified:
  java/com/mysql/cluster/ndbj/NdbResultSet.java
ndbresultset.java-20070517181935-98huwjarzuh25b30-21
  java/com/mysql/cluster/ndbj/NdbResultSetImpl.java
ndbresultsetimpl.jav-20070517181935-98huwjarzuh25b30-22
  java/testsuite/ndbj/NdbIndexScanOperationUtf8Latin1Test.java
ndbindexscanoperatio-20070517181935-98huwjarzuh25b30-51
=== modified file 'java/com/mysql/cluster/ndbj/NdbResultSet.java'
--- a/java/com/mysql/cluster/ndbj/NdbResultSet.java	2007-10-05 19:21:07 +0000
+++ b/java/com/mysql/cluster/ndbj/NdbResultSet.java	2007-10-11 07:35:31 +0000
@@ -157,7 +157,8 @@
      * @throws NdbApiException if a problem occurred when attempting to get the next row.
      */
     public abstract boolean next() throws NdbApiException;
-
+    public abstract boolean next(boolean fetchAllowed) throws NdbApiException;
+    
     /**
      * Deletes the next row in the NdbResultSet.
      * @throws NdbApiException if a problem occurred when attempting to delete the row.

=== modified file 'java/com/mysql/cluster/ndbj/NdbResultSetImpl.java'
--- a/java/com/mysql/cluster/ndbj/NdbResultSetImpl.java	2007-10-05 19:21:07 +0000
+++ b/java/com/mysql/cluster/ndbj/NdbResultSetImpl.java	2007-10-11 07:35:31 +0000
@@ -207,6 +207,12 @@
 		return this.op.getBlobHandle(columnName);
 	}
 
+	public boolean next(boolean fetchAllowed) throws NdbApiException {
+		// TODO: Seriously - this method and the next need to be redesigned
+		int scanCheck = ((NdbScanOperation)op).nextResult(fetchAllowed);
+		
+		return (scanCheck==0);
+	}
 	/**
      * @see com.mysql.cluster.ndbj.NdbResultSet#next()
      */
@@ -226,6 +232,8 @@
 		if (NdbScanOperationImpl.class.isInstance((Object)op) ||
 				NdbIndexScanOperationImpl.class.isInstance((Object)op)) {
 
+			scanCheck = ((NdbScanOperation)op).nextResult();
+			
 			// if nextResult(false) returns scanCheck == 0, transfer the record to another
transaction.
 			// if nextResult(false) returns scanCheck == 2, execute and commit the other
transaction
 			// Following this, call nextResult(true) — this fetches more

=== modified file 'java/testsuite/ndbj/NdbIndexScanOperationUtf8Latin1Test.java'
--- a/java/testsuite/ndbj/NdbIndexScanOperationUtf8Latin1Test.java	2007-10-05 19:46:08
+0000
+++ b/java/testsuite/ndbj/NdbIndexScanOperationUtf8Latin1Test.java	2007-10-11 07:35:31
+0000
@@ -226,13 +226,16 @@
 			      AbortOption.AbortOnError,
 			      true);
 
-            while (rs.next()) {
+            while (rs.next(true)) {
+            	do {
                 NdbOperation pkOp = rs.updateRow();
-                pkOp.setString(col3, (col3Val + "_jd"));
+                pkOp.setString(col3, col3Val + "_jd"));
+                trans.execute(ExecType.Commit,
+                        AbortOption.AbortOnError,
+                        true);
+            	} while (rs.next(false));
             }
-            trans.execute(ExecType.Commit,
-                      AbortOption.AbortOnError,
-                      true);
+
 
             System.out.println("Finished update");
 			assertTrue(true);

Thread
Rev 176: Fixed updateTuple transaction takeover problem. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/ndbjmergeMonty Taylor11 Oct