[ 
https://issues.apache.org/jira/browse/DERBY-6533?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-6533:
---------------------------------

    Attachment: derby-6533-01-aa-quietMode.diff

Attaching derby-6533-01-aa-quietMode.diff. This patch makes various 
improvements to NsTest:

1) Silent logger - Adds a silent logger, enabled by setting 
-Dderby.nstest.justCountErrors=true. This causes the test to not log every 
insert, update, delete, and select. In this mode, the test counts errors 
instead. Each error is identified by its stack trace. The error counts are 
printed when the test ends.

2) Shutdown hook - Adds a shutdown hook which prints the final statistics at 
the end of test, even when you kill the test by typing control-c.

3) Output file - Adds the ability to re-direct diagnostic printout to a file.

4) Bug fixes - In the course of running the test, I found various places where 
the test trips over itself.

I have updated the test's README.txt to reflect the new usage:

{noformat}
Usage:

    java org.apache.derbyTesting.system.nstest.NsTest [ DerbyClient | Embedded 
[ small ] ]

If no arguments are specified, the test defaults to a client/server 
configuration (DerbyClient)

The following flags can be set:

    -Dderby.nstest.backupRestore=false    Turns off backup, restore, and 
re-encryption.

    -Dderby.nstest.outputFile=fileName    Redirects output and errors to a file.

    -Dderby.nstest.justCountErrors=true    Makes the test run quietly at 
steady-state, counting errors, and printing a summary at the end.
{noformat}

When derby.nstest.justCountErrors is set, the test prints a count of every 
SQLState it saw. E.g.:

{noformat}
        Number of 40XL1 = 40
{noformat}

Since the same SQLState can be raised at multiple points in the test, the 
printout also includes a count of how many time each distinct stack trace was 
seen. E.g.:

{noformat}
//////////////////////////////////////////////////////////////
//    
//    Count = 26, SQLState = 40XL1, Message = A lock could not be obtained 
within the time requested
//    
//////////////////////////////////////////////////////////////

java.sql.SQLTransactionRollbackException: A lock could not be obtained within 
the time requested
        at 
org.apache.derby.client.am.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:80)
        at 
org.apache.derby.client.am.SqlException.getSQLException(SqlException.java:321)
        at 
org.apache.derby.client.am.ClientConnection.prepareStatement(ClientConnection.java:442)
        at 
org.apache.derbyTesting.system.nstest.utils.DbUtil.add_one_row(DbUtil.java:95)
        at 
org.apache.derbyTesting.system.nstest.tester.TesterObject.doIUDOperation(TesterObject.java:148)
        at 
org.apache.derbyTesting.system.nstest.tester.Tester2.startTesting(Tester2.java:109)
        at org.apache.derbyTesting.system.nstest.NsTest.run(NsTest.java:721)
Caused by: ERROR 40XL1: A lock could not be obtained within the time requested
        at 
org.apache.derby.client.am.ClientStatement.completeSqlca(ClientStatement.java:2109)
        at 
org.apache.derby.client.net.NetStatementReply.parsePrepareError(NetStatementReply.java:579)
        at 
org.apache.derby.client.net.NetStatementReply.parsePRPSQLSTTreply(NetStatementReply.java:145)
        at 
org.apache.derby.client.net.NetStatementReply.readPrepareDescribeOutput(NetStatementReply.java:54)
        at 
org.apache.derby.client.net.StatementReply.readPrepareDescribeOutput(StatementReply.java:41)
        at 
org.apache.derby.client.net.NetStatement.readPrepareDescribeOutput_(NetStatement.java:156)
        at 
org.apache.derby.client.am.ClientStatement.readPrepareDescribeOutput(ClientStatement.java:1695)
        at 
org.apache.derby.client.am.ClientPreparedStatement.readPrepareDescribeInputOutput(ClientPreparedStatement.java:1912)
        at 
org.apache.derby.client.am.ClientPreparedStatement.flowPrepareDescribeInputOutput(ClientPreparedStatement.java:1975)
        at 
org.apache.derby.client.am.ClientPreparedStatement.prepare(ClientPreparedStatement.java:314)
        at 
org.apache.derby.client.am.ClientConnection.prepareStatementX(ClientConnection.java:1946)
        at 
org.apache.derby.client.am.ClientConnection.prepareStatement(ClientConnection.java:429)
        ... 4 more
{noformat}



I have run the test in embedded and client/server modes with these 
configurations:

A) Re-directing output to a file.

B) Re-directing output to a file and setting derby.nstest.justCountErrors.

C) Not setting any flags.


Touches the following files:

M       java/testing/org/apache/derbyTesting/system/nstest/utils/DbUtil.java
M       java/testing/org/apache/derbyTesting/system/nstest/utils/MemCheck.java
M       java/testing/org/apache/derbyTesting/system/nstest/NsTest.java
M       java/testing/org/apache/derbyTesting/system/nstest/init/Initializer.java
M       
java/testing/org/apache/derbyTesting/system/nstest/init/NWServerThread.java
M       java/testing/org/apache/derbyTesting/system/nstest/init/DbSetup.java
M       java/testing/org/apache/derbyTesting/system/nstest/tester/Tester1.java
M       java/testing/org/apache/derbyTesting/system/nstest/tester/Tester2.java
M       java/testing/org/apache/derbyTesting/system/nstest/tester/Tester3.java
M       
java/testing/org/apache/derbyTesting/system/nstest/tester/BackupRestoreReEncryptTester.java
M       
java/testing/org/apache/derbyTesting/system/nstest/tester/TesterObject.java
A       
java/testing/org/apache/derbyTesting/system/nstest/NsTestPrintStream.java
A       java/testing/org/apache/derbyTesting/system/nstest/NsTestError.java
M       java/testing/org/apache/derbyTesting/system/nstest/README.txt


> Add a quiet mode to NsTest
> --------------------------
>
>                 Key: DERBY-6533
>                 URL: https://issues.apache.org/jira/browse/DERBY-6533
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>    Affects Versions: 10.11.0.0
>            Reporter: Rick Hillegas
>            Assignee: Rick Hillegas
>         Attachments: derby-6533-01-aa-quietMode.diff
>
>
> Right now NsTest produces an enormous log file. This may be useful for 
> tracking down some errors. However, this can also make it hard to find the 
> signal in the noise. It would be good to turn off the chatty diagnostics 
> which report the result of every insert, update, delete, and select. A 
> summary at the end may be good enough, including a summary of the number of 
> times each kind of error (SQLState) was seen. While I'm in there, I plan to 
> make other smallish changes.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to