Skip to content

[improve](streaming-job) Support MySQL ADD DROP schema changes#65325

Merged
JNSimba merged 12 commits into
apache:masterfrom
JNSimba:mysql-schemachange-add-drop-master
Jul 14, 2026
Merged

[improve](streaming-job) Support MySQL ADD DROP schema changes#65325
JNSimba merged 12 commits into
apache:masterfrom
JNSimba:mysql-schemachange-add-drop-master

Conversation

@JNSimba

@JNSimba JNSimba commented Jul 7, 2026

Copy link
Copy Markdown
Member

What problem does this PR solve?

Issue Number: None

Problem Summary: Support MySQL ADD/DROP column schema changes in streaming jobs. MySQL schema change events now update the FE schema baseline, execute Doris ADD/DROP column DDLs for supported changes, and keep unsupported changes aligned with the existing PostgreSQL schema-change behavior.

This also keeps cdc_stream TVF behavior stable when source-side schema changes happen during incremental consumption. The TVF path disables schema-change handling internally, skips schema change records in the CDC client, and continues to consume DML that matches the query projection for both MySQL and PostgreSQL sources.

Release note

Support MySQL ADD/DROP column schema changes for streaming jobs. cdc_stream TVF continues compatible incremental consumption when source-side schema changes are observed.

@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@JNSimba
JNSimba requested a review from Copilot July 7, 2026 09:42
@JNSimba

JNSimba commented Jul 7, 2026

Copy link
Copy Markdown
Member Author

/review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the fs_brokers/cdc_client streaming-job CDC pipeline to handle MySQL schema-change events by enabling Debezium schema change capture, parsing MySQL ALTER TABLE DDL to detect supported ADD/DROP COLUMN operations, emitting corresponding Doris DDLs, and adding regression + unit tests to validate behavior (including FE restart scenarios).

Changes:

  • Enable MySQL schema-change events in the source reader and propagate them through the record iterator/offset tracking.
  • Implement MySQL DDL parsing and schema-change deserialization to generate Doris ALTER TABLE ... ADD/DROP COLUMN operations.
  • Add regression suites and Java unit tests covering MySQL ADD/DROP, mixed/unsupported DDL, and FE restart resilience.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
regression-test/suites/job_p0/streaming_job/cdc/test_streaming_mysql_job_sc.groovy End-to-end regression test for MySQL streaming job handling ADD/DROP column with follow-up DML.
regression-test/suites/job_p0/streaming_job/cdc/test_streaming_mysql_job_sc_restart_fe.groovy Regression test verifying schema-change handling persists/recovers across FE restart.
regression-test/suites/job_p0/streaming_job/cdc/test_streaming_mysql_job_sc_latest.groovy Regression test validating behavior when starting from offset=latest and applying schema changes afterward.
regression-test/suites/job_p0/streaming_job/cdc/test_streaming_mysql_job_sc_advanced.groovy Regression test covering advanced/mixed DDL (FIRST/AFTER, mixed ADD+DROP, and unsupported MODIFY/CHANGE).
regression-test/data/job_p0/streaming_job/cdc/test_streaming_mysql_job_sc.out Expected output for test_streaming_mysql_job_sc.
regression-test/data/job_p0/streaming_job/cdc/test_streaming_mysql_job_sc_restart_fe.out Expected output for test_streaming_mysql_job_sc_restart_fe.
regression-test/data/job_p0/streaming_job/cdc/test_streaming_mysql_job_sc_latest.out Expected output for test_streaming_mysql_job_sc_latest.
regression-test/data/job_p0/streaming_job/cdc/test_streaming_mysql_job_sc_advanced.out Expected output for test_streaming_mysql_job_sc_advanced.
fs_brokers/cdc_client/src/test/java/org/apache/doris/cdcclient/utils/SchemaChangeHelperTest.java Adds unit tests for MySQL Debezium Column → Doris type mapping.
fs_brokers/cdc_client/src/test/java/org/apache/doris/cdcclient/source/reader/mysql/MySqlSourceReaderTest.java Verifies generated MySQL source config enables schema change events.
fs_brokers/cdc_client/src/test/java/org/apache/doris/cdcclient/source/parse/mysql/CustomMySqlAntlrDdlParserTest.java Unit tests for parsing MySQL ADD/DROP and marking unsupported column changes.
fs_brokers/cdc_client/src/main/java/org/apache/doris/cdcclient/utils/SchemaChangeHelper.java Adds MySQL Column→Doris type conversion used for emitted ADD COLUMN DDL.
fs_brokers/cdc_client/src/main/java/org/apache/doris/cdcclient/source/reader/mysql/MySqlSourceReader.java Enables includeSchemaChanges(true) and forwards schema-change events via the iterator/offset updates.
fs_brokers/cdc_client/src/main/java/org/apache/doris/cdcclient/source/parse/mysql/MySqlSchemaChange.java New model type representing parsed MySQL schema-change operations (ADD/DROP/UNSUPPORTED).
fs_brokers/cdc_client/src/main/java/org/apache/doris/cdcclient/source/parse/mysql/CustomMySqlAntlrDdlParserListener.java Custom parse-tree listener wiring Debezium listeners plus Doris-specific ALTER TABLE listener.
fs_brokers/cdc_client/src/main/java/org/apache/doris/cdcclient/source/parse/mysql/CustomMySqlAntlrDdlParser.java Custom MySQL DDL parser exposing parsed column changes for Doris handling.
fs_brokers/cdc_client/src/main/java/org/apache/doris/cdcclient/source/parse/mysql/CustomAlterTableParserListener.java Extracts column ADD/DROP (and flags unsupported changes) during MySQL ALTER TABLE parsing.
fs_brokers/cdc_client/src/main/java/org/apache/doris/cdcclient/source/deserialize/MySqlDebeziumJsonDeserializer.java Implements MySQL schema-change deserialization: baseline checks, DDL parsing, and Doris DDL emission.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +141 to +146
Preconditions.checkNotNull(column.typeName());
String mysqlTypeName = column.typeName().toUpperCase();
String[] typeFields = mysqlTypeName.split(" ");
String mysqlType = typeFields[0];
boolean unsigned = typeFields.length > 1 && "UNSIGNED".equals(typeFields[1]);
int length = column.length();
@JNSimba JNSimba changed the title [feature](streaming-job) Support MySQL ADD DROP schema changes [improve](streaming-job) Support MySQL ADD DROP schema changes Jul 7, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review completed. I found one blocking CI/style issue: the CDC client Spotless validation fails on changed Java sources, so this should be fixed before relying on CI or test results.

Critical checkpoint conclusions:

  • Goal/test proof: the PR targets MySQL ADD/DROP column schema changes for streaming jobs and adds unit/regression coverage for main, latest-offset, mixed-DDL, and FE-restart flows. Local validation is blocked by formatting.
  • Scope: the implementation is focused on CDC client schema-change parsing/deserialization and related regression tests.
  • Concurrency/lifecycle: no new independent concurrent state was added beyond the existing reader/coordinator path; schema DDL execution still happens before in-memory schema update in the write path.
  • Compatibility/persistence: FE schema baseline serialization/update paths were checked; restart coverage was added, but could not be run here.
  • Parallel paths: from-to write path executes schema changes; TVF/debug fetch remains DML-only, consistent with the existing PostgreSQL note.
  • Tests/results: new expected outputs are ordered. I could not run functional tests in this shallow runner because fe-common / generated org.apache.doris.job.cdc classes are unavailable after skipping Spotless; the PR body also says tests were not run.
  • User focus: no additional user-provided focus points were supplied.
  • Existing review context: I did not duplicate the existing Copilot threads for ADD COLUMN null lookup or ZEROFILL unsigned handling.

Subagent conclusions:

  • tests-session-config candidate TSC-1 was accepted as inline comment M-1.
  • optimizer-rewrite candidate OPT-1 was dismissed/merged as duplicate/unsupported by evidence: SERIAL is normalized by Debezium to BIGINT UNSIGNED, and the remaining ADD-column null failure overlaps the existing Copilot threads.
  • Final convergence round 1 ended with both live subagents replying NO_NEW_VALUABLE_FINDINGS for the same ledger/comment set.

schemaChanges.add(
SchemaChangeOperation.dropColumn(
targetTable,
columnName,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mvn -f fs_brokers/cdc_client/pom.xml -DskipTests -Dspotless.check.skip=false validate currently fails in spotless:check before the module compiles. Spotless reports five changed Java files need formatting, including this file around the buildDropColumnSql wrapping here and the return below, plus SchemaChangeHelper.java, CustomMySqlAntlrDdlParser.java, CustomAlterTableParserListener.java, and CustomMySqlAntlrDdlParserListener.java. Please run the configured formatter for this module and commit the result; otherwise the CDC client CI/style gate will fail before tests run.

@JNSimba

JNSimba commented Jul 7, 2026

Copy link
Copy Markdown
Member Author

/review

@JNSimba

JNSimba commented Jul 7, 2026

Copy link
Copy Markdown
Member Author

run buildall

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the full CDC schema-change path for this PR and checked the existing review threads before submitting.

Findings: three generated .out files contain added blank EOF lines that fail git diff --check.

Validation:

  • mvn -f fs_brokers/cdc_client/pom.xml -DskipTests -Dspotless.check.skip=false validate passed locally.
  • git diff --check 4f3cd539b6fd3c6fd55b4148e7ab0ac255f9dee2..HEAD failed on the three commented .out files.
  • Targeted Maven tests for the CDC client did not reach execution in this standalone checkout because generated org.apache.doris.job.cdc.* classes were missing.

I did not duplicate the existing review threads for ZEROFILL unsigned handling, ADD-column null resolution, or the earlier Spotless report.

Comment thread regression-test/data/job_p0/streaming_job/cdc/test_streaming_mysql_job_sc.out Outdated
@JNSimba
JNSimba force-pushed the mysql-schemachange-add-drop-master branch from c561598 to d1db168 Compare July 7, 2026 14:51
@JNSimba

JNSimba commented Jul 7, 2026

Copy link
Copy Markdown
Member Author

run buildall

@JNSimba

JNSimba commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found three additional correctness issues in the new MySQL ADD COLUMN type mapping. They are distinct from the existing live threads for Spotless, .out EOF blanks, ZEROFILL/UNSIGNED, add-column null resolution, and parser-test metadata coverage.

Critical checkpoint conclusions:

  • Goal/test proof: the PR implements MySQL ADD/DROP schema-change handling and adds unit/regression coverage, but the added type mapper does not yet preserve several source types consistently with initial table creation.
  • Scope: the implementation is focused on CDC client schema-change parsing/deserialization and related tests.
  • Concurrency/lifecycle: no new independent shared-state concurrency issue was found; the coordinator still flushes before DDL, executes schema changes, applies updated schemas, and persists the schema baseline with offset commit.
  • Compatibility/persistence: restart/baseline flow was checked statically and is covered by a new restart suite, but unsupported DDL remains intentionally skipped while advancing baseline.
  • Parallel paths: no optimizer/Nereids changes apply. PostgreSQL-style unsupported-change behavior appears intentional for this MySQL path.
  • Tests/results: I could not run the focused Maven tests to execution in this runner; compilation stops on missing org.apache.doris.job.cdc.* FE classes. thirdparty/installed is also absent, so validation here is static plus GitHub metadata/patch inspection.
  • User focus: no additional user-provided focus points were supplied.

Subagent conclusions:

  • optimizer-rewrite proposed OR-1, accepted as inline comment M-1.
  • tests-session-config reported NO_NEW_VALUABLE_FINDINGS; its duplicate checks for existing formatting/.out/test-coverage threads were dismissed as already covered.
  • Main review added M-2 and M-3 for additional MySQL type-mapping mismatches.
  • Convergence round 1 ended with both live subagents replying NO_NEW_VALUABLE_FINDINGS for the same final ledger/comment set.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.

@JNSimba

JNSimba commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

run buildall

@JNSimba

JNSimba commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

/review

@JNSimba

JNSimba commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

run buildall

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Codex automated review failed and did not complete.

Error: You've hit your usage limit. Visit https://chatgpt.com/codex/settings/usage to purchase more credits or try again at Jul 10th, 2026 6:44 AM.
Workflow run: https://github.com/apache/doris/actions/runs/28927466772

Please inspect the workflow logs and rerun the review after the underlying issue is resolved.

@JNSimba

JNSimba commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

run buildall

3 similar comments
@JNSimba

JNSimba commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

run buildall

@JNSimba

JNSimba commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

run buildall

@JNSimba

JNSimba commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

run buildall

@JNSimba

JNSimba commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated follow-up review for PR 65325 at be25955.

I did not find a new distinct inline issue to add on this pass. I am leaving this as a comment-only review, not an approval, because the PR already has unresolved CHANGES_REQUESTED review state from existing threads.

User focus: no additional user-provided review focus was supplied.

Critical checkpoint conclusions:

  • Goal and scope: the change is scoped to the CDC client MySQL ADD/DROP schema-change path plus regression coverage. I reviewed the parser/deserializer path, schema-change execution, schema baseline commit, retry behavior, and added CDC/regression tests.
  • Correctness: DDL-before-DML ordering is preserved by flushing before schema DDL execution and writing schema-event records only after executeChanges and applySchemaChange. Schema baselines are serialized into the committed offset when DDL is executed.
  • Compatibility/configuration: MySQL Debezium schema events are enabled with includeSchemaChanges(true), and the source reload path restores table schemas from committed request state. I did not find a new cross-version or config compatibility issue in the reviewed path.
  • Concurrency/lifecycle: I did not find new unprotected shared state or lifecycle ordering issues in the changed path. Retry/idempotency behavior is handled through the schema-change manager and is covered by the new retry test.
  • Parallel paths: I compared the MySQL event-driven path against the existing PostgreSQL schema-change flow and the from-to / TVF test coverage. No new uncovered split-path issue was found.
  • Tests/results: the added result-producing regression queries use deterministic ORDER BY or single aggregate rows. Existing comments already cover earlier formatting/output issues, and those appear stale for the current head.
  • Existing review threads: the remaining MySQL unsigned/ZEROFILL type-mapping problem is still covered by existing threads, so I did not duplicate it. Prior decimal, string length, datetime precision, parser-failure, parser-null, Spotless, and .out EOF concerns are either already covered or resolved/stale in this head.
  • Observability/performance: the schema-change path logs the relevant DDL handling, and I did not find a hot-path performance regression; these events are not on the normal per-row path.

Validation:

  • Passed: mvn -f fs_brokers/cdc_client/pom.xml -DskipTests -Dspotless.check.skip=false spotless:check
  • Not completed: mvn -f fs_brokers/cdc_client/pom.xml -DskipTests test-compile failed before tests because the standalone cdc_client module compile could not resolve existing org.apache.doris.job.cdc.* classes in this checkout/classpath.
  • Not run: full Doris build and regression suites, because this review checkout lacks .worktree_initialized and thirdparty/installed.

Subagent conclusions:

  • optimizer-rewrite: returned NO_NEW_VALUABLE_FINDINGS after re-reading the final ledger/comment set.
  • tests-session-config: returned NO_NEW_VALUABLE_FINDINGS after re-reading the final ledger/comment set.

@JNSimba
JNSimba force-pushed the mysql-schemachange-add-drop-master branch from 4446b13 to b0adfb8 Compare July 9, 2026 08:08
@JNSimba

JNSimba commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

run buildall

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes based on the current live head (b0adfb81f88278a72837378a086a8d9e687f5d5b). I found twelve additional non-duplicate issues after deduplicating against existing review threads.

Critical checkpoints covered:

  • Goal/scope: the PR adds CDC schema-change support for MySQL/Postgres ADD/DROP paths, but ADD COLUMN still diverges from initial table creation for several source types, unsupported type handling, and default/nullability semantics, and the new disable flag is not reachable through normal job source validation.
  • Compatibility/persistence: baseline advancement and existing mixed/unsupported ALTER concerns were checked against current threads; the remaining new compatibility issues are type-equivalence drift, unsupported-type acceptance, skipped PostgreSQL Relation baseline advancement, default/backfill/nullability drift, and FE validation of the new source key.
  • Tests: the live head added generated expected-output files for the TVF schema-change suites, so I withdrew those two test-output findings. A targeted cdc_client Maven test was attempted earlier but failed during compilation because this checkout cannot resolve Doris job/cdc classes.
  • Validation limits: static review only. This worktree is missing .worktree_initialized, thirdparty/installed, and thirdparty/installed/bin/protoc, so I did not run a full Doris build or regression suite.

No additional user-provided review focus was supplied.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Codex automated review failed and did not complete.

Error: Codex completed, but no new pull request review was submitted for the current head SHA.
Workflow run: https://github.com/apache/doris/actions/runs/29001457433

Please inspect the workflow logs and rerun the review after the underlying issue is resolved.

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 100.00% (1/1) 🎉
Increment coverage report
Complete coverage report

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 0.00% (0/4) 🎉
Increment coverage report
Complete coverage report

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 29335 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit b0adfb81f88278a72837378a086a8d9e687f5d5b, data reload: false

------ Round 1 ----------------------------------
============================================
q1	17619	4068	4010	4010
q2	2041	319	209	209
q3	10267	1385	850	850
q4	4704	471	336	336
q5	7608	849	564	564
q6	198	168	132	132
q7	762	840	629	629
q8	9903	1607	1581	1581
q9	6087	4410	4428	4410
q10	6832	1778	1497	1497
q11	517	345	315	315
q12	737	546	423	423
q13	18106	3335	2745	2745
q14	269	265	243	243
q15	q16	801	788	710	710
q17	975	971	934	934
q18	6841	5645	5488	5488
q19	1422	1253	1052	1052
q20	746	720	533	533
q21	5863	2616	2368	2368
q22	422	353	306	306
Total cold run time: 102720 ms
Total hot run time: 29335 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4411	4348	4278	4278
q2	297	309	219	219
q3	4562	4953	4370	4370
q4	2052	2122	1357	1357
q5	4406	4301	4321	4301
q6	225	176	126	126
q7	1718	2040	1685	1685
q8	2474	2180	2051	2051
q9	7918	7797	7803	7797
q10	4717	4658	4197	4197
q11	599	440	384	384
q12	732	745	538	538
q13	3514	3673	2944	2944
q14	314	310	292	292
q15	q16	737	779	632	632
q17	1330	1312	1294	1294
q18	7920	7473	6888	6888
q19	1078	1066	1063	1063
q20	2219	2236	1931	1931
q21	5167	4555	4338	4338
q22	507	443	403	403
Total cold run time: 56897 ms
Total hot run time: 51088 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 180106 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit b0adfb81f88278a72837378a086a8d9e687f5d5b, data reload: false

query5	4344	644	489	489
query6	465	230	212	212
query7	4888	577	340	340
query8	340	195	171	171
query9	8763	4025	4032	4025
query10	473	375	293	293
query11	5947	2372	2147	2147
query12	160	104	101	101
query13	1300	647	431	431
query14	6267	5294	4949	4949
query14_1	4433	4297	4327	4297
query15	207	210	182	182
query16	1030	489	432	432
query17	1134	706	554	554
query18	2684	434	333	333
query19	197	183	149	149
query20	111	109	106	106
query21	233	151	131	131
query22	13754	13700	13546	13546
query23	17438	16448	16081	16081
query23_1	16286	16175	16215	16175
query24	7469	1778	1294	1294
query24_1	1308	1339	1268	1268
query25	562	441	356	356
query26	1335	336	199	199
query27	2674	609	387	387
query28	4493	2042	1986	1986
query29	1080	616	481	481
query30	349	281	234	234
query31	1142	1113	973	973
query32	108	69	65	65
query33	514	320	255	255
query34	1158	1164	656	656
query35	761	764	679	679
query36	1358	1384	1188	1188
query37	155	112	96	96
query38	1890	1686	1641	1641
query39	923	931	881	881
query39_1	858	878	899	878
query40	252	169	145	145
query41	72	69	69	69
query42	99	101	93	93
query43	322	324	279	279
query44	1429	779	790	779
query45	197	201	180	180
query46	1096	1224	743	743
query47	2346	2303	2184	2184
query48	435	439	278	278
query49	600	441	325	325
query50	1055	415	336	336
query51	10819	10894	10706	10706
query52	88	87	78	78
query53	277	285	205	205
query54	308	266	240	240
query55	77	76	74	74
query56	319	297	309	297
query57	1427	1381	1281	1281
query58	298	258	266	258
query59	1595	1646	1438	1438
query60	316	280	270	270
query61	180	176	181	176
query62	702	655	576	576
query63	249	209	212	209
query64	2898	1128	830	830
query65	4879	4824	4802	4802
query66	1771	519	413	413
query67	29650	29509	29425	29425
query68	3098	1592	1045	1045
query69	411	297	280	280
query70	1056	1014	945	945
query71	350	326	295	295
query72	3066	2675	2366	2366
query73	834	788	435	435
query74	5106	4986	4755	4755
query75	2610	2584	2201	2201
query76	2311	1161	755	755
query77	362	379	291	291
query78	12219	12299	11762	11762
query79	1509	1162	737	737
query80	1276	544	468	468
query81	558	322	269	269
query82	638	156	121	121
query83	365	315	292	292
query84	277	157	130	130
query85	960	596	498	498
query86	448	304	279	279
query87	1830	1816	1755	1755
query88	3712	2788	2783	2783
query89	461	408	345	345
query90	1888	202	203	202
query91	200	191	161	161
query92	65	61	57	57
query93	1680	1523	1034	1034
query94	756	359	339	339
query95	771	480	453	453
query96	1123	778	352	352
query97	2676	2663	2529	2529
query98	215	205	200	200
query99	1164	1174	1021	1021
Total cold run time: 266771 ms
Total hot run time: 180106 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
ClickBench: Total hot run time: 24.85 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit b0adfb81f88278a72837378a086a8d9e687f5d5b, data reload: false

query1	0.01	0.00	0.01
query2	0.10	0.05	0.05
query3	0.25	0.13	0.14
query4	1.62	0.14	0.13
query5	0.28	0.23	0.22
query6	1.24	1.05	1.10
query7	0.04	0.01	0.01
query8	0.06	0.04	0.04
query9	0.38	0.33	0.30
query10	0.54	0.54	0.57
query11	0.19	0.13	0.14
query12	0.18	0.14	0.14
query13	0.46	0.46	0.47
query14	1.01	1.00	1.02
query15	0.62	0.59	0.59
query16	0.31	0.33	0.32
query17	1.08	1.12	1.10
query18	0.23	0.21	0.21
query19	2.01	1.92	1.99
query20	0.02	0.02	0.01
query21	15.42	0.18	0.13
query22	4.96	0.05	0.06
query23	16.13	0.30	0.12
query24	3.01	0.42	0.35
query25	0.12	0.04	0.04
query26	0.73	0.20	0.16
query27	0.04	0.04	0.04
query28	3.55	0.93	0.53
query29	12.48	4.00	3.17
query30	0.28	0.14	0.14
query31	2.77	0.60	0.31
query32	3.22	0.59	0.48
query33	3.19	3.16	3.21
query34	15.57	4.30	3.52
query35	3.54	3.47	3.48
query36	0.55	0.44	0.43
query37	0.08	0.07	0.07
query38	0.06	0.04	0.04
query39	0.05	0.03	0.03
query40	0.19	0.17	0.16
query41	0.09	0.03	0.03
query42	0.04	0.04	0.03
query43	0.05	0.04	0.04
Total cold run time: 96.75 s
Total hot run time: 24.85 s

@JNSimba

JNSimba commented Jul 10, 2026

Copy link
Copy Markdown
Member Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review completed.

I found one distinct issue not already covered by the existing review threads: the PostgreSQL direct fetch/debug endpoints still allow schema-change records by default but do not provide the Doris target database or handle SCHEMA_CHANGE results, so an ADD/DROP Relation event can fail while constructing Doris DDL.

Critical checkpoint conclusions:

  • Goal/test coverage: the PR adds MySQL ADD/DROP schema-change handling and TVF schema-change disabling with new unit/regression coverage, but the direct PostgreSQL fetch path remains uncovered.
  • Scope/focus: no additional user-provided review focus was supplied.
  • Parallel paths/compatibility: MySQL fetch-path missing target DB, FE validation for schema_change_enabled, mapper parity, unsupported baseline advancement, positional ADD, mixed ALTER atomicity, default/nullability behavior, and during-snapshot determinism are already covered by existing inline threads, so I did not duplicate them. The new inline comment is the separate PostgreSQL fetch/debug instance.
  • Concurrency/lifecycle: reviewed reader reuse, offset/schema persistence, retry/idempotency, and FE restart paths; no additional concurrency issue was substantiated beyond existing threads.
  • Config/session propagation: reader-level propagation of schema_change_enabled is present; the from-to FE validation gap is already threaded.
  • Validation: static review only. git diff --check a35099df1f5634296dfd3b67f9a13b84ad91d719..HEAD passed, but FE/CDC builds and regression tests were not run because this checkout is not worktree-initialized and lacks thirdparty/installed / thirdparty/installed/bin/protoc.

Subagent conclusions:

  • optimizer-rewrite proposed optimizer-rewrite-001; I verified and accepted it as the single inline comment.
  • tests-session-config reported no new valuable finding; its noted concerns were duplicates of existing threads or dismissed by current evidence.
  • Final convergence round 1 ended with both live subagents replying NO_NEW_VALUABLE_FINDINGS for the same ledger and one-comment set.

col.name(),
SchemaChangeHelper.buildAddColumnSql(
db, targetTable, col.name(), colType, null, null)));
db, targetTable, col.name(), colType)));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PostgreSQL fetch/debug paths still have the same write-path-only target DB assumption. PostgresSourceReader defaults schema_change_enabled to true, and both /api/fetchRecords and /api/fetchRecordStream pass the raw FetchRecordRequest config into sourceReader.deserialize(...); unlike writeRecords(), they never add Constants.DORIS_TARGET_DB and they do not handle SCHEMA_CHANGE results. If a direct Postgres fetch sees a Relation ADD/DROP, this call builds Doris DDL with db == null, and SchemaChangeHelper.quoteTableIdentifier() dereferences it while the fetch path cannot execute that DDL anyway. The normal FE TVF now forces schema_change_enabled=false, but the public/debug fetch endpoints remain exposed to this by default. Please keep schema-change records disabled for all fetch paths, or carry target context and handle schema-change results there instead of building DDL with a null target DB.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FE has already been configured; this scenario does not exist.

@liaoxin01 liaoxin01 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions github-actions Bot added the approved Indicates a PR has been approved by one committer. label Jul 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR approved by at least one committer and no changes requested.

@JNSimba
JNSimba merged commit c759957 into apache:master Jul 14, 2026
33 checks passed
github-actions Bot pushed a commit that referenced this pull request Jul 16, 2026
### What problem does this PR solve?

Issue Number: None

Problem Summary: Support MySQL ADD/DROP column schema changes in
streaming jobs. MySQL schema change events now update the FE schema
baseline, execute Doris ADD/DROP column DDLs for supported changes, and
keep unsupported changes aligned with the existing PostgreSQL
schema-change behavior.

This also keeps `cdc_stream` TVF behavior stable when source-side schema
changes happen during incremental consumption. The TVF path disables
schema-change handling internally, skips schema change records in the
CDC client, and continues to consume DML that matches the query
projection for both MySQL and PostgreSQL sources..
yiguolei pushed a commit that referenced this pull request Jul 17, 2026
…anges #65325 (#65707)

Cherry-picked from #65325

Co-authored-by: wudi <wudi@selectdb.com>
JNSimba added a commit that referenced this pull request Jul 23, 2026
### What problem does this PR solve?

Related PR: #65325

Streaming jobs currently support MySQL and PostgreSQL CDC sources but
cannot use OceanBase as a source.

This change adds OceanBase MySQL compatibility mode as a streaming job
data source. It introduces OceanBase source type handling in FE and the
CDC client, reuses the MySQL-compatible CDC processing path, validates
source configuration and compatibility mode before creating target
tables, and supports initial, snapshot, latest, earliest, and specific
startup offsets.

The OceanBase third-party environment exposes separate JDBC and CDC
ports. Test coverage includes basic synchronization, data types, startup
offsets, schema changes, and FE restart recovery.
github-actions Bot pushed a commit that referenced this pull request Jul 23, 2026
### What problem does this PR solve?

Related PR: #65325

Streaming jobs currently support MySQL and PostgreSQL CDC sources but
cannot use OceanBase as a source.

This change adds OceanBase MySQL compatibility mode as a streaming job
data source. It introduces OceanBase source type handling in FE and the
CDC client, reuses the MySQL-compatible CDC processing path, validates
source configuration and compatibility mode before creating target
tables, and supports initial, snapshot, latest, earliest, and specific
startup offsets.

The OceanBase third-party environment exposes separate JDBC and CDC
ports. Test coverage includes basic synchronization, data types, startup
offsets, schema changes, and FE restart recovery.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. dev/4.1.4-merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants