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

ASF subversion and git services commented on KNOX-3536:
-------------------------------------------------------

Commit fa9e89aad20df24a4d9307f1005a456ac70b0da0 in knox's branch 
refs/heads/master from hanicz
[ https://gitbox.apache.org/repos/asf?p=knox.git;h=fa9e89aad ]

KNOX-3536: JDBCTokenStateService fails on PostgreSQL in HA: duplicate key on 
pg_type_typname_nsp_index during concurrent table creation (#1477)

> JDBCTokenStateService fails on PostgreSQL in HA: duplicate key on 
> pg_type_typname_nsp_index during concurrent table creation
> ----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: KNOX-3536
>                 URL: https://issues.apache.org/jira/browse/KNOX-3536
>             Project: Apache Knox
>          Issue Type: Bug
>          Components: Server
>    Affects Versions: 3.0.0
>            Reporter: Tamás Hanicz
>            Assignee: Tamás Hanicz
>            Priority: Major
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> When several Knox instances start at the same time against an empty 
> PostgreSQL database, \{{JDBCTokenStateService}} can fail to initialize:
> {noformat}
> PSQLException: ERROR: duplicate key value violates unique constraint 
> "pg_type_typname_nsp_index"
>   Detail: Key (typname, typnamespace)=(knox_tokens, 2200) already exists.
> {noformat}
> Cause: The Postgres DDL scripts wrap \{{CREATE TABLE IF NOT EXISTS}} in 
> \{{pg_advisory_lock}} / \{{pg_advisory_unlock}}. The whole script is sent in 
> one \{{Statement.execute()}}, which PostgreSQL runs as a single implicit 
> transaction. As a result, the unlock happens before the \{{CREATE TABLE}} 
> commits, and the next instance creates the table again.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to