You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cayenne.apache.org by Andrus Adamchik <an...@objectstyle.org> on 2008/01/28 23:00:45 UTC
Unit Test Slowness [Re: 3.0 M3 test results]
I finally found time to run unit tests of the M3 tag on various DB's
(evaluating release artifacts is next on my list).... I'll post the
results in a little bit (so far all good), but I wanted to comment on
the merge test case slowness.
Because of repeated DB metadata access via DbLoader I noticed a bit of
slowdown on MySQL. Then I started testing on Oracle, and this one is a
bummer. My unit tests are already running for about 50 minutes with no
end in sight... So maybe there is a way to cache the DbLoader calls
for the purpose of unit testing? Would be nice if we could optimize
that on trunk.
Andrus
On Jan 27, 2008, at 12:46 AM, Kevin Menard wrote:
>
> On 1/25/08 4:34 PM, "Kevin Menard" <km...@servprise.com> wrote:
>
>> Windows XP Pro SP2 (Java 1.5)
>> =============================
>> HSQLDB: FAIL
>>
>> Only one test failed for HSQLDB for Windows and it was the following:
>> testEncodeAsXML(org.apache.cayenne.map.ObjRelationshipTest)
>>
>> Without looking into it too much, it's probably a line ending issue.
>
> I think I'm going to address the line ending issues once and for all
> by
> setting the eol-style to native in Subversion. I'll just wait until
> trunk
> for this.
>
> There's also an issue with the JpaUnitClassLoader on Windows. So,
> the JPA
> itests all fail. While unfortunate, I don't think this is worth
> holding the
> release up. The other tests all pass, so I'm fairly confident the
> core
> framework is good to go.
>
> --
> Kevin
>
>
Re: Unit Test Slowness [Re: 3.0 M3 test results]
Posted by Tore Halset <ha...@pvv.ntnu.no>.
Hello.
(sorry for answering an old post)
I did not get any feedback on this one, but have commited it to trunk.
Please comment Oracle results on https://issues.apache.org/cayenne/browse/CAY-981
Regards,
- Tore.
On Jan 30, 2008, at 00:13, Tore Halset wrote:
> Hello.
>
> I have looked at this, but are not really able to reproduce the
> problem as I do not have access to Oracle. Even if I had, there is
> 6+ years since I used Oracle.. Makes me feel old :/
>
> My first attempt is to reduce the work for DbLoader by specifying a
> the tables that should be tested. I have done this by adding a
> overridable method called includeTableName(String) that defaults to
> true. It is not very elegant, but might work.
>
> Could you please try the attached patch on oracle Andrus?
>
> Regards,
> - Tore.
>
> On Jan 28, 2008, at 23:00, Andrus Adamchik wrote:
>
>> I finally found time to run unit tests of the M3 tag on various
>> DB's (evaluating release artifacts is next on my list).... I'll
>> post the results in a little bit (so far all good), but I wanted to
>> comment on the merge test case slowness.
>>
>> Because of repeated DB metadata access via DbLoader I noticed a bit
>> of slowdown on MySQL. Then I started testing on Oracle, and this
>> one is a bummer. My unit tests are already running for about 50
>> minutes with no end in sight... So maybe there is a way to cache
>> the DbLoader calls for the purpose of unit testing? Would be nice
>> if we could optimize that on trunk.
>
>
> Index: framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/
> cayenne/merge/DbMerger.java
> ===================================================================
> --- framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/
> cayenne/merge/DbMerger.java (revision 616534)
> +++ framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/
> cayenne/merge/DbMerger.java (working copy)
> @@ -53,8 +53,12 @@
> public class DbMerger {
>
> private MergerFactory factory;
> -
> - public boolean includeTableName(String tableName){
> +
> + /**
> + * A method that return true if the given table name should be
> included. The default
> + * implemntation include all tables.
> + */
> + public boolean includeTableName(String tableName) {
> return true;
> }
>
> @@ -82,7 +86,15 @@
> try {
> conn = dataSource.getConnection();
>
> - DbLoader dbLoader = new DbLoader(conn, adapter, new
> LoaderDelegate());
> + final DbMerger merger = this;
> + DbLoader dbLoader = new DbLoader(conn, adapter, new
> LoaderDelegate()) {
> +
> + @Override
> + public boolean includeTableName(String tableName) {
> + return merger.includeTableName(tableName);
> + }
> + };
> +
> DataMap detectedDataMap = dbLoader.loadDataMapFromDB(
> null,
> null,
> @@ -94,7 +106,7 @@
> for (DbEntity dbEntity : dataMap.getDbEntities()) {
> String tableName = dbEntity.getName();
>
> - if(!includeTableName(tableName)){
> + if (!includeTableName(tableName)) {
> continue;
> }
>
> @@ -119,7 +131,7 @@
> // TODO: support drop table. currently, too many tables
> are marked for drop
> for (DbEntity e : dbEntityToDropByName.values()) {
>
> - if(!includeTableName(e.getName())){
> + if (!includeTableName(e.getName())) {
> continue;
> }
>
> @@ -258,6 +270,11 @@
>
> // relationships to add
> for (DbRelationship rel : dbEntity.getRelationships()) {
> +
> + if (!includeTableName(rel.getTargetEntityName())) {
> + continue;
> + }
> +
> if (findDbRelationship(detectedEntity, rel) == null) {
> // TODO: very ugly. perhaps MergerToken should have
> a .isNoOp()?
> AbstractToDbToken t = (AbstractToDbToken) factory
> Index: framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/
> cayenne/access/DbLoader.java
> ===================================================================
> --- framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/
> cayenne/access/DbLoader.java (revision 616534)
> +++ framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/
> cayenne/access/DbLoader.java (working copy)
> @@ -165,6 +165,14 @@
> public DbAdapter getAdapter() {
> return adapter;
> }
> +
> + /**
> + * A method that return true if the given table name should be
> included. The default
> + * implemntation include all tables.
> + */
> + public boolean includeTableName(String tableName) {
> + return true;
> + }
>
> /**
> * Retrieves catalogues for the database associated with this
> DbLoader.
> @@ -284,6 +292,10 @@
> if (name == null || name.startsWith("BIN$")) {
> continue;
> }
> +
> + if (!includeTableName(name)) {
> + continue;
> + }
>
> Table info = new Table(cat, schema, name);
> tables.add(info);
> @@ -572,7 +584,11 @@
> // start new entity
> String fkEntityName =
> rs.getString("FKTABLE_NAME");
> String fkName = rs.getString("FK_NAME");
> -
> +
> + if (!includeTableName(fkEntityName)) {
> + continue;
> + }
> +
> fkEntity = map.getDbEntity(fkEntityName);
>
> if (fkEntity == null) {
>
>
>
Re: Unit Test Slowness [Re: 3.0 M3 test results]
Posted by Tore Halset <ha...@pvv.ntnu.no>.
Hello.
I have looked at this, but are not really able to reproduce the
problem as I do not have access to Oracle. Even if I had, there is 6+
years since I used Oracle.. Makes me feel old :/
My first attempt is to reduce the work for DbLoader by specifying a
the tables that should be tested. I have done this by adding a
overridable method called includeTableName(String) that defaults to
true. It is not very elegant, but might work.
Could you please try the attached patch on oracle Andrus?
Regards,
- Tore.
On Jan 28, 2008, at 23:00, Andrus Adamchik wrote:
> I finally found time to run unit tests of the M3 tag on various DB's
> (evaluating release artifacts is next on my list).... I'll post the
> results in a little bit (so far all good), but I wanted to comment
> on the merge test case slowness.
>
> Because of repeated DB metadata access via DbLoader I noticed a bit
> of slowdown on MySQL. Then I started testing on Oracle, and this one
> is a bummer. My unit tests are already running for about 50 minutes
> with no end in sight... So maybe there is a way to cache the
> DbLoader calls for the purpose of unit testing? Would be nice if we
> could optimize that on trunk.
Index: framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/
cayenne/merge/DbMerger.java
===================================================================
--- framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/
cayenne/merge/DbMerger.java (revision 616534)
+++ framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/
cayenne/merge/DbMerger.java (working copy)
@@ -53,8 +53,12 @@
public class DbMerger {
private MergerFactory factory;
-
- public boolean includeTableName(String tableName){
+
+ /**
+ * A method that return true if the given table name should be
included. The default
+ * implemntation include all tables.
+ */
+ public boolean includeTableName(String tableName) {
return true;
}
@@ -82,7 +86,15 @@
try {
conn = dataSource.getConnection();
- DbLoader dbLoader = new DbLoader(conn, adapter, new
LoaderDelegate());
+ final DbMerger merger = this;
+ DbLoader dbLoader = new DbLoader(conn, adapter, new
LoaderDelegate()) {
+
+ @Override
+ public boolean includeTableName(String tableName) {
+ return merger.includeTableName(tableName);
+ }
+ };
+
DataMap detectedDataMap = dbLoader.loadDataMapFromDB(
null,
null,
@@ -94,7 +106,7 @@
for (DbEntity dbEntity : dataMap.getDbEntities()) {
String tableName = dbEntity.getName();
- if(!includeTableName(tableName)){
+ if (!includeTableName(tableName)) {
continue;
}
@@ -119,7 +131,7 @@
// TODO: support drop table. currently, too many tables
are marked for drop
for (DbEntity e : dbEntityToDropByName.values()) {
- if(!includeTableName(e.getName())){
+ if (!includeTableName(e.getName())) {
continue;
}
@@ -258,6 +270,11 @@
// relationships to add
for (DbRelationship rel : dbEntity.getRelationships()) {
+
+ if (!includeTableName(rel.getTargetEntityName())) {
+ continue;
+ }
+
if (findDbRelationship(detectedEntity, rel) == null) {
// TODO: very ugly. perhaps MergerToken should have
a .isNoOp()?
AbstractToDbToken t = (AbstractToDbToken) factory
Index: framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/
cayenne/access/DbLoader.java
===================================================================
--- framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/
cayenne/access/DbLoader.java (revision 616534)
+++ framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/
cayenne/access/DbLoader.java (working copy)
@@ -165,6 +165,14 @@
public DbAdapter getAdapter() {
return adapter;
}
+
+ /**
+ * A method that return true if the given table name should be
included. The default
+ * implemntation include all tables.
+ */
+ public boolean includeTableName(String tableName) {
+ return true;
+ }
/**
* Retrieves catalogues for the database associated with this
DbLoader.
@@ -284,6 +292,10 @@
if (name == null || name.startsWith("BIN$")) {
continue;
}
+
+ if (!includeTableName(name)) {
+ continue;
+ }
Table info = new Table(cat, schema, name);
tables.add(info);
@@ -572,7 +584,11 @@
// start new entity
String fkEntityName =
rs.getString("FKTABLE_NAME");
String fkName = rs.getString("FK_NAME");
-
+
+ if (!includeTableName(fkEntityName)) {
+ continue;
+ }
+
fkEntity = map.getDbEntity(fkEntityName);
if (fkEntity == null) {