You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "tedyu (via GitHub)" <gi...@apache.org> on 2024/09/18 22:43:12 UTC

[PR] Abort changelog writer before resetting [spark]

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

   ### What changes were proposed in this pull request?
   In `commit()`, `changelogWriter` is set to None before iterating.
   
   This PR calls `abort()` on the `changelogWriter` before resetting.
   
   ### Why are the changes needed?
   To properly handle the abort of `changelogWriter`.
   
   ### Does this PR introduce _any_ user-facing change?
   No
   
   ### How was this patch tested?
   Existing test suite.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   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] [MINOR] Abort changelog writer before resetting [spark]

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


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/state/RocksDB.scala:
##########
@@ -646,8 +646,11 @@ class RocksDB(
           // is enabled.
           if (shouldForceSnapshot.get()) {
             uploadSnapshot()
-            changelogWriter = None
-            changelogWriter.foreach(_.abort())
+            try {
+              changelogWriter.foreach(_.abort())
+            } finally {
+              changelogWriter = None
+            }

Review Comment:
   cc @anishshri-db 



-- 
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] [Minor] Abort changelog writer before resetting [spark]

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

   @HeartSaVioR 
   Can you 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


Re: [PR] [MINOR] Abort changelog writer before resetting [spark]

Posted by "anishshri-db (via GitHub)" <gi...@apache.org>.
anishshri-db commented on code in PR #48153:
URL: https://github.com/apache/spark/pull/48153#discussion_r1765908056


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/state/RocksDB.scala:
##########
@@ -646,8 +646,11 @@ class RocksDB(
           // is enabled.
           if (shouldForceSnapshot.get()) {
             uploadSnapshot()
-            changelogWriter = None
-            changelogWriter.foreach(_.abort())
+            try {
+              changelogWriter.foreach(_.abort())
+            } finally {
+              changelogWriter = None
+            }

Review Comment:
   @tedyu - Actually we can't do the abort at all here. we need to ensure that the changelog file is written out. Otherwise it breaks reading the state in change-data-feed mode. Pls take a look at my fix - thx !



-- 
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] [MINOR] Abort changelog writer before resetting [spark]

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


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/state/RocksDB.scala:
##########
@@ -646,8 +646,11 @@ class RocksDB(
           // is enabled.
           if (shouldForceSnapshot.get()) {
             uploadSnapshot()
-            changelogWriter = None
-            changelogWriter.foreach(_.abort())
+            try {
+              changelogWriter.foreach(_.abort())
+            } finally {
+              changelogWriter = None
+            }

Review Comment:
   I came up with this PR around the same time as https://github.com/apache/spark/pull/48148.
   
   Since the fix is independent of the above PR, do you think this can go in first ?
   
   Thanks



-- 
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] [MINOR] Abort changelog writer before resetting [spark]

Posted by "anishshri-db (via GitHub)" <gi...@apache.org>.
anishshri-db commented on code in PR #48153:
URL: https://github.com/apache/spark/pull/48153#discussion_r1765908777


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/state/RocksDB.scala:
##########
@@ -646,8 +646,11 @@ class RocksDB(
           // is enabled.
           if (shouldForceSnapshot.get()) {
             uploadSnapshot()
-            changelogWriter = None
-            changelogWriter.foreach(_.abort())
+            try {
+              changelogWriter.foreach(_.abort())
+            } finally {
+              changelogWriter = None
+            }

Review Comment:
   we can maybe just fix the update on the error message tho as part of this PR. Will let @HeartSaVioR decide 



-- 
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] [MINOR] Abort changelog writer before resetting [spark]

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


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/state/RocksDB.scala:
##########
@@ -646,8 +646,11 @@ class RocksDB(
           // is enabled.
           if (shouldForceSnapshot.get()) {
             uploadSnapshot()
-            changelogWriter = None
-            changelogWriter.foreach(_.abort())
+            try {
+              changelogWriter.foreach(_.abort())
+            } finally {
+              changelogWriter = None
+            }

Review Comment:
   This was actually fixed via #48125 - the PR #48125 was up a couple days ahead on this.
   @tedyu Thanks for your contribution and nice finding.



-- 
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] [MINOR] Abort changelog writer before resetting [spark]

Posted by "tedyu (via GitHub)" <gi...@apache.org>.
tedyu closed pull request #48153: [MINOR] Abort changelog writer before resetting
URL: https://github.com/apache/spark/pull/48153


-- 
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] [MINOR] Abort changelog writer before resetting [spark]

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


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/state/RocksDB.scala:
##########
@@ -646,8 +646,11 @@ class RocksDB(
           // is enabled.
           if (shouldForceSnapshot.get()) {
             uploadSnapshot()
-            changelogWriter = None
-            changelogWriter.foreach(_.abort())
+            try {
+              changelogWriter.foreach(_.abort())
+            } finally {
+              changelogWriter = None
+            }

Review Comment:
   Seems like https://github.com/apache/spark/pull/48148 includes this fix



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