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

Deepesh Khandelwal commented on HIVE-18465:
-------------------------------------------

[~jcamachorodriguez] can you review the patch?

> Hive metastore schema initialization failing on postgres
> --------------------------------------------------------
>
>                 Key: HIVE-18465
>                 URL: https://issues.apache.org/jira/browse/HIVE-18465
>             Project: Hive
>          Issue Type: Bug
>          Components: Metastore
>    Affects Versions: 3.0.0
>            Reporter: Deepesh Khandelwal
>            Assignee: Deepesh Khandelwal
>            Priority: Major
>             Fix For: 3.0.0
>
>         Attachments: HIVE-18465.patch
>
>
> Hive metastore schema on postgres is broken after the commit for HIVE-14498. 
> Following error is seen during schema initialization:
> {noformat}
> 0: jdbc:postgresql://localhost.localdomain:54> ALTER TABLE ONLY 
> "MV_CREATION_MET
> ADATA" ADD CONSTRAINT "MV_CREATION_METADATA_FK" FOREIGN KEY ("TBL_ID") 
> REFERENCE
> S "TBLS"("TBL_ID") DEFERRABLE
> Error: ERROR: there is no unique constraint matching given keys for 
> referenced table "TBLS" (state=42830,code=0)
> Closing: 0: jdbc:postgresql://localhost.localdomain:5432/hive
> org.apache.hadoop.hive.metastore.HiveMetaException: Schema initialization 
> FAILED! Metastore state would be inconsistent !!
> Underlying cause: java.io.IOException : Schema script failed, errorcode 2
> org.apache.hadoop.hive.metastore.HiveMetaException: Schema initialization 
> FAILED! Metastore state would be inconsistent !!
>       at 
> org.apache.hive.beeline.HiveSchemaTool.doInit(HiveSchemaTool.java:586)
>       at 
> org.apache.hive.beeline.HiveSchemaTool.doInit(HiveSchemaTool.java:559)
>       at org.apache.hive.beeline.HiveSchemaTool.main(HiveSchemaTool.java:1183)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:498)
>       at org.apache.hadoop.util.RunJar.run(RunJar.java:239)
>       at org.apache.hadoop.util.RunJar.main(RunJar.java:153)
> Caused by: java.io.IOException: Schema script failed, errorcode 2
>       at 
> org.apache.hive.beeline.HiveSchemaTool.runBeeLine(HiveSchemaTool.java:957)
>       at 
> org.apache.hive.beeline.HiveSchemaTool.runBeeLine(HiveSchemaTool.java:935)
>       at 
> org.apache.hive.beeline.HiveSchemaTool.doInit(HiveSchemaTool.java:582)
>       ... 8 more
> *** schemaTool failed ***{noformat}
> In the file metastore/scripts/upgrade/postgres/hive-schema-3.0.0.postgres.sql 
> the ordering of statement
> {noformat}
> ALTER TABLE ONLY "MV_CREATION_METADATA"
>  ADD CONSTRAINT "MV_CREATION_METADATA_FK" FOREIGN KEY ("TBL_ID") REFERENCES 
> "TBLS"("TBL_ID") DEFERRABLE;{noformat}
> is before the definition of unique constraints for TBLS which is causing the 
> issue.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to