-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-31608][CORE][WEBUI][TEST] Add test suites for HybridStore and HistoryServerMemoryManager #29509
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
Conversation
|
cc @gatorsmile @HeartSaVioR ^^ Unit tests for #28412. |
|
Test build #127750 has finished for PR 29509 at commit
|
|
cc @tgravescs @redsanket ^^ |
|
Test build #127751 has finished for PR 29509 at commit
|
|
Test build #127761 has finished for PR 29509 at commit
|
HeartSaVioR
left a comment
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.
Thanks for the patch. Done the first round of review.
| // Use InMemoryStore to rebuild app store | ||
| while (hybridStore == null) { | ||
| // A RuntimeException will be thrown if the heap memory is not sufficient | ||
| memoryManager.lease(appId, attempt.info.attemptId, reader.totalSize, |
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.
IMHO, previous code looks better, as it doesn't require FsHistoryProvider to know about the details on memory manager. Is this related to the test code?
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.
It's related to the test code, but my original thought is that passing the actual amount of memory, instead of filesize to memoryManager.lease() would make more sense. Although exposing inner details to fsHistoryProvider is not ideal. What's your opinion? Should I revert this change?
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.
Previous code looks consistent with HistoryDiskManager. Let's leave it as it is.
If we really want to make the approximate memory calculation be separate and be exposed to others, I guess it no longer needs to be class method. It may be method of the util object, which also contain the approximate disk usage as well. (so both will keep consistent after the change) Probably better to do it in separate PR if you think it looks to be a good change.
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.
Make sense, I've reverted the changes on lease().
|
|
||
| if (!inMemory) { | ||
| conf.set(LOCAL_STORE_DIR, Utils.createTempDir().getAbsolutePath()) | ||
| if (useHybridStore) { |
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.
This is affected by the default value of config (suppose the default value becomes true) - we'd be better to just assign.
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.
Fixed
| if (switch) switchHybridStore(store) | ||
|
|
||
| intercept[NoSuchElementException] { | ||
| store.read(t2.getClass(), t2.key) |
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.
nit: indent seems to be broken
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.
Fixed
| val listener = new SwitchListener() | ||
| store.switchToLevelDB(listener, "test", None) | ||
| assert(listener.waitUntilDone()) | ||
| while (!store.getStore().isInstanceOf[LevelDB]) { |
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.
Would we need to wait more after waiting listener? Or just to make sure?
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.
There is a potential race in https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/deploy/history/HybridStore.scala#L154. So we need this while loop to ensure the shouldUseInMemoryStore is set to false.
| assert(store.getStore().isInstanceOf[InMemoryStore]) | ||
| val listener = new SwitchListener() | ||
| store.switchToLevelDB(listener, "test", None) | ||
| assert(listener.waitUntilDone()) |
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.
Please introduce test timeout to avoid hang on possible (future) bugs, either here or waitUntilDone().
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.
failAfter() added here.
|
|
||
| private class SwitchListener extends HybridStore.SwitchToLevelDBListener { | ||
|
|
||
| private val results = new LinkedBlockingQueue[Int]() |
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.
Let's just simplify it - true/false would be sufficient. If in doubt we can leave one line comment to explain the meaning of true/false.
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.
Fixed, using boolean directly.
|
Test build #127826 has finished for PR 29509 at commit
|
|
Test build #127846 has finished for PR 29509 at commit
|
HeartSaVioR
left a comment
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.
LGTM pending test
|
retest this, please |
|
Test build #127861 has finished for PR 29509 at commit
|
|
Thanks @baohe-zhang for the PR! Merged into master. |
|
@HeartSaVioR Thanks for the review! |
What changes were proposed in this pull request?
This pull request adds 2 test suites for 2 new classes HybridStore and HistoryServerMemoryManager, which were created in #28412. This pull request also did some minor changes in these 2 classes to expose some variables for testing. Besides 2 suites, this pull request adds a unit test in FsHistoryProviderSuite to test parsing logs with HybridStore.
Why are the changes needed?
Unit tests are needed for new features.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Unit tests.