[GitHub] spark pull request #16979: [SPARK-19617][SS]Fix the race condition when star...
Github user zsxwing closed the pull request at: https://github.com/apache/spark/pull/16979 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #16979: [SPARK-19617][SS]Fix the race condition when star...
Github user tdas commented on a diff in the pull request: https://github.com/apache/spark/pull/16979#discussion_r102371334 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/HDFSMetadataLog.scala --- @@ -63,8 +63,34 @@ class HDFSMetadataLog[T <: AnyRef : ClassTag](sparkSession: SparkSession, path: val metadataPath = new Path(path) protected val fileManager = createFileManager() - if (!fileManager.exists(metadataPath)) { -fileManager.mkdirs(metadataPath) + runUninterruptiblyIfLocal { +if (!fileManager.exists(metadataPath)) { + fileManager.mkdirs(metadataPath) +} + } + + private def runUninterruptiblyIfLocal[T](body: => T): T = { +if (fileManager.isLocalFileSystem && Thread.currentThread.isInstanceOf[UninterruptibleThread]) { --- End diff -- So we are changing this to a best-effort attempt, rather than the try-and-explicitly-fail attempt, in the case of a local file system... right? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #16979: [SPARK-19617][SS]Fix the race condition when star...
Github user zsxwing commented on a diff in the pull request: https://github.com/apache/spark/pull/16979#discussion_r102335119 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/HDFSMetadataLog.scala --- @@ -63,8 +63,34 @@ class HDFSMetadataLog[T <: AnyRef : ClassTag](sparkSession: SparkSession, path: val metadataPath = new Path(path) protected val fileManager = createFileManager() - if (!fileManager.exists(metadataPath)) { -fileManager.mkdirs(metadataPath) + runUninterruptiblyIfLocal { +if (!fileManager.exists(metadataPath)) { + fileManager.mkdirs(metadataPath) +} + } + + private def runUninterruptiblyIfLocal[T](body: => T): T = { +if (fileManager.isLocalFileSystem && Thread.currentThread.isInstanceOf[UninterruptibleThread]) { + // When using a local file system, some file system APIs like "create" or "mkdirs" must be --- End diff -- I fixed the comments to point to the root cause: HADOOP-10622. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #16979: [SPARK-19617][SS]Fix the race condition when star...
Github user zsxwing commented on a diff in the pull request: https://github.com/apache/spark/pull/16979#discussion_r102141431 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/HDFSMetadataLog.scala --- @@ -63,8 +63,34 @@ class HDFSMetadataLog[T <: AnyRef : ClassTag](sparkSession: SparkSession, path: val metadataPath = new Path(path) protected val fileManager = createFileManager() - if (!fileManager.exists(metadataPath)) { -fileManager.mkdirs(metadataPath) + runUninterruptiblyIfLocal { +if (!fileManager.exists(metadataPath)) { + fileManager.mkdirs(metadataPath) +} + } + + private def runUninterruptiblyIfLocal[T](body: => T): T = { +if (fileManager.isLocalFileSystem && Thread.currentThread.isInstanceOf[UninterruptibleThread]) { --- End diff -- have to change the condition here because StreamExecution will create a HDFSMetadata in a non UninterruptibleThread. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #16979: [SPARK-19617][SS]Fix the race condition when star...
Github user zsxwing commented on a diff in the pull request: https://github.com/apache/spark/pull/16979#discussion_r101882783 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/HDFSMetadataLog.scala --- @@ -63,8 +63,39 @@ class HDFSMetadataLog[T <: AnyRef : ClassTag](sparkSession: SparkSession, path: val metadataPath = new Path(path) protected val fileManager = createFileManager() - if (!fileManager.exists(metadataPath)) { -fileManager.mkdirs(metadataPath) + runUninterruptiblyIfLocal { +if (!fileManager.exists(metadataPath)) { + fileManager.mkdirs(metadataPath) +} + } + + private def runUninterruptiblyIfLocal[T](body: => T): T = { +if (fileManager.isLocalFileSystem) { + Thread.currentThread match { +case ut: UninterruptibleThread => + // When using a local file system, some file system APIs like "create" or "mkdirs" must be --- End diff -- Fixed the comment. I added it in https://github.com/apache/spark/commit/88c43f4fb5ea042a119819c11a5cdbe225095c54 but it was wrong. We don't need to use `runUninterruptibly ` to workaround `HADOOP-14084`. The root cause is `HADOOP-10622`. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #16979: [SPARK-19617][SS]Fix the race condition when star...
Github user zsxwing commented on a diff in the pull request: https://github.com/apache/spark/pull/16979#discussion_r101882720 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/StreamExecution.scala --- @@ -178,8 +178,9 @@ class StreamExecution( /** * The thread that runs the micro-batches of this stream. Note that this thread must be - * [[org.apache.spark.util.UninterruptibleThread]] to avoid swallowing `InterruptException` when - * using [[HDFSMetadataLog]]. See SPARK-19599 for more details. + * [[org.apache.spark.util.UninterruptibleThread]] to workaround KAFKA-1894: interrupting a + * running `KafkaConsumer` may cause endless loop, and HADOOP-10622: interrupting --- End diff -- This file is almost same as #16947 except this comment. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #16979: [SPARK-19617][SS]Fix the race condition when star...
GitHub user zsxwing opened a pull request: https://github.com/apache/spark/pull/16979 [SPARK-19617][SS]Fix the race condition when starting and stopping a query quickly (branch-2.1) ## What changes were proposed in this pull request? Backport #16947 to branch 2.1. ## How was this patch tested? Jenkins You can merge this pull request into a Git repository by running: $ git pull https://github.com/zsxwing/spark SPARK-19617-branch-2.1 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/16979.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #16979 commit 7a0b199dc47a71001d44731b22a0addd1359d8ec Author: Shixiong Zhu Date: 2017-02-16T00:59:57Z [SPARK-19617][SS]Fix the race condition when starting and stopping a query quickly (branch-2.1) --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org