1、錯誤描述
hive執行任務 map reducer 階段均執行成功。但在文件移動時報錯“Error: Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MoveTask.”,同時對應分區文件中有數據出現,也可查詢。
2、 詳細日志
?[2KMap 1 .......... container SUCCEEDED 17 17 0 0 0 0
Reducer 2 ...... container SUCCEEDED 1009 1009 0 0 0 0
Reducer 3 ...... container SUCCEEDED 1009 1009 0 0 0 0
Reducer 4 ...... container SUCCEEDED 253 253 0 0 0 0
?[2K----------------------------------------------------------------------------------------------
?[2K?[31;1mVERTICES: 04/04 [==========================>>] 100% ELAPSED TIME: 3876.53 s
?[22;0m?[2K----------------------------------------------------------------------------------------------
ERROR : FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MoveTask. Exception when loading 39 in table ods_srvc_adm_order_d with loadPath=hdfs://XXX.cn:8020/warehouse/tablespace/external/hive/ods_XXX.db/ods_XXX_order_d/.hive-staging_hive_2024-11-04_06-42-32_919_5538586256515894993-19857/-ext-10000
INFO : Completed executing command(queryId=hive_20241104064232_fd4a116d-8883-4c9b-94bd-632ae431b508); Time taken: 5155.834 seconds
[INFO] 2024-11-04 08:08:42.334 +0800 - process has exited. execute path:/tmp/dolphinscheduler/exec/process/root/11595226163648/11605886348353_5/126472/416224, processId:426636 ,exitStatusCode:1 ,processWaitForStatus:true ,processExitValue:1
[INFO] 2024-11-04 08:08:42.335 +0800 - Send task execute result to master, the current task status: TaskExecutionStatus{code=6, desc='failure'}
[INFO] 2024-11-04 08:08:42.335 +0800 - Remove the current task execute context from worker cache
[INFO] 2024-11-04 08:08:42.336 +0800 - The current execute mode isn't develop mode, will clear the task execute file: /tmp/dolphinscheduler/exec/process/root/11595226163648/11605886348353_5/126472/416224
[INFO] 2024-11-04 08:08:42.337 +0800 - Success clear the task execute file: /tmp/dolphinscheduler/exec/process/root/11595226163648/11605886348353_5/126472/416224
[INFO] 2024-11-04 08:08:43.042 +0800 - -> Error: Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MoveTask. Exception when loading 39 in table ods_XXX_d with loadPath=hdfs://XXX.cn:8020/warehouse/tablespace/external/hive/ods_ylfw.db/ods_srvc_adm_order_d/.hive-staging_hive_2024-11-04_06-42-32_919_5538586256515894993-19857/-ext-10000 (state=08S01,code=1)
Closing: 0: jdbc:hive2://XXX.cn:2181,XXX.cn:2181,XXX.cn:2181/default;password=XXX;serviceDiscoveryMode=zooKeeper;user=admin;zooKeeperNamespace=hiveserver2
[INFO] 2024-11-04 08:08:43.043 +0800 - FINALIZE_SESSION
3、異常分析
第一、 map reducer 階段均執行成功,說明任務sql不存在問題。可以造成問題是在數據存儲HDFS。
第二、數據存儲HDFS,無非就是權限問題和內存 磁盤問題。一一排查即可。
第三、分別排查了目錄權限、內存、磁盤。發現在HDFS目錄中出現非標準分區信息。見下圖
分區信息
大膽猜想,可能是分區字段中出現了特殊符號引起,HDFS文件及文件夾異常在move出現錯誤。
HDFS命名規范
命名規則:
命名限制:HDFS文件名和目錄名可以包含字母、數字、下劃線()和點(.)。文件名不能以點(.)開頭或結尾,且不能包含空格。
大小寫敏感性:HDFS對大小寫不敏感,即大小寫不同的文件名會被視為相同的文件。
命名最佳實踐:
簡潔明了:盡量使用簡短且具有描述性的名稱,避免使用過長或復雜的名稱。
避免特殊字符:盡管HDFS允許使用下劃線()和點(.),但建議避免使用其他特殊字符,以減少潛在的兼容性問題。
使用英文:盡管中文等非英文字符在HDFS中可能可以存儲,但為了兼容性和可讀性,建議使用英文命名。
4、問題處理
sql中對org_code分區字段進行規范處理,過濾非法字符。
5、異常驗證
再次執行此任務,錯誤消失。任務成功。
執行成功截圖