You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Mark Struberg (Jira)" <ji...@apache.org> on 2021/04/07 05:45:00 UTC

[jira] [Commented] (OPENJPA-2806) PESSIMISTIC_READ takes out exclusive lock on Postgres

    [ https://issues.apache.org/jira/browse/OPENJPA-2806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17315980#comment-17315980 ] 

Mark Struberg commented on OPENJPA-2806:
----------------------------------------

Hi [~pveselov] That could have something to do that PostgreSQL didn't support setQueryTimeout properly for a long time. Since pg10 it's nicely supported and I enabled it in our {{PostgresDictionary}} a few days ago in OPENJPA-2860. Can you please retest it with 3.1.3-SNAPSHOT? txs!

> PESSIMISTIC_READ takes out exclusive lock on Postgres
> -----------------------------------------------------
>
>                 Key: OPENJPA-2806
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2806
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 2.4.2, 3.0.0, 3.1.0
>            Reporter: Pawel Veselov
>            Assignee: Mark Struberg
>            Priority: Major
>             Fix For: 3.1.3
>
>         Attachments: openjpa-lock.zip
>
>
> I've found out that using PESSIMISTIC_READ on an entity with postgres
> uses 'for update' lock, which is actually exclusive.
> I understand JPA specification says that it's permissible to do that,
> but I really need a shared lock for what I'm trying to achieve.
> Is it possible to control somehow? I've had to resolve to using native
> queries, and I'd like to avoid this as much as possible...
> Attached is a test.
> Change App.java to control database properties for connection (top of `main()`)
> Run App.class to execute the test. If the lock taken by OpenJPA is exclusive, then native query will fail (with an exception).
> I'm testing on Postgres 9.6
> Tested with 2.4.2, 3.0.0 and 3.1.0



--
This message was sent by Atlassian Jira
(v8.3.4#803005)