markap14 commented on a change in pull request #3594: NIFI-3833 Support for Encrypted Flow File Repositories URL: https://github.com/apache/nifi/pull/3594#discussion_r314027272
########## File path: nifi-commons/nifi-write-ahead-log/src/main/java/org/apache/nifi/wali/LengthDelimitedJournal.java ########## @@ -373,7 +378,8 @@ public synchronized void fsync() throws IOException { try { if (fileOut != null) { - fileOut.getChannel().force(false); + // Before transparent crypto, this was: fileOut.getChannel().force(false); Review comment: This change is not equivalent. We must be sure that we cause a `fsync` to occur, or else we face the possibility of data loss. To do this, we will need access to the `FileOutputStream`. So we will need to somehow couple the FileOutputStream along with the CipherOutputStream - either by storing a Tuple<FileOutputStream, CipherOutputStream> (which is not ideal, as it's not very clean) or - preferably - by creating a wrapper with either a getter for the underlying FileOutputStream and a getter for the underlying CipherOutputStream or an `fsync()` method and a getter for the underlying CipherOutputStream. Either way, we must ensure that we `fsync` here to avoid loss of data. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services