-
Notifications
You must be signed in to change notification settings - Fork 28.5k
[SPARK-8390][Streaming][Kafka] fix docs related to HasOffsetRanges #6863
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
…f the existing java direct stream api
Test build #35065 has finished for PR 6863 at commit
|
I don't think a doc change caused a python test failure.
|
|
||
- *Efficiency:* Achieving zero-data loss in the first approach required the data to be stored in a Write Ahead Log, which further replicated the data. This is actually inefficient as the data effectively gets replicated twice - once by Kafka, and a second time by the Write Ahead Log. This second approach eliminate the problem as there is no receiver, and hence no need for Write Ahead Logs. | ||
- *Efficiency:* Achieving zero-data loss in the first approach required the data to be stored in a Write Ahead Log, which further replicated the data. This is actually inefficient as the data effectively gets replicated twice - once by Kafka, and a second time by the Write Ahead Log. This second approach eliminates the problem as there is no receiver, and hence no need for Write Ahead Logs. As long as you have sufficient Kafka retention, messages can be recovered from Kafka. |
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.
Are there two spaces before "As long as"
If the java example is updated to the access the offsets, then the scala example should also be updated. |
Yeah, the spacing in that document in general is a mess (mix of tabs and spaces, some 2 spaces between sentences, etc). I cleaned it up somewhat. Also further fixed the scala / java offset ranges examples, the java one is pretty much a C&P from the test at this point. |
Test build #35087 has finished for PR 6863 at commit
|
|
||
- *Exactly-once semantics:* The first approach uses Kafka's high level API to store consumed offsets in Zookeeper. This is traditionally the way to consume data from Kafka. While this approach (in combination with write ahead logs) can ensure zero data loss (i.e. at-least once semantics), there is a small chance some records may get consumed twice under some failures. This occurs because of inconsistencies between data reliably received by Spark Streaming and offsets tracked by Zookeeper. Hence, in this second approach, we use simple Kafka API that does not use Zookeeper and offsets tracked only by Spark Streaming within its checkpoints. This eliminates inconsistencies between Spark Streaming and Zookeeper/Kafka, and so each record is received by Spark Streaming effectively exactly once despite failures. | ||
- *Exactly-once semantics:* The first approach uses Kafka's high level API to store consumed offsets in Zookeeper. This is traditionally the way to consume data from Kafka. While this approach (in combination with write ahead logs) can ensure zero data loss (i.e. at-least once semantics), there is a small chance some records may get consumed twice under some failures. This occurs because of inconsistencies between data reliably received by Spark Streaming and offsets tracked by Zookeeper. Hence, in this second approach, we use simple Kafka API that does not use Zookeeper. Offsets are tracked by Spark Streaming within its checkpoints. This eliminates inconsistencies between Spark Streaming and Zookeeper/Kafka, and so each record is received by Spark Streaming effectively exactly once despite failures. In order to achieve exactly-once semantics for output of your results, your save method must be either idempotent, or an atomic transaction that saves results and offsets in your own data store. |
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.
- "save method" --> "output operation that saves the data to external data stores"
- Also refer to the fault-tolerance section in the main programming guide. This stuff is common for everything.
*nit: Can you capitalize Write Ahead Logs
Could you update the example to something that accesses the offsets in the foreachRDD?
Do the same for Java and Scala |
…approach shown in docs actually compiles + runs
Test build #35279 has finished for PR 6863 at commit
|
Test build #35280 has finished for PR 6863 at commit
|
So the JIRA was about updating the examples actually. Its great that you have updated the docs AND the tests, but it would ideal if the examples DirectKafkaWordCount and JavaDirectKafkaWordCount are updated to show how the offset ranges can be accessed. Since you have updated the tests, mind updating the examples as well? |
The word count examples don't have any need of accessing offsets. Wouldn't it be better to have separate examples? I don't want someone On Fri, Jun 19, 2015 at 3:16 PM, Tathagata Das notifications@github.com
|
That is a good point. Then make two different examples one for Java and On Fri, Jun 19, 2015 at 1:29 PM, Cody Koeninger notifications@github.com
|
Could you update title to get the ordering right? [JIRA][Streaming][Kafka]. Otherwise LGTM. |
Title should be right now
|
Author: cody koeninger <cody@koeninger.org> Closes #6863 from koeninger/SPARK-8390 and squashes the following commits: 26a06bd [cody koeninger] Merge branch 'master' into SPARK-8390 3744492 [cody koeninger] [Streaming][Kafka][SPARK-8390] doc changes per TD, test to make sure approach shown in docs actually compiles + runs b108c9d [cody koeninger] [Streaming][Kafka][SPARK-8390] further doc fixes, clean up spacing bb4336b [cody koeninger] [Streaming][Kafka][SPARK-8390] fix docs related to HasOffsetRanges, cleanup 3f3c57a [cody koeninger] [Streaming][Kafka][SPARK-8389] Example of getting offset ranges out of the existing java direct stream api
I have merged this to master and branch-1.4, thanks man! |
Author: cody koeninger <cody@koeninger.org> Closes apache#6863 from koeninger/SPARK-8390 and squashes the following commits: 26a06bd [cody koeninger] Merge branch 'master' into SPARK-8390 3744492 [cody koeninger] [Streaming][Kafka][SPARK-8390] doc changes per TD, test to make sure approach shown in docs actually compiles + runs b108c9d [cody koeninger] [Streaming][Kafka][SPARK-8390] further doc fixes, clean up spacing bb4336b [cody koeninger] [Streaming][Kafka][SPARK-8390] fix docs related to HasOffsetRanges, cleanup 3f3c57a [cody koeninger] [Streaming][Kafka][SPARK-8389] Example of getting offset ranges out of the existing java direct stream api
No description provided.