Karaf
  1. Karaf
  2. KARAF-447

Add JDBC lock implementation for PostgreSQL

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.3
    • Fix Version/s: 2.2.9, 2.3.0, 3.0.0
    • Component/s: karaf-core
    • Labels:
      None

      Description

      When using the org.apache.karaf.main.DefaultJDBCLock class together with PostgreSQL, you can run into this exception (caused by the setQueryTimeout() method not being implemented yet - http://jdbc.postgresql.org/todo.html):

      Failed to acquire database lock: org.postgresql.util.PSQLException: Method org.postgresql.jdbc4.Jdbc4PreparedStatement.setQueryTimeout(int) is not yet implemented.
      

      We should at the very least document that the timeout should be set to 0 for PostgreSQL, but perhaps we'd better create a new JDBC lock implementation that hides this bit of knowledge from the users and provides them with a nice and easy way to use PostgreSQL for JDBC locking.

      1. karaf_447.diff
        12 kB
        Heath Kesler
      2. karaf-2.3_447.diff
        11 kB
        Heath Kesler
      3. updated-karaf-3.0_447.diff
        3 kB
        Heath Kesler

        Issue Links

          Activity

          Hide
          Jamie goodyear added a comment -

          Bumping fix version up to 2.2.1 and 3.0.0.
          I don't believe that introducing a new JDBC Lock class would break any backwards compatibility if introduced on the 2.2.x maintenance branch.

          Show
          Jamie goodyear added a comment - Bumping fix version up to 2.2.1 and 3.0.0. I don't believe that introducing a new JDBC Lock class would break any backwards compatibility if introduced on the 2.2.x maintenance branch.
          Hide
          Jamie goodyear added a comment -

          Discussed issue status with reporter. We'll push this one out to at least the next patch roll up.

          Show
          Jamie goodyear added a comment - Discussed issue status with reporter. We'll push this one out to at least the next patch roll up.
          Hide
          Heath Kesler added a comment -

          @Jamie, I added a new class for PostgreSQL locking and added tests. Please review when you get a chance and advise.

          Cheers
          Heath

          Show
          Heath Kesler added a comment - @Jamie, I added a new class for PostgreSQL locking and added tests. Please review when you get a chance and advise. Cheers Heath
          Hide
          Jamie goodyear added a comment -

          The patch looks good, thanks Heath

          Could you create a patch for the 2.2.x and 2.3.x branches as well?
          Also a patch for our documentation would be great to have.

          Cheers,
          Jamie

          Show
          Jamie goodyear added a comment - The patch looks good, thanks Heath Could you create a patch for the 2.2.x and 2.3.x branches as well? Also a patch for our documentation would be great to have. Cheers, Jamie
          Hide
          Jamie goodyear added a comment -

          Checked into trunk:

          Thank you Heath for the patch!

          $ svn ci
          Adding main/src/main/java/org/apache/karaf/main/lock/PostgreSQLJDBCLock.java
          Adding main/src/test/java/org/apache/karaf/main/lock/PostgreSQLJDBCLockIntegrationTest.java
          Adding main/src/test/java/org/apache/karaf/main/lock/PostgreSQLJDBCLockTest.java
          Transmitting file data ...
          Committed revision 1368007.

          Show
          Jamie goodyear added a comment - Checked into trunk: Thank you Heath for the patch! $ svn ci Adding main/src/main/java/org/apache/karaf/main/lock/PostgreSQLJDBCLock.java Adding main/src/test/java/org/apache/karaf/main/lock/PostgreSQLJDBCLockIntegrationTest.java Adding main/src/test/java/org/apache/karaf/main/lock/PostgreSQLJDBCLockTest.java Transmitting file data ... Committed revision 1368007.
          Hide
          Heath Kesler added a comment -

          I updated the code slightly to make it more complete, while the previous patch works this fixes/updates a few unneeded option values. I had the create=true on the tests which are not required by postgres so I removed them

          Show
          Heath Kesler added a comment - I updated the code slightly to make it more complete, while the previous patch works this fixes/updates a few unneeded option values. I had the create=true on the tests which are not required by postgres so I removed them
          Hide
          Heath Kesler added a comment -

          @Jamie, I will provide patches for 2.2 and 2.3 soon, it is only a package naming change for the most part.

          Show
          Heath Kesler added a comment - @Jamie, I will provide patches for 2.2 and 2.3 soon, it is only a package naming change for the most part.
          Hide
          Jamie goodyear added a comment -

          Thanks for the updates to the unit tests Heath

          $ svn ci
          Sending main/src/test/java/org/apache/karaf/main/lock/PostgreSQLJDBCLockIntegrationTest.java
          Sending main/src/test/java/org/apache/karaf/main/lock/PostgreSQLJDBCLockTest.java
          Transmitting file data ..
          Committed revision 1368406.

          Show
          Jamie goodyear added a comment - Thanks for the updates to the unit tests Heath $ svn ci Sending main/src/test/java/org/apache/karaf/main/lock/PostgreSQLJDBCLockIntegrationTest.java Sending main/src/test/java/org/apache/karaf/main/lock/PostgreSQLJDBCLockTest.java Transmitting file data .. Committed revision 1368406.
          Hide
          Heath Kesler added a comment -

          the 2.3 patch will patch both 2.2 and 2.3 branches.

          Show
          Heath Kesler added a comment - the 2.3 patch will patch both 2.2 and 2.3 branches.
          Hide
          Jamie goodyear added a comment -

          I noticed references to derby in the unit tests - lets update it to postgre as above – so far looks good

          Show
          Jamie goodyear added a comment - I noticed references to derby in the unit tests - lets update it to postgre as above – so far looks good
          Hide
          Heath Kesler added a comment -

          here is the updated patch file

          Show
          Heath Kesler added a comment - here is the updated patch file
          Hide
          Jamie goodyear added a comment -

          Check in on 2.2.x branch:
          $ svn ci
          Adding main/src/main/java/org/apache/karaf/main/PostgreSQLJDBCLock.java
          Adding main/src/test/java/org/apache/karaf/main/PostgreSQLJDBCLockIntegrationTest.java
          Adding main/src/test/java/org/apache/karaf/main/PostgreSQLJDBCLockTest.java
          Transmitting file data ...
          Committed revision 1368732.

          Show
          Jamie goodyear added a comment - Check in on 2.2.x branch: $ svn ci Adding main/src/main/java/org/apache/karaf/main/PostgreSQLJDBCLock.java Adding main/src/test/java/org/apache/karaf/main/PostgreSQLJDBCLockIntegrationTest.java Adding main/src/test/java/org/apache/karaf/main/PostgreSQLJDBCLockTest.java Transmitting file data ... Committed revision 1368732.
          Hide
          Jamie goodyear added a comment -

          Check in on 2.3.x branch

          $ svn ci
          Adding main/src/main/java/org/apache/karaf/main/PostgreSQLJDBCLock.java
          Adding main/src/test/java/org/apache/karaf/main/PostgreSQLJDBCLockIntegrationTest.java
          Adding main/src/test/java/org/apache/karaf/main/PostgreSQLJDBCLockTest.java
          Transmitting file data ...
          Committed revision 1368742.

          Show
          Jamie goodyear added a comment - Check in on 2.3.x branch $ svn ci Adding main/src/main/java/org/apache/karaf/main/PostgreSQLJDBCLock.java Adding main/src/test/java/org/apache/karaf/main/PostgreSQLJDBCLockIntegrationTest.java Adding main/src/test/java/org/apache/karaf/main/PostgreSQLJDBCLockTest.java Transmitting file data ... Committed revision 1368742.
          Hide
          Jamie goodyear added a comment -

          Thank you for the 2.2 and 2.3 branch patches Heath Kesler

          Show
          Jamie goodyear added a comment - Thank you for the 2.2 and 2.3 branch patches Heath Kesler
          Hide
          Jamie goodyear added a comment -

          Thank you for the patches Heath Kesler!

          Show
          Jamie goodyear added a comment - Thank you for the patches Heath Kesler!

            People

            • Assignee:
              Jamie goodyear
              Reporter:
              Gert Vanthienen
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development