goutamadwant opened a new pull request, #13358:
URL: https://github.com/apache/seatunnel/pull/13358

   ### Purpose of this pull request
   
   Closes #13357.
   
   `StarRocksSinkWriter.applySchemaChange` dropped the current 
`StarRocksSinkManager`, and whatever it had buffered, before running the DDL, 
relying on the engine to have flushed it. Same hardening as the Doris sink in 
#11156.
   
   | Behaviour | Before | After |
   |---|---|---|
   | Rows buffered when a DDL arrives | discarded with the old manager | loaded 
into StarRocks before the table changes |
   | Flush fails before the DDL | nothing was flushed | the failure is raised, 
the DDL is not run, the manager keeps the rows and their label |
   | New schema | serializer switched before the DDL | validated before the 
DDL, adopted only after it |
   | `RestoreTableSchemaEvent` | old manager closed, new one created | same, 
through the one code path |
   
   Changes:
   
   - `StarRocksSinkWriter.applySchemaChange`: close the manager, compute the 
new schema and serializer, run the DDL (non-restore events), then switch. The 
JDBC DDL call moved to a protected `applySchemaChangeToStarRocks` so the writer 
can be tested without a database.
   - Docs EN/ZH: note under the Mysql-cdc -> StarRocks schema-evolution example.
   
   The CDC sources on Zeta checkpoint before each DDL and Flink's 
`SchemaOperator` waits for a completed checkpoint, so on those paths the buffer 
is already empty; the sink no longer depends on that. In a multi-table job 
where sibling writers share one physical table, the siblings still flush after 
the first sibling's DDL (drop column with CSV now fails loudly instead of 
dropping rows); flushing every target before any DDL belongs in 
`MultiTableSinkWriter`.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. At most one extra Stream Load per schema change.
   
   ### How was this patch tested?
   
   | Check | Result |
   |---|---|
   | New cases in `StarRocksSinkWriterTest` (flush before DDL and new-schema 
rows on the new manager, restore event, failed flush keeps the manager and 
skips the DDL) | 2 fail on dev, all pass with the fix |
   | `connector-starrocks` unit suite, JDK 11 and 17 | 97 / 97 |
   | `StarRocksSchemaChangeIT` (Zeta) | passes locally (MySQL-CDC -> StarRocks 
with add and drop column, savepoint and restore) |
   
   ### Check list
   
   * [x] No new dependency
   * [x] Documentation updated 
(`docs/en|zh/introduction/configuration/schema-evolution.md`)
   * [x] `incompatible-changes.md` not needed
   * [x] Not a connector addition
   


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