You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Rick Hillegas (JIRA)" <ji...@apache.org> on 2018/01/08 00:16:00 UTC

[jira] [Updated] (DERBY-6945) Re-package Derby as a collection of jigsaw modules

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

Rick Hillegas updated DERBY-6945:
---------------------------------
    Attachment: derby-6945-09-ab-moveInternalDriver.diff

Attaching derby-6945-09-ab-moveInternalDriver.diff. As preparation for moving org.apache.derby.jdbc into derbytools.jar, this patch moves the following non-publicAPI classes out of org.apache.derby.jdbc and into org.apache.derby.iapi.jdbc:

  InternalDriver (the tricky guts of the embedded driver)
  JDBC (the engine's Version MBean)

This also involved some delicate changes to

  JDBCBoot (the tricky logic which boots the engine)

For the moment, I have retreated from a more ambitious effort to also move AutoloadedDriver. That change was causing nested connections to fail. That is, it broke the resolution of connection URLs which start with the special sqlj jdbc:default:connection token. After I commit this patch, I will go back to trying to move AutoloadedDriver.

The embedded driver and engine boot logic are spread fragilely across several cooperating classes. When I moved InternalDriver and JDBCBoot, I uncovered another race condition which involves two threads trying to call DriverManager.getConnection() simultaneously. ConcurrentAutoloadTest disclosed this. I have put all of the boot logic inside a synchronized block. That fixed the problem. Moreover, it struck me as a long overdue improvement. It seems to me that we were just asking for trouble by allowing two threads to simultaneously race through the complicated booting of engine components. I am not confident that there aren't other race conditions in this subtle logic. It could use a top-down overhaul.

Tests ran cleanly for me on this patch.


Touches the following files:

-------------------------------------

A  +    java/engine/org/apache/derby/iapi/jdbc/InternalDriver.java
A  +    java/engine/org/apache/derby/iapi/jdbc/JDBC.java
D       java/engine/org/apache/derby/jdbc/InternalDriver.java
D       java/engine/org/apache/derby/jdbc/JDBC.java
M       java/build/org/apache/derbyBuild/lastgoodjarcontents/insane.derby.jar.lastcontents
M       java/build/org/apache/derbyBuild/lastgoodjarcontents/sane.derby.jar.lastcontents

Move InternalDriver and JDBC out of the public api package and into an engine-internal api package.

-------------------------------------

M       java/engine/org/apache/derby/jdbc/AutoloadedDriver.java
M       java/engine/org/apache/derby/jdbc/EmbeddedDriver.java
M       java/engine/org/apache/derby/iapi/jdbc/JDBCBoot.java

Fix a race condition involving two threads which try to get a connection at the same time.

-------------------------------------

M       java/engine/org/apache/derby/jdbc/BasicEmbeddedConnectionPoolDataSource40.java
M       java/engine/org/apache/derby/jdbc/BasicEmbeddedDataSource40.java
M       java/engine/org/apache/derby/jdbc/BasicEmbeddedXADataSource40.java
M       java/engine/org/apache/derby/jdbc/EmbeddedConnectionPoolDataSource.java
M       java/engine/org/apache/derby/jdbc/EmbeddedXADataSource.java

Pull the creation of Connection objects out of InternalDriver and put it into the DataSources, where it belongs. This fixes InternalDriver so that it does not call up into the public api package.

-------------------------------------

M       java/drda/org/apache/derby/impl/drda/DRDAConnThread.java
M       java/engine/org/apache/derby/catalog/SystemProcedures.java
M       java/engine/org/apache/derby/impl/db/SlaveDatabase.java
M       java/engine/org/apache/derby/impl/jdbc/ConnectionChild.java
M       java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
M       java/engine/org/apache/derby/impl/jdbc/LOBStoredProcedure.java
M       java/engine/org/apache/derby/impl/jdbc/TransactionResourceImpl.java
M       java/engine/org/apache/derby/impl/jdbc/authentication/NativeAuthenticationServiceImpl.java
M       java/engine/org/apache/derby/jdbc/Driver42.java
M       java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/Wrapper41Driver.java
M       java/testing/org/apache/derbyTesting/functionTests/tests/tools/RollBackWrappingWhenFailOnImportTest.java

Adjust import statements to account for the relocation of InternalDriver.

-------------------------------------

M       java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ConcurrentAutoloadTest.java

Make this test report more failure information.


> Re-package Derby as a collection of jigsaw modules
> --------------------------------------------------
>
>                 Key: DERBY-6945
>                 URL: https://issues.apache.org/jira/browse/DERBY-6945
>             Project: Derby
>          Issue Type: Improvement
>    Affects Versions: 10.13.1.2
>            Reporter: Rick Hillegas
>         Attachments: derby-6945-01-aa-remove_derbyPreBuild_dep.diff, derby-6945-02-ab-newDerbySharedJar.diff, derby-6945-02-ac-newDerbySharedJar.diff, derby-6945-03-aa-partitionTest.diff, derby-6945-04-aa-moveRunClass.diff, derby-6945-05-aa-removeRedundant_Attribute_SQLState.diff, derby-6945-06-aa-removeOtherSharedDuplicates.diff, derby-6945-07-aa-net_client_overlap.diff, derby-6945-08-aa-move_shared_iapi_under_shared.diff, derby-6945-08-ab-move_shared_iapi_under_shared.diff, derby-6945-08-ad-move_shared_iapi_under_shared.diff, derby-6945-09-ab-moveInternalDriver.diff, jdeps.out.tar
>
>
> Once we commit to building with Java 9 (see DERBY-6856), we should consider re-packaging Derby as a set of jigsaw modules. This would result in a different set of release artifacts. This might be a good opportunity to address the Tomcat artifactory issues raised by issue DERBY-6944.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)