prince286 opened a new pull request, #21349: URL: https://github.com/apache/kafka/pull/21349
This Pull Request implements two key fault tolerance features within MirrorMaker's `MirrorSourceTask` to enhance data integrity in mission-critical deployments. The changes address the risk of silent data loss (truncation) and service disruption (topic reset). ### 1. Log Truncation Detection (Fail-Fast) **Problem:** Kafka's retention policies can delete log segments, causing MM2's consumer to lose its expected offset and silently skip data. **Solution (in MirrorSourceTask.java):** An in-memory map tracks the last processed offset for each partition. If the newly polled offset is greater than the last processed offset + 1, a data gap is confirmed. - **Action:** Throws a `ConnectException` with a **CRITICAL** log message, forcing a Fail-Fast stop and preventing further silent data loss. ### 2. Graceful Topic Reset Handling (Auto-Recovery) **Problem:** Deleting and recreating the source topic resets its offset to 0. MM2's stored offset is now invalid. **Solution (in MirrorSourceTask.java):** The logic detects if the newly polled offset is less than the last processed offset (indicating a log reset/topic recreation). - **Action:** Logs an **AUTO-RECOVERED** event but does **not** throw an exception. The consumer automatically resets to the earliest offset (0) based on Connect's default behavior, allowing replication to resume immediately. ### 3. Environment Fix (MirrorUtils.java) **Problem:** Single-node Connect deployments fail due to Kafka 4.0.0's strict default replication factor of 3 for internal topics. **Solution (in MirrorUtils.java):** The `createCompactedTopic` method is modified to explicitly set `replicationFactor = 1`, ensuring compatibility with single-broker testing environments. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
