In the book "Spark Streaming with Apache Spark", the authors mention that the field "failOnDataLoss (default: true)" should be set to false while testing with Kafka as the source. They say,
This flag indicates whether to fail the restart of a streaming query in case data might be lost. This is usually when offsets are out of range, topics are deleted, or topics are rebalanced. We recommend setting this option to false during the develop/test cycle because stop/restart of the query side with a continuous producer will often trigger a failure. Set this back to true for production deployment.
I want to understand why would there be failures in stopping/restarting the query. How would offsets get out of range? Doesn't Spark maintain what offsets to read as checkpointing?