-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-17513][SQL] Make StreamExecution garbage-collect its metadata #15166
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
Changes from all commits
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 |
|---|---|---|
|
|
@@ -125,6 +125,30 @@ class StreamingQuerySuite extends StreamTest with BeforeAndAfter { | |
| ) | ||
| } | ||
|
|
||
| testQuietly("StreamExecution metadata garbage collection") { | ||
| val inputData = MemoryStream[Int] | ||
| val mapped = inputData.toDS().map(6 / _) | ||
|
|
||
| // Run 3 batches, and then assert that only 1 metadata file is left at the end | ||
| // since the first 2 should have been purged. | ||
| testStream(mapped)( | ||
| AddData(inputData, 1, 2), | ||
| CheckAnswer(6, 3), | ||
| AddData(inputData, 1, 2), | ||
| CheckAnswer(6, 3, 6, 3), | ||
| AddData(inputData, 4, 6), | ||
| CheckAnswer(6, 3, 6, 3, 1, 1), | ||
|
|
||
| AssertOnQuery("metadata log should contain only one file") { q => | ||
| val metadataLogDir = new java.io.File(q.offsetLog.metadataPath.toString) | ||
| val logFileNames = metadataLogDir.listFiles().toSeq.map(_.getName()) | ||
| val toTest = logFileNames.filter(! _.endsWith(".crc")) // Workaround for SPARK-17475 | ||
| assert(toTest.size == 1 && toTest.head == "2") | ||
| true | ||
|
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. This line ("true") shouldn't be here. It makes the Assert always pass, even when the condition on the previous line isn't satisfied.
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. It still fails. There was an assert there.
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. Ah, yes. The previous like (146) should be just |
||
| } | ||
| ) | ||
| } | ||
|
|
||
| /** | ||
| * A [[StreamAction]] to test the behavior of `StreamingQuery.awaitTermination()`. | ||
| * | ||
|
|
||
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.
Is the space between
!and_intentionally added? I saw other similar code not having a space.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.
I think @frreiss added this to be more obvious. I don't really have a preference here.
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.
Either way is fine with me.