You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/12/08 10:30:33 UTC

[GitHub] [spark] boneanxs opened a new pull request, #38980: [SPARK-41448] Make consistent MR job IDs in FileBatchWriter and FileFormatWriter

boneanxs opened a new pull request, #38980:
URL: https://github.com/apache/spark/pull/38980

   <!--
   Thanks for sending a pull request!  Here are some tips for you:
     1. If this is your first time, please read our contributor guidelines: https://spark.apache.org/contributing.html
     2. Ensure you have added or run the appropriate tests for your PR: https://spark.apache.org/developer-tools.html
     3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][SPARK-XXXX] Your PR title ...'.
     4. Be sure to keep the PR description updated to reflect all changes.
     5. Please write your PR title to summarize what this PR proposes.
     6. If possible, provide a concise example to reproduce the issue for a faster review.
     7. If you want to add a new configuration, please read the guideline first for naming configurations in
        'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
     8. If you want to add or modify an error type or message, please read the guideline first in
        'core/src/main/resources/error/README.md'.
   -->
   
   ### What changes were proposed in this pull request?
   Make consistent MR job IDs in FileBatchWriter and FileFormatWriter
   
   ### Why are the changes needed?
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you propose a new API, clarify the use case for a new API.
     2. If you fix a bug, you can clarify why it is a bug.
   -->
   [SPARK-26873](https://issues.apache.org/jira/browse/SPARK-26873) fix the consistent issue for FileFormatWriter, but [SPARK-33230](https://issues.apache.org/jira/browse/SPARK-33230) break this requirement by introducing a random long, we need to address this to expects identical task IDs across attempts for correctness.
   
   Also FileBatchWriter doesn't follow this requirement, need to fix it as well.
   
   ### Does this PR introduce _any_ user-facing change?
   <!--
   Note that it means *any* user-facing change including all aspects such as the documentation fix.
   If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
   If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
   If no, write 'No'.
   -->
   no
   
   ### How was this patch tested?
   <!--
   If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
   If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
   If tests were not added, please describe why they were not added and/or why it was difficult to add.
   If benchmark tests were added, please run the benchmarks in GitHub Actions for the consistent environment, and the instructions could accord to: https://spark.apache.org/developer-tools.html#github-workflow-benchmarks.
   -->


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] Yikf commented on a diff in pull request #38980: [SPARK-41448] Make consistent MR job IDs in FileBatchWriter and FileFormatWriter

Posted by "Yikf (via GitHub)" <gi...@apache.org>.
Yikf commented on code in PR #38980:
URL: https://github.com/apache/spark/pull/38980#discussion_r1109330675


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/FileWriterFactory.scala:
##########
@@ -29,6 +29,9 @@ import org.apache.spark.sql.execution.datasources.{DynamicPartitionDataSingleWri
 case class FileWriterFactory (
     description: WriteJobDescription,
     committer: FileCommitProtocol) extends DataWriterFactory {
+
+  private val jobId = SparkHadoopWriterUtils.createJobID(new Date, 0)

Review Comment:
   @boneanxs It looks like tha `jobId` is not serializable?



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] boneanxs commented on pull request #38980: [SPARK-41448] Make consistent MR job IDs in FileBatchWriter and FileFormatWriter

Posted by GitBox <gi...@apache.org>.
boneanxs commented on PR #38980:
URL: https://github.com/apache/spark/pull/38980#issuecomment-1343903807

   @cloud-fan @rdblue @dongjoon-hyun @steveloughran could you please take a look?


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] steveloughran commented on a diff in pull request #38980: [SPARK-41448] Make consistent MR job IDs in FileBatchWriter and FileFormatWriter

Posted by GitBox <gi...@apache.org>.
steveloughran commented on code in PR #38980:
URL: https://github.com/apache/spark/pull/38980#discussion_r1044322385


##########
core/src/main/scala/org/apache/spark/internal/io/SparkHadoopWriterUtils.scala:
##########
@@ -47,11 +47,22 @@ object SparkHadoopWriterUtils {
    * @return a job ID
    */
   def createJobID(time: Date, id: Int): JobID = {
+    val jobTrackerID = createJobTrackerID(time)
+    createJobID(jobTrackerID, id)
+  }
+
+  /**
+   * Create a job ID.

Review Comment:
   how about extending the comment here by noting that the job id needs to be unique across all jobs (linking to SPARK-33402) and consistently across places used (SPARK-26873 + SPARK-41448). That way, whoever next goes near the code knows what is needed



##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/FileFormatWriter.scala:
##########
@@ -201,14 +201,14 @@ object FileFormatWriter extends Logging {
         rdd
       }
 
-      val jobIdInstant = new Date().getTime
+      val jobTrackerID = SparkHadoopWriterUtils.createJobTrackerID(new Date())

Review Comment:
   i must have missed this -but also we've not had any reports of the timstamp clash surfacing.
   
   that's probably because the s3a and abfs/gcs committers all pick up the uuid in "spark.sql.sources.writeJobUUID" in preference to anything else, and they are being generated uniquely



##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/FileWriterFactory.scala:
##########
@@ -29,6 +29,9 @@ import org.apache.spark.sql.execution.datasources.{DynamicPartitionDataSingleWri
 case class FileWriterFactory (
     description: WriteJobDescription,
     committer: FileCommitProtocol) extends DataWriterFactory {
+
+  private val jobId = SparkHadoopWriterUtils.createJobID(new Date, 0)
+

Review Comment:
   I wonder if a uuid should be created here which is then passed down in that "spark.sql.sources.writeJobUUID" option in `createTaskAttemptContext()`. It would be consistent with the rest and the mapreduce manifest committer would pick it up. (so would the s3a one, but as you can't do dynamic partitioning there it's less relevant)



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] steveloughran commented on a diff in pull request #38980: [SPARK-41448] Make consistent MR job IDs in FileBatchWriter and FileFormatWriter

Posted by "steveloughran (via GitHub)" <gi...@apache.org>.
steveloughran commented on code in PR #38980:
URL: https://github.com/apache/spark/pull/38980#discussion_r1109921742


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/FileWriterFactory.scala:
##########
@@ -29,6 +29,9 @@ import org.apache.spark.sql.execution.datasources.{DynamicPartitionDataSingleWri
 case class FileWriterFactory (
     description: WriteJobDescription,
     committer: FileCommitProtocol) extends DataWriterFactory {
+
+  private val jobId = SparkHadoopWriterUtils.createJobID(new Date, 0)

Review Comment:
   it does implement WritableComparable; you could use WritableConverter to do the marshalling if you don't just want to do via a string



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on pull request #38980: [SPARK-41448] Make consistent MR job IDs in FileBatchWriter and FileFormatWriter

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on PR #38980:
URL: https://github.com/apache/spark/pull/38980#issuecomment-1346229161

   thanks, merging to master/3.3./3.2


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #38980: [SPARK-41448] Make consistent MR job IDs in FileBatchWriter and FileFormatWriter

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on PR #38980:
URL: https://github.com/apache/spark/pull/38980#issuecomment-1345290011

   Can one of the admins verify this patch?


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan closed pull request #38980: [SPARK-41448] Make consistent MR job IDs in FileBatchWriter and FileFormatWriter

Posted by GitBox <gi...@apache.org>.
cloud-fan closed pull request #38980: [SPARK-41448] Make consistent MR job IDs in FileBatchWriter and FileFormatWriter
URL: https://github.com/apache/spark/pull/38980


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org