Ngone51 commented on a change in pull request #31102:
URL: https://github.com/apache/spark/pull/31102#discussion_r555848975



##########
File path: 
core/src/main/scala/org/apache/spark/storage/BlockManagerDecommissioner.scala
##########
@@ -361,37 +350,28 @@ private[storage] class BlockManagerDecommissioner(
       stopped = true
     }
     try {
-      rddBlockMigrationExecutor.shutdown()
-    } catch {
-      case e: Exception =>
-        logError(s"Error during shutdown", e)
-    }
-    try {
-      shuffleBlockMigrationRefreshExecutor.shutdown()
-    } catch {
-      case e: Exception =>
-        logError(s"Error during shutdown", e)
-    }
-    try {
-      stopOffloadingShuffleBlocks()
+      rddBlockMigrationExecutor.foreach(_.shutdownNow())
     } catch {
-      case e: Exception =>
-        logError(s"Error during shutdown", e)
+      case NonFatal(e) =>
+        logError(s"Error during shutdown RDD block migration thread", e)
     }
-    logInfo("Forcing block migrations threads to stop")
-    try {
-      rddBlockMigrationExecutor.shutdownNow()
-    } catch {
-      case e: Exception =>
-        logError(s"Error during shutdown", e)
-    }
-    try {
-      shuffleBlockMigrationRefreshExecutor.shutdownNow()
-    } catch {
-      case e: Exception =>
-        logError(s"Error during shutdown", e)
+    shuffleBlockMigrationRefreshExecutor.foreach { executor =>
+      try {
+        executor.shutdownNow()
+      } catch {
+        case NonFatal(e) =>
+          logError(s"Error during shutdown shuffle block refreshing thread", e)
+      }
+      try {
+        // invoke inside `foreach` so we can avoid initiating
+        // `shuffleMigrationPool` when it's unnecessary
+        stopMigratingShuffleBlocks()

Review comment:
       Sounds good to me!




----------------------------------------------------------------
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to