waitinfuture commented on code in PR #2088:
URL: 
https://github.com/apache/incubator-celeborn/pull/2088#discussion_r1390730803


##########
worker/src/main/java/org/apache/celeborn/service/deploy/worker/storage/FileWriter.java:
##########
@@ -159,14 +162,24 @@ protected void flush(boolean finalFlush) throws 
IOException {
         int numBytes = flushBuffer.readableBytes();
         if (numBytes != 0) {
           notifier.checkException();
-          notifier.numPendingFlushes.incrementAndGet();
-          FlushTask task = null;
-          if (channel != null) {
-            task = new LocalFlushTask(flushBuffer, channel, notifier);
-          } else if (fileInfo.isHdfs()) {
-            task = new HdfsFlushTask(flushBuffer, fileInfo.getHdfsPath(), 
notifier);
+          if (finalFlush
+              && channel != null
+              && fileInfo.getFileLength() == 0
+              && cacheManager.canCache(numBytes)) {
+            cacheManager.putCache(fileInfo.getFilePath(), flushBuffer.copy());

Review Comment:
   copy() here is to simplify release logic



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to