uros-b commented on code in PR #58741:
URL: https://github.com/apache/spark/pull/58741#discussion_r3995533765


##########
core/src/test/scala/org/apache/spark/deploy/history/HistoryServerDiskManagerSuite.scala:
##########
@@ -411,6 +411,35 @@ abstract class HistoryServerDiskManagerSuite extends 
SparkFunSuite with BeforeAn
     assert(manager.committed() === 0)
   }
 
+  test("SPARK-59439: a failed commit rename does not double-release the 
lease") {
+    val manager = mockManager()
+
+    // Reserve space for a store, then make the rename in commit() fail by 
removing the source
+    // directory. commit() releases the lease reservation before the rename, 
so a failure there
+    // must not let the caller's rollback() deduct the reservation a second 
time.
+    val lease = manager.lease(2)
+    doReturn(2L).when(manager).sizeOf(meq(lease.tmpPath))
+    Utils.deleteRecursively(lease.tmpPath)
+
+    intercept[IOException] {
+      lease.commit("app1", None)
+    }
+    // The caller rolls the lease back after the failed commit, as 
FsHistoryProvider does.
+    lease.rollback()
+
+    // The reservation was returned exactly once: usage is back to zero (not 
negative) and the
+    // full capacity is free again.
+    assert(manager.committed() === 0)

Review Comment:
   Replaced with a comment, thank you!



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

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