You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "philipse (Jira)" <ji...@apache.org> on 2020/05/09 02:10:00 UTC

[jira] [Commented] (HIVE-21820) drop database command flushing other data outside db folder

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

philipse commented on HIVE-21820:
---------------------------------

for create database operation:

if no locations specific,then the “.db” is generated as the path suffix,the rootpath will be the default warehouse path.

if locations are specific,then the location will be the whole path for the database
{code:java}
// private void create_database_core(RawStore ms, final Database db)
 throws AlreadyExistsException, InvalidObjectException, MetaException {
 if (!validateName(db.getName())) {
 throw new InvalidObjectException(db.getName() + " is not a valid database name");
 }
 if (null == db.getLocationUri()) {
 db.setLocationUri(wh.getDefaultDatabasePath(db.getName()).toString());
 } else {
 db.setLocationUri(wh.getDnsPath(new Path(db.getLocationUri())).toString());
 }
{code}
for drop database operation:

it will delete the database location after cleaning the meta(views,functions,tables),if other dbs  share the same location as the deleted db, meta will not feel that, the relation between the location and meta info are not like the foreign key, maybe related with the original design of metastore db,you can monitor the the event and do the filter if different databases or tables share the same location.

Help it will help you.

> drop database command flushing other data outside db folder
> -----------------------------------------------------------
>
>                 Key: HIVE-21820
>                 URL: https://issues.apache.org/jira/browse/HIVE-21820
>             Project: Hive
>          Issue Type: Bug
>    Affects Versions: 1.2.1
>            Reporter: Neeraj Maheshwari
>            Priority: Blocker
>
> On running the below command to create new database:
> *create database abc location /users/hive/warehouse/project_name/;*
> here expected is, this command should create a new db folder named abc.db under project_name directory, but with hive version 1.2.1000.2.6.3.0-235 its not creating abc.db folder.
>  
> And on running command *drop database abc;* the entire project_name directory got deleted from HDFS. So here drop command rather than dropping just one db it deleted whole directory and just retained meta informations in hive metastore for other dbs present in project_name directory.



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