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

Tamás Hanicz resolved KNOX-3536.
--------------------------------
    Fix Version/s: 3.1.0
       Resolution: Fixed

> 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
>             Fix For: 3.1.0
>
>          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