diff --git a/src/main/java/com/microsoft/azure/datalake/store/ADLFileInputStream.java b/src/main/java/com/microsoft/azure/datalake/store/ADLFileInputStream.java index 1418ed6..1e7b1b3 100644 --- a/src/main/java/com/microsoft/azure/datalake/store/ADLFileInputStream.java +++ b/src/main/java/com/microsoft/azure/datalake/store/ADLFileInputStream.java @@ -259,24 +259,32 @@ int readRemote(long position, byte[] b, int offset, int length, boolean speculat while (inStream.read(junkbuffer, 0, junkbuffer.length)>=0); // read and consume rest of stream, if any remains } } catch (IOException ex) { - throw new ADLException("Error reading data from response stream in positioned read() for file " + filename, ex); + String requestDebugDetails = getRequestDebugDetails(opts, resp, + (System.nanoTime() - start) / 1000000, totalBytesRead, position); + throw new ADLException("Error reading data from response stream in positioned read() for file " + + filename + ". Details " + requestDebugDetails, ex); } finally { if (inStream != null) inStream.close(); long timeTaken=(System.nanoTime() - start)/1000000; if (log.isDebugEnabled()) { - String logline ="HTTPRequestRead," + (resp.successful?"Succeeded":"Failed") + - ",cReqId:" + opts.requestid + - ",lat:" + Long.toString(resp.lastCallLatency+timeTaken) + - ",Reqlen:" + totalBytesRead + - ",sReqId:" + resp.requestId + - ",path:" + filename + - ",offset:" + position; + String logline = getRequestDebugDetails(opts, resp, timeTaken, totalBytesRead, position); log.debug(logline); } } return totalBytesRead; } + private String getRequestDebugDetails(RequestOptions reqOpts, OperationResponse resp, + long timeTaken, int totalBytesRead, long position) { + return "HTTPRequestRead," + (resp.successful?"Succeeded":"Failed") + + ",cReqId:" + reqOpts.requestid + + ",lat:" + Long.toString(resp.lastCallLatency+timeTaken) + + ",Reqlen:" + totalBytesRead + + ",sReqId:" + resp.requestId + + ",path:" + filename + + ",offset:" + position; + } + /** * Seek to given position in stream. diff --git a/src/main/java/com/microsoft/azure/datalake/store/SyncFlag.java b/src/main/java/com/microsoft/azure/datalake/store/SyncFlag.java index 6198f44..3134be6 100644 --- a/src/main/java/com/microsoft/azure/datalake/store/SyncFlag.java +++ b/src/main/java/com/microsoft/azure/datalake/store/SyncFlag.java @@ -9,6 +9,15 @@ /** * Indicator flags to backend during append. + * Optionally indicates what to do after completion of the concurrent append. + * DATA indicates that more data will be sent immediately by the client, the file handle should + * remain open/locked, and file metadata (including file length, last modified time) should NOT + * get updated. + * METADATA indicates that more data will be sent immediately by the client, the file handle should + * remain open/locked, and file metadata should get updated. CLOSE indicates that the client is + * done sending data, the file handle should be closed/unlocked, and file metadata should get + * updated. + * Possible values include: 'DATA', 'METADATA', 'CLOSE' */ public enum SyncFlag { /**