Description
Alter Table operation for db_enc.rename_test failed to move data due to: '/hdfs/encrypted_path/db_enc/rename_test can't be moved from an encryption zone.'
When Hive renames a managed table, it always creates the new renamed table directory under its database directory in order to keep a db/table hierarchy. In this case, the renamed table directory is created under "default db" directory "hive/warehouse/". When Hive renames a managed table, it always creates the new renamed table directory under its database directory in order to keep a db/table hierarchy. In this case, the renamed table directory is created under "default' db directory typically set as /hive/warehouse/ .
This error doesn't appear if first create a database which points to a directory outside /hive/warehouse/, say '/hdfs/encrypted_path', you won't have this problem. For example,
create database db_enc location '/hdfs/encrypted_path/db_enc;
use db_enc;
create table rename_test (...) location '/hdfs/encrypted_path/db_enc/rename_test';
alter table rename_test rename to test_rename;
The renamed test_rename directory is created under /hdfs/encrypted_path/db_enc.
Considering that the encryption of a filesystem is part of the evolution hardening of a system (where the system and the data contained can already exists) and a db can be already created without location set (because it is not strictly required)and the default db is outside the same encryption zone (or in a no-encryption zone) the alter table rename operation will fail.
Improvement:
Preserve the "parent location" of the table when an "alter table <table> rename to <newname>" is submitted (the case when the db location is not specified and the Hive defult db is outside the same encrypted zone).
Attachments
Attachments
Issue Links
- relates to
-
HIVE-15091 Master: Update errata.txt for the missing JIRA number in HIVE-14909 commit msg
- Resolved
- supercedes
-
HIVE-14319 update encryption_move_tbl.q when switching Hive to use Hadoop 2.7
- Resolved
- links to