db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From myrn...@apache.org
Subject svn commit: r1300682 - in /db/derby/code/branches/10.8: ./ java/client/org/apache/derby/client/net/ java/testing/org/apache/derbyTesting/system/nstest/ java/testing/org/apache/derbyTesting/system/nstest/init/ java/testing/org/apache/derbyTesting/system...
Date Wed, 14 Mar 2012 18:39:24 GMT
Author: myrnavl
Date: Wed Mar 14 18:39:24 2012
New Revision: 1300682

URL: http://svn.apache.org/viewvc?rev=1300682&view=rev
Log:
DERBY-5649; make improvements to nstest so it's easier to run/analyze/debug
  backport revision 1300658 from trunk.

Modified:
    db/derby/code/branches/10.8/   (props changed)
    db/derby/code/branches/10.8/java/client/org/apache/derby/client/net/NetCursor.java   (props
changed)
    db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/NsTest.java
    db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/README.txt
    db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/init/DbSetup.java
    db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/init/Initializer.java
    db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/tester/BackupRestoreReEncryptTester.java
    db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/tester/Tester1.java
    db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/tester/TesterObject.java
    db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/utils/DbUtil.java

Propchange: db/derby/code/branches/10.8/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Mar 14 18:39:24 2012
@@ -1,2 +1,2 @@
 /db/derby/code/branches/10.7:1061570,1061578,1082235
-/db/derby/code/trunk:1088633,1089795,1091000,1091221,1091285,1092067,1092795,1094315,1094572,1094728,1095247,1096741,1096890,1096991,1097247,1097249,1097460,1097469,1097471,1098033,1101059,1101839,1102620,1102826,1103681,1103718,1103742,1104365,1125305,1126358,1126468,1127825,1127883,1128243,1128942,1129136,1129764,1129797,1130077,1130084,1130632,1130895,1131030,1131272,1132546,1132664,1132747,1132860,1132928,1133304,1133317,1133741,1133752,1134139,1136363,1136371,1136397,1136844,1137213,1138201,1138341,1138444,1138787,1138795,1139449,1139451,1140222,1140744,1141924,1142583,1142635,1145057,1146644,1146915,1146962,1147219,1147242,1147335,1148344,1148354,1148429,1148658,1149054,1149090,1149270,1149482,1149662,1151101,1151612,1158108,1160593,1160597,1161208,1162737,1163131,1163616,1164358,1164370,1164495,1165221,1166313,1167017,1167226,1167470,1169692,1170470,1171227,1171665,1171672,1173446,1173647,1174436,1174646,1176633,1176636,1177589,1179374,1179546,1180790,1180858,1181756,
 1183463,1183503,1183671,1186020,1186691,1189201,1189222,1203050,1203252,1204128,1207729,1208775,1210846,1212541,1213251,1230480,1236887,1239898,1241841,1242098,1242409,1242413,1242460,1242610,1243878,1292109,1293494,1294512,1294522,1295085
+/db/derby/code/trunk:1088633,1089795,1091000,1091221,1091285,1092067,1092795,1094315,1094572,1094728,1095247,1096741,1096890,1096991,1097247,1097249,1097460,1097469,1097471,1098033,1101059,1101839,1102620,1102826,1103681,1103718,1103742,1104365,1125305,1126358,1126468,1127825,1127883,1128243,1128942,1129136,1129764,1129797,1130077,1130084,1130632,1130895,1131030,1131272,1132546,1132664,1132747,1132860,1132928,1133304,1133317,1133741,1133752,1134139,1136363,1136371,1136397,1136844,1137213,1138201,1138341,1138444,1138787,1138795,1139449,1139451,1140222,1140744,1141924,1142583,1142635,1145057,1146644,1146915,1146962,1147219,1147242,1147335,1148344,1148354,1148429,1148658,1149054,1149090,1149270,1149482,1149662,1151101,1151612,1158108,1160593,1160597,1161208,1162737,1163131,1163616,1164358,1164370,1164495,1165221,1166313,1167017,1167226,1167470,1169692,1170470,1171227,1171665,1171672,1173446,1173647,1174436,1174646,1176633,1176636,1177589,1179374,1179546,1180790,1180858,1181756,
 1183463,1183503,1183671,1186020,1186691,1189201,1189222,1203050,1203252,1204128,1207729,1208775,1210846,1212541,1213251,1230480,1236887,1239898,1241841,1242098,1242409,1242413,1242460,1242610,1243878,1292109,1293494,1294512,1294522,1295085,1300658

Propchange: db/derby/code/branches/10.8/java/client/org/apache/derby/client/net/NetCursor.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Mar 14 18:39:24 2012
@@ -1,2 +1,2 @@
 /db/derby/code/branches/10.7/java/client/org/apache/derby/client/net/NetCursor.java:1061570,1061578,1082235
-/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetCursor.java:1063809,1088633,1089795,1091000,1091221,1091285,1092067,1092795,1094315,1094572,1094728,1095247,1096741,1096890,1096991,1097247,1097249,1097460,1097469,1097471,1098033,1101059,1101839,1102620,1102826,1103681,1103718,1103742,1104365,1125305,1126358,1126468,1127825,1127883,1128243,1128942,1129136,1129764,1129797,1130077,1130084,1130632,1130895,1131030,1131272,1132546,1132664,1132747,1132860,1132928,1133304,1133317,1133741,1133752,1134139,1136363,1136371,1136397,1136844,1137213,1138201,1138341,1138444,1138787,1138795,1139449,1139451,1140222,1140744,1141924,1142583,1142635,1145057,1145961,1146644,1146915,1146962,1147219,1147242,1147335,1148344,1148354,1148429,1148658,1149054,1149090,1149270,1149482,1149662,1151101,1151612,1158108,1160593,1160597,1161208,1162737,1163131,1163616,1164358,1164370,1164495,1165221,1167017,1167470,1169692,1171665,1171672,1173647,1174436,1176633,1176636,1177589,1179374,1179546,1
 180790,1180858,1181756,1183463,1183671,1186020,1186691,1203252,1210846,1213251,1230480,1239898,1241841,1242098,1242409,1242413,1242460,1243878,1292109,1294512,1294522,1295085
+/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetCursor.java:1063809,1088633,1089795,1091000,1091221,1091285,1092067,1092795,1094315,1094572,1094728,1095247,1096741,1096890,1096991,1097247,1097249,1097460,1097469,1097471,1098033,1101059,1101839,1102620,1102826,1103681,1103718,1103742,1104365,1125305,1126358,1126468,1127825,1127883,1128243,1128942,1129136,1129764,1129797,1130077,1130084,1130632,1130895,1131030,1131272,1132546,1132664,1132747,1132860,1132928,1133304,1133317,1133741,1133752,1134139,1136363,1136371,1136397,1136844,1137213,1138201,1138341,1138444,1138787,1138795,1139449,1139451,1140222,1140744,1141924,1142583,1142635,1145057,1145961,1146644,1146915,1146962,1147219,1147242,1147335,1148344,1148354,1148429,1148658,1149054,1149090,1149270,1149482,1149662,1151101,1151612,1158108,1160593,1160597,1161208,1162737,1163131,1163616,1164358,1164370,1164495,1165221,1167017,1167470,1169692,1171665,1171672,1173647,1174436,1176633,1176636,1177589,1179374,1179546,1
 180790,1180858,1181756,1183463,1183671,1186020,1186691,1203252,1210846,1213251,1230480,1239898,1241841,1242098,1242409,1242413,1242460,1243878,1292109,1294512,1294522,1295085,1300658

Modified: db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/NsTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/NsTest.java?rev=1300682&r1=1300681&r2=1300682&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/NsTest.java
(original)
+++ db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/NsTest.java
Wed Mar 14 18:39:24 2012
@@ -78,7 +78,6 @@ public class NsTest extends Thread {
 			+ ";create=true");
 
 	public static boolean embeddedMode = false; // true is to run the test in
-
 	// embedded mode
 
 	public static final String driver = new String(
@@ -104,52 +103,32 @@ public class NsTest extends Thread {
 	public static String RESTOREDIR = "restoredir";
 
 	public static boolean START_SERVER_IN_SAME_VM = false;// If the server
-
-	// also needs to be
-	// started as a
-	// thread
+	// also needs to be started as a thread
 
 	public static boolean AUTO_COMMIT_OFF = false; // true is autocommit off
 
 	public static boolean CREATE_DATABASE_ONLY = false;
 
 	public static boolean schemaCreated = false; // initially schema is
-
 	// assumed to not exist
 
-	// *********Uncomment this block for a small test scenario, comment it for
-	// full testing
-	/*
-	 * public static int INIT_THREADS = 3; //keep this low to avoid deadlocks
-	 * public static int MAX_INITIAL_ROWS = 150; //for a small test public
-	 * static int MAX_ITERATIONS = 50; //for a small test public static int
-	 * MAX_LOW_STRESS_ROWS = 10; //for a small test public static int
-	 * MAX_OPERATIONS_PER_CONN = 10; //for a small test public static int
-	 * NUMTESTER1 = 3; //for a small test public static int NUMTESTER2 = 4;
-	 * //for a small test public static int NUMTESTER3 = 3; //for a small test
-	 * public static int NUM_HIGH_STRESS_ROWS = 20; //for a small test public
-	 * static int NUM_UNTOUCHED_ROWS = 50; //for a small test
-	 */
-	// ***End of small test scenario block
-	// ****Comment this block for a small test scenario, uncomment it for full
-	// testing
+	// Default configuration; can be overwritten by
+	// adding the argument 'small' to the call of this class - 
+	// see setSmallConfig()
 	public static int INIT_THREADS = 6; // keep this low to avoid deadlocks
 
 	// public static int MAX_INITIAL_ROWS = 60000; //for network server mode
 	public static int MAX_INITIAL_ROWS = 6000; // for network server mode
 
 	public static int MAX_ITERATIONS = 2000; // Each client does these many
-
 	// transactions in the test.
 
 	// for network server mode
 	public static int MAX_LOW_STRESS_ROWS = 30; // num of rows worked over in a
-
 	// transaction
 
 	// for network server mode
 	public static int MAX_OPERATIONS_PER_CONN = 25; // num of transaction
-
 	// batches made by a client
 
 	// before closing the connection
@@ -212,6 +191,18 @@ public class NsTest extends Thread {
 	public static String driver_type = null;
 
 	private int type;
+    
+	private static NsTest[] testThreads = null;
+
+	public static int numActiveTestThreads() {
+		int activeThreadCount=0;
+		for (int i = 0; i < testThreads.length ; i++)
+		{
+			if (testThreads[i] != null && testThreads[i].isAlive())
+			activeThreadCount++;
+		}
+		return activeThreadCount;
+	}
 
 	public static synchronized void addStats(int type, int addValue) {
 		switch (type) {
@@ -254,6 +245,20 @@ public class NsTest extends Thread {
 			this.setName("Thread " + k);
 	}
 
+	private static void setSmallConfig() {
+        
+		INIT_THREADS = 3; //keep this low to avoid deadlocks
+		MAX_INITIAL_ROWS = 150; //for a small test public
+		MAX_ITERATIONS = 50; //for a small test public static int
+		MAX_LOW_STRESS_ROWS = 10; //for a small test public static int
+		MAX_OPERATIONS_PER_CONN = 10; //for a small test public static int
+		NUMTESTER1 = 3; //for a small test 
+		NUMTESTER2 = 4;//for a small test
+		NUMTESTER3 = 3; //for a small test
+		NUM_HIGH_STRESS_ROWS = 20; //for a small test public
+		NUM_UNTOUCHED_ROWS = 50; //for a small test
+	}
+    
 	// ****************************************************************************
 	//
 	// main - will load the Derby embedded or client, invoke the
@@ -265,7 +270,7 @@ public class NsTest extends Thread {
 	InterruptedException, Exception, Throwable {
 
 		Connection conn = null;
-		if (args.length == 1) {
+		if (args.length >= 1) {
 			driver_type = args[0];
 			if (!((driver_type.equalsIgnoreCase("DerbyClient"))
 					|| (driver_type
@@ -278,7 +283,15 @@ public class NsTest extends Thread {
 		} else {
 			driver_type = "DerbyClient";
 		}
-
+		if (args.length >= 2) {
+		String testConfiguration = args [1];
+		if (testConfiguration.equalsIgnoreCase("small"))
+		{
+			System.out.println("using small config");
+			setSmallConfig();
+		}    
+	}
+        
 		// Load the driver and get a connection to the database
 		String jdbcUrl = "";
 		try {
@@ -352,22 +365,17 @@ public class NsTest extends Thread {
 		mc.start();
 
 		// Now populate the tables using INIT_THREADS number of threads only if
-		// the schemaCreated
-		// flag has not been set. If so, then we assume that some other thread
-		// from possibly
-		// another jvm reached here and has already created the schema and
-		// loaded the tables.
+		// the schemaCreated flag has not been set. If so, then we assume that 
+		// some other thread from possibly another jvm reached here and has
+		// already created the schema and loaded the tables.
 		// Note that we kick off threads of this object type (nstest) and use
-		// the run method to
-		// do the work. The key to starting the init threads is the use of the
-		// constructor
-		// to indicate to the thread that it is an init thread. In this case, we
-		// pass the
-		// value INIT to the constructor and in the run method we go to the
-		// right section of the
+		// the run method to do the work. The key to starting the init threads
+		// is the use of the constructor to indicate to the thread that it is
+		// an init thread. In this case, we pass the value INIT to the
+		// constructor and in the run method we go to the right section of the
 		// code based on what value is passed in. The other possible value that
-		// a thread can get
-		// is TESTER which indicates that these are the main test threads.
+		// a thread can get is TESTER which indicates that these are the main 
+		// test threads.
 
 		if (NsTest.schemaCreated == false) {
 			// Table was created by this object, so we need to load it
@@ -395,9 +403,8 @@ public class NsTest extends Thread {
 			.println("Schema has already been created by another process!");
 
 		// The following 2 lines are used when you want to only create the test
-		// database that can be
-		// used as a reference so that subsequent tests do not need to create
-		// one of their own.
+		// database that can be used as a reference so that subsequent tests do
+		// not need to create one of their own.
 		// The CREATE_DATABASE_ONLY FLAG is set with the rest of the flags
 		if (CREATE_DATABASE_ONLY) {
 			System.out
@@ -412,15 +419,14 @@ public class NsTest extends Thread {
 		// Table was created by some other object, so we assume it is already
 		// loaded
 		// Now kick off the actual test threads that will do the work for us.
-		// Note that we use
-		// the value TESTER when initializing the threads.
+		// Note that we use the value TESTER when initializing the threads.
 		// The total number of threads is NUMTESTER1+NUMTESTER2+NUMTESTER3
 		System.out
 		.println("Kicking off test threads that will work over the test table");
 
 		int numTestThread = 0;
 		int maxTestThreads = 1 + NUMTESTER1 + NUMTESTER2 + NUMTESTER3;
-		NsTest testThreads[] = new NsTest[maxTestThreads];
+		testThreads = new NsTest[maxTestThreads];
 
 		// This loop is made of 3 subloops that will initialize the required
 		// amount of tester threads
@@ -460,7 +466,7 @@ public class NsTest extends Thread {
 
 		}
 
-		// Wait for the init threads to finish and join back
+		// Wait for the test threads to finish and join back
 		for (int j = 0; j < maxTestThreads; j++) {
 			System.out.println("Waiting for thread " + j
 					+ " to join back/finish");
@@ -484,11 +490,11 @@ public class NsTest extends Thread {
 		System.out.println("	Number of failed DELETES = " + numFailedDeletes);
 		System.out.println("	Number of failed SELECTS = " + numFailedSelects);
 		System.out.println("");
-		System.out.println("  Note that this may not be the same as the server side connections
made "
+		System.out.println("  Note that this may not be the same as the server side connections
made\n"
 				+ "   to the database especially if connection pooling is employed");
 		System.out.println("");
 		System.out
-		.println("NOTE: Failing operations could be because of locking issue that are "
+		.println("NOTE: Failing operations could be because of locking issue that are\n"
 				+ "directly related to the application logic.  They are not necessarily bugs.");
 
 		// Finally also stop the memory checker thread
@@ -503,16 +509,14 @@ public class NsTest extends Thread {
 	// ****************************************************************************
 	//
 	// run() - the main workhorse method of the threads that will either
-	// initialize
-	// the table data or work over it as part of the test process.
+	// initialize the table data or work over it as part of the test process.
 	// Table data initialization threads are of the following type
 	// Initializer -
 	// Bulk Insert client type that deals with a large(stress)
 	// number of rows with the connection being closed after the insert.
 	// Max rows inserted is based on the parameter MAX_INITIAL_ROWS
 	// Note that the run method will also instantiate tester objects of
-	// different
-	// types based on the following criteria
+	// different types based on the following criteria
 	// Tester1 -
 	// The connection to the database is open forever. This client
 	// will do Insert/Update/Delete and simple Select queries over

Modified: db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/README.txt
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/README.txt?rev=1300682&r1=1300681&r2=1300682&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/README.txt
(original)
+++ db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/README.txt
Wed Mar 14 18:39:24 2012
@@ -66,7 +66,7 @@ variable settings used in the test are s
 HOW TO RUN:
 ===========
 Usage:
-java org.apache.derbyTesting.system.nstest.NsTest DerbyClient|Embedded
+java org.apache.derbyTesting.system.nstest.NsTest DerbyClient|Embedded [small]
 
 The main class to invoke is org.apache.derbyTesting.system.nstest.NsTest. This class
 takes a String argument of "DerbyClient"/"Embedded", default is DerbyClient. The test requires
@@ -78,6 +78,10 @@ useful for a small test setup.
 To turn off Backup/Restore/Re-Encryption, set the System property 'derby.nstest.backupRestore'
 to 'false', default is 'true'.
 
+To run the test can be run with a smaller configuration, add the parameter 'small'. This
+can only be used as the 2nd parameter, so you'll need to add DerbyClient or Embedded 
+as the first parameter, then add small as the second.
+
 EXIT CRITERIA
 =============
 
@@ -109,9 +113,14 @@ always started.
 KNOWN ISSUES:
 =============
 
-With the addition of the Backup/Restore/Re-Encryption thread, long runs of this test are
blocked
-by:
-DERBY-1947 - OOM after repeated calls to boot and shutdown a database
+EXPECTED ERRORS:
+================
+The test expects and catches the following errors (so seeing them in derby.log is expected):
+- XBM06; see BackupRestoreReEncryptTester.java - trying to access restored db with old encryption
pwd:
+    ERROR XBM06: Startup failed. An encrypted database cannot be accessed without the correct
boot password.
+- XJ040; see BackupRestoreReEncryptTester.java - the sqlstate is not always available in
derby.log, but
+    you'll see the message:  
+java.sql.SQLException: Failed to start database 'restoredir\nstestdb' with class loader sun.misc.Launcher$AppClassLoader@40614061,
see the next exception for details.
 
 FUTURE WORK:
 ============

Modified: db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/init/DbSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/init/DbSetup.java?rev=1300682&r1=1300681&r2=1300682&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/init/DbSetup.java
(original)
+++ db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/init/DbSetup.java
Wed Mar 14 18:39:24 2012
@@ -60,8 +60,7 @@ public class DbSetup {
 				System.out.println("table 'NSTESTTAB' already exists");
 				finished = true;
 				NsTest.schemaCreated = true; // indicates to other classes
-				// that the schema already
-				// exists
+				// that the schema already exists
 			}
 		} catch (Exception e) {
 			System.out

Modified: db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/init/Initializer.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/init/Initializer.java?rev=1300682&r1=1300681&r2=1300682&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/init/Initializer.java
(original)
+++ db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/init/Initializer.java
Wed Mar 14 18:39:24 2012
@@ -49,8 +49,7 @@ public class Initializer {
 		int insertsRemaining = NsTest.MAX_INITIAL_ROWS;
 
 		// The JDBC driver should have been loaded by nstest.java at this
-		// point, we just need
-		// to get a connection to the database
+		// point, we just need to get a connection to the database
 		try {
 
 			System.out.println(thread_id
@@ -91,8 +90,8 @@ public class Initializer {
 		while (insertsRemaining-- >= 0) {
 			try {
 				int numInserts = dbutil.add_one_row(conn, thread_id);
-				System.out.println("Intializer.java: exited add_one_row: "
-						+ numInserts + " rows");
+				//System.out.println("Intializer.java: exited add_one_row: "
+				//		+ numInserts + " rows");
 			} catch (Exception e) {
 				System.out.println(" FAIL: " + thread_id
 						+ " unexpected exception:");

Modified: db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/tester/BackupRestoreReEncryptTester.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/tester/BackupRestoreReEncryptTester.java?rev=1300682&r1=1300681&r2=1300682&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/tester/BackupRestoreReEncryptTester.java
(original)
+++ db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/tester/BackupRestoreReEncryptTester.java
Wed Mar 14 18:39:24 2012
@@ -71,13 +71,12 @@ public class BackupRestoreReEncryptTeste
 	//
 	// *********************************************************************************
 	public void startTesting() {
-
+        
 		// The following loop will be done nstest.MAX_ITERATIONS times after
 		// which we exit the thread
 		// Note that a different connection is used for each operation. The
-		// purpose of this client is
-		// to work on a large set of data as defined by the parameter
-		// NUM_HIGH_STRESS_ROWS
+		// purpose of this client is to work on a large set of data as defined 
+        // by the parameter NUM_HIGH_STRESS_ROWS
 		// This thread could be made to pause (sleep) for a bit between each
 		// iteration.
 		for (int i = 0; i < NsTest.MAX_ITERATIONS; i++) {
@@ -92,8 +91,7 @@ public class BackupRestoreReEncryptTeste
 			}
 
 			// set isolation level to Connection.TRANSACTION_READ_UNCOMMITTED to
-			// reduce number of
-			// deadlocks/lock issues
+			// reduce number of deadlocks/lock issues
 			setIsolationLevel(Connection.TRANSACTION_READ_UNCOMMITTED);
 
 			// Now select nstest.NUM_HIGH_STRESS_ROWS number of rows
@@ -138,6 +136,20 @@ public class BackupRestoreReEncryptTeste
 				log(message);
 			}
 
+            // first check if there are still active tester threads, so 
+            // we do not make backups on an unchanged db every 10 mins for
+            // the remainder of MAX_ITERATIONS.
+            if (NsTest.numActiveTestThreads() > 1)
+            {
+                log("active test threads > 1, backup will continue in 10 minutes");
+                continue;
+            }
+            else
+            {
+                log("no more test threads, finishing backup also");
+                break;
+            }
+    
 		}// end of for (int i=0;...)
 
 		System.out.println("Thread " + getThread_id() + " is now terminating");

Modified: db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/tester/Tester1.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/tester/Tester1.java?rev=1300682&r1=1300681&r2=1300682&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/tester/Tester1.java
(original)
+++ db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/tester/Tester1.java
Wed Mar 14 18:39:24 2012
@@ -45,14 +45,12 @@ public class Tester1 extends TesterObjec
 	// This starts the acutal test operations. Overrides the startTesting() of
 	// parent.
 	// Tester1 profile -
-	// The connection to the database is open forever. This client
-	// will do Insert/Update/Delete and simple Select queries over
-	// a small to medium set of data determined randomly over
-	// MAX_LOW_STRESS_ROWS rows. Autocommit is left on else too many deadlocks
-	// occur and the
-	// goal is to test the data flow and connection management of the network
-	// server,
-	// not the transaction management of the database.
+	// The connection to the database is open forever. This client will do 
+	// Insert/Update/Delete and simple Select queries over a small to medium 
+	// set of data determined randomly over MAX_LOW_STRESS_ROWS rows. 
+	// Autocommit is left on else too many deadlocks occur and the goal is to
+	// test the data flow and connection management of the network server, not
+	// the transaction management of the database.
 	//
 	// *********************************************************************************
 	public void startTesting() {
@@ -76,19 +74,16 @@ public class Tester1 extends TesterObjec
 		}
 
 		// also set isolation level to Connection.TRANSACTION_READ_UNCOMMITTED
-		// to reduce number of
-		// deadlocks
+		// to reduce number of deadlocks
 		setIsolationLevel(Connection.TRANSACTION_READ_UNCOMMITTED);
 
 		// The following loop will be done nstest.MAX_ITERATIONS times after
-		// which we exit the thread
+		// which we exit the thread.
 		// Note that the same connection is used for each operation. The
-		// connection is only closed
-		// outside the loop. Since autocommit is on, we make an interation work
-		// over
-		// MAX_LOW_STRESS_ROWS number of rows. This thread could be made to
-		// pause (sleep) for a bit
-		// between each iteration.
+		// connection is only closed outside the loop. Since autocommit is on,
+		// we make an interation work over MAX_LOW_STRESS_ROWS number of rows.
+		// This thread could be made to pause (sleep) for a bit between each
+		// iteration.
 		for (int i = 0; i < NsTest.MAX_ITERATIONS; i++) {
 
 			// Now loop through nstest.MAX_LOW_STRESS_ROWS number of times/rows
@@ -121,8 +116,8 @@ public class Tester1 extends TesterObjec
 			}
 
 			// Letting this be even though autocommit is on so that if later on
-			// if we decide to turn
-			// autocommit off, this automatically takes effect.
+			// if we decide to turn autocommit off, this automatically takes
+            // effect.
 			// commit
 			try {
 				connex.commit();

Modified: db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/tester/TesterObject.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/tester/TesterObject.java?rev=1300682&r1=1300681&r2=1300682&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/tester/TesterObject.java
(original)
+++ db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/tester/TesterObject.java
Wed Mar 14 18:39:24 2012
@@ -120,7 +120,7 @@ public class TesterObject {
 	public void closeConnection() {
 		try {
 			System.out.println(getThread_id()
-					+ " is closing it's connection to the database...");
+					+ " is closing its connection to the database...");
 			connex.close();
 		} catch (Exception e) {
 			System.out.println("FAIL: " + getThread_id()
@@ -190,15 +190,12 @@ public class TesterObject {
 	// This method will do a basic Select operation based on the following
 	// criteria
 	// The query should return approximately nstest.MAX_LOW_STRESS number of
-	// rows that we
-	// loop through via a result set and perform operations (getXX calls) in
-	// order to ensure
-	// that data flows properly. The method will
-	// return the total number of rows selected. Note that we do not touch rows
-	// with serialkey
-	// less than nstest.NUM_UNTOUCHED_ROWS, and the selects will be based on the
-	// parameter passed
-	// in, viz numRowsToSelect which is <= nstest.NUM_UNTOUCHED_ROWS
+	// rows that we loop through via a result set and perform operations 
+	// (getXX calls) in order to ensure that data flows properly. The method 
+	// will return the total number of rows selected. Note that we do not touch
+	// rows with serialkey less than nstest.NUM_UNTOUCHED_ROWS, and the selects
+	// will be based on the parameter passed in, viz numRowsToSelect which is
+	// <= nstest.NUM_UNTOUCHED_ROWS
 	//
 	// *******************************************************************************************
 	public int doSelectOperation(int numRowsToSelect) throws SQLException {
@@ -231,11 +228,10 @@ public class TesterObject {
 		}
 
 		if (rSet != null) {
-		    // Now work over the returned ResultSet and keep track of number of rows
-		    // returned
+		    // Now work over the returned ResultSet and keep track of number of
+		    // rows returned
 		    // We execute the getXXX methods on each of the selected columns so that
-		    // data flow out
-		    // from the network server is also tested.
+		    // data flow out from the network server is also tested.
 		    try {
 		        while (rSet.next()) {
 		            // get value of column id
@@ -302,7 +298,7 @@ public class TesterObject {
 		    }
 		}
 
-		// close the ResultSet and statement and release it's resources.
+		// close the ResultSet and statement and release its resources.
 		try {
 			if ((rSet != null) && (s != null)) {
 				rSet.close();
@@ -326,23 +322,18 @@ public class TesterObject {
 	public void startTesting() {
 
 		// This method needs to be overridden by the child classes in order for
-		// a Tester to
-		// be able to do work. The specifics such as how often the connection is
-		// opened and
-		// closed and how many transactions are done etc etc which form
-		// individual test cases or
-		// sorts are left to the child class to implement in their overridden
-		// version of this
-		// method
+		// a Tester to be able to do work. The specifics such as how often the
+		// connection is opened and closed and how many transactions are done 
+		// etc etc which form individual test cases or sorts are left to the 
+		// child class to implement in their overridden version of this method.
 
 	}// end of startTesting()
 
 	// ** This method abstracts exception message printing for all exception
-	// messages. You may want to change
-	// ****it if more detailed exception messages are desired.
+	// messages. You may want to change it if more detailed exception messages
+	// are desired.
 	// ***Method is synchronized so that the output file will contain sensible
-	// stack traces that are not
-	// ****mixed but rather one exception printed at a time
+	// stack traces that are not mixed but one exception printed at a time
 	public synchronized void printException(String where, Exception e) {
 		if (e instanceof SQLException) {
 			SQLException se = (SQLException) e;

Modified: db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/utils/DbUtil.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/utils/DbUtil.java?rev=1300682&r1=1300681&r2=1300682&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/utils/DbUtil.java
(original)
+++ db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/system/nstest/utils/DbUtil.java
Wed Mar 14 18:39:24 2012
@@ -88,10 +88,9 @@ public class DbUtil {
 		
 		try {
 			// autoincrement feature added, so we need to specify the column
-			// name
-			// for prepared statement, otherwise auto increment column will
-			// think
-			// it is trying to update/insert a null value to the column.
+			// name for prepared statement, otherwise auto increment column
+			// will think it is trying to update/insert a null value to the
+			// column.
 			
 			ps = conn
 			.prepareStatement(" insert into nstesttab (id, t_char,"
@@ -132,9 +131,6 @@ public class DbUtil {
 			// System.out.println("set t_date to " + dt.toString());
 			
 			// Set value of column "t_decimal"
-			// double t_dec = rand.nextDouble() *
-			// Math.pow(10,Math.abs(rand.nextInt()%18));
-			// double t_dec = rand.nextDouble();
 			double t_dec = rand.nextDouble()
 			* Math.pow(10, Math.abs(rand.nextInt() % 6));
 			ps.setDouble(4, t_dec);
@@ -212,13 +208,12 @@ public class DbUtil {
 			}
 			if (rowsAdded == 1) {
 				System.out.println(thread_id + " inserted 1 row with id "
-						+ id_ind + NsTest.SUCCESS);
-				
+						//+ id_ind + NsTest.SUCCESS);
+                        + id_ind);
 			} else
-				System.out.println("FAIL: " + thread_id + " insert failed");
+				System.out.println("FAIL: " + thread_id + " inserted " + rowsAdded + "rows");
 			
 		} catch (Exception e) {
-			e.printStackTrace();
 			System.out
 			.println("Exception when preparing or executing insert prepared stmt");
 			printException("executing/preparing insert stmt in dbUtil", e);
@@ -289,7 +284,7 @@ public class DbUtil {
 			break;
 			
 		case TDECIMAL:
-			d = rand.nextDouble() * Math.pow(10, rand.nextInt() % 18);
+			d = rand.nextDouble() * Math.pow(10, Math.abs(rand.nextInt() % 6));
 			ps2.setDouble(1, d);
 			ds2 = String.valueOf(d);
 			break;
@@ -364,8 +359,8 @@ public class DbUtil {
 			
 		} // end of switch(type)
 		
-		System.out.println(thread_id + " attempting  to update col " + column
-				+ " to " + ds2);
+		//System.out.println(thread_id + " attempting  to update col " + column
+		//		+ " to " + ds2);
 		try {
 			rowsUpdated = ps2.executeUpdate();
 		} catch (SQLException sqe) {
@@ -416,8 +411,8 @@ public class DbUtil {
 		}
 		
 		long skey = pick_one(conn, thread_id);
-		System.out.println(thread_id
-				+ " attempting  to delete a row with serialkey = " + skey);
+		//System.out.println(thread_id
+		//		+ " attempting  to delete a row with serialkey = " + skey);
 		if (skey == 0) { // means we did not find a row
 			System.out.println(thread_id
 					+ " could not find a row to delete or there was an error.");
@@ -491,10 +486,10 @@ public class DbUtil {
 			while (rs.next()) {
 				if (rs.getLong(1) > 0) {
 					rowToReturn = rs.getLong(1);
-					System.out
-					.println(getThreadName()
-							+ " dbutil.pick_one() -> Obtained row from the table "
-							+ rowToReturn);
+					//System.out
+					//.println(getThreadName()
+					//		+ " dbutil.pick_one() -> Obtained row from the table "
+					//		+ rowToReturn);
 				} else {
 					System.out
 					.println(getThreadName()



Mime
View raw message