You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "László Bodor (Jira)" <ji...@apache.org> on 2021/09/27 12:01:00 UTC

[jira] [Resolved] (HIVE-25331) Create database query doesn't create MANAGEDLOCATION directory

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

László Bodor resolved HIVE-25331.
---------------------------------
    Fix Version/s: 4.0.0
       Resolution: Fixed

merged to master, thanks [~robbiezhang] for the patch!

> Create database query doesn't create MANAGEDLOCATION directory
> --------------------------------------------------------------
>
>                 Key: HIVE-25331
>                 URL: https://issues.apache.org/jira/browse/HIVE-25331
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Robbie Zhang
>            Assignee: Robbie Zhang
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 4.0.0
>
>          Time Spent: 2h 40m
>  Remaining Estimate: 0h
>
> If we don't assign MANAGEDLOCATION in a "create database" query, the MANAGEDLOCATION will be NULL so HMS doesn't create the directory. In this case, a CTAS query immediately after the CREATE DATABASE query might fail in MOVE task due to "destination's parent does not exist". I can use the following script to reproduce this issue:
> {code:java}
> set hive.support.concurrency=true;
> set hive.txn.manager=org.apache.hadoop.hive.ql.lockmgr.DbTxnManager;
> create database testdb location '/tmp/testdb.db';
> create table testdb.test as select 1;
> {code}
> If the staging directory is under the MANAGEDLOCATION directory, the CTAS query is fine as the MANAGEDLOCATION directory is created while creating the staging directory. Since we set LOCATION to a default directory when LOCATION is not assigned in the CREATE DATABASE query, I believe it's worth to set MANAGEDLOCATION to a default directory, too.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)