HeartSaVioR commented on a change in pull request #28859:
URL: https://github.com/apache/spark/pull/28859#discussion_r443216605
##########
File path:
core/src/test/scala/org/apache/spark/deploy/history/HistoryServerDiskManagerSuite.scala
##########
@@ -158,4 +158,26 @@ class HistoryServerDiskManagerSuite extends SparkFunSuite
with BeforeAndAfter {
assert(manager.approximateSize(50L, true) > 50L)
}
+ test ("SPARK-32024: update ApplicationStoreInfo.size during initializing") {
+ val manager = mockManager()
+ val leaseA = manager.lease(2)
+ doReturn(3L).when(manager).sizeOf(meq(leaseA.tmpPath))
+ val dstA = leaseA.commit("app2", None)
+ assert(manager.free() === 0)
+ assert(manager.committed() === 3)
+ // Simulate: service restarts, new disk manager (manager1) is initialized.
+ val manager1 = mockManager()
+ // Simulate: leveldb compaction before restart, directory size reduces.
+ doReturn(2L).when(manager1).sizeOf(meq(dstA))
+ doReturn(2L).when(manager1).sizeOf(meq(new File(testDir, "apps")))
+ manager1.initialize()
+ assert(manager1.free() === 1)
+ // If "ApplicationStoreInfo.size" is not correctly updated,
"IllegalStateException"
+ // would be thrown.
+ val leaseB = manager1.lease(2)
+ assert(manager1.free() === 1)
+ leaseB.rollback()
+ assert(manager1.free() === 3)
Review comment:
Probably better to simulate another case: actual directory size is
bigger than appinfo - some cache entities can be written after replaying, which
"might" affect the size.
(That said, the mismatch between appinfo and actual dir size also occurs
during run, though it may not matter unless there's no reflection.)
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]