List:NDB Connectors« Previous MessageNext Message »
From:Monty Taylor Date:November 17 2007 8:12pm
Subject:Rev 259: Committing Johan's changes to point out OOM problems. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/devel
View as plain text  
At http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/devel

------------------------------------------------------------
revno: 259
revision-id: mtaylor@stripped
parent: mtaylor@stripped
committer: Monty Taylor <mtaylor@stripped>
branch nick: devel
timestamp: Sat 2007-11-17 12:12:22 -0800
message:
  Committing Johan's changes to point out OOM problems.
modified:
  java/testsuite/ndbj/OutOfConnectionProblemTest.java
outofconnectionprobl-20071114201416-ycjx0i6uz5umawy0-1
=== modified file 'java/testsuite/ndbj/OutOfConnectionProblemTest.java'
--- a/java/testsuite/ndbj/OutOfConnectionProblemTest.java	2007-11-14 20:19:39 +0000
+++ b/java/testsuite/ndbj/OutOfConnectionProblemTest.java	2007-11-17 20:12:22 +0000
@@ -13,12 +13,12 @@
 	// GENERAL STUFF
 	///////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
-	static final int     NUMBER_OF_TEST_ITERATIONS    = 10000;
+	static final int     NUMBER_OF_TEST_ITERATIONS    = 1000000;
 
 	static final int     NUMBER_OF_ELEMENT_INSERTIONS = 25;
 
-	static final int     NUM_TRANSACTIONS             = 5;
-	static final int     TRANSACTIONS_TIMEOUT         = 1;
+	static final int     NUM_TRANSACTIONS             = 500;
+	static final int     TRANSACTIONS_TIMEOUT         = 10;
 	static final int     FORCE_SEND                   = 1;
 
 	///////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -54,7 +54,7 @@
 		if (!alreadySetUp) {
 			// Create required tables
 
-			createTable(PROBTABLE, "(field1 SMALLINT UNSIGNED NOT NULL, PRIMARY KEY(field1))
ENGINE=ndb PARTITION BY KEY (field1);");
+			createTable(PROBTABLE, "(field1 INT UNSIGNED NOT NULL, a integer, b integer, c
integer, d integer, e int,f integer, g integer, PRIMARY KEY(field1)) ENGINE=ndb PARTITION
BY KEY (field1);");
 
 			NdbDictionary dictionary = ndb.getDictionary();
 
@@ -81,7 +81,7 @@
 			     iteration++) {
 				generateRequestTxs(iteration);
 
-				sendPollNdb(TRANSACTIONS_TIMEOUT, NUM_TRANSACTIONS, FORCE_SEND);	
+			int x=sendPollNdb(TRANSACTIONS_TIMEOUT, NUM_TRANSACTIONS, FORCE_SEND);	
 			}
 
 			System.out.println("Performing cooldown");
@@ -102,7 +102,7 @@
 			System.out.println("End of test.");
 		}
 	}
-
+	static int cnt=0;
 	public void generateRequestTxs(int theLastBatch) throws NdbApiException {
 
 		boolean  success = false;
@@ -110,6 +110,8 @@
 		NdbOperation orderOp;
 		BaseCallback callback;
 
+		Hashtable ht= new Hashtable();
+
 		try {
 
 		    for (int elementCount = 1;
@@ -117,16 +119,23 @@
 			     elementCount++) {
 		    
 				int id = (NUMBER_OF_ELEMENT_INSERTIONS * theLastBatch) + elementCount;
-
+				cnt++;
 				trans = startCountedTransaction();
 
 				orderOp = trans.getNdbOperation(PROBTABLE);
 
 				orderOp.insertTuple();
 
-				orderOp.equalInt(PROBTABLE_FIELD1, id);
+				orderOp.equalInt(PROBTABLE_FIELD1, cnt);
+				orderOp.setInt("a", cnt);
+				orderOp.setInt("b", cnt);
+				orderOp.setInt("c", cnt);
+				orderOp.setInt("d", cnt);
+				orderOp.setInt("e", cnt);
+				orderOp.setInt("f", cnt);
+				orderOp.setInt("g", cnt);
 
-				callback = new CountingCallback(id, ndb, orderOp.resultData(), trans);
+				callback = new CountingCallback(cnt, ndb, orderOp.resultData(), trans);
 
 				trans.executeAsynchPrepare(ExecType.Commit,
 				                           callback,
@@ -164,9 +173,10 @@
 	}
 
 	class CountingCallback extends BaseCallback {
-
+		NdbTransaction t;
 	    public CountingCallback(int theCallbackNum, Ndb theNdb, NdbResultSet theResults,
NdbTransaction trans) {
 	    	super(trans);
+			t=trans;
 		}
 
 		public void callback(int theResult) {
@@ -174,7 +184,9 @@
 			//System.out.print("Callback (" + theTrans + "): ");	
 
 			//System.out.print("Transaction was " + (theTrans.isClosed() ? "closed" : "open") + "
(before close()) " );
-			theTrans.close();
+//			theTrans.close();
+				t.close();
+
 			//System.out.println("and is now " + (theTrans.isClosed() ? "closed" : "open") );
 		}
 

Thread
Rev 259: Committing Johan's changes to point out OOM problems. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/develMonty Taylor17 Nov