Uh oh!
There was an error while loading. Please reload this page.
[SPARK-17165][SQL] FileStreamSource should not track the list of seen files indefinitely - #14728
[SPARK-17165][SQL] FileStreamSource should not track the list of seen files indefinitely#14728petermaxlee wants to merge 5 commits into
Conversation
… files indefinitely
| /** | ||
| * User specified options for file streams. | ||
| */ | ||
| class FileStreamOptions(@transient private val parameters: Map[String, String]) |
There was a problem hiding this comment.
This is a similar setup to CSVOptions and JSONOptions. I felt it would be easier to track the list of options read by the source here.
There was a problem hiding this comment.
You can remove Serializable and @transient from this class. It's not used in the executor side.
petermaxlee
commented
Aug 20, 2016
| /** Maximum age of a file that can be found in this directory, before it is deleted. */ | ||
| val maxFileAgeMs: Long = | ||
| Utils.timeStringAsMs(parameters.getOrElse("maxFileAge", "24h")) |
There was a problem hiding this comment.
24 hour seems too short. Maybe a month or a week?
rxin
commented
Aug 20, 2016
cc @tdas |
SparkQA
commented
Aug 20, 2016
Test build #64133 has finished for PR 14728 at commit
|
| /** | ||
| * A very simple source that reads text files from the given directory as they appear. | ||
| * | ||
| * TODO Clean up the metadata files periodically |
There was a problem hiding this comment.
This TODO still applies right?
There was a problem hiding this comment.
Put it back. Also updated the file with a new test case to make the seen map more robust.
SparkQA
commented
Aug 23, 2016
Test build #64260 has finished for PR 14728 at commit
|
petermaxlee
commented
Aug 24, 2016
I've updated the default and set it to 1 week. |
rxin
commented
Aug 24, 2016
@jerryshao want to review this? |
jerryshao
commented
Aug 24, 2016
Sure, let me take a look at this. |
| def apply(paramName: String, paramValue: String): FileStreamOptions = { | ||
| new FileStreamOptions(Map(paramName -> paramValue)) | ||
| } |
There was a problem hiding this comment.
Looks like these two apply methods are not used, it would be better to remove them if not used.
SparkQA
commented
Aug 24, 2016
Test build #64336 has finished for PR 14728 at commit
|
jerryshao
commented
Aug 24, 2016
For the definition of Another concern is that this patch changes the |
petermaxlee
commented
Aug 24, 2016
Re: format compatibility My understanding is that structured streaming is not yet production ready and the compatibility guarantee across versions doesn't really apply. Otherwise, we shouldn't use Java serialization here at all and should opt for explicit JSON or protobuf. |
SparkQA
commented
Aug 24, 2016
Test build #64362 has finished for PR 14728 at commit
|
zsxwing
commented
Aug 26, 2016
Looks pretty good. Just one comment about |
SparkQA
commented
Aug 26, 2016
Test build #64454 has finished for PR 14728 at commit
|
zsxwing
commented
Aug 26, 2016
LGTM. Thanks! Merging into master and 2.0. |
… files indefinitely ## What changes were proposed in this pull request? Before this change, FileStreamSource uses an in-memory hash set to track the list of files processed by the engine. The list can grow indefinitely, leading to OOM or overflow of the hash set. This patch introduces a new user-defined option called "maxFileAge", default to 24 hours. If a file is older than this age, FileStreamSource will purge it from the in-memory map that was used to track the list of files that have been processed. ## How was this patch tested? Added unit tests for the underlying utility, and also added an end-to-end test to validate the purge in FileStreamSourceSuite. Also verified the new test cases would fail when the timeout was set to a very large number. Author: petermaxlee <petermaxlee@gmail.com> Closes#14728 from petermaxlee/SPARK-17165. (cherry picked from commit 9812f7d) Signed-off-by: Shixiong Zhu <shixiong@databricks.com>
What changes were proposed in this pull request?
Before this change, FileStreamSource uses an in-memory hash set to track the list of files processed by the engine. The list can grow indefinitely, leading to OOM or overflow of the hash set.
This patch introduces a new user-defined option called "maxFileAge", default to 24 hours. If a file is older than this age, FileStreamSource will purge it from the in-memory map that was used to track the list of files that have been processed.
How was this patch tested?
Added unit tests for the underlying utility, and also added an end-to-end test to validate the purge in FileStreamSourceSuite. Also verified the new test cases would fail when the timeout was set to a very large number.