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

Eugene Koifman commented on HIVE-10630:
---------------------------------------

The rename operation ends up in 
{noformat}
HiveAlterHandler.alterTable(RawStore msdb, Warehouse wh, String dbname,
      String name, Table newt, boolean cascade)
{noformat}

which performs the metadata part of the operation and in the finally block tires
{noformat}
          if (srcFs.exists(srcPath) && !srcFs.rename(srcPath, destPath)) {
            throw new IOException("Renaming " + srcPath + " to " + destPath + " 
has failed");
          }
{noformat}
FileSystem.rename() only returns the status but the namenode log has
{noformat}
2015-05-11 13:00:45,352 INFO org.apache.hadoop.ipc.Server: IPC Server handler 2 
on 9000, call org.apache.hadoop.hdfs.protocol.ClientProtocol.rename from 
127.0.0.1:61916 Call#34\
 Retry#0
java.io.IOException: /user/hive/warehouse/testdb256.db/abc can't be moved from 
an encryption zone.
        at 
org.apache.hadoop.hdfs.server.namenode.EncryptionZoneManager.checkMoveValidity(EncryptionZoneManager.java:256)
        at 
org.apache.hadoop.hdfs.server.namenode.FSDirRenameOp.unprotectedRenameTo(FSDirRenameOp.java:187)
        at 
org.apache.hadoop.hdfs.server.namenode.FSDirRenameOp.renameTo(FSDirRenameOp.java:474)
        at 
org.apache.hadoop.hdfs.server.namenode.FSDirRenameOp.renameToInt(FSDirRenameOp.java:73)
        at 
org.apache.hadoop.hdfs.server.namenode.FSNamesystem.renameTo(FSNamesystem.java:3665)
        at 
org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.rename(NameNodeRpcServer.java:864)
        at 
org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.rename(ClientNamenodeProtocolServerSideTranslatorPB.java:575)
        at 
org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(ClientNamenodeProtocolProtos.java)
        at 
org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:616)
        at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:969)
        at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2049)
        at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2045)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAs(Subject.java:415)
        at 
org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1657)
        at org.apache.hadoop.ipc.Server$Handler.run(Server.java:2043)
{noformat}

Then the code in HiveAlterHandler.alterTable() attempts to undo the metadata 
operation which (due to a bug not related to TDE) fails and we get a bunch 
errors in hive.log like "Reverting metadata by HDFS operation failure failed 
During HDFS operation failed" that don't indicate the real issue and end with 
"rename" operation partially completed.


> Renaming tables across encryption zones renames table even though the 
> operation throws error
> --------------------------------------------------------------------------------------------
>
>                 Key: HIVE-10630
>                 URL: https://issues.apache.org/jira/browse/HIVE-10630
>             Project: Hive
>          Issue Type: Sub-task
>          Components: Security
>            Reporter: Deepesh Khandelwal
>            Assignee: Eugene Koifman
>
> Create a table with data in an encrypted zone 1 and then rename it to 
> encrypted zone 2.
> {noformat}
> hive> alter table encdb1.testtbl rename to encdb2.testtbl;
> FAILED: Execution Error, return code 1 from 
> org.apache.hadoop.hive.ql.exec.DDLTask. Unable to alter table. Unable to 
> access old location 
> hdfs://node-1.example.com:8020/apps/hive/warehouse/encdb1.db/testtbl for 
> table encdb1.testtbl
> {noformat}
> Even though the command errors out the table is renamed. I think the right 
> behavior should be to not rename the table at all including the metadata.



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

Reply via email to