<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Data loss with spark streaming and kafka in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/data-loss-with-spark-streaming-and-kafka/m-p/114700#M44912</link>
    <description>&lt;P&gt;1)To Troubleshoot: Add metrics collection to your job to track the number of records processed vs. dropped.You can check the kafka offset.Compare Kafka offsets with checkpoint committed offsets.&lt;/P&gt;
&lt;P&gt;2) Consider modifying your code to use continuous processing with a reasonable trigger interval instead of &lt;CODE class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]"&gt;trigger(once=True)&lt;/CODE&gt; for more consistent results.&lt;/P&gt;
&lt;P&gt;3)&lt;STRONG&gt;Temporary solution&lt;/STRONG&gt;: Rename or delete the checkpoint directory to force reprocessing of all records from the beginning.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 07 Apr 2025 10:42:04 GMT</pubDate>
    <dc:creator>SriramMohanty</dc:creator>
    <dc:date>2025-04-07T10:42:04Z</dc:date>
    <item>
      <title>Data loss with spark streaming and kafka</title>
      <link>https://community.databricks.com/t5/data-engineering/data-loss-with-spark-streaming-and-kafka/m-p/114525#M44856</link>
      <description>&lt;P class=""&gt;Hi guys!&lt;/P&gt;&lt;P class=""&gt;I'm facing a problem, and I have no idea where it came from. My process is not appending all the topic data into my bronze table. I checked the topic, and the data is there.&lt;/P&gt;&lt;P class=""&gt;For example, I have some rows that are still in my Kafka topic but do not show up in my Bronze table. These records were created in Kafka around the same time yesterday. However, until now, they have not been processed, but the new data (from today) is there.&lt;/P&gt;&lt;P class=""&gt;There were no errors or alerts in my jobs, and it's pure chaos.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;read_kafka = (spark.readStream.format('kafka')
                              .option("kafka.bootstrap.servers", KAFKA_HOST)
                              .option("subscribe", topic_name)
                              .option("startingOffsets", "earliest")
                              .option("minPartitions", 15)
                              .option("unparsedDataColumn", "bi_unparsed_data")
                              .load())

read_kafka = transform_data(read_kafka, tableObject.schema, force_reset_schema)
read_kafka = adjust_date_columns(read_kafka)

write_stream = (read_kafka.writeStream
                      .format("delta")
                      .option("mergeSchema", "true")
                      .option("checkpointLocation", f"{delta_location}_checkpoint/")
                      .queryName(table_name_concat_target)
                      .outputMode("Append")
                      .trigger(once=True)
                      .start(delta_location))

await_stream_initialization(write_stream)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Apr 2025 14:04:22 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/data-loss-with-spark-streaming-and-kafka/m-p/114525#M44856</guid>
      <dc:creator>joao_augusto</dc:creator>
      <dc:date>2025-04-04T14:04:22Z</dc:date>
    </item>
    <item>
      <title>Re: Data loss with spark streaming and kafka</title>
      <link>https://community.databricks.com/t5/data-engineering/data-loss-with-spark-streaming-and-kafka/m-p/114535#M44863</link>
      <description>&lt;P&gt;EDIT:&amp;nbsp;&lt;/P&gt;&lt;P&gt;I checked that the data that is inserted into the kafka topic while my stream is running is neither process by the current stream nor the next job run&lt;/P&gt;</description>
      <pubDate>Fri, 04 Apr 2025 15:37:17 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/data-loss-with-spark-streaming-and-kafka/m-p/114535#M44863</guid>
      <dc:creator>joao_augusto</dc:creator>
      <dc:date>2025-04-04T15:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: Data loss with spark streaming and kafka</title>
      <link>https://community.databricks.com/t5/data-engineering/data-loss-with-spark-streaming-and-kafka/m-p/114700#M44912</link>
      <description>&lt;P&gt;1)To Troubleshoot: Add metrics collection to your job to track the number of records processed vs. dropped.You can check the kafka offset.Compare Kafka offsets with checkpoint committed offsets.&lt;/P&gt;
&lt;P&gt;2) Consider modifying your code to use continuous processing with a reasonable trigger interval instead of &lt;CODE class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]"&gt;trigger(once=True)&lt;/CODE&gt; for more consistent results.&lt;/P&gt;
&lt;P&gt;3)&lt;STRONG&gt;Temporary solution&lt;/STRONG&gt;: Rename or delete the checkpoint directory to force reprocessing of all records from the beginning.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Apr 2025 10:42:04 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/data-loss-with-spark-streaming-and-kafka/m-p/114700#M44912</guid>
      <dc:creator>SriramMohanty</dc:creator>
      <dc:date>2025-04-07T10:42:04Z</dc:date>
    </item>
  </channel>
</rss>

