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

   ### Search before asking
   
   - [x] I had searched in the issues and found no similar issues.
   
   ### What happened
   
   `StarRocksSinkWriter.applySchemaChange` (`StarRocksSinkWriter.java:87-120` 
on dev `aaa9e8871b`) handles a DDL event by rebuilding the serializer and 
assigning a new `StarRocksSinkManager`. For every event except 
`RestoreTableSchemaEvent` the previous manager is dropped without a flush.
   
   - Expected: the rows buffered under the old schema (up to `batch_max_rows` / 
`batch_max_bytes`) are loaded before the table is altered, as the Doris sink 
does since #11156.
   - Actual: the sink relies on the engine having flushed them. The CDC sources 
on Zeta checkpoint before each DDL and Flink's `SchemaOperator` holds a DDL 
back until a checkpoint completed, so the buffer is empty on those paths. Any 
source that emits a `SchemaChangeEvent` without that protocol, or a writer used 
outside it (the `SupportSchemaEvolutionSinkWriter` contract does not require a 
preceding `prepareCommit`), loses the batch silently.
   
   A unit test shows it: write a row, apply an `AlterTableAddColumnEvent`, and 
the row is never handed to a Stream Load.
   
   Also, the new serializer was switched on before the DDL ran, so a failed DDL 
left the writer on the new schema with the table unchanged.
   
   ### SeaTunnel Version
   
   dev (`aaa9e8871b`), 3.1.0
   
   ### SeaTunnel Config
   
   ```hocon
   sink {
     StarRocks {
       nodeUrls = ["starrocks:8030"]
       base-url = "jdbc:mysql://starrocks:9030/shop"
       database = "shop"
       table = "products"
       batch_max_rows = 1000
     }
   }
   ```
   
   ### Running Command
   
   ```shell
   ./bin/seatunnel.sh -c config/products.conf
   ```
   
   ### Error Exception
   
   No exception. Rows buffered before the DDL are missing in StarRocks.
   
   ### Zeta or Flink or Spark Version
   
   Zeta
   
   ### Java or Scala Version
   
   11
   
   ### Screenshots
   
   _No response_
   
   ### 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