CloverDew opened a new issue, #10969:
URL: https://github.com/apache/seatunnel/issues/10969

   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/seatunnel/issues?q=is%3Aissue+label%3A%22bug%22)
 and found no similar issues.
   
   
   ### What happened
   
   ### What happened
   The SQL Server CDC connector has an inconsistency between the LSN boundary 
semantics used in the main data reading window versus the DDL history query 
window, which can cause DDL events to be lost.
   
   #### Background: 
   In SqlServerStreamingChangeEventSource.java, the main data reading logic 
explicitly uses a closed interval (inclusive of fromLsn):
   
   The code comments clearly state: "reading interval is inclusive", But the 
DDL history query introduced in https://github.com/apache/seatunnel/pull/10890 
uses a left-open, right-closed interval with the condition:
   ```
   ddl_lsn > ? AND ddl_lsn <= ?
   ```
   This excludes DDL statements whose LSN is exactly equal to fromLsn, when a 
DDL statement's LSN equals exactly fromLsn, data rows with the new schema will 
be read due to closed interval semantics, the corresponding DDL schema event 
will be lost, downstream systems will process new data using the old schema.
   
   #### Root Cause: 
   The DDL query should use ddl_lsn >= ? AND ddl_lsn <= ? to match the closed 
interval semantics of the main reading window. The incrementLsn() logic can 
prevent duplicate processing.
   
   #### Related PR: 
   https://github.com/apache/seatunnel/pull/10890
   #### Fix: 
   Change the DDL history query lower bound from ddl_lsn > ? to ddl_lsn >= ? to 
align with the closed interval semantics of the main data reading window.
   
   ### SeaTunnel Version
   
   --
   
   ### SeaTunnel Config
   
   ```conf
   --
   ```
   
   ### Running Command
   
   ```shell
   --
   ```
   
   ### Error Exception
   
   ```log
   --
   ```
   
   ### Zeta or Flink or Spark Version
   
   --
   
   ### Java or Scala Version
   
   --
   
   ### Screenshots
   
   --
   
   ### Are you willing to submit PR?
   
   - [x] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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]

Reply via email to