hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Damien Carol (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HIVE-7689) Fix wrong lower case table names in Postgres Metastore back end
Date Thu, 02 Oct 2014 08:04:34 GMT

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

Damien Carol commented on HIVE-7689:
------------------------------------

[~alangates] [[~brocknoland] Now I can confirm that without the patch, Metastore backend for
stats on postgres don't work.

when using jdbc connector for stats, {{JDBCStatsPublisher}} throws errors. Here the error
in the logs :
{noformat}
14/10/02 09:49:11 ERROR jdbc.JDBCStatsPublisher: Error during JDBC initialization.
org.postgresql.util.PSQLException: ERROR: relation "partition_stats_v2" already exists
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2096)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1829)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:510)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:372)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:300)
        at org.apache.hadoop.hive.ql.stats.jdbc.JDBCStatsPublisher.init(JDBCStatsPublisher.java:286)
{noformat}

It is a side effect of mixing lower case and upper case.

To understand this bug :

1. JDBC stats publisher use this code to check if table exists.
{code}
 // Check if the table exists
        DatabaseMetaData dbm = conn.getMetaData();
        rs = dbm.getTables(null, null, JDBCStatsUtils.getStatTableName(), null);
        boolean tblExists = rs.next();
        if (!tblExists) { // Table does not exist, create it
          String createTable = JDBCStatsUtils.getCreate("");
          stmt.executeUpdate(createTable);          
        }
{code}

2. But {{JDBCStatsUtils.getStatTableName()}} value is {{PARTITION_STATS_V2}} in *uppercase*.
3. The Metastore try to create an already existing table.

I will create another JIRA that fix *only* this part.


> Fix wrong lower case table names in Postgres Metastore back end
> ---------------------------------------------------------------
>
>                 Key: HIVE-7689
>                 URL: https://issues.apache.org/jira/browse/HIVE-7689
>             Project: Hive
>          Issue Type: Improvement
>          Components: Metastore
>    Affects Versions: 0.14.0
>            Reporter: Damien Carol
>            Assignee: Damien Carol
>            Priority: Blocker
>              Labels: metastore, postgres
>             Fix For: 0.14.0
>
>         Attachments: HIVE-7689.5.patch, HIVE-7689.6.patch, HIVE-7689.7.patch, HIVE-7689.8.patch,
HIVE-7689.9.patch, HIVE-7889.1.patch, HIVE-7889.2.patch, HIVE-7889.3.patch, HIVE-7889.4.patch
>
>
> Current 0.14 patch create table with lower case names.
> This patch fix wrong lower case tables names in Postgres Metastore back end.
> Mixing lower case and upper case throws bugs in {{JDBCStatsPublisher}}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message