You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "mingkangli-db (via GitHub)" <gi...@apache.org> on 2024/07/17 18:01:19 UTC

[PR] [SPARK-48928] Log Warning for Calling .unpersist() on Locally Checkpointed RDDs [spark]

mingkangli-db opened a new pull request, #47391:
URL: https://github.com/apache/spark/pull/47391

   <!--
   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
        'common/utils/src/main/resources/error/README.md'.
   -->
   
   ### What changes were proposed in this pull request?
   <!--
   Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue. 
   If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
     1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
     2. If you fix some SQL features, you can provide some references of other DBMSes.
     3. If there is design documentation, please add the link.
     4. If there is a discussion in the mailing list, please add the link.
   -->
   
   This pull request proposes logging a warning message when the `.unpersist()` method is called on RDDs that have been locally checkpointed. The goal is to inform users about the potential risks associated with unpersisting locally checkpointed RDDs without changing the current behavior of the method.
   
   
   ### 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.
   -->
   
   Local checkpointing truncates the lineage of an RDD, preventing it from being recomputed from its source. If a locally checkpointed RDD is unpersisted, it loses its data and cannot be regenerated, potentially leading to job failures if subsequent actions or transformations are attempted on the RDD (which was seen on some user workloads). Logging a warning message helps users avoid such pitfalls and aids in debugging.
   
   
   ### 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'.
   -->
   
   Yes, this PR adds a warning log message when .unpersist() is called on a locally checkpointed RDD, but it does not alter any existing behavior.
   
   
   
   ### 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 PR does not change any existing behavior and therefore no tests are added.
   
   
   ### Was this patch authored or co-authored using generative AI tooling?
   <!--
   If generative AI tooling has been used in the process of authoring this patch, please include the
   phrase: 'Generated-by: ' followed by the name of the tool and its version.
   If no, write 'No'.
   Please refer to the [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html) for details.
   -->
   No.


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


Re: [PR] [SPARK-48928] Log Warning for Calling .unpersist() on Locally Checkpointed RDDs [spark]

Posted by "mingkangli-db (via GitHub)" <gi...@apache.org>.
mingkangli-db commented on PR #47391:
URL: https://github.com/apache/spark/pull/47391#issuecomment-2244052554

   > My point is, use of persist/unpersist is orthogonal to this - so why special case only here ? 
   
   Yes, you are right that the use of persist/unpersist can be orthogonal to this. However, we special case because calling`.unpersist()` _after local checkpointing_ will lead to job failure if any recomputation happens.  `.unpersist()` is usually a safe operation because the RDD can still be recomputed if `unpersist()` is called, but not in this case.
   
   > Better would be to add it when user invokes local checkpoint
   When user invokes `.localCheckpoint()`, this is fine as long as they understand the risk of having no fault-tolerance, but the combo `localCheckpoint()` + `unpersist()` can happen when there is no executor failure, so this is just to make users aware of the potential consequences. 


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


Re: [PR] [SPARK-48928] Log Warning for Calling .unpersist() on Locally Checkpointed RDDs [spark]

Posted by "mridulm (via GitHub)" <gi...@apache.org>.
mridulm commented on PR #47391:
URL: https://github.com/apache/spark/pull/47391#issuecomment-2246142777

   Ah, I see what you mean - sorry, I had forgotten that this is simply relying on storage level and not actually writing to the local disk (similar to hdfs for regular checkpoint).
   
   Make sense to add this.


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


Re: [PR] [SPARK-48928] Log Warning for Calling .unpersist() on Locally Checkpointed RDDs [spark]

Posted by "mridulm (via GitHub)" <gi...@apache.org>.
mridulm commented on PR #47391:
URL: https://github.com/apache/spark/pull/47391#issuecomment-2246146791

   Merged to master, thanks for fixing this @mingkangli-db !
   Thanks for the reviews @jiangxb1987 , @Ngone51 :-)
   
   Also thanks to everyone for answering my queries - I really was misremembering how local checkpoint was happening.


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


Re: [PR] [SPARK-48928] Log Warning for Calling .unpersist() on Locally Checkpointed RDDs [spark]

Posted by "mridulm (via GitHub)" <gi...@apache.org>.
mridulm commented on PR #47391:
URL: https://github.com/apache/spark/pull/47391#issuecomment-2238279977

   It is unclear to me what the value of adding this to unpersist is.
   Use of local checkpoint'ing, irrespective of whether it was persist'ed or not, is risky.


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


Re: [PR] [SPARK-48928] Log Warning for Calling .unpersist() on Locally Checkpointed RDDs [spark]

Posted by "mingkangli-db (via GitHub)" <gi...@apache.org>.
mingkangli-db commented on PR #47391:
URL: https://github.com/apache/spark/pull/47391#issuecomment-2245804911

   > If there is no executor failure/loss, whether unpersist is called or not, there should be no failure as there is locally checkpointed data on the node. Are you seeing this not being the case ? (It has been quite a while since I looked at this though, so hopefully I am not misremembering)
   
   You're right that when there is no executor failure, there is no failure when you call `.localCheckpoint()` and `.unpersist()` _by themselves_. However, if you perform any action on the RDD _afterwards_, it will lead to an exception. This happens because, after unpersisting, the lineage is cut, and the RDD cannot be recomputed. For example:
   
   ```
     val checkpointedDf = sql("select * from range(10)")
       .localCheckpoint(eager = false)
     val rdd = checkpointedDf.queryExecution.analyzed.asInstanceOf[LogicalRDD].rdd
     checkpointedDf.collect()
     rdd.unpersist()
     
   // EXCEPTION HAPPENS HERE
       checkpointedDf.collect()
   ```
   The last line results in an exception because the checkpointed RDD is evicted, even without node failure. Logging a warning after `rdd.unpersist()` would make it clearer to users what the consequence would be.
   


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


Re: [PR] [SPARK-48928] Log Warning for Calling .unpersist() on Locally Checkpointed RDDs [spark]

Posted by "mridulm (via GitHub)" <gi...@apache.org>.
mridulm commented on PR #47391:
URL: https://github.com/apache/spark/pull/47391#issuecomment-2244505394

   If there is no executor failure, whether unpersist is called or not, there should be no failure as there is locally checkpointed data on the node.
   Are you seeing this not being the case ?


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


Re: [PR] [SPARK-48928] Log Warning for Calling .unpersist() on Locally Checkpointed RDDs [spark]

Posted by "mridulm (via GitHub)" <gi...@apache.org>.
mridulm closed pull request #47391: [SPARK-48928] Log Warning for Calling .unpersist() on Locally Checkpointed RDDs
URL: https://github.com/apache/spark/pull/47391


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


Re: [PR] [SPARK-48928] Log Warning for Calling .unpersist() on Locally Checkpointed RDDs [spark]

Posted by "mridulm (via GitHub)" <gi...@apache.org>.
mridulm commented on PR #47391:
URL: https://github.com/apache/spark/pull/47391#issuecomment-2241285255

   My point is, use of persist/unpersist is orthogonal to this - so why special case only here ?
   Better would be to add it when user invokes local checkpoint


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


Re: [PR] [SPARK-48928] Log Warning for Calling .unpersist() on Locally Checkpointed RDDs [spark]

Posted by "Ngone51 (via GitHub)" <gi...@apache.org>.
Ngone51 commented on PR #47391:
URL: https://github.com/apache/spark/pull/47391#issuecomment-2238627870

   > It is unclear to me what the value of adding this to unpersist is.
   
   I think it at least gives users an explict warning in first place rather than relying on the lazily triggered error msg in the case of the misuse of local checkpoint. And local checkpoint is still used by the public API today, `Dataset#localCheckpoint()`. So might be ok to add it.


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