db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lily Wei (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-4653) Avoid unnecessary round-trip for commit/rollback in the client driver
Date Sat, 22 May 2010 00:08:16 GMT

    [ https://issues.apache.org/jira/browse/DERBY-4653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12870236#action_12870236

Lily Wei commented on DERBY-4653:

Change the code in Connection.flowcommit() to save the round trip
 if (!this.inUnitOfWork_)

Run suites.AllPackages and test_04_undefinedAndIllegal and test_04_undefinedAndIllegal fails.
1) test_04_undefinedAndIllegal(org.apache.derbyTesting.functionTests.tests.lang.Bo
oleanValuesTest)junit.framework.ComparisonFailure: getBoolean() on BLOB_COL expect
ed:<...2005> but was:<...4000>
        at org.apache.derbyTesting.junit.BaseJDBCTestCase.assertSQLState(BaseJDBCT
        at org.apache.derbyTesting.functionTests.tests.lang.BooleanValuesTest.vet_
        at org.apache.derbyTesting.functionTests.tests.lang.BooleanValuesTest.vet_
        at org.apache.derbyTesting.functionTests.tests.lang.BooleanValuesTest.test
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso
        at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:10
        at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
        at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
        at junit.extensions.TestSetup.run(TestSetup.java:23)
        at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
Caused by: java.sql.SQLException: Invalid cursor state - no current row.

However, these two tests fail when I don't have Connect.flowcommit() change either. 

On BooleanTestsValue.java, 
    public void test_04_undefinedAndIllegal() throws Exception
        Connection conn = getConnection();

        vet_getBooleanIsIllegal( conn, "BLOB_COL" );         <<<====This is the failure
comes from

I will keep looking to see why these two tests failed with or without Connection.flowcommit(()

> Avoid unnecessary round-trip for commit/rollback in the client driver
> ---------------------------------------------------------------------
>                 Key: DERBY-4653
>                 URL: https://issues.apache.org/jira/browse/DERBY-4653
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC, Network Client
>    Affects Versions:
>            Reporter: Kristian Waagan
>            Assignee: Lily Wei
>            Priority: Minor
> The methods Connection.commit() and Connection.rollback() in the client driver cause
a round-trip to the server even if the commit/rollback is unnecessary (i.e. there is nothing
to commit or roll back).
> Comments suggest (see below) that this can be optimized, such that the commands are flowed
to the server only when required. It can be seen that this optimization has been used other
places in the client driver. Never the less, it must be checked that this optimization doesn't
have side-effects.
> This issue came up in connection with connection pooling, where a pool implementation
always issued a rollback to make sure there was no active transaction on the connection handed
> From Connection.flowCommit:
>         // Per JDBC specification (see javadoc for Connection.commit()):
>         //   "This method should be used only when auto-commit mode has been disabled."
>         // However, some applications do this anyway, it is harmless, so
>         // if they ask to commit, we could go ahead and flow a commit.
>         // But note that rollback() is less harmless, rollback() shouldn't be used in
auto-commit mode.
>         // This behavior is subject to further review.
>         //   if (!this.inUnitOfWork)
>         //     return;
>         // We won't try to be "too smart", if the user requests a commit, we'll flow
a commit,
>         // regardless of whether or not we're in a unit of work or in auto-commit mode.
>         //

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message