-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-32024][WEBUI] Update ApplicationStoreInfo.size during HistoryServerDiskManager initializing #28859
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-32024][WEBUI] Update ApplicationStoreInfo.size during HistoryServerDiskManager initializing #28859
Changes from all commits
599152e
57c16a0
3e242b3
79ed4b9
73042c3
56134d6
a6760e1
b9057ec
ed05872
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -158,4 +158,50 @@ 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("app1", None) | ||
| assert(manager.free() === 0) | ||
| assert(manager.committed() === 3) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we track and verify ApplicationStoreInfo in store as well? I see the test represents how HistoryServerDiskManager fails without the patch, but it would be pretty much intuitive if we also verify what we've changed directly.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good idea, updated. |
||
| // Listing store tracks dstA now. | ||
| assert(store.read(classOf[ApplicationStoreInfo], dstA.getAbsolutePath).size === 3) | ||
|
|
||
| // Simulate: service restarts, new disk manager (manager1) is initialized. | ||
| val manager1 = mockManager() | ||
| // Simulate: event KVstore 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() | ||
| // "ApplicationStoreInfo.size" is updated for dstA. | ||
| assert(store.read(classOf[ApplicationStoreInfo], dstA.getAbsolutePath).size === 2) | ||
| assert(manager1.free() === 1) | ||
| // If "ApplicationStoreInfo.size" is not correctly updated, "IllegalStateException" | ||
| // would be thrown. | ||
| val leaseB = manager1.lease(2) | ||
| assert(manager1.free() === 1) | ||
| doReturn(2L).when(manager1).sizeOf(meq(leaseB.tmpPath)) | ||
| val dstB = leaseB.commit("app2", None) | ||
| assert(manager1.committed() === 2) | ||
| // Listing store tracks dstB only, dstA is evicted by "makeRoom()". | ||
| assert(store.read(classOf[ApplicationStoreInfo], dstB.getAbsolutePath).size === 2) | ||
|
|
||
| val manager2 = mockManager() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's add some empty lines in overall to bring readability.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, updated |
||
| // Simulate: cache entities are written after replaying, directory size increases. | ||
| doReturn(3L).when(manager2).sizeOf(meq(dstB)) | ||
| doReturn(3L).when(manager2).sizeOf(meq(new File(testDir, "apps"))) | ||
| manager2.initialize() | ||
| // "ApplicationStoreInfo.size" is updated for dstB. | ||
| assert(store.read(classOf[ApplicationStoreInfo], dstB.getAbsolutePath).size === 3) | ||
| assert(manager2.free() === 0) | ||
| val leaseC = manager2.lease(2) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Better to explicitly mention it leads eviction on cached entities, hence free() goes to 1.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, updated |
||
| doReturn(2L).when(manager2).sizeOf(meq(leaseC.tmpPath)) | ||
| val dstC = leaseC.commit("app3", None) | ||
| assert(manager2.free() === 1) | ||
| assert(manager2.committed() === 2) | ||
| // Listing store tracks dstC only, dstB is evicted by "makeRoom()". | ||
| assert(store.read(classOf[ApplicationStoreInfo], dstC.getAbsolutePath).size === 2) | ||
| } | ||
|
|
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could apply "partition" instead of filter in L78, so that we only call iterate with view once and retrieve two lists (orphans, existing) - L90 can use existing to avoid calling view again.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@HeartSaVioR , thank you for your comments, updated it.