diff --git hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/tool/JobState.java hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/tool/JobState.java index ec121fd..2754827 100644 --- hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/tool/JobState.java +++ hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/tool/JobState.java @@ -128,7 +128,22 @@ public void setPercentComplete(String percent) */ public String getChildId() throws IOException { - return getField("childid"); + String childId = getField("childid"); + // getField can return an empty string in case DFS read + // happens at the time when JobController tries to write to + // this property. Specifically, if the read happens + // in-between FileSystem#create() and Stream#close() + // the returned result will be an empty string. + // This is generally a rare race condition that will + // result in the client jobid status check to fail with + // "jobid string "" is not properly formed". + // + // We return null in this case to harden the code and prevent + // this failure. + if ((childId != null) && (childId.equals(""))) { + childId = null; + } + return childId; } public void setChildId(String childid)