Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-48

A connection request that has a default schema that is being created by another transaction will fail to connect

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.0.2.0, 10.0.2.1, 10.0.2.2, 10.1.1.0, 10.1.2.1, 10.1.3.1, 10.2.1.6, 10.2.2.0, 10.3.1.4, 10.3.2.1, 10.3.3.0, 10.4.1.3
    • Fix Version/s: 10.4.2.0, 10.5.1.1
    • Component/s: JDBC
    • Labels:
      None
    • Issue & fix info:
      Release Note Needed

      Description

      A connection request that has a default schema that is being
      created by another transaction will block until that transaction
      completes (or time out). Probably in this situation the connection
      request should be succeed as if the schema does not exist.

      This is a problem in particular for a prepared XA transaction, where even after restarting the system, the user cannot reconnect and recover the transaction.

      Here is the reproduction in ij.
      java -Dij.exceptionTrace=true -Dij.protocol=jdbc:derby: -Dij.user=me -Dij.password=pw org.apache.derby.tools.ij
      ij version 10.0 (C) Copyright IBM Corp. 1997, 2004.

      ij> connect 'testdb;create=true';
      ij> autocommit off;
      ij> create table mytabi(i int);
      0 rows inserted/updated/deleted
      ij> connect 'testdb';
      ERROR 40XL1: A lock could not be obtained within the time requestedERROR 40XL1: A lock could not be obtained within the time requested
      at org.apache.derby.iapi.error.StandardException.newException(StandardException.java:295)
      at org.apache.derby.impl.services.locks.LockSet.lockObject(LockSet.java:408)
      at org.apache.derby.impl.services.locks.SinglePool.lockAnObject(SinglePool.java:168)
      at org.apache.derby.impl.services.locks.SinglePool.lockObject(SinglePool.java:220)
      at org.apache.derby.impl.store.raw.xact.RowLocking3.lockRecordForRead(RowLocking3.java:181)
      at org.apache.derby.impl.store.access.heap.HeapController.lockRow(HeapController.java:425)
      at org.apache.derby.impl.store.access.heap.HeapController.lockRow(HeapController.java:543)
      at org.apache.derby.impl.store.access.btree.index.B2IRowLocking3.lockRowOnPage(B2IRowLocking3.java:329)
      at org.apache.derby.impl.store.access.btree.index.B2IRowLocking3._lockScanRow(B2IRowLocking3.java:571)
      at org.apache.derby.impl.store.access.btree.index.B2IRowLockingRR.lockScanRow(B2IRowLockingRR.java:115)
      at org.apache.derby.impl.store.access.btree.BTreeForwardScan.fetchRows(BTreeForwardScan.java:374)
      at org.apache.derby.impl.store.access.btree.BTreeScan.next(BTreeScan.java:1691)
      at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getDescriptorViaIndex(DataDictionaryImpl.java:7118)
      at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.locateSchemaRow(DataDictionaryImpl.java:1381)
      at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getSchemaDescriptor(DataDictionaryImpl.java:1291)
      at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.initDefaultSchemaDescriptor(GenericLanguageCon
      at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.initialize(GenericLanguageConnectionContext.ja
      at org.apache.derby.impl.db.BasicDatabase.setupConnection(BasicDatabase.java:267)
      at org.apache.derby.impl.jdbc.TransactionResourceImpl.startTransaction(TransactionResourceImpl.java:182)
      at org.apache.derby.impl.jdbc.EmbedConnection.<init>(EmbedConnection.java:237)
      at org.apache.derby.impl.jdbc.EmbedConnection20.<init>(EmbedConnection20.java:49)
      at org.apache.derby.impl.jdbc.EmbedConnection30.<init>(EmbedConnection30.java:56)
      at org.apache.derby.jdbc.Driver30.getNewEmbedConnection(Driver30.java:68)
      at org.apache.derby.jdbc.Driver169.connect(Driver169.java:172)
      at java.sql.DriverManager.getConnection(DriverManager.java:512)
      at java.sql.DriverManager.getConnection(DriverManager.java:140)
      at org.apache.derby.impl.tools.ij.ij.dynamicConnection(ij.java:843)
      at org.apache.derby.impl.tools.ij.ij.ConnectStatement(ij.java:700)
      at org.apache.derby.impl.tools.ij.ij.ijStatement(ij.java:528)
      at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:283)
      at org.apache.derby.impl.tools.ij.Main.go(Main.java:204)
      at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:170)
      at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:50)
      at org.apache.derby.tools.ij.main(ij.java:54)

        Attachments

        1. derby-48-1.diff
          15 kB
          Dag H. Wanvik
        2. derby-48-1.stat
          0.7 kB
          Dag H. Wanvik
        3. derby-48-10_4-1.diff
          23 kB
          Dag H. Wanvik
        4. derby-48-10_4-1.stat
          0.6 kB
          Dag H. Wanvik
        5. derby-48-2.diff
          13 kB
          Dag H. Wanvik
        6. derby-48-2.stat
          0.4 kB
          Dag H. Wanvik
        7. derby-48-3.diff
          15 kB
          Dag H. Wanvik
        8. derby-48-3.stat
          0.4 kB
          Dag H. Wanvik
        9. derby-48-4.diff
          11 kB
          Dag H. Wanvik
        10. derby-48-4.stat
          0.3 kB
          Dag H. Wanvik
        11. derby-48-5.diff
          18 kB
          Dag H. Wanvik
        12. derby-48-5.stat
          0.4 kB
          Dag H. Wanvik
        13. derby-48-6.diff
          20 kB
          Dag H. Wanvik
        14. derby-48-6.stat
          0.4 kB
          Dag H. Wanvik
        15. derby-48-7.diff
          21 kB
          Dag H. Wanvik
        16. derby-48-7.stat
          0.5 kB
          Dag H. Wanvik
        17. derby-48b-1.diff
          10 kB
          Dag H. Wanvik
        18. derby-48b-1.stat
          0.3 kB
          Dag H. Wanvik
        19. LazyDefaultSchemaCreationTest.java
          3 kB
          Dag H. Wanvik
        20. releaseNote.html
          5 kB
          Rick Hillegas
        21. releaseNote.html
          5 kB
          Dag H. Wanvik
        22. releaseNote.html
          5 kB
          Dag H. Wanvik
        23. releaseNote.html
          5 kB
          Dag H. Wanvik

          Issue Links

            Activity

              People

              • Assignee:
                dagw Dag H. Wanvik
                Reporter:
                kmarsden Kathey Marsden
              • Votes:
                1 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: