mirror of https://github.com/apache/nifi.git
NIFI-3630 This closes #1632. Use a BufferedOutputStream when checkpointing FlowFile Repository
Signed-off-by: joewitt <joewitt@apache.org>
This commit is contained in:
parent
fd92999daf
commit
091359b450
|
@ -569,7 +569,7 @@ public final class MinimalLockingWriteAheadLog<T> implements WriteAheadRepositor
|
||||||
|
|
||||||
// perform checkpoint, writing to .partial file
|
// perform checkpoint, writing to .partial file
|
||||||
fileOut = new FileOutputStream(partialPath.toFile());
|
fileOut = new FileOutputStream(partialPath.toFile());
|
||||||
dataOut = new DataOutputStream(fileOut);
|
dataOut = new DataOutputStream(new BufferedOutputStream(fileOut));
|
||||||
dataOut.writeUTF(MinimalLockingWriteAheadLog.class.getName());
|
dataOut.writeUTF(MinimalLockingWriteAheadLog.class.getName());
|
||||||
dataOut.writeInt(getVersion());
|
dataOut.writeInt(getVersion());
|
||||||
dataOut.writeUTF(serde.getClass().getName());
|
dataOut.writeUTF(serde.getClass().getName());
|
||||||
|
@ -590,9 +590,12 @@ public final class MinimalLockingWriteAheadLog<T> implements WriteAheadRepositor
|
||||||
} finally {
|
} finally {
|
||||||
if (dataOut != null) {
|
if (dataOut != null) {
|
||||||
try {
|
try {
|
||||||
dataOut.flush();
|
try {
|
||||||
fileOut.getFD().sync();
|
dataOut.flush();
|
||||||
dataOut.close();
|
fileOut.getFD().sync();
|
||||||
|
} finally {
|
||||||
|
dataOut.close();
|
||||||
|
}
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
logger.warn("Failed to close Data Stream due to {}", e.toString(), e);
|
logger.warn("Failed to close Data Stream due to {}", e.toString(), e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue