You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Deeran Peethamparam (JIRA)" <ji...@apache.org> on 2015/09/01 05:12:45 UTC

[jira] [Commented] (HIVE-11667) Support Trash and Snapshot in Truncate Table

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

Deeran Peethamparam commented on HIVE-11667:
--------------------------------------------


Test case to demonstrate issue.

{noformat}
# hdfs dfsadmin -allowSnapshot /user/hive/warehouse/dp.db/managed_table
Allowing snaphot on /user/hive/warehouse/dp.db/managed_table succeeded

# hdfs dfs -createSnapshot /user/hive/warehouse/dp.db/managed_table managed-2011
Created snapshot /user/hive/warehouse/dp.db/managed_table/.snapshot/managed-2011

hive> truncate table managed_table;
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. Exception while processing

2015-08-23 10:20:01,629 INFO [main]: ql.Driver (Driver.java:execute(1243)) - Starting command: truncate table managed_table
2015-08-23 10:20:01,770 ERROR [main]: exec.DDLTask (DDLTask.java:execute(482)) - org.apache.hadoop.hive.ql.metadata.HiveException: Exception while processing
at org.apache.hadoop.hive.ql.exec.DDLTask.truncateTable(DDLTask.java:4450)
at org.apache.hadoop.hive.ql.exec.DDLTask.execute(DDLTask.java:472)
...
at org.apache.hadoop.util.RunJar.main(RunJar.java:212)
Caused by: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.hdfs.protocol.SnapshotException): The directory /user/hive/warehouse/dp.db/managed_table cannot be deleted since /user/hive/warehouse/dp.db/managed_table is snapshottable and already has snapshots
at org.apache.hadoop.hdfs.server.namenode.FSDirectory.checkSnapshot(FSDirectory.java:1323)
at org.apache.hadoop.hdfs.server.namenode.FSDirectory.delete(FSDirectory.java:1171)
...
at org.apache.hadoop.hdfs.DistributedFileSystem.delete(DistributedFileSystem.java:595)
at org.apache.hadoop.hive.ql.exec.DDLTask.truncateTable(DDLTask.java:4441)
... 19 more

2015-08-23 10:20:01,770 ERROR [main]: ql.Driver (SessionState.java:printError(567)) - FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. Exception while processing
{noformat}


> Support Trash and Snapshot in Truncate Table
> --------------------------------------------
>
>                 Key: HIVE-11667
>                 URL: https://issues.apache.org/jira/browse/HIVE-11667
>             Project: Hive
>          Issue Type: Improvement
>          Components: Query Processor
>            Reporter: Chaoyu Tang
>            Assignee: Chaoyu Tang
>            Priority: Minor
>
> Currently Truncate Table (or Partition) is implemented using FileSystem.delete and then recreate the directory. It does not support HDFS Trash if it is turned on. The table/partition can not be truncated if it has a snapshot.



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