s0nskar commented on code in PR #3696:
URL: https://github.com/apache/celeborn/pull/3696#discussion_r3373240376


##########
worker/src/main/scala/org/apache/celeborn/service/deploy/worker/storage/Flusher.scala:
##########
@@ -73,29 +73,38 @@ abstract private[worker] class Flusher(
             copyBytes = new Array[Byte](maxTaskSize.toInt)
           }
           while (!stopFlag.get()) {
-            val task = workingQueues(index).take()
-            val key = s"Flusher-$this-${Random.nextInt()}"
-            workerSource.sample(getFlushTimeMetric(), key) {
-              if (!task.notifier.hasException) {
-                try {
-                  val flushBeginTime = System.nanoTime()
-                  lastBeginFlushTime.set(index, flushBeginTime)
-                  task.flush(copyBytes)
-                  if (flushTimeMetric != null) {
-                    val delta = System.nanoTime() - flushBeginTime
-                    flushTimeMetric.update(delta)
+            val task = workingQueues(index).poll(1000, TimeUnit.MILLISECONDS)
+            if (task != null) {
+              val key = s"Flusher-$this-${Random.nextInt()}"
+              workerSource.sample(getFlushTimeMetric(), key) {
+                if (!task.notifier.hasException) {
+                  try {
+                    val flushBeginTime = System.nanoTime()
+                    lastBeginFlushTime.set(index, flushBeginTime)
+                    task.flush(copyBytes)
+                    if (flushTimeMetric != null) {
+                      val delta = System.nanoTime() - flushBeginTime
+                      flushTimeMetric.update(delta)
+                    }
+                  } catch {
+                    case t: Throwable =>
+                      val e = ExceptionUtils.wrapThrowableToIOException(t)
+                      task.notifier.setException(e)
+                      processIOException(e, DiskStatus.READ_OR_WRITE_FAILURE)
+                      logWarning(s"Flusher-$this-thread-$index encounter 
exception.", t)
                   }
-                } catch {
-                  case t: Throwable =>
-                    val e = ExceptionUtils.wrapThrowableToIOException(t)
-                    task.notifier.setException(e)
-                    processIOException(e, DiskStatus.READ_OR_WRITE_FAILURE)
-                    logWarning(s"Flusher-$this-thread-$index encounter 
exception.", t)
+                  lastBeginFlushTime.set(index, -1)
                 }

Review Comment:
   I think this flow is ok as it is.



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