Uh oh!
There was an error while loading. Please reload this page.
[SPARK-16963] [STREAMING] [SQL] Changes to Source trait and related implementation classes - #14553
[SPARK-16963] [STREAMING] [SQL] Changes to Source trait and related implementation classes#14553frreiss wants to merge 31 commits into
Conversation
frreiss
commented
Aug 22, 2016
These changes are now ready for review. The contents of this PR pass regression tests on my machines. Can one of the committers please start a Jenkins build? |
| */ | ||
| def getLatest(): Option[(Long, T)] | ||
frreiss
commented
Aug 29, 2016
frreiss
commented
Aug 31, 2016
@ScrapCodes, would you mind triggering a build of this PR? |
ScrapCodes
commented
Sep 1, 2016
ok to test |
ScrapCodes
commented
Sep 1, 2016
retest this please |
ScrapCodes
commented
Sep 6, 2016
I have tested the PR with my MQTT connector. Looks like I do not have sufficient privilege to command jenkins. |
vanzin
commented
Sep 7, 2016
ok to test |
SparkQA
commented
Sep 8, 2016
Test build #65062 has finished for PR 14553 at commit
|
| offsetLog.purge(currentBatchId) | ||
| // the batch before the previous batch, and it is safe to discard the old metadata. | ||
| // Note that purge is exclusive, i.e. it purges everything before the target ID. | ||
| offsetLog.purge(currentBatchId - 1) |
There was a problem hiding this comment.
nit: this can be offsetLog.purge(currentBatchId), it's exclusive, then you can revert changes to StreamingQuerySuite.
There was a problem hiding this comment.
I can move this change to another JIRA if you'd like, but we really should change currentBatchId to currentBatchId - 1 at some point. The call to offsetLog.purge(currentBatchId), which I introduced in my PR for SPARK-17513, contains a subtle bug. The recovery logic in populateStartOffsets() reads the last and second-to-last entries in offsetLog. populateStartOffsets() uses those entries to populate availableOffsets and committedOffsets, respectively. Calling offsetLog.purge(currentBatchId) at line 350/366 results in the offsetLog being truncated to one entry, which in turn results in committedOffsets being left empty on recovery, which in turn causes the first call to getBatch() for any source to have None as its first argument. Sources that do not prune buffered data in their commit() methods will return a previously committed data in response to such a getBatch() call.
SparkQA
commented
Oct 21, 2016
Test build #67350 has finished for PR 14553 at commit
|
zsxwing
commented
Oct 24, 2016
retest this please |
SparkQA
commented
Oct 24, 2016
Test build #67463 has finished for PR 14553 at commit
|
zsxwing
commented
Oct 24, 2016
@frreiss you need to reset |
| } | ||
| override def commit(end: Offset): Unit = synchronized { | ||
| if (end.isInstanceOf[LongOffset]) { |
There was a problem hiding this comment.
nit:
end match {
case newOffset: LongOffset =>
...
case _ => sys.error(...)
}
There was a problem hiding this comment.
Corrected in my local copy.
| lastOffsetCommitted = newOffset | ||
| } else { | ||
| sys.error(s"MemoryStream.commit() received an offset ($end) that did not originate with " + | ||
| s"an instance of this class") |
There was a problem hiding this comment.
Corrected in my local copy.
brkyvz
commented
Oct 25, 2016
LGTM as well! |
zsxwing
commented
Oct 26, 2016
@frreiss any update? |
frreiss
commented
Oct 26, 2016
Updated the branch and addressed new review comments. Looks like my last push missed a one-line change to memory.scala. Tests are running now. |
SparkQA
commented
Oct 27, 2016
Test build #67603 has finished for PR 14553 at commit
|
zsxwing
commented
Oct 27, 2016
LGMT. Merging to master and 2.0. Thanks! |
…lementation classes ## What changes were proposed in this pull request? This PR contains changes to the Source trait such that the scheduler can notify data sources when it is safe to discard buffered data. Summary of changes: * Added a method `commit(end: Offset)` that tells the Source that is OK to discard all offsets up `end`, inclusive. * Changed the semantics of a `None` value for the `getBatch` method to mean "from the very beginning of the stream"; as opposed to "all data present in the Source's buffer". * Added notes that the upper layers of the system will never call `getBatch` with a start value less than the last value passed to `commit`. * Added a `lastCommittedOffset` method to allow the scheduler to query the status of each Source on restart. This addition is not strictly necessary, but it seemed like a good idea -- Sources will be maintaining their own persistent state, and there may be bugs in the checkpointing code. * The scheduler in `StreamExecution.scala` now calls `commit` on its stream sources after marking each batch as complete in its checkpoint. * `MemoryStream` now cleans committed batches out of its internal buffer. * `TextSocketSource` now cleans committed batches from its internal buffer. ## How was this patch tested? Existing regression tests already exercise the new code. Author: frreiss <frreiss@us.ibm.com> Closes#14553 from frreiss/fred-16963. (cherry picked from commit 5b27598) Signed-off-by: Shixiong Zhu <shixiong@databricks.com>
…ion" ## What changes were proposed in this pull request? A follow up PR for #14553 to fix the flaky test. It's flaky because the file list API doesn't guarantee any order of the return list. ## How was this patch tested? Jenkins Author: Shixiong Zhu <shixiong@databricks.com> Closes#15661 from zsxwing/fix-StreamingQuerySuite.
…ion" ## What changes were proposed in this pull request? A follow up PR for #14553 to fix the flaky test. It's flaky because the file list API doesn't guarantee any order of the return list. ## How was this patch tested? Jenkins Author: Shixiong Zhu <shixiong@databricks.com> Closes#15661 from zsxwing/fix-StreamingQuerySuite. (cherry picked from commit 79fd0cc) Signed-off-by: Shixiong Zhu <shixiong@databricks.com>
…lementation classes ## What changes were proposed in this pull request? This PR contains changes to the Source trait such that the scheduler can notify data sources when it is safe to discard buffered data. Summary of changes: * Added a method `commit(end: Offset)` that tells the Source that is OK to discard all offsets up `end`, inclusive. * Changed the semantics of a `None` value for the `getBatch` method to mean "from the very beginning of the stream"; as opposed to "all data present in the Source's buffer". * Added notes that the upper layers of the system will never call `getBatch` with a start value less than the last value passed to `commit`. * Added a `lastCommittedOffset` method to allow the scheduler to query the status of each Source on restart. This addition is not strictly necessary, but it seemed like a good idea -- Sources will be maintaining their own persistent state, and there may be bugs in the checkpointing code. * The scheduler in `StreamExecution.scala` now calls `commit` on its stream sources after marking each batch as complete in its checkpoint. * `MemoryStream` now cleans committed batches out of its internal buffer. * `TextSocketSource` now cleans committed batches from its internal buffer. ## How was this patch tested? Existing regression tests already exercise the new code. Author: frreiss <frreiss@us.ibm.com> Closesapache#14553 from frreiss/fred-16963.
…ion" ## What changes were proposed in this pull request? A follow up PR for apache#14553 to fix the flaky test. It's flaky because the file list API doesn't guarantee any order of the return list. ## How was this patch tested? Jenkins Author: Shixiong Zhu <shixiong@databricks.com> Closesapache#15661 from zsxwing/fix-StreamingQuerySuite.
…lementation classes ## What changes were proposed in this pull request? This PR contains changes to the Source trait such that the scheduler can notify data sources when it is safe to discard buffered data. Summary of changes: * Added a method `commit(end: Offset)` that tells the Source that is OK to discard all offsets up `end`, inclusive. * Changed the semantics of a `None` value for the `getBatch` method to mean "from the very beginning of the stream"; as opposed to "all data present in the Source's buffer". * Added notes that the upper layers of the system will never call `getBatch` with a start value less than the last value passed to `commit`. * Added a `lastCommittedOffset` method to allow the scheduler to query the status of each Source on restart. This addition is not strictly necessary, but it seemed like a good idea -- Sources will be maintaining their own persistent state, and there may be bugs in the checkpointing code. * The scheduler in `StreamExecution.scala` now calls `commit` on its stream sources after marking each batch as complete in its checkpoint. * `MemoryStream` now cleans committed batches out of its internal buffer. * `TextSocketSource` now cleans committed batches from its internal buffer. ## How was this patch tested? Existing regression tests already exercise the new code. Author: frreiss <frreiss@us.ibm.com> Closesapache#14553 from frreiss/fred-16963.
…ion" ## What changes were proposed in this pull request? A follow up PR for apache#14553 to fix the flaky test. It's flaky because the file list API doesn't guarantee any order of the return list. ## How was this patch tested? Jenkins Author: Shixiong Zhu <shixiong@databricks.com> Closesapache#15661 from zsxwing/fix-StreamingQuerySuite.
What changes were proposed in this pull request?
This PR contains changes to the Source trait such that the scheduler can notify data sources when it is safe to discard buffered data. Summary of changes:
commit(end: Offset)that tells the Source that is OK to discard all offsets upend, inclusive.Nonevalue for thegetBatchmethod to mean "from the very beginning of the stream"; as opposed to "all data present in the Source's buffer".getBatchwith a start value less than the last value passed tocommit.lastCommittedOffsetmethod to allow the scheduler to query the status of each Source on restart. This addition is not strictly necessary, but it seemed like a good idea -- Sources will be maintaining their own persistent state, and there may be bugs in the checkpointing code.StreamExecution.scalanow callscommiton its stream sources after marking each batch as complete in its checkpoint.MemoryStreamnow cleans committed batches out of its internal buffer.TextSocketSourcenow cleans committed batches from its internal buffer.How was this patch tested?
Existing regression tests already exercise the new code.