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

Clément Stenac commented on HIVE-20568:
---------------------------------------

Hi,

If I am not mistaken, this fix is not only a minor enhancement but a real bug 
fix that impacts ability to enumerate tables across schemas.

We have discovered that in Hortonworks HDP 3.1 (which ships with Hive 3.1.0), 
when Ranger authorization is in effect, the "getTables" call of the CLIService 
(accessed through the JDBC driver) will fail to return any table matching the 
search pattern if the database name contains underscores.

For example, getTables(null, null, "%", null) which should return tables from 
the whole metastore, will not return the ones from databases with underscores.

The reason is that when the Ranger authorizer is called, the dbName in the 
HivePrivObject has been mangled from my_db_with_underscores to 
my.db.with.underscores, and the authorization rule will fail to match.

My understanding is that this was introduced as part of HIVE-19432, when we 
started converting to pattern the dbName *after* retrieving it from the 
metastore.

The next call to the metastoreClient will contain the mangled name. The call to 
the metastore itself will succeed, because the pattern matches, but the 
HiveMetastoreClient will also call FilterUtils.filterTableNamesIfEnabled with 
the wrongful dbName, hence the authorizer will filter everything out.

Is our interpretation correct ?

Thanks,

> There is no need to convert the dbname to pattern while pulling tablemeta
> -------------------------------------------------------------------------
>
>                 Key: HIVE-20568
>                 URL: https://issues.apache.org/jira/browse/HIVE-20568
>             Project: Hive
>          Issue Type: Improvement
>          Components: Hive
>    Affects Versions: 0.4.0
>         Environment: Hive-4,Java-8
>            Reporter: Rajkumar Singh
>            Assignee: Rajkumar Singh
>            Priority: Minor
>             Fix For: 4.0.0
>
>         Attachments: HIVE-20568.patch
>
>
> there is no need to convert the dbname to pattern, dbNamePattern is just a 
> dbName which we are passing to getTableMeta
> https://github.com/apache/hive/blob/master/service/src/java/org/apache/hive/service/cli/operation/GetTablesOperation.java#L117



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

Reply via email to