4239 Martin Zaun 2011-06-07 [merge]
crund - merge from ndb-7.1-dbg64
modified:
storage/ndb/test/crund/config_samples/crundClusterj.properties
storage/ndb/test/crund/config_samples/crundDerby.properties
storage/ndb/test/crund/config_samples/crundMysql.properties
storage/ndb/test/crund/config_samples/crundNdbapi.properties
storage/ndb/test/crund/config_samples/crundNdbj.properties
storage/ndb/test/crund/config_samples/crundNdbjtie.properties
storage/ndb/test/crund/config_samples/crundOpenjpaClusterj.properties
storage/ndb/test/crund/config_samples/crundOpenjpaDerby.properties
storage/ndb/test/crund/config_samples/crundOpenjpaMysql.properties
storage/ndb/test/crund/config_samples/crundRun.properties
storage/ndb/test/crund/config_samples/env.properties
storage/ndb/test/crund/src/com/mysql/cluster/crund/ClusterjLoad.java
storage/ndb/test/crund/src/com/mysql/cluster/crund/CrundDriver.java
storage/ndb/test/crund/src/com/mysql/cluster/crund/Driver.java
storage/ndb/test/crund/src/com/mysql/cluster/crund/JdbcLoad.java
storage/ndb/test/crund/src/com/mysql/cluster/crund/JpaLoad.java
storage/ndb/test/crund/src/com/mysql/cluster/crund/NdbApiLoad.java
storage/ndb/test/crund/src/com/mysql/cluster/crund/NdbJTieLoad.java
storage/ndb/test/crund/src/com/mysql/cluster/crund/NdbjLoad.java
storage/ndb/test/crund/src/com/mysql/cluster/crund/ResultProcessor.java
storage/ndb/test/crund/src/crundndb/Driver.cpp
storage/ndb/test/crund/src/crundndb/Driver.hpp
4238 Martin Zaun 2011-06-07 [merge]
merge from ndb-7.1-jtie
modified:
storage/ndb/src/ndbjtie/jtie/test/myjapi/test/MyJapiTest.java
4237 magnus.blaudd@stripped 2011-06-07 [merge]
Merge 7.0 -> 7.1
modified:
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.h
storage/ndb/src/ndbapi/NdbIndexStatImpl.cpp
=== modified file 'storage/ndb/src/ndbjtie/jtie/test/myjapi/test/MyJapiTest.java'
--- a/storage/ndb/src/ndbjtie/jtie/test/myjapi/test/MyJapiTest.java 2011-02-02 09:52:33 +0000
+++ b/storage/ndb/src/ndbjtie/jtie/test/myjapi/test/MyJapiTest.java 2011-06-07 18:35:02 +0000
@@ -331,7 +331,7 @@ public class MyJapiTest {
MyJapi.f311bb(f211bb);
assert (nf211bb == f211bb.asReadOnlyBuffer().get());
MyJapi.f311bb(MyJapi.f211bb());
- assert (nf211bb - 1 == f211bb.asReadOnlyBuffer().get());
+ assert (nf211bb != f211bb.asReadOnlyBuffer().get());
out.println("\ncalling f312bb(f212bb())");
final ByteBuffer f212bb = MyJapi.f212bb().order(ByteOrder.nativeOrder());
@@ -425,7 +425,7 @@ public class MyJapiTest {
final ByteBuffer f231bb = MyJapi.f231bb().order(ByteOrder.nativeOrder());
final byte nf231bb = f231bb.asReadOnlyBuffer().get();
MyJapi.f331bb(f231bb);
- assert (nf231bb - 1 == f231bb.asReadOnlyBuffer().get());
+ assert (nf231bb != f231bb.asReadOnlyBuffer().get());
out.println("\ncalling f332bb(f232bb())");
final ByteBuffer f232bb = MyJapi.f232bb().order(ByteOrder.nativeOrder());
@@ -904,7 +904,7 @@ public class MyJapiTest {
MyJapi.f511bb1(f411bb);
assert (nf411bb == f411bb.asReadOnlyBuffer().get());
MyJapi.f511bb1(MyJapi.f411bb1());
- assert (nf411bb - 1 == f411bb.asReadOnlyBuffer().get());
+ assert (nf411bb != f411bb.asReadOnlyBuffer().get());
out.println("\ncalling f512bb1(f412bb1())");
final ByteBuffer f412bb = MyJapi.f412bb1().order(ByteOrder.nativeOrder());
@@ -998,7 +998,7 @@ public class MyJapiTest {
final ByteBuffer f431bb = MyJapi.f431bb1().order(ByteOrder.nativeOrder());
final byte nf431bb = f431bb.asReadOnlyBuffer().get();
MyJapi.f531bb1(f431bb);
- assert (nf431bb - 1 == f431bb.asReadOnlyBuffer().get());
+ assert (nf431bb != f431bb.asReadOnlyBuffer().get());
out.println("\ncalling f532bb1(f432bb1())");
final ByteBuffer f432bb = MyJapi.f432bb1().order(ByteOrder.nativeOrder());
@@ -1072,7 +1072,7 @@ public class MyJapiTest {
MyJapi.f551bb1(f451bb);
assert (nf451bb == f451bb.asReadOnlyBuffer().get());
MyJapi.f551bb1(MyJapi.f451bb1());
- assert (nf451bb - 1 == f451bb.asReadOnlyBuffer().get());
+ assert (nf451bb != f451bb.asReadOnlyBuffer().get());
out.println("\ncalling f552bb1(f452bb1())");
final ByteBuffer f452bb = MyJapi.f452bb1().order(ByteOrder.nativeOrder());
@@ -1166,7 +1166,7 @@ public class MyJapiTest {
final ByteBuffer f471bb = MyJapi.f471bb1().order(ByteOrder.nativeOrder());
final byte nf471bb = f471bb.asReadOnlyBuffer().get();
MyJapi.f571bb1(f471bb);
- assert (nf471bb - 1 == f471bb.asReadOnlyBuffer().get());
+ assert (nf471bb != f471bb.asReadOnlyBuffer().get());
out.println("\ncalling f572bb1(f472bb1())");
final ByteBuffer f472bb = MyJapi.f472bb1().order(ByteOrder.nativeOrder());
=== modified file 'storage/ndb/test/crund/config_samples/crundClusterj.properties'
--- a/storage/ndb/test/crund/config_samples/crundClusterj.properties 2011-01-31 09:07:01 +0000
+++ b/storage/ndb/test/crund/config_samples/crundClusterj.properties 2011-06-07 14:12:24 +0000
@@ -1,4 +1,4 @@
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -13,7 +13,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
# XXX NPE with clusterj if field = null
#exclude=setVarbinary1,setVarbinary1_batch,getVarbinary1,getVarbinary1_batch,setVarbinary10,setVarbinary10_batch,getVarbinary10,getVarbinary10_batch,setVarbinary100,setVarbinary100_batch,getVarbinary100,getVarbinary100_batch
#exclude=navA->B0
=== modified file 'storage/ndb/test/crund/config_samples/crundDerby.properties'
--- a/storage/ndb/test/crund/config_samples/crundDerby.properties 2011-01-31 09:07:01 +0000
+++ b/storage/ndb/test/crund/config_samples/crundDerby.properties 2011-06-07 14:12:24 +0000
@@ -1,5 +1,4 @@
-# Copyright 2010 Sun Microsystems, Inc.
-# All rights reserved. Use is subject to license terms.
+# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,7 +13,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
# not implemented by other backends yet
#exclude=setBlob1000,getBlob1000,setBlob10000,getBlob10000,setBlob100000,getBlob100000,setText1000,getText1000,setText10000,getText10000,setText100000,getText100000
#exclude=navA->B0,navA->B0_opt
=== modified file 'storage/ndb/test/crund/config_samples/crundMysql.properties'
--- a/storage/ndb/test/crund/config_samples/crundMysql.properties 2011-01-31 09:07:01 +0000
+++ b/storage/ndb/test/crund/config_samples/crundMysql.properties 2011-06-07 14:12:24 +0000
@@ -1,4 +1,4 @@
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -13,7 +13,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
# blobs seem to work but not implemented in other backends yet
exclude=setBlob1000,setBlob1000_batch,getBlob1000,getBlob1000_batch,setBlob10000,setBlob10000_batch,getBlob10000,getBlob10000_batch,setBlob100000,setBlob100000_batch,getBlob100000,getBlob100000_batch,setText1000,setText1000_batch,getText1000,getText1000_batch,setText10000,setText10000_batch,getText10000,getText10000_batch,setText100000,setText100000_batch,getText100000,getText100000_batch
=== modified file 'storage/ndb/test/crund/config_samples/crundNdbapi.properties'
--- a/storage/ndb/test/crund/config_samples/crundNdbapi.properties 2011-01-31 09:07:01 +0000
+++ b/storage/ndb/test/crund/config_samples/crundNdbapi.properties 2011-06-07 14:12:24 +0000
@@ -1,4 +1,4 @@
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -13,7 +13,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
#exclude=navA->B0,navA->B0_forceSend,navA->B0_alt,navA->B0_alt_forceSend
#exclude=navA->B0_alt,navA->B0_alt_forceSend
#exclude=navA->B0_alt_forceSend
=== modified file 'storage/ndb/test/crund/config_samples/crundNdbj.properties'
--- a/storage/ndb/test/crund/config_samples/crundNdbj.properties 2011-01-31 09:07:01 +0000
+++ b/storage/ndb/test/crund/config_samples/crundNdbj.properties 2011-06-07 14:12:24 +0000
@@ -1,5 +1,4 @@
-# Copyright 2010 Sun Microsystems, Inc.
-# All rights reserved. Use is subject to license terms.
+# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,7 +13,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
# throws exceptions, see NdbjLoad.java
#exclude=navA->B0,navA->B0_forceSend,navA->B0_alt,navA->B0_alt_forceSend
=== modified file 'storage/ndb/test/crund/config_samples/crundNdbjtie.properties'
--- a/storage/ndb/test/crund/config_samples/crundNdbjtie.properties 2011-01-31 09:07:01 +0000
+++ b/storage/ndb/test/crund/config_samples/crundNdbjtie.properties 2011-06-07 14:12:24 +0000
@@ -1,4 +1,4 @@
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -13,7 +13,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
# XXX not yet implemented by NdbJTie
#exclude=setVarbinary1,setVarbinary1_batch,getVarbinary1,getVarbinary1_batch,setVarchar1,setVarchar1_batch,getVarchar1,getVarchar1_batch,setVarbinary10,setVarbinary10_batch,getVarbinary10,getVarbinary10_batch,setVarchar10,setVarchar10_batch,getVarchar10,getVarchar10_batch,setVarbinary100,setVarbinary100_batch,getVarbinary100,getVarbinary100_batch,setVarchar100,setVarchar100_batch,getVarchar100,getVarchar100_batch,setB0->A,setB0->A_batch,navB0->A,navB0->A_batch,navB0->A_alt,navB0->A_alt_batch,navA->B0,navA->B0_forceSend,navA->B0_alt,navA->B0_alt_forceSend,nullB0->A,nullB0->A_batch
#exclude=navA->B0,navA->B0_forceSend,navA->B0_alt,navA->B0_alt_forceSend
=== modified file 'storage/ndb/test/crund/config_samples/crundOpenjpaClusterj.properties'
--- a/storage/ndb/test/crund/config_samples/crundOpenjpaClusterj.properties 2011-01-31 09:07:01 +0000
+++ b/storage/ndb/test/crund/config_samples/crundOpenjpaClusterj.properties 2011-06-07 14:12:24 +0000
@@ -1,4 +1,4 @@
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -13,7 +13,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
#exclude=navA->B0,navA->B0_opt
#exclude=setAByPK_bulk,setB0ByPK_bulk,setAByPK,setB0ByPK,getAByPK,getB0ByPK
=== modified file 'storage/ndb/test/crund/config_samples/crundOpenjpaDerby.properties'
--- a/storage/ndb/test/crund/config_samples/crundOpenjpaDerby.properties 2011-01-31 09:07:01 +0000
+++ b/storage/ndb/test/crund/config_samples/crundOpenjpaDerby.properties 2011-06-07 14:12:24 +0000
@@ -1,5 +1,4 @@
-# Copyright 2010 Sun Microsystems, Inc.
-# All rights reserved. Use is subject to license terms.
+# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,7 +13,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
#exclude=navA->B0,navA->B0_opt
# JPA - Derby connection settings
=== modified file 'storage/ndb/test/crund/config_samples/crundOpenjpaMysql.properties'
--- a/storage/ndb/test/crund/config_samples/crundOpenjpaMysql.properties 2011-01-31 09:07:01 +0000
+++ b/storage/ndb/test/crund/config_samples/crundOpenjpaMysql.properties 2011-06-07 14:12:24 +0000
@@ -1,5 +1,4 @@
-# Copyright 2010 Sun Microsystems, Inc.
-# All rights reserved. Use is subject to license terms.
+# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,7 +13,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
#exclude=navA->B0,navA->B0_opt
# OpenJPA - MySQL JDBC connection settings
=== modified file 'storage/ndb/test/crund/config_samples/crundRun.properties'
--- a/storage/ndb/test/crund/config_samples/crundRun.properties 2011-01-31 09:07:01 +0000
+++ b/storage/ndb/test/crund/config_samples/crundRun.properties 2011-06-07 17:37:44 +0000
@@ -13,12 +13,15 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-# the benchmark's metrics: measure time, memory use
-logRealTime=true
-logCpuTime=true
-logMemUsage=false
-includeFullGC=false
-logSumOfOps=true
+# the number of warmup and finally recorded runs
+nRuns=1
+#nRuns=20
+
+# the pattern/execution modes to be run
+#xMode=
+#xMode=INDY
+#xMode=INDY,BULK
+xMode=INDY,EACH,BULK
# optional number of ops per transaction with a scale factor
#nOpsStart=4
@@ -43,6 +46,13 @@ maxVarcharChars=100
maxBlobBytes=100000
maxTextChars=100000
+# the benchmark's metrics: measure time, memory use
+logRealTime=true
+logCpuTime=true
+logMemUsage=false
+includeFullGC=false
+logSumOfOps=true
+
# whether operations or connections are to be renewed after a run
renewOperations=false
renewConnection=false
@@ -50,27 +60,22 @@ renewConnection=false
# whether data objects can be cached/reused after a transaction
allowExtendedPC=false
-# the number of warmup and finally recorded runs
-warmupRuns=0
-hotRuns=1
-#hotRuns=20
-
# CURRENT LIMITS:
#
# ndbd errors (increase SendBufferMemory) at:
-# aEnd, bEnd >= 65536
+# nOps >= 65536
#
# ndbapi@(A=16384, B=16384) fails at running out of MaxNoOfLocalOperations
# increase the correlated from default MaxNoOfConcurrentOperations=32768
# MaxNoOfConcurrentOperations=65536
#
# msqld errors with JDBC (increase MaxNoOfConcurrentOperations) at:
-# aEnd, bEnd >= 16384
+# nOps >= 16384
#
# NdbApi (driver+load) at:
-# aEnd, bEnd >= 4096:
+# nOps >= 4096:
#
-# ClusterJ breaks in navA->B0,navA->B0_opt at: aEnd, bEnd >= 4096
+# ClusterJ breaks in navA->B0,navA->B0_opt at: nOps >= 4096
# clusterj@(A=4096, B=4096) fails at MaxNoOfConcurrentTransactions=4096
# clusterj@(A=16384, B=16384) fails at MaxNoOfConcurrentTransactions=16384
#MaxNoOfConcurrentTransactions=16384
=== modified file 'storage/ndb/test/crund/config_samples/env.properties'
--- a/storage/ndb/test/crund/config_samples/env.properties 2011-01-31 09:07:01 +0000
+++ b/storage/ndb/test/crund/config_samples/env.properties 2011-06-07 14:12:24 +0000
@@ -1,4 +1,4 @@
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -11,7 +11,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# Common Configuration File included by Ant, Makefile, and Shell Scripts
@@ -37,8 +37,8 @@ HOME=/Users/mz
# no quotes (interpreted by ant):
#MYSQL_HOME=${HOME}/mysql/bin-7.1-opt32
#MYSQL_HOME=${HOME}/mysql/bin-7.1-dbg32
-MYSQL_HOME=${HOME}/mysql/bin-7.1-opt64
-#MYSQL_HOME=${HOME}/mysql/bin-7.1-dbg64
+#MYSQL_HOME=${HOME}/mysql/bin-7.1-opt64
+MYSQL_HOME=${HOME}/mysql/bin-7.1-dbg64
#MYSQL_HOME="${HOME}/bin/mysql-cluster-gpl-6.3.20"
# must match architecture of MYSQL_HOME
@@ -63,7 +63,8 @@ MYSQL_LIBEXEC="$MYSQL_HOME/libexec"
# - Martin's Little Helpers utilities (see below)
#JAVA_INCLUDEOPTS=-I"/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Headers"
-JAVA_INCLUDEOPTS=-I"/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Headers"
+#JAVA_INCLUDEOPTS=-I"/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Headers"
+JAVA_INCLUDEOPTS=-I"/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers"
#JAVA_INCLUDEOPTS=-I"/usr/lib/jvm/java-6-sun/include" -I"/usr/lib/jvm/java-6-sun/include/linux"
# Comments:
@@ -163,7 +164,7 @@ CLUSTERJPA_JAR=${MYSQL_CLUSTERJ}/share/m
# Must be set & valid for running
# - JdbcLoad on MySQL
-MYSQL_JDBC_JAR=${HOME}/mysql/lib/mysql-connector-java-5.1.11-bin.jar
+MYSQL_JDBC_JAR=${HOME}/mysql/lib/mysql-connector-java-5.1.16-bin.jar
# Comments:
# - get from here:
@@ -195,12 +196,12 @@ JPA_API_JAR=${HOME}/mysql/lib/geronimo-j
# Must be set & valid for running
# - JpaLoad on OpenJPA
-JTA_API_JAR=${HOME}/mysql/lib/geronimo-jta_1.1_spec-1.1.jar
+JTA_API_JAR=${HOME}/mysql/lib/geronimo-jta_1.1_spec-1.1.1.jar
OPENJPA_JAR=${HOME}/mysql/lib/openjpa-1.2.2.jar
SERP_JAR=${HOME}/mysql/lib/serp-1.13.1.jar
-COMMONS_LANG_JAR=${HOME}/mysql/lib/commons-lang-2.1.jar
-COMMONS_COLLECTIONS_JAR=${HOME}/mysql/lib/commons-collections-3.2.jar
-COMMONS_POOL_JAR=${HOME}/mysql/lib/commons-pool-1.3.jar
+COMMONS_LANG_JAR=${HOME}/mysql/lib/commons-lang-2.4.jar
+COMMONS_COLLECTIONS_JAR=${HOME}/mysql/lib/commons-collections-3.2.1.jar
+COMMONS_POOL_JAR=${HOME}/mysql/lib/commons-pool-1.5.3.jar
# Comments:
# - included in the binary release
=== modified file 'storage/ndb/test/crund/src/com/mysql/cluster/crund/ClusterjLoad.java'
--- a/storage/ndb/test/crund/src/com/mysql/cluster/crund/ClusterjLoad.java 2011-06-02 21:43:17 +0000
+++ b/storage/ndb/test/crund/src/com/mysql/cluster/crund/ClusterjLoad.java 2011-06-07 14:12:24 +0000
@@ -92,14 +92,9 @@ public class ClusterjLoad extends CrundD
}
@Override
- protected void init() throws Exception {
- super.init();
-
- // load native library (better diagnostics doing it explicitely)
- out.println();
- //loadSystemLibrary("ndbj");
-
- // instantiate NDB cluster singleton
+ protected void initLoad() throws Exception {
+ // XXX support generic load class
+ //super.init();
out.println();
out.print("creating SessionFactory ...");
@@ -109,7 +104,8 @@ public class ClusterjLoad extends CrundD
}
@Override
- protected void close() throws Exception {
+ protected void closeLoad() throws Exception {
+ out.println();
out.print("closing SessionFactory ...");
out.flush();
if (sessionFactory != null)
@@ -117,7 +113,8 @@ public class ClusterjLoad extends CrundD
sessionFactory = null;
out.println(" [ok]");
- super.close();
+ // XXX support generic load class
+ //super.close();
}
// ----------------------------------------------------------------------
@@ -577,19 +574,21 @@ public class ClusterjLoad extends CrundD
// ----------------------------------------------------------------------
protected void initConnection() {
- out.print("creating Session ...");
+ out.println();
+ out.print("creating ClusterJ Session ...");
out.flush();
session = sessionFactory.getSession();
- out.println(" [Session: 1]");
+ out.println(" [Session: 1]");
}
protected void closeConnection() {
- out.print("closing Session ...");
+ out.println();
+ out.print("closing ClusterJ Session ...");
out.flush();
if (session != null)
session.close();
session = null;
- out.println(" [ok]");
+ out.println(" [ok]");
}
protected void clearPersistenceContext() {
=== modified file 'storage/ndb/test/crund/src/com/mysql/cluster/crund/CrundDriver.java'
--- a/storage/ndb/test/crund/src/com/mysql/cluster/crund/CrundDriver.java 2011-01-31 09:07:01 +0000
+++ b/storage/ndb/test/crund/src/com/mysql/cluster/crund/CrundDriver.java 2011-06-07 17:37:44 +0000
@@ -22,6 +22,7 @@ package com.mysql.cluster.crund;
import java.util.Properties;
import java.util.List;
import java.util.Set;
+import java.util.EnumSet;
import java.util.HashSet;
import java.util.ArrayList;
import java.util.Date;
@@ -33,7 +34,6 @@ import java.io.IOException;
import java.io.PrintWriter;
import java.io.InputStream;
-
/**
* This class benchmarks standard database operations over a series
* of transactions on an increasing data set.
@@ -55,7 +55,10 @@ import java.io.InputStream;
*/
abstract public class CrundDriver extends Driver {
+ enum XMode { INDY, EACH, BULK }
+
// benchmark settings
+ protected final EnumSet< XMode > xMode = EnumSet.noneOf(XMode.class);
protected boolean renewConnection;
protected boolean renewOperations;
protected boolean logSumOfOps;
@@ -74,12 +77,61 @@ abstract public class CrundDriver extend
// ----------------------------------------------------------------------
protected void init() throws Exception {
+ out.println();
+ out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
+ out.println("initializing benchmark ...");
+ out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
super.init();
- // do work here
+
+/*
+ // XXX support multiple load instances
+ // initialize load classes
+ if (doJdbc) {
+ assert (jdbcLoad == null);
+ jdbcLoad = new JdbcLoad(this);
+ jdbcLoad.init();
+ }
+ if (doClusterj) {
+ assert (clusterjLoad == null);
+ clusterjLoad = new ClusterjLoad(this);
+ clusterjLoad.init();
+ }
+ if (doNdbjtie) {
+ assert (ndbjtieLoad == null);
+ ndbjtieLoad = new NdbjtieLoad(this);
+ ndbjtieLoad.init();
+ }
+*/
+ initLoad();
}
protected void close() throws Exception {
- // do work here
+ out.println();
+ out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
+ out.println("closing benchmark ...");
+ out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
+
+/*
+ // XXX support multiple load instances
+ // close load classes
+ if (doJdbc) {
+ assert (jdbcLoad != null);
+ jdbcLoad.close();
+ jdbcLoad = null;
+ }
+ if (doClusterj) {
+ assert (clusterjLoad != null);
+ clusterjLoad.close();
+ clusterjLoad = null;
+ }
+ if (doNdbjtie) {
+ assert (ndbjtieLoad != null);
+ ndbjtieLoad.close();
+ ndbjtieLoad = null;
+ }
+*/
+ closeLoad();
+
super.close();
}
@@ -91,6 +143,13 @@ abstract public class CrundDriver extend
final StringBuilder msg = new StringBuilder();
final String eol = System.getProperty("line.separator");
+ // parse execution modes
+ final String[] xm = props.getProperty("xMode", "").split(",");
+ for (int i = 0; i < xm.length; i++) {
+ if (!"".equals(xm[i]))
+ xMode.add(XMode.valueOf(XMode.class, xm[i]));
+ }
+
renewConnection = parseBoolean("renewConnection", false);
renewOperations = parseBoolean("renewOperations", false);
logSumOfOps = parseBoolean("logSumOfOps", true);
@@ -158,6 +217,7 @@ abstract public class CrundDriver extend
out.println();
out.println("crund settings ...");
+ out.println("xMode: " + xMode);
out.println("renewConnection: " + renewConnection);
out.println("renewOperations: " + renewOperations);
out.println("logSumOfOps: " + logSumOfOps);
@@ -176,6 +236,7 @@ abstract public class CrundDriver extend
// benchmark operations
// ----------------------------------------------------------------------
+ // XXX move to generic load class
// a database operation to be benchmarked
protected abstract class Op {
final protected String name;
@@ -187,6 +248,7 @@ abstract public class CrundDriver extend
public abstract void run(int nOps) throws Exception;
};
+ // XXX move to generic load class
// the list of database operations to be benchmarked
protected final List<Op> ops = new ArrayList<Op>();
@@ -195,36 +257,63 @@ abstract public class CrundDriver extend
abstract protected void closeOperations() throws Exception;
protected void runTests() throws Exception {
- out.println();
- initConnection();
- initOperations();
-
+ initConnections();
+ runLoads();
+ closeConnections();
+ }
+
+ protected void runLoads() throws Exception {
+/*
+ // XXX support multiple load instances
+ if (doJdbc)
+ runLoads(jdbcLoad);
+ if (doClusterj)
+ runLoads(clusterjLoad);
+ if (doNdbjtie)
+ runLoads(ndbjtieLoad);
+*/
+ runLoad();
+ }
+
+ protected void runLoad() throws Exception {
assert (nOpsStart <= nOpsEnd && nOpsScale > 1);
for (int i = nOpsStart; i <= nOpsEnd; i *= nOpsScale) {
try {
- runLoads(i);
+ out.println();
+ out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
+ // XXX support multiple load instances
+ //out.print("running load nOps = " + i + " on "
+ // + load.getDescriptor());
+ out.println("running load [" + i + " nOps] on " + descr);
+ out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
+ runSeries(i);
} catch (Exception ex) {
// already in rollback for database/orm exceptions
throw ex;
}
}
-
- out.println();
- out.println("------------------------------------------------------------");
- out.println();
-
- clearData();
- closeOperations();
- closeConnection();
}
- protected void runLoads(int nOps) throws Exception {
- out.println();
- out.println("------------------------------------------------------------");
+ protected void runSeries(int nOps) throws Exception {
+ if (nRuns == 0)
+ return; // nothing to do
- out.println("running operations ..."
- + " [nOps=" + nOps + "]");
+ for (int i = 1; i <= nRuns; i++) {
+ out.println();
+ out.println("------------------------------------------------------------");
+ out.println("run " + i + " of " + nRuns + " [" + nOps + " nOps]");
+ out.println("------------------------------------------------------------");
+ // XXX runLoad(load);
+ runLoad(nOps);
+ }
+
+ // XXX support multiple load instances
+ //writeLogBuffers(load.getDescriptor());
+ writeLogBuffers(descr);
+ clearLogBuffers();
+ }
+ protected void runLoad(int nOps) throws Exception {
// log buffers
if (logRealTime) {
rtimes.append(nOps);
@@ -237,6 +326,7 @@ abstract public class CrundDriver extend
// pre-run cleanup
if (renewConnection) {
+ // XXX move to generic load class?
closeOperations();
closeConnection();
initConnection();
@@ -247,7 +337,7 @@ abstract public class CrundDriver extend
}
clearData();
- runOperations(nOps);
+ runSequence(nOps);
if (logSumOfOps) {
out.println();
@@ -284,7 +374,8 @@ abstract public class CrundDriver extend
}
}
- protected void runOperations(int nOps) throws Exception {
+ // XXX move to generic load class
+ protected void runSequence(int nOps) throws Exception {
for (Op op : ops) {
// pre-tx cleanup
if (!allowExtendedPC) {
@@ -292,11 +383,12 @@ abstract public class CrundDriver extend
// any data/result caches before the next transaction
clearPersistenceContext();
}
- runOp(op, nOps);
+ runOperation(op, nOps);
}
}
- protected void runOp(Op op, int nOps) throws Exception {
+ // XXX move to generic load class
+ protected void runOperation(Op op, int nOps) throws Exception {
final String name = op.getName();
if (!exclude.contains(name)) {
begin(name);
@@ -305,6 +397,7 @@ abstract public class CrundDriver extend
}
}
+ // XXX move to generic load class
// reports an error if a condition is not met
static protected final void verify(boolean cond) {
//assert (cond);
@@ -312,6 +405,7 @@ abstract public class CrundDriver extend
throw new RuntimeException("data verification failed.");
}
+ // XXX move to generic load class
static protected final void verify(int exp, int act) {
if (exp != act)
throw new RuntimeException("data verification failed:"
@@ -319,6 +413,7 @@ abstract public class CrundDriver extend
+ ", actual = " + act);
}
+ // XXX move to generic load class
static protected final void verify(String exp, String act) {
if ((exp == null && act != null)
|| (exp != null && !exp.equals(act)))
@@ -331,6 +426,7 @@ abstract public class CrundDriver extend
// helpers
// ----------------------------------------------------------------------
+ // XXX move to generic load class
static final protected String myString(int n) {
final StringBuilder s = new StringBuilder();
switch (n) {
@@ -361,6 +457,7 @@ abstract public class CrundDriver extend
return s.toString();
}
+ // XXX move to generic load class
static final protected byte[] myBytes(String s) {
final char[] c = s.toCharArray();
final int n = c.length;
@@ -369,6 +466,7 @@ abstract public class CrundDriver extend
return b;
}
+ // XXX move to generic load class
// some string and byte constants
static final protected String string1 = myString(1);
static final protected String string2 = myString(2);
@@ -393,6 +491,63 @@ abstract public class CrundDriver extend
// datastore operations
// ----------------------------------------------------------------------
+ protected void initConnections() throws Exception {
+ out.println();
+ out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
+ out.println("initializing connections ...");
+ out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
+
+/*
+ // XXX support multiple load instances
+ if (doJdbc) {
+ assert (jdbcLoad != null);
+ jdbcLoad.initConnection();
+ }
+ if (doClusterj) {
+ assert (clusterjLoad != null);
+ clusterjLoad.initConnection();
+ }
+ if (doNdbjtie) {
+ assert (ndbjtieLoad != null);
+ ndbjtieLoad.initConnection();
+ }
+*/
+ initConnection();
+
+ // XXX move to generic load class
+ initOperations();
+ }
+
+ protected void closeConnections() throws Exception {
+ out.println();
+ out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
+ out.println("closing connections ...");
+ out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
+
+ // XXX move to generic load class
+ clearData();
+ closeOperations();
+
+ closeConnection();
+/*
+ // XXX support multiple load instances
+ if (doJdbc) {
+ assert (jdbcLoad != null);
+ jdbcLoad.closeConnection();
+ }
+ if (doClusterj) {
+ assert (clusterjLoad != null);
+ clusterjLoad.closeConnection();
+ }
+ if (doNdbjtie) {
+ assert (ndbjtieLoad != null);
+ ndbjtieLoad.closeConnection();
+ }
+*/
+ }
+
+ abstract protected void initLoad() throws Exception;
+ abstract protected void closeLoad() throws Exception;
abstract protected void initConnection() throws Exception;
abstract protected void closeConnection() throws Exception;
abstract protected void clearPersistenceContext() throws Exception;
=== modified file 'storage/ndb/test/crund/src/com/mysql/cluster/crund/Driver.java'
--- a/storage/ndb/test/crund/src/com/mysql/cluster/crund/Driver.java 2011-01-31 09:07:01 +0000
+++ b/storage/ndb/test/crund/src/com/mysql/cluster/crund/Driver.java 2011-06-07 14:12:24 +0000
@@ -70,8 +70,7 @@ abstract public class Driver {
protected boolean logRealTime;
protected boolean logMemUsage;
protected boolean includeFullGC;
- protected int warmupRuns;
- protected int hotRuns;
+ protected int nRuns;
// driver resources
protected PrintWriter log;
@@ -144,49 +143,7 @@ abstract public class Driver {
public void run() {
try {
init();
-
- if (warmupRuns > 0) {
- out.println();
- out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
- out.println("warmup runs ...");
- out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
-
- for (int i = 0; i < warmupRuns; i++) {
- runTests();
- }
-
- // truncate log file, reset log buffers
- closeLogFile();
- openLogFile();
- header = new StringBuilder();
- rtimes = new StringBuilder();
- musage = new StringBuilder();
- logHeader = true;
- }
-
- if (hotRuns > 0) {
- out.println();
- out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
- out.println("hot runs ...");
- out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
-
- for (int i = 0; i < hotRuns; i++) {
- runTests();
- }
-
- // write log buffers
- if (logRealTime) {
- log.println(descr + ", rtime[ms]"
- + header.toString() + endl
- + rtimes.toString() + endl + endl + endl);
- }
- if (logMemUsage) {
- log.println(descr + ", net musage[KiB]"
- + header.toString() + endl
- + musage.toString() + endl + endl + endl);
- }
- }
-
+ runTests();
close();
} catch (Exception ex) {
// end the program regardless of threads
@@ -251,17 +208,13 @@ abstract public class Driver {
initProperties();
printProperties();
openLogFile();
-
- // clear log buffers
- logHeader = true;
- header = new StringBuilder();
- rtimes = new StringBuilder();
- musage = new StringBuilder();
+ clearLogBuffers();
}
// releases the driver's resources.
protected void close() throws Exception {
- // clear log buffers
+ // release log buffers
+ logHeader = false;
header = null;
rtimes = null;
musage = null;
@@ -319,16 +272,10 @@ abstract public class Driver {
logMemUsage = parseBoolean("logMemUsage", false);
includeFullGC = parseBoolean("includeFullGC", false);
- warmupRuns = parseInt("warmupRuns", 0);
- if (warmupRuns < 0) {
- msg.append("[ignored] warmupRuns: " + warmupRuns + eol);
- warmupRuns = 0;
- }
-
- hotRuns = parseInt("hotRuns", 1);
- if (hotRuns < 1) {
- msg.append("[ignored] hotRuns: " + hotRuns + eol);
- hotRuns = 1;
+ nRuns = parseInt("nRuns", 1);
+ if (nRuns < 1) {
+ msg.append("[ignored] nRuns: " + nRuns + eol);
+ nRuns = 1;
}
if (msg.length() == 0) {
@@ -346,8 +293,7 @@ abstract public class Driver {
out.println("logRealTime: " + logRealTime);
out.println("logMemUsage: " + logMemUsage);
out.println("includeFullGC: " + includeFullGC);
- out.println("warmupRuns: " + warmupRuns);
- out.println("hotRuns: " + hotRuns);
+ out.println("nRuns: " + nRuns);
}
// opens the benchmark's data log file
@@ -359,6 +305,7 @@ abstract public class Driver {
// closes the benchmark's data log file
private void closeLogFile() throws IOException {
+ out.println();
out.print("closing files ...");
out.flush();
if (log != null) {
@@ -374,6 +321,30 @@ abstract public class Driver {
abstract protected void runTests() throws Exception;
+ protected void clearLogBuffers() {
+ logHeader = true;
+ header = new StringBuilder();
+ if (logRealTime) {
+ rtimes = new StringBuilder();
+ }
+ if (logMemUsage) {
+ musage = new StringBuilder();
+ }
+ }
+
+ protected void writeLogBuffers(String descr) {
+ if (logRealTime) {
+ log.println(descr + ", rtime[ms]"
+ + header.toString() + endl
+ + rtimes.toString() + endl);
+ }
+ if (logMemUsage) {
+ log.println(descr + ", net musage[KiB]"
+ + header.toString() + endl
+ + musage.toString() + endl);
+ }
+ }
+
protected void begin(String name) {
out.println();
out.println(name);
=== modified file 'storage/ndb/test/crund/src/com/mysql/cluster/crund/JdbcLoad.java'
--- a/storage/ndb/test/crund/src/com/mysql/cluster/crund/JdbcLoad.java 2011-01-31 09:07:01 +0000
+++ b/storage/ndb/test/crund/src/com/mysql/cluster/crund/JdbcLoad.java 2011-06-07 17:37:44 +0000
@@ -39,7 +39,6 @@ public class JdbcLoad extends CrundDrive
protected String url;
protected String user;
protected String password;
- protected boolean autoCommit;
// JDBC resources
protected Connection conn;
@@ -80,13 +79,6 @@ public class JdbcLoad extends CrundDrive
user = props.getProperty("jdbc.user");
password = props.getProperty("jdbc.password");
- // single ops not supported yet
- autoCommit = parseBoolean("jdbc.autoCommit", false);
- if (autoCommit) {
- msg.append("[ignored] autoCommit: " + autoCommit + eol);
- autoCommit = false;
- }
-
if (msg.length() == 0) {
out.println(" [ok]");
} else {
@@ -107,7 +99,16 @@ public class JdbcLoad extends CrundDrive
out.println("jdbc.url: " + url);
out.println("jdbc.user: \"" + user + "\"");
out.println("jdbc.password: \"" + password + "\"");
- out.println("jdbc.autoCommit: " + autoCommit);
+ }
+
+ protected void initLoad() throws Exception {
+ // XXX support generic load class
+ //super.init();
+ }
+
+ protected void closeLoad() throws Exception {
+ // XXX support generic load class
+ //super.close();
}
// ----------------------------------------------------------------------
@@ -159,62 +160,65 @@ public class JdbcLoad extends CrundDrive
out.print("initializing statements ...");
out.flush();
- for (boolean f = false, done = false; !done; done = f, f = true) {
+ for (CrundDriver.XMode m : xMode) {
// inner classes can only refer to a constant
- final boolean batch = f;
- final boolean ignore = f;
- final boolean setAttrs = true;
+ final CrundDriver.XMode mode = m;
ops.add(
- new JdbcOp("insA" + (batch ? "_batch" : ""),
+ new JdbcOp("insA_" + mode.toString().toLowerCase(),
"INSERT INTO a (id) VALUES (?)") {
public void run(int nOps) throws SQLException {
+ conn.setAutoCommit(mode == CrundDriver.XMode.INDY);
for (int i = 1; i <= nOps; i++) {
stmt.setInt(1, i);
- if (batch) {
+ if (mode == CrundDriver.XMode.BULK) {
stmt.addBatch();
} else {
int cnt = stmt.executeUpdate();
verify(cnt == 1);
}
}
- if (batch) {
+ if (mode == CrundDriver.XMode.BULK) {
int[] cnts = stmt.executeBatch();
for (int i = 0; i < cnts.length; i++) {
verify(cnts[i] == 1);
}
}
- conn.commit();
+ if (mode != CrundDriver.XMode.INDY)
+ conn.commit();
}
});
ops.add(
- new JdbcOp("insB0" + (batch ? "_batch" : ""),
+ new JdbcOp("insB0_" + mode.toString().toLowerCase(),
"INSERT INTO b0 (id) VALUES (?)") {
public void run(int nOps) throws SQLException {
+ conn.setAutoCommit(mode == CrundDriver.XMode.INDY);
for (int i = 1; i <= nOps; i++) {
stmt.setInt(1, i);
- if (batch) {
+ if (mode == CrundDriver.XMode.BULK) {
stmt.addBatch();
} else {
int cnt = stmt.executeUpdate();
verify(cnt == 1);
}
}
- if (batch) {
+ if (mode == CrundDriver.XMode.BULK) {
int[] cnts = stmt.executeBatch();
for (int i = 0; i < cnts.length; i++) {
verify(cnts[i] == 1);
}
}
- conn.commit();
+ if (mode != CrundDriver.XMode.INDY)
+ conn.commit();
}
});
ops.add(
- new JdbcOp("setAByPK" + (batch ? "_batch" : ""),
+ new JdbcOp("setAByPK_" + mode.toString().toLowerCase(),
"UPDATE a a SET a.cint = ?, a.clong = ?, a.cfloat = ?, a.cdouble = ? WHERE (a.id = ?)") {
public void run(int nOps) throws SQLException {
+ conn.setAutoCommit(mode == CrundDriver.XMode.INDY);
for (int i = 1; i <= nOps; i++) {
// refactor by numbered args
stmt.setInt(1, i);
@@ -222,27 +226,29 @@ public class JdbcLoad extends CrundDrive
stmt.setInt(3, i);
stmt.setInt(4, i);
stmt.setInt(5, i);
- if (batch) {
+ if (mode == CrundDriver.XMode.BULK) {
stmt.addBatch();
} else {
int cnt = stmt.executeUpdate();
verify(cnt == 1);
}
}
- if (batch) {
+ if (mode == CrundDriver.XMode.BULK) {
int[] cnts = stmt.executeBatch();
for (int i = 0; i < cnts.length; i++) {
verify(cnts[i] == 1);
}
}
- conn.commit();
+ if (mode != CrundDriver.XMode.INDY)
+ conn.commit();
}
});
ops.add(
- new JdbcOp("setB0ByPK" + (batch ? "_batch" : ""),
+ new JdbcOp("setB0ByPK_" + mode.toString().toLowerCase(),
"UPDATE b0 b0 SET b0.cint = ?, b0.clong = ?, b0.cfloat = ?, b0.cdouble = ? WHERE (b0.id = ?)") {
public void run(int nOps) throws SQLException {
+ conn.setAutoCommit(mode == CrundDriver.XMode.INDY);
for (int i = 1; i <= nOps; i++) {
// refactor by numbered args
stmt.setInt(1, i);
@@ -250,86 +256,63 @@ public class JdbcLoad extends CrundDrive
stmt.setInt(3, i);
stmt.setInt(4, i);
stmt.setInt(5, i);
- if (batch) {
+ if (mode == CrundDriver.XMode.BULK) {
stmt.addBatch();
} else {
int cnt = stmt.executeUpdate();
verify(cnt == 1);
}
}
- if (batch) {
+ if (mode == CrundDriver.XMode.BULK) {
int[] cnts = stmt.executeBatch();
for (int i = 0; i < cnts.length; i++) {
verify(cnts[i] == 1);
}
}
- conn.commit();
+ if (mode != CrundDriver.XMode.INDY)
+ conn.commit();
}
});
ops.add(
- new JdbcOp((batch ? "getAllA_asc" : "getAByPK"),
- "SELECT id, cint, clong, cfloat, cdouble FROM a "
- + (batch ? "ORDER BY id ASC" : "WHERE (id = ?)")) {
+ new JdbcOp("getAByPK_" + mode.toString().toLowerCase(),
+ "SELECT id, cint, clong, cfloat, cdouble FROM a WHERE (id = ?)") {
public void run(int nOps) throws SQLException {
- if (batch) {
+ conn.setAutoCommit(mode == CrundDriver.XMode.INDY);
+ for (int i = 1; i <= nOps; i++) {
+ stmt.setInt(1, i);
ResultSet rs = stmt.executeQuery();
- for (int i = 1; i <= nOps; i++) {
- rs.next();
- final int id = rs.getInt(1);
- verify(id == i);
- final int j = getCommonAttributes(rs);
- verify(j == id);
- }
+ rs.next();
+ final int id = rs.getInt(1);
+ verify(id == i);
+ final int j = getCommonAttributes(rs);
+ verify(j == id);
verify(!rs.next());
rs.close();
- } else {
- for (int i = 1; i <= nOps; i++) {
- stmt.setInt(1, i);
- ResultSet rs = stmt.executeQuery();
- rs.next();
- final int id = rs.getInt(1);
- verify(id == i);
- final int j = getCommonAttributes(rs);
- verify(j == id);
- verify(!rs.next());
- rs.close();
- }
}
- conn.commit();
+ if (mode != CrundDriver.XMode.INDY)
+ conn.commit();
}
});
ops.add(
- new JdbcOp((batch ? "getAllB0_asc" : "getB0ByPK"),
- "SELECT id, cint, clong, cfloat, cdouble FROM b0 "
- + (batch ? "ORDER BY id ASC" : "WHERE (id = ?)")) {
+ new JdbcOp("getB0ByPK_" + mode.toString().toLowerCase(),
+ "SELECT id, cint, clong, cfloat, cdouble FROM b0 WHERE (id = ?)") {
public void run(int nOps) throws SQLException {
- if (batch) {
+ conn.setAutoCommit(mode == CrundDriver.XMode.INDY);
+ for (int i = 1; i <= nOps; i++) {
+ stmt.setInt(1, i);
ResultSet rs = stmt.executeQuery();
- for (int i = 1; i <= nOps; i++) {
- rs.next();
- final int id = rs.getInt(1);
- verify(id == i);
- final int j = getCommonAttributes(rs);
- verify(j == id);
- }
+ rs.next();
+ final int id = rs.getInt(1);
+ verify(id == i);
+ final int j = getCommonAttributes(rs);
+ verify(j == id);
verify(!rs.next());
rs.close();
- } else {
- for (int i = 1; i <= nOps; i++) {
- stmt.setInt(1, i);
- ResultSet rs = stmt.executeQuery();
- rs.next();
- final int id = rs.getInt(1);
- verify(id == i);
- final int j = getCommonAttributes(rs);
- verify(j == id);
- verify(!rs.next());
- rs.close();
- }
}
- conn.commit();
+ if (mode != CrundDriver.XMode.INDY)
+ conn.commit();
}
});
@@ -338,35 +321,36 @@ public class JdbcLoad extends CrundDrive
assert l == b.length;
ops.add(
- new JdbcOp("setVarbinary" + l + (batch ? "_batch" : ""),
+ new JdbcOp("setVarbinary" + l + "_" + mode.toString().toLowerCase(),
"UPDATE b0 b0 SET b0.cvarbinary_def = ? WHERE (b0.id = ?)") {
- public void run(int nOps)
- throws SQLException {
+ public void run(int nOps) throws SQLException {
+ conn.setAutoCommit(mode == CrundDriver.XMode.INDY);
for (int i = 1; i <= nOps; i++) {
stmt.setBytes(1, b);
stmt.setInt(2, i);
- if (batch) {
+ if (mode == CrundDriver.XMode.BULK) {
stmt.addBatch();
} else {
int cnt = stmt.executeUpdate();
verify(cnt == 1);
}
}
- if (batch) {
+ if (mode == CrundDriver.XMode.BULK) {
int[] cnts = stmt.executeBatch();
for (int i = 0; i < cnts.length; i++) {
verify(cnts[i] == 1);
}
}
- conn.commit();
+ if (mode != CrundDriver.XMode.INDY)
+ conn.commit();
}
});
ops.add(
- new JdbcOp("getVarbinary" + l,
+ new JdbcOp("getVarbinary" + l + "_" + mode.toString().toLowerCase(),
"SELECT cvarbinary_def FROM b0 WHERE (id = ?)") {
- public void run(int nOps)
- throws SQLException {
+ public void run(int nOps) throws SQLException {
+ conn.setAutoCommit(mode == CrundDriver.XMode.INDY);
for (int i = 1; i <= nOps; i++) {
stmt.setInt(1, i);
ResultSet rs = stmt.executeQuery();
@@ -376,31 +360,33 @@ public class JdbcLoad extends CrundDrive
verify(!rs.next());
rs.close();
}
- conn.commit();
+ if (mode != CrundDriver.XMode.INDY)
+ conn.commit();
}
});
ops.add(
- new JdbcOp("clearVarbinary" + l + (batch ? "_batch" : ""),
+ new JdbcOp("clearVarbinary" + l + "_" + mode.toString().toLowerCase(),
"UPDATE b0 b0 SET b0.cvarbinary_def = NULL WHERE (b0.id = ?)") {
- public void run(int nOps)
- throws SQLException {
+ public void run(int nOps) throws SQLException {
+ conn.setAutoCommit(mode == CrundDriver.XMode.INDY);
for (int i = 1; i <= nOps; i++) {
stmt.setInt(1, i);
- if (batch) {
+ if (mode == CrundDriver.XMode.BULK) {
stmt.addBatch();
} else {
int cnt = stmt.executeUpdate();
verify(cnt == 1);
}
}
- if (batch) {
+ if (mode == CrundDriver.XMode.BULK) {
int[] cnts = stmt.executeBatch();
for (int i = 0; i < cnts.length; i++) {
verify(cnts[i] == 1);
}
}
- conn.commit();
+ if (mode != CrundDriver.XMode.INDY)
+ conn.commit();
}
});
}
@@ -410,35 +396,36 @@ public class JdbcLoad extends CrundDrive
assert l == s.length();
ops.add(
- new JdbcOp("setVarchar" + l + (batch ? "_batch" : ""),
+ new JdbcOp("setVarchar" + l + "_" + mode.toString().toLowerCase(),
"UPDATE b0 b0 SET b0.cvarchar_def = ? WHERE (b0.id = ?)") {
- public void run(int nOps)
- throws SQLException {
+ public void run(int nOps) throws SQLException {
+ conn.setAutoCommit(mode == CrundDriver.XMode.INDY);
for (int i = 1; i <= nOps; i++) {
stmt.setString(1, s);
stmt.setInt(2, i);
- if (batch) {
+ if (mode == CrundDriver.XMode.BULK) {
stmt.addBatch();
} else {
int cnt = stmt.executeUpdate();
verify(cnt == 1);
}
}
- if (batch) {
+ if (mode == CrundDriver.XMode.BULK) {
int[] cnts = stmt.executeBatch();
for (int i = 0; i < cnts.length; i++) {
verify(cnts[i] == 1);
}
}
- conn.commit();
+ if (mode != CrundDriver.XMode.INDY)
+ conn.commit();
}
});
ops.add(
- new JdbcOp("getVarchar" + l,
+ new JdbcOp("getVarchar" + l + "_" + mode.toString().toLowerCase(),
"SELECT cvarchar_def FROM b0 WHERE (id = ?)") {
- public void run(int nOps)
- throws SQLException {
+ public void run(int nOps) throws SQLException {
+ conn.setAutoCommit(mode == CrundDriver.XMode.INDY);
for (int i = 1; i <= nOps; i++) {
stmt.setInt(1, i);
ResultSet rs = stmt.executeQuery();
@@ -448,31 +435,33 @@ public class JdbcLoad extends CrundDrive
verify(!rs.next());
rs.close();
}
- conn.commit();
+ if (mode != CrundDriver.XMode.INDY)
+ conn.commit();
}
});
ops.add(
- new JdbcOp("clearVarchar" + l + (batch ? "_batch" : ""),
+ new JdbcOp("clearVarchar" + l + "_" + mode.toString().toLowerCase(),
"UPDATE b0 b0 SET b0.cvarchar_def = NULL WHERE (b0.id = ?)") {
- public void run(int nOps)
- throws SQLException {
+ public void run(int nOps) throws SQLException {
+ conn.setAutoCommit(mode == CrundDriver.XMode.INDY);
for (int i = 1; i <= nOps; i++) {
stmt.setInt(1, i);
- if (batch) {
+ if (mode == CrundDriver.XMode.BULK) {
stmt.addBatch();
} else {
int cnt = stmt.executeUpdate();
verify(cnt == 1);
}
}
- if (batch) {
+ if (mode == CrundDriver.XMode.BULK) {
int[] cnts = stmt.executeBatch();
for (int i = 0; i < cnts.length; i++) {
verify(cnts[i] == 1);
}
}
- conn.commit();
+ if (mode != CrundDriver.XMode.INDY)
+ conn.commit();
}
});
}
@@ -483,35 +472,36 @@ public class JdbcLoad extends CrundDrive
assert l == b.length;
ops.add(
- new JdbcOp("setBlob" + l + (batch ? "_batch" : ""),
+ new JdbcOp("setBlob" + l + "_" + mode.toString().toLowerCase(),
"UPDATE b0 b0 SET b0.cblob_def = ? WHERE (b0.id = ?)") {
- public void run(int nOps)
- throws SQLException {
+ public void run(int nOps) throws SQLException {
+ conn.setAutoCommit(mode == CrundDriver.XMode.INDY);
for (int i = 1; i <= nOps; i++) {
stmt.setBytes(1, b);
stmt.setInt(2, i);
- if (batch) {
+ if (mode == CrundDriver.XMode.BULK) {
stmt.addBatch();
} else {
int cnt = stmt.executeUpdate();
verify(cnt == 1);
}
}
- if (batch) {
+ if (mode == CrundDriver.XMode.BULK) {
int[] cnts = stmt.executeBatch();
for (int i = 0; i < cnts.length; i++) {
verify(cnts[i] == 1);
}
}
- conn.commit();
+ if (mode != CrundDriver.XMode.INDY)
+ conn.commit();
}
});
ops.add(
- new JdbcOp("getBlob" + l,
+ new JdbcOp("getBlob" + l + "_" + mode.toString().toLowerCase(),
"SELECT cblob_def FROM b0 WHERE (id = ?)") {
- public void run(int nOps)
- throws SQLException {
+ public void run(int nOps) throws SQLException {
+ conn.setAutoCommit(mode == CrundDriver.XMode.INDY);
for (int i = 1; i <= nOps; i++) {
stmt.setInt(1, i);
ResultSet rs = stmt.executeQuery();
@@ -521,7 +511,8 @@ public class JdbcLoad extends CrundDrive
verify(!rs.next());
rs.close();
}
- conn.commit();
+ if (mode != CrundDriver.XMode.INDY)
+ conn.commit();
}
});
}
@@ -533,35 +524,36 @@ public class JdbcLoad extends CrundDrive
assert l == s.length();
ops.add(
- new JdbcOp("setText" + l + (batch ? "_batch" : ""),
+ new JdbcOp("setText" + l + "_" + mode.toString().toLowerCase(),
"UPDATE b0 b0 SET b0.ctext_def = ? WHERE (b0.id = ?)") {
- public void run(int nOps)
- throws SQLException {
+ public void run(int nOps) throws SQLException {
+ conn.setAutoCommit(mode == CrundDriver.XMode.INDY);
for (int i = 1; i <= nOps; i++) {
stmt.setString(1, s);
stmt.setInt(2, i);
- if (batch) {
+ if (mode == CrundDriver.XMode.BULK) {
stmt.addBatch();
} else {
int cnt = stmt.executeUpdate();
verify(cnt == 1);
}
}
- if (batch) {
+ if (mode == CrundDriver.XMode.BULK) {
int[] cnts = stmt.executeBatch();
for (int i = 0; i < cnts.length; i++) {
verify(cnts[i] == 1);
}
}
- conn.commit();
+ if (mode != CrundDriver.XMode.INDY)
+ conn.commit();
}
});
ops.add(
- new JdbcOp("getText" + l,
+ new JdbcOp("getText" + l + "_" + mode.toString().toLowerCase(),
"SELECT ctext_def FROM b0 WHERE (id = ?)") {
- public void run(int nOps)
- throws SQLException {
+ public void run(int nOps) throws SQLException {
+ conn.setAutoCommit(mode == CrundDriver.XMode.INDY);
for (int i = 1; i <= nOps; i++) {
stmt.setInt(1, i);
ResultSet rs = stmt.executeQuery();
@@ -571,41 +563,45 @@ public class JdbcLoad extends CrundDrive
verify(!rs.next());
rs.close();
}
- conn.commit();
+ if (mode != CrundDriver.XMode.INDY)
+ conn.commit();
}
});
}
}
ops.add(
- new JdbcOp("setB0->A" + (batch ? "_batch" : ""),
+ new JdbcOp("setB0->A_" + mode.toString().toLowerCase(),
"UPDATE b0 b0 SET b0.a_id = ? WHERE (b0.id = ?)") {
public void run(int nOps) throws SQLException {
+ conn.setAutoCommit(mode == CrundDriver.XMode.INDY);
for (int i = 1; i <= nOps; i++) {
int aId = ((i - 1) % nOps) + 1;
stmt.setInt(1, aId);
stmt.setInt(2, i);
- if (batch) {
+ if (mode == CrundDriver.XMode.BULK) {
stmt.addBatch();
} else {
int cnt = stmt.executeUpdate();
verify(cnt == 1);
}
}
- if (batch) {
+ if (mode == CrundDriver.XMode.BULK) {
int[] cnts = stmt.executeBatch();
for (int i = 0; i < cnts.length; i++) {
verify(cnts[i] == 1);
}
}
- conn.commit();
+ if (mode != CrundDriver.XMode.INDY)
+ conn.commit();
}
});
ops.add(
- new JdbcOp("navB0->A_subsel",
+ new JdbcOp("navB0->A_subsel_" + mode.toString().toLowerCase(),
"SELECT id, cint, clong, cfloat, cdouble FROM a WHERE id = (SELECT b0.a_id FROM b0 b0 WHERE b0.id = ?)") {
public void run(int nOps) throws SQLException {
+ conn.setAutoCommit(mode == CrundDriver.XMode.INDY);
for (int i = 1; i <= nOps; i++) {
stmt.setInt(1, i);
ResultSet rs = stmt.executeQuery();
@@ -617,14 +613,16 @@ public class JdbcLoad extends CrundDrive
verify(!rs.next());
rs.close();
}
- conn.commit();
+ if (mode != CrundDriver.XMode.INDY)
+ conn.commit();
}
});
ops.add(
- new JdbcOp("navB0->A_joinproj",
+ new JdbcOp("navB0->A_joinproj_" + mode.toString().toLowerCase(),
"SELECT a.id, a.cint, a.clong, a.cfloat, a.cdouble FROM a a, b0 b0 WHERE (a.id = b0.a_id AND b0.id = ?)") {
public void run(int nOps) throws SQLException {
+ conn.setAutoCommit(mode == CrundDriver.XMode.INDY);
for (int i = 1; i <= nOps; i++) {
stmt.setInt(1, i);
ResultSet rs = stmt.executeQuery();
@@ -636,12 +634,13 @@ public class JdbcLoad extends CrundDrive
verify(!rs.next());
rs.close();
}
- conn.commit();
+ if (mode != CrundDriver.XMode.INDY)
+ conn.commit();
}
});
ops.add(
- new JdbcOp("navB0->A_2stmts",
+ new JdbcOp("navB0->A_2stmts_" + mode.toString().toLowerCase(),
"SELECT id, cint, clong, cfloat, cdouble FROM a WHERE id = ?") {
protected PreparedStatement stmt0;
@@ -658,6 +657,7 @@ public class JdbcLoad extends CrundDrive
}
public void run(int nOps) throws SQLException {
+ conn.setAutoCommit(mode == CrundDriver.XMode.INDY);
for (int i = 1; i <= nOps; i++) {
// fetch a.id
stmt0.setInt(1, i);
@@ -678,14 +678,16 @@ public class JdbcLoad extends CrundDrive
verify(!rs.next());
rs.close();
}
- conn.commit();
+ if (mode != CrundDriver.XMode.INDY)
+ conn.commit();
}
});
ops.add(
- new JdbcOp("navA->B0",
+ new JdbcOp("navA->B0_" + mode.toString().toLowerCase(),
"SELECT id, cint, clong, cfloat, cdouble FROM b0 WHERE (a_id = ?)") {
public void run(int nOps) throws SQLException {
+ conn.setAutoCommit(mode == CrundDriver.XMode.INDY);
int cnt = 0;
for (int i = 1; i <= nOps; i++) {
stmt.setInt(1, i);
@@ -700,146 +702,161 @@ public class JdbcLoad extends CrundDrive
rs.close();
}
verify(cnt == nOps);
- conn.commit();
+ if (mode != CrundDriver.XMode.INDY)
+ conn.commit();
}
});
ops.add(
- new JdbcOp("nullB0->A" + (batch ? "_batch" : ""),
+ new JdbcOp("nullB0->A_" + mode.toString().toLowerCase(),
"UPDATE b0 b0 SET b0.a_id = NULL WHERE (b0.id = ?)") {
public void run(int nOps) throws SQLException {
+ conn.setAutoCommit(mode == CrundDriver.XMode.INDY);
for (int i = 1; i <= nOps; i++) {
stmt.setInt(1, i);
- if (batch) {
+ if (mode == CrundDriver.XMode.BULK) {
stmt.addBatch();
} else {
int cnt = stmt.executeUpdate();
verify(cnt == 1);
}
}
- if (batch) {
+ if (mode == CrundDriver.XMode.BULK) {
int[] cnts = stmt.executeBatch();
for (int i = 0; i < cnts.length; i++) {
verify(cnts[i] == 1);
}
}
- conn.commit();
+ if (mode != CrundDriver.XMode.INDY)
+ conn.commit();
}
});
ops.add(
// MySQL rejects this syntax: "DELETE FROM b0 b0 WHERE b0.id = ?"
- new JdbcOp("delB0ByPK" + (batch ? "_batch" : ""),
+ new JdbcOp("delB0ByPK_" + mode.toString().toLowerCase(),
"DELETE FROM b0 WHERE id = ?") {
public void run(int nOps) throws SQLException {
+ conn.setAutoCommit(mode == CrundDriver.XMode.INDY);
for (int i = 1; i <= nOps; i++) {
stmt.setInt(1, i);
- if (batch) {
+ if (mode == CrundDriver.XMode.BULK) {
stmt.addBatch();
} else {
int cnt = stmt.executeUpdate();
verify(cnt == 1);
}
}
- if (batch) {
+ if (mode == CrundDriver.XMode.BULK) {
int[] cnts = stmt.executeBatch();
for (int i = 0; i < cnts.length; i++) {
verify(cnts[i] == 1);
}
}
- conn.commit();
+ if (mode != CrundDriver.XMode.INDY)
+ conn.commit();
}
});
ops.add(
// MySQL rejects this syntax: "DELETE FROM a a WHERE a.id = ?"
- new JdbcOp("delAByPK" + (batch ? "_batch" : ""),
+ new JdbcOp("delAByPK_" + mode.toString().toLowerCase(),
"DELETE FROM a WHERE id = ?") {
public void run(int nOps) throws SQLException {
+ conn.setAutoCommit(mode == CrundDriver.XMode.INDY);
for (int i = 1; i <= nOps; i++) {
stmt.setInt(1, i);
- if (batch) {
+ if (mode == CrundDriver.XMode.BULK) {
stmt.addBatch();
} else {
int cnt = stmt.executeUpdate();
verify(cnt == 1);
}
}
- if (batch) {
+ if (mode == CrundDriver.XMode.BULK) {
int[] cnts = stmt.executeBatch();
for (int i = 0; i < cnts.length; i++) {
verify(cnts[i] == 1);
}
}
- conn.commit();
+ if (mode != CrundDriver.XMode.INDY)
+ conn.commit();
}
});
ops.add(
- new JdbcOp("insA_attr" + (batch ? "_batch" : ""),
+ new JdbcOp("insA_attr_" + mode.toString().toLowerCase(),
"INSERT INTO a (id, cint, clong, cfloat, cdouble) VALUES (?, ?, ?, ?, ?)") {
public void run(int nOps) throws SQLException {
+ conn.setAutoCommit(mode == CrundDriver.XMode.INDY);
for (int i = 1; i <= nOps; i++) {
stmt.setInt(1, i);
setCommonAttributes(stmt, -i);
- if (batch) {
+ if (mode == CrundDriver.XMode.BULK) {
stmt.addBatch();
} else {
int cnt = stmt.executeUpdate();
verify(cnt == 1);
}
}
- if (batch) {
+ if (mode == CrundDriver.XMode.BULK) {
int[] cnts = stmt.executeBatch();
for (int i = 0; i < cnts.length; i++) {
verify(cnts[i] == 1);
}
}
- conn.commit();
+ if (mode != CrundDriver.XMode.INDY)
+ conn.commit();
}
});
ops.add(
- new JdbcOp("insB0_attr" + (batch ? "_batch" : ""),
+ new JdbcOp("insB0_attr_" + mode.toString().toLowerCase(),
"INSERT INTO b0 (id, cint, clong, cfloat, cdouble) VALUES (?, ?, ?, ?, ?)") {
public void run(int nOps) throws SQLException {
+ conn.setAutoCommit(mode == CrundDriver.XMode.INDY);
for (int i = 1; i <= nOps; i++) {
stmt.setInt(1, i);
setCommonAttributes(stmt, -i);
- if (batch) {
+ if (mode == CrundDriver.XMode.BULK) {
stmt.addBatch();
} else {
int cnt = stmt.executeUpdate();
verify(cnt == 1);
}
}
- if (batch) {
+ if (mode == CrundDriver.XMode.BULK) {
int[] cnts = stmt.executeBatch();
for (int i = 0; i < cnts.length; i++) {
verify(cnts[i] == 1);
}
}
- conn.commit();
+ if (mode != CrundDriver.XMode.INDY)
+ conn.commit();
}
});
ops.add(
- new JdbcOp("delAllB0",
+ new JdbcOp("delAllB0_" + mode.toString().toLowerCase(),
"DELETE FROM b0") {
public void run(int nOps) throws SQLException {
+ conn.setAutoCommit(mode == CrundDriver.XMode.INDY);
int cnt = stmt.executeUpdate();
verify(cnt == nOps);
- conn.commit();
+ if (mode != CrundDriver.XMode.INDY)
+ conn.commit();
}
});
ops.add(
- new JdbcOp("delAllA",
+ new JdbcOp("delAllA_" + mode.toString().toLowerCase(),
"DELETE FROM a") {
public void run(int nOps) throws SQLException {
+ conn.setAutoCommit(mode == CrundDriver.XMode.INDY);
int cnt = stmt.executeUpdate();
verify(cnt == nOps);
- conn.commit();
+ if (mode != CrundDriver.XMode.INDY)
+ conn.commit();
}
});
}
@@ -867,17 +884,54 @@ public class JdbcLoad extends CrundDrive
// ----------------------------------------------------------------------
protected void initConnection() throws SQLException {
- out.print("initializing connection ...");
+ assert (conn == null);
+
+ out.println();
+ out.println("initializing jdbc resources ...");
+
+ out.println();
+ out.print("creating jdbc connection ...");
out.flush();
conn = DriverManager.getConnection(url, user, password);
- conn.setAutoCommit(autoCommit);
+ // XXX remove this default when fully implemented all of XMode
+ conn.setAutoCommit(false);
delAllA = conn.prepareStatement("DELETE FROM a");
delAllB0 = conn.prepareStatement("DELETE FROM b0");
- out.println(" [Conn: 1]");
+ out.println(" [ok: " + url + "]");
+
+ out.print("setting isolation level ...");
+ out.flush();
+ // ndb storage engine only supports READ_COMMITTED
+ final int il = Connection.TRANSACTION_READ_COMMITTED;
+ conn.setTransactionIsolation(il);
+ out.print(" [ok: ");
+ switch (conn.getTransactionIsolation()) {
+ case Connection.TRANSACTION_READ_UNCOMMITTED:
+ out.print("READ_UNCOMMITTED");
+ break;
+ case Connection.TRANSACTION_READ_COMMITTED:
+ out.print("READ_COMMITTED");
+ break;
+ case Connection.TRANSACTION_REPEATABLE_READ:
+ out.print("REPEATABLE_READ");
+ break;
+ case Connection.TRANSACTION_SERIALIZABLE:
+ out.print("SERIALIZABLE");
+ break;
+ default:
+ assert false;
+ }
+ out.println("]");
}
protected void closeConnection() throws SQLException {
- out.print("closing connection ...");
+ assert (conn != null);
+
+ out.println();
+ out.println("releasing jdbc resources ...");
+
+ out.println();
+ out.print("closing jdbc connection ...");
out.flush();
if (delAllB0 != null)
delAllB0.close();
@@ -888,7 +942,7 @@ public class JdbcLoad extends CrundDrive
if (conn != null)
conn.close();
conn = null;
- out.println(" [ok]");
+ out.println(" [ok]");
}
protected void clearPersistenceContext() {
@@ -896,6 +950,7 @@ public class JdbcLoad extends CrundDrive
}
protected void clearData() throws SQLException {
+ conn.setAutoCommit(false);
out.print("deleting all rows ...");
out.flush();
int delB0 = delAllB0.executeUpdate();
=== modified file 'storage/ndb/test/crund/src/com/mysql/cluster/crund/JpaLoad.java'
--- a/storage/ndb/test/crund/src/com/mysql/cluster/crund/JpaLoad.java 2011-01-31 09:07:01 +0000
+++ b/storage/ndb/test/crund/src/com/mysql/cluster/crund/JpaLoad.java 2011-06-07 14:12:24 +0000
@@ -137,26 +137,29 @@ public class JpaLoad extends CrundDriver
out.println("openjpa.ndb.database: " + ndbDatabase);
}
- protected void init() throws Exception {
- super.init();
+ protected void initLoad() throws Exception {
+ // XXX support generic load class
+ //super.init();
out.println();
- out.print("creating EMFactory ...");
+ out.print("creating JPA EMFactory ...");
out.flush();
// create EMF by standard API, which allows vendors to pool factories
emf = Persistence.createEntityManagerFactory("crundjpa", props);
- out.println(" [EMF: 1]");
+ out.println(" [EMF: 1]");
}
- protected void close() throws Exception {
- out.print("closing EMFactory ...");
+ protected void closeLoad() throws Exception {
+ out.println();
+ out.print("closing JPA EMFactory ...");
out.flush();
if (emf != null)
emf.close();
emf = null;
- out.println(" [ok]");
+ out.println(" [ok]");
- super.close();
+ // XXX support generic load class
+ //super.close();
}
// ----------------------------------------------------------------------
@@ -602,7 +605,8 @@ public class JpaLoad extends CrundDriver
// ----------------------------------------------------------------------
protected void initConnection() {
- out.print("creating EntityManager ...");
+ out.println();
+ out.print("creating JPA EntityManager ...");
out.flush();
// See: clearPersistenceContext() for !allowExtendedPC
// Tx-scope EM supported by JPA only by container injection:
@@ -619,18 +623,19 @@ public class JpaLoad extends CrundDriver
//query.setHint("eclipselink.join-fetch", "e.address");
delAllA = em.createQuery("DELETE FROM A");
delAllB0 = em.createQuery("DELETE FROM B0");
- out.println(" [EM: 1]");
+ out.println(" [EM: 1]");
}
protected void closeConnection() {
- out.print("closing EntityManager ...");
+ out.println();
+ out.print("closing JPA EntityManager ...");
out.flush();
delAllB0 = null;
delAllA = null;
if (em != null)
em.close();
em = null;
- out.println(" [ok]");
+ out.println(" [ok]");
}
protected void clearPersistenceContext() {
=== modified file 'storage/ndb/test/crund/src/com/mysql/cluster/crund/NdbApiLoad.java'
--- a/storage/ndb/test/crund/src/com/mysql/cluster/crund/NdbApiLoad.java 2011-01-31 09:07:01 +0000
+++ b/storage/ndb/test/crund/src/com/mysql/cluster/crund/NdbApiLoad.java 2011-06-07 14:12:24 +0000
@@ -35,8 +35,9 @@ public class NdbApiLoad extends NdbBase
static protected native int ndbinit(String mgmd_host_portno);
static protected native int ndbclose();
- protected void init() throws Exception {
- super.init();
+ protected void initLoad() throws Exception {
+ // XXX support generic load class
+ //super.init();
// load dependent libs first
out.println();
@@ -53,7 +54,7 @@ public class NdbApiLoad extends NdbBase
}
}
- protected void close() throws Exception {
+ protected void closeLoad() throws Exception {
// release NDB resources
final int ret = ndbclose();
if (ret != 0) {
@@ -62,7 +63,9 @@ public class NdbApiLoad extends NdbBase
err.println(msg);
throw new Exception(msg);
}
- super.close();
+
+ // XXX support generic load class
+ //super.close();
}
// ----------------------------------------------------------------------
=== modified file 'storage/ndb/test/crund/src/com/mysql/cluster/crund/NdbJTieLoad.java'
--- a/storage/ndb/test/crund/src/com/mysql/cluster/crund/NdbJTieLoad.java 2011-01-31 09:07:01 +0000
+++ b/storage/ndb/test/crund/src/com/mysql/cluster/crund/NdbJTieLoad.java 2011-06-07 14:12:24 +0000
@@ -78,8 +78,9 @@ public class NdbJTieLoad extends NdbBase
descr = "->ndbjtie(" + mgmdConnect + ")";
}
- protected void init() throws Exception {
- super.init();
+ protected void initLoad() throws Exception {
+ // XXX support generic load class
+ //super.init();
// load native library (better diagnostics doing it explicitely)
out.println();
@@ -109,14 +110,17 @@ public class NdbJTieLoad extends NdbBase
out.println(" [ok: " + mgmdConnect + "]");
}
- protected void close() throws Exception {
- out.print("closing mgmd conn ...");
+ protected void closeLoad() throws Exception {
+ out.println();
+ out.print("closing mgmd connection ...");
out.flush();
if (mgmd != null)
Ndb_cluster_connection.delete(mgmd);
mgmd = null;
- out.println(" [ok]");
- super.close();
+ out.println(" [ok]");
+
+ // XXX support generic load class
+ //super.close();
}
// ----------------------------------------------------------------------
@@ -895,8 +899,10 @@ public class NdbJTieLoad extends NdbBase
// ----------------------------------------------------------------------
protected void initConnection() {
+ out.println();
+
// optionally, connect and wait for reaching the data nodes (ndbds)
- out.print("waiting for data nodes...");
+ out.print("waiting for ndbd ...");
out.flush();
final int initial_wait = 10; // secs to wait until first node detected
final int final_wait = 0; // secs to wait after first node detected
@@ -907,10 +913,10 @@ public class NdbJTieLoad extends NdbBase
out.println(msg);
throw new RuntimeException(msg);
}
- out.println(" [ok]");
+ out.println(" [ok]");
// connect to database
- out.print("connecting to database...");
+ out.print("connecting to ndbd ...");
out.flush();
ndb = Ndb.create(mgmd, catalog, schema);
final int max_no_tx = 10; // maximum number of parallel tx (<=1024)
@@ -919,19 +925,20 @@ public class NdbJTieLoad extends NdbBase
String msg = "Error caught: " + ndb.getNdbError().message();
throw new RuntimeException(msg);
}
- out.println(" [ok]");
+ out.println(" [ok]");
// initialize the schema shortcuts
model = new Model(ndb);
}
protected void closeConnection() {
- out.print("closing database conn ...");
+ out.println();
+ out.print("closing ndbd connection ...");
out.flush();
model = null;
Ndb.delete(ndb);
ndb = null;
- out.println(" [ok]");
+ out.println(" [ok]");
}
protected void clearData() {
=== modified file 'storage/ndb/test/crund/src/com/mysql/cluster/crund/NdbjLoad.java'
--- a/storage/ndb/test/crund/src/com/mysql/cluster/crund/NdbjLoad.java 2011-01-31 09:07:01 +0000
+++ b/storage/ndb/test/crund/src/com/mysql/cluster/crund/NdbjLoad.java 2011-06-07 14:12:24 +0000
@@ -73,8 +73,9 @@ public class NdbjLoad extends NdbBase {
descr = "->ndbj->ndbapi(" + mgmdConnect + ")";
}
- protected void init() throws Exception {
- super.init();
+ protected void initLoad() throws Exception {
+ // XXX support generic load class
+ //super.init();
// load native library (better diagnostics doing it explicitely)
out.println();
@@ -102,17 +103,20 @@ public class NdbjLoad extends NdbBase {
out.println(msg);
throw new RuntimeException("!!! " + msg);
}
- out.println(" [ok: " + mgmdConnect + "]");
+ out.println(" [ok: " + mgmdConnect + "]");
}
- protected void close() throws Exception {
- out.print("closing mgmd conn ...");
+ protected void closeLoad() throws Exception {
+ out.println();
+ out.print("closing mgmd connection ...");
out.flush();
if (mgmd != null)
mgmd.close();
mgmd = null;
- out.println(" [ok]");
- super.close();
+ out.println(" [ok]");
+
+ // XXX support generic load class
+ //super.close();
}
// ----------------------------------------------------------------------
@@ -1189,8 +1193,10 @@ public class NdbjLoad extends NdbBase {
// ----------------------------------------------------------------------
protected void initConnection() throws NdbApiException {
+ out.println();
+
// optionally, connect and wait for reaching the data nodes (ndbds)
- out.print("waiting for data nodes...");
+ out.print("waiting for ndbd ...");
out.flush();
final int initial_wait = 10; // secs to wait until first node detected
final int final_wait = 0; // secs to wait after first node detected
@@ -1204,10 +1210,10 @@ public class NdbjLoad extends NdbBase {
+ (initial_wait + final_wait) + "s.");
throw e;
}
- out.println(" [ok]");
+ out.println(" [ok]");
// connect to database
- out.print("connecting to database...");
+ out.print("connecting to ndbd ...");
out.flush();
try {
// XXX where to set schema?
@@ -1223,26 +1229,27 @@ public class NdbjLoad extends NdbBase {
out.println("!!! failed to connect: " + e);
throw e;
}
- out.println(" [ok]");
+ out.println(" [ok]");
// initialize the schema shortcuts
model = new Model(ndb);
}
protected void closeConnection() {
- out.print("closing database conn ...");
+ out.println();
+ out.print("closing ndbd connection ...");
out.flush();
model = null;
ndb.close();
ndb = null;
- out.println(" [ok]");
+ out.println(" [ok]");
}
protected void clearData() throws NdbApiException {
out.print("deleting all rows ...");
out.flush();
final int delB0 = delByScan(model.table_B0);
- out.print(" [B0: " + delB0);
+ out.print(" [B0: " + delB0);
out.flush();
final int delA = delByScan(model.table_A);
out.print(", A: " + delA);
=== modified file 'storage/ndb/test/crund/src/com/mysql/cluster/crund/ResultProcessor.java'
--- a/storage/ndb/test/crund/src/com/mysql/cluster/crund/ResultProcessor.java 2011-02-02 09:52:33 +0000
+++ b/storage/ndb/test/crund/src/com/mysql/cluster/crund/ResultProcessor.java 2011-06-07 14:12:24 +0000
@@ -55,6 +55,7 @@ public class ResultProcessor {
* @param avg the relative standard deviations
*/
void report(String tag,
+ int nRuns,
int nTxOps,
String[] op,
double[] avg,
@@ -72,6 +73,7 @@ public class ResultProcessor {
*
*/
public void report(String tag,
+ int nRuns,
int nTxOps,
String[] op,
double[] avg,
@@ -79,6 +81,7 @@ public class ResultProcessor {
double[] rsdev) {
out.println();
out.println("tag = " + tag);
+ out.println("nRuns = " + nRuns);
out.println("nTxOps = " + nTxOps);
out.println();
@@ -126,7 +129,7 @@ public class ResultProcessor {
protected ResultReporter reporter;
protected String[] header;
protected int nTxOps;
- protected int nval;
+ protected int nRuns;
protected double[] ravg;
protected double[] rdev;
@@ -252,7 +255,7 @@ public class ResultProcessor {
header = line.split("\\t");
assert (header.length > 0);
- nval = 0;
+ nRuns = 0;
nTxOps = 0;
ravg = new double[header.length];
rdev = new double[header.length];
@@ -268,7 +271,7 @@ public class ResultProcessor {
+ ", found: " + values.length);
throw new ParseException(msg, 0);
}
- nval++;
+ nRuns++;
// parse nTxOps
int n;
@@ -279,7 +282,7 @@ public class ResultProcessor {
+ ": " + e);
throw new ParseException(msg, 0);
}
- if (nval == 1) {
+ if (nRuns == 1) {
nTxOps = n;
} else if (nTxOps != n) {
String msg = ("line # " + lineNo
@@ -290,8 +293,8 @@ public class ResultProcessor {
}
// skip warmup runs
- if (nval <= nIgnored) {
- nval--;
+ if (nRuns <= nIgnored) {
+ nRuns--;
nIgnored--;
continue;
}
@@ -310,7 +313,7 @@ public class ResultProcessor {
// compute running averages and squared deviations
final double v = l;
final double oavg = ravg[i];
- final double navg = oavg + (v - oavg) / nval;
+ final double navg = oavg + (v - oavg) / nRuns;
final double odev = rdev[i];
final double ndev = odev + (v - oavg) * (v - navg);
ravg[i] = navg;
@@ -331,12 +334,12 @@ public class ResultProcessor {
for (int i = 1; i <= nops; i++) {
op[i-1] = header[i];
avg[i-1] = ravg[i];
- sdev[i-1] = Math.sqrt(rdev[i] / nval);
+ sdev[i-1] = Math.sqrt(rdev[i] / nRuns);
rsdev[i-1] = (sdev[i-1] * 100.0) / avg[i-1];
}
final String tag = header[0];
- reporter.report(tag, nTxOps, op, avg, sdev, rsdev);
+ reporter.report(tag, nRuns, nTxOps, op, avg, sdev, rsdev);
}
// ----------------------------------------------------------------------
=== modified file 'storage/ndb/test/crund/src/crundndb/Driver.cpp'
--- a/storage/ndb/test/crund/src/crundndb/Driver.cpp 2011-01-31 09:07:01 +0000
+++ b/storage/ndb/test/crund/src/crundndb/Driver.cpp 2011-06-07 14:12:24 +0000
@@ -114,32 +114,13 @@ void
Driver::run() {
init();
- if (warmupRuns > 0) {
- cout << endl
- << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl
- << "warmup runs ..." << endl
- << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl;
-
- for (int i = 0; i < warmupRuns; i++) {
- runTests();
- }
-
- // truncate log file, reset log buffers
- closeLogFile();
- openLogFile();
- header.rdbuf()->str("");
- rtimes.rdbuf()->str("");
- ctimes.rdbuf()->str("");
- logHeader = true;
- }
-
- if (hotRuns > 0) {
+ if (nRuns > 0) {
cout << endl
<< "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl
<< "hot runs ..." << endl
<< "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl;
- for (int i = 0; i < hotRuns; i++) {
+ for (int i = 0; i < nRuns; i++) {
runTests();
}
@@ -201,18 +182,11 @@ Driver::initProperties() {
logRealTime = toBool(props[L"logRealTime"], true);
logCpuTime = toBool(props[L"logCpuTime"], false);
- warmupRuns = toInt(props[L"warmupRuns"], 0, -1);
- if (warmupRuns < 0) {
- msg << "[ignored] warmupRuns: '"
- << toString(props[L"warmupRuns"]) << "'" << endl;
- warmupRuns = 0;
- }
-
- hotRuns = toInt(props[L"hotRuns"], 1, -1);
- if (hotRuns < 0) {
- msg << "[ignored] hotRuns: '"
- << toString(props[L"hotRuns"]) << "'" << endl;
- hotRuns = 1;
+ nRuns = toInt(props[L"nRuns"], 1, -1);
+ if (nRuns < 0) {
+ msg << "[ignored] nRuns: '"
+ << toString(props[L"nRuns"]) << "'" << endl;
+ nRuns = 1;
}
//if (msg.tellp() == 0) // netbeans reports amibuities
@@ -233,8 +207,7 @@ Driver::printProperties() {
cout << endl << "driver settings ..." << endl;
cout << "logRealTime: " << logRealTime << endl;
cout << "logCpuTime: " << logCpuTime << endl;
- cout << "warmupRuns: " << warmupRuns << endl;
- cout << "hotRuns: " << hotRuns << endl;
+ cout << "nRuns: " << nRuns << endl;
cout.flags(f);
}
=== modified file 'storage/ndb/test/crund/src/crundndb/Driver.hpp'
--- a/storage/ndb/test/crund/src/crundndb/Driver.hpp 2011-01-31 09:07:01 +0000
+++ b/storage/ndb/test/crund/src/crundndb/Driver.hpp 2011-06-07 14:12:24 +0000
@@ -71,8 +71,7 @@ protected:
Properties props;
bool logRealTime;
bool logCpuTime;
- int warmupRuns;
- int hotRuns;
+ int nRuns;
// driver resources
ofstream log;
Attachment: [text/bzr-bundle] bzr/martin.zaun@oracle.com-20110607195054-j95j5xmqj0iugp4o.bundle
| Thread |
|---|
| • bzr push into mysql-5.1-telco-7.1 branch (martin.zaun:4237 to 4239) | Martin Zaun | 8 Jun |