Details
-
Improvement
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
0.13.0
-
None
-
None
Description
The HS2 offers an API to fetch Operation Log results from the maintained OperationLog file. The reader used inside class OperationLog$LogFile class reads line-by-line on its input stream, for any lines available from the OS's file input perspective.
The writer inside the same class uses PrintStream to write to the file in parallel. However, the PrintStream constructor used sets PrintStream's autoFlush feature in an OFF state. This causes the BufferedWriter used by PrintStream to accumulate 8k worth of bytes in memory as the buffer before flushing the writes to disk, causing a slowness in the logs streamed back to the client. Every line must be ideally flushed entirely as-its-written, for a smoother experience.
I suggest changing the line inside OperationLog$LogFile that appears as below:
out = new PrintStream(new FileOutputStream(file));
Into:
out = new PrintStream(new FileOutputStream(file), true);
This will cause it to use the described autoFlush feature of PrintStream and make for a better reader-log-results-streaming experience: https://docs.oracle.com/javase/7/docs/api/java/io/PrintStream.html#PrintStream(java.io.OutputStream,%20boolean)
Attachments
Attachments
Issue Links
- Is contained by
-
HIVE-14618 beeline fetch logging delays before query completion
- Closed