hai-tao-1 opened a new pull request, #36597:
URL: https://github.com/apache/spark/pull/36597
<!--
Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, please read our contributor guidelines:
https://spark.apache.org/contributing.html
2. Ensure you have added or run the appropriate tests for your PR:
https://spark.apache.org/developer-tools.html
3. If the PR is unfinished, add '[WIP]' in your PR title, e.g.,
'[WIP][SPARK-XXXX] Your PR title ...'.
4. Be sure to keep the PR description updated to reflect all changes.
5. Please write your PR title to summarize what this PR proposes.
6. If possible, provide a concise example to reproduce the issue for a
faster review.
7. If you want to add a new configuration, please read the guideline first
for naming configurations in
'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
8. If you want to add or modify an error type or message, please read the
guideline first in
'core/src/main/resources/error/README.md'.
-->
### What changes were proposed in this pull request?
- Add a spark property, spark.history.fs.update.batchSize(default 1000),
which specifies the batch size for updating new eventlog files.
- For each eventlog scan/parse process, only a max of
`spark.history.fs.update.batchSize` jobs are scanned/parsed. This allows the
scan process ends within a reasonable time, so new eventlog files(appeared
after the scan process starts) can be scanned sooner.
<!--
Please clarify what changes you are proposing. The purpose of this section
is to outline the changes and how this PR fixes the issue.
If possible, please consider writing useful notes for better and faster
reviews in your PR. See the examples below.
1. If you refactor some codes with changing classes, showing the class
hierarchy will help reviewers.
2. If you fix some SQL features, you can provide some references of other
DBMSes.
3. If there is design documentation, please add the link.
4. If there is a discussion in the mailing list, please add the link.
-->
### Why are the changes needed?
Current Spark History Server suffers when there are a large number of
eventlog files under eventLog.dir: when a SHS starts, the initial scan may take
a long time, and new eventlog files would not be scanned/parsed until the
initial scan completes.
For example, if the initial scan takes 1-2 days(this is not uncommon in
large environments), the newly finished spark jobs would not show up in SHS
since their eventlog files are not scanned/parsed until the initial scan
process finishes. This would result in a 1-2 days SHS malfunctioning since the
newly finished spark jobs are most likely to be queried by users.
This PR adds a limit for each scan process to
`spark.history.fs.update.batchSize`, so that each scan can finish within a
reasonable time(default 1000 jobs can usually be scanned in ~10-15 mins but
this can vary depending on the sizes of the eventlog files). This will prevent
the long initial scan process from blocking the newly appeared eventlog files
be scanned.
<!--
Please clarify why the changes are needed. For instance,
1. If you propose a new API, clarify the use case for a new API.
2. If you fix a bug, you can clarify why it is a bug.
-->
### Does this PR introduce _any_ user-facing change?
No.
<!--
Note that it means *any* user-facing change including all aspects such as
the documentation fix.
If yes, please clarify the previous behavior and the change this PR proposes
- provide the console output, description and/or an example to show the
behavior difference if possible.
If possible, please also clarify if this is a user-facing change compared to
the released Spark versions or within the unreleased branches such as master.
If no, write 'No'.
-->
### How was this patch tested?
Tested locally:
- Tested with unit tests in the core module and all passed.
- Placed 10 eventlog files under `eventLog.dir`, and set
`spark.history.fs.update.batchSize` to 2. When the SHS started, observed that
the scan process parsed 2 files at each time(starting from the files with the
latest modification time).
- Added a new eventlog file after the first scan started, and observed that
the 2nd scan process picked up and parsed the new eventlog file before parsing
other remaining (older) eventlog files.
<!--
If tests were added, say they were added here. Please make sure to add some
test cases that check the changes thoroughly including negative and positive
cases if possible.
If it was tested in a way different from regular unit tests, please clarify
how you tested step by step, ideally copy and paste-able, so that other
reviewers can test and check, and descendants can verify in the future.
If tests were not added, please describe why they were not added and/or why
it was difficult to add.
If benchmark tests were added, please run the benchmarks in GitHub Actions
for the consistent environment, and the instructions could accord to:
https://spark.apache.org/developer-tools.html#github-workflow-benchmarks.
-->
--
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]