Hdfs的rename问题
来源:互联网 发布:淘宝不是卖家怎么贷款 编辑:程序博客网 时间:2024/04/28 17:21
公司之前有些人使用hadoop的原生api的rename方法。因为他只返回true或者false 并不报错。所以当在无法rename的时候不知道问题在哪 就怪我们搭建平台的人
所以我被去要求研究下问题所在
调研了hadoop的源代码 发现rename的方法上有这几段注释
/** * Renames Path src to Path dst * <ul> * <li * <li>Fails if src is a file and dst is a directory. * <li>Fails if src is a directory and dst is a file. * <li>Fails if the parent of dst does not exist or is a file. * </ul> * <p> * If OVERWRITE option is not passed as an argument, rename fails * if the dst already exists. * <p> * If OVERWRITE option is passed as an argument, rename overwrites * the dst if it is a file or an empty directory. Rename fails if dst is * a non-empty directory. * <p> * Note that atomicity of rename is dependent on the file system * implementation. Please refer to the file system documentation for * details. This default implementation is non atomic. * <p> * This method is deprecated since it is a temporary method added to * support the transition from FileSystem to FileContext for user * applications. *
这些都是出现错误的原因:
1 源文件是文件 但目标文件是目录
2 源文件是目录 但目标文件是文件
3 目标文件的父目录不存在
4 ..
5 ..
因为测试到第3步的时候就发现了他们的问题 所以后面的没有继续研究
他们有对源文件的父目录进行判断 但是没有对目标文件的父目录进行判断
所以最后的解决办法是:
首先代码里最好要标出 源文件和目标文件的具体目录 然后
例如/apps/cal/normal/input/2/201601/123456.txt 也可以手动去判断/apps/cal/normal/input/2/201601/ 这个目录是否存在
因为好几次的问题 都是因为coder自己觉得没问题 但是目标文件的父目录是不存在的
经过排查后 该问题解决
0 0
- Hdfs的rename问题
- rename 出现的奇怪问题
- File rename的bug问题
- hdfs文件系统FileSystem.rename异常
- About hadoop hdfs filesystem rename
- 【HDFS】文件入Trash-rename操作
- Druid连接HDFS做Rename超时
- os.rename()导致WindowsError: [Error 32]的问题
- os.rename()导致WindowsError: [Error 183]的问题
- 解决LOG4J:ERROR Failed to rename的问题
- 修改HDFS遇到的问题
- #import的rename使用
- rename函数的用法
- linux的rename命令
- linux的rename命令
- rename命令的使用
- rename函数的使用
- linux的rename命令
- 使用unity实现顿帧,大大提升打击感
- 二分问题-捉老鼠
- 斜率优化初涉
- 对Abstract类的一点理解
- 购买与搭建云服务器
- Hdfs的rename问题
- protobuf对象二进制序列化存储
- Oracle修改字段类型方法总结
- How to uninstall Python 2.7 (installed by yourself) on a Mac OS
- 高仿QQ6.0侧滑菜单之滑动优化(二)
- 浙江绿盟科技笔试题
- 安装grafana-zabbix插件
- 哈希表算法
- 关于Spring中ApplicationContext的说明