hive超级用户drop partition权限问题bug

今天有个etl开发在drop partition的时候遇到了问题,因为是使用了自己的账号,而hdfs中对应partition的文件属主是hdfs的,在删除时会因为权限问题报错,切换用户为hdfs,做drop partition的错误,还是报错,看来没这么简单。

查看表的hdfs属性,目录的属主不是hdfs且目录对 hdfs没有写权限:

1
2
3
[hdfs @nfzm ~]$ hadoop fs -ls -d hdfs: //xxxx:9000/bip/external_table/vipdw/droptest     
Found 1 items
drwxr-x r-x   - ericni hdfs          0 2014 - 08 - 21 17 : 13 hdfs: //xxxxx:9000/bip/external_table/vipdw/droptest

drop partition报错,报hdfs用户没有权限,在hive中是设置了hdfs为超级管理员的,所以如果直接用hadoop fs命令是可以删除的,也就是权限问题不是出在hdfs上,而是在hive上,这里怎么会没有权限呢?

1
2
hive (vipdw)> ALTER TABLE droptest DROP PARTITION(dt= '20140840' );
14 / 08 / 21 17 : 31 : 21 ERROR metastore.RetryingHMSHandler: MetaException(message:Table partition not deleted since hdfs: //xxxx:9000/bip/external_table/vipdw/droptest is not writable by hdfs

根据调用信息,异常是在HiveMetaStore类中的verifyIsWritablePath 方法中抛出, verifyIsWritablePath类用来判断本目录的上层目录对当前用户是否可写,按照一般的思路,所有的hdfs目录都应该对超级管理员可写的。

1
2
3
4
5
6
7
8
9
10
11
12
private void verifyIsWritablePath(Path dir) throws MetaException {
      try {
        if (!wh.isWritable(dir.getParent())) {
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值