[Bug](Low) ALTER TABLE changing ROW binlog.format returns wrong error message
Search before asking
- [x] I had searched in the issues and found no similar issues.
Version
Reproduced with the table stream regression case on local Doris HEAD d4a077caf8a.
Test environment:
regression-test/suites/table_stream_p0/test_binlog_property_alter_exception.groovy
remote log: /mnt/disk1/jianxu/case_output/doris/testrun/table_stream_p0_20260708/test_binlog_property_alter_exception.final.log
FE: 172.20.49.4:9030
What's Wrong?
When a table is created with ROW binlog enabled, changing binlog.format by ALTER TABLE ... SET should be rejected by the binlog format validation path.
The regression case expects an exception message containing:
not support change binlog format
However, Doris currently returns a generic light schema change error:
errCode = 2, detailMessage = only support light schema change operator when use table with binlog<Row>
This makes test_binlog_property_alter_exception fail on the first ALTER TABLE check.
What You Expected?
Changing binlog.format after table creation should fail with a clear binlog format error, for example:
not support change binlog format
How to Reproduce?
Regression case:
regression-test/suites/table_stream_p0/test_binlog_property_alter_exception.groovy
Failing SQL:
ALTER TABLE tbl_row_fmt SET ("binlog.format" = "STATEMENT_AND_SNAPSHOT");
Minimal flow:
CREATE TABLE tbl_row_fmt (
k1 INT,
v1 INT
)
UNIQUE KEY(k1)
DISTRIBUTED BY HASH(k1) BUCKETS 1
PROPERTIES (
"replication_num" = "1",
"enable_unique_key_merge_on_write" = "true",
"binlog.enable" = "true",
"binlog.format" = "ROW"
);
ALTER TABLE tbl_row_fmt SET ("binlog.format" = "STATEMENT_AND_SNAPSHOT");
Regression Test Result
suite: test_binlog_property_alter_exception
command: ALTER TABLE tbl_row_fmt SET ("binlog.format" = "STATEMENT_AND_SNAPSHOT")
expected: exception message contains "not support change binlog format"
actual: errCode = 2, detailMessage = only support light schema change operator when use table with binlog<Row>
Log excerpt:
2026-07-08 18:04:09.369 INFO - Execute sql:
ALTER TABLE tbl_row_fmt SET ("binlog.format" = "STATEMENT_AND_SNAPSHOT")
2026-07-08 18:04:09.382 ERROR - Exception: java.sql.SQLException: errCode = 2, detailMessage = only support light schema change operator when use table with binlog<Row>
Caused by: java.lang.AssertionError: Expect exception msg contains 'not support change binlog format', but meet 'java.sql.SQLException: errCode = 2, detailMessage = only support light schema change operator when use table with binlog<Row>'
Anything Else?
Tracking issue: #65265
Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
Breakwater-GitHub-Analysis-Slot: slot_b528dc2e891b This content is generated by AI for reference only.
Initial analysis for apache/doris#65383:
This looks like a real FE validation-order bug, not only a regression-test expectation problem.
What I checked:
- The live issue is open, has no labels/comments at read time, and reports Doris HEAD
d4a077caf8awith a failingALTER TABLE tbl_row_fmt SET ("binlog.format" = "STATEMENT_AND_SNAPSHOT"). - The exact short commit is not visible from the public
apache/doriscommit search I ran, but the same routing gap is present on refreshedupstream/master(16a745d5125).
Code path:
ModifyTablePropertiesOp.validate()recognizesbinlog.*properties and callsPropertyAnalyzer.analyzeBinlogConfig(...), but this only validates the property value shape. It does not compare the requested value with the existing table binlog config.- The comparison that would produce the expected message is in
SchemaChangeHandler.updateBinlogConfig(): it builds a newBinlogConfigand callsBinlogConfig.mergeFromProperties(..., false).BinlogConfig.mergeFromProperties()explicitly returnsnot support change binlog format from ROW to STATEMENT_AND_SNAPSHOTwhenbinlog.formatchanges. - However,
AlterOperations.checkBinlogConfigChange()currently routes only these keys toupdateBinlogConfig():binlog.enable,binlog.ttl_seconds,binlog.max_bytes, andbinlog.max_history_nums. - It does not include
binlog.format, so this statement falls through to the generichasSchemaChangeOp()path. InSchemaChangeHandler.process(),ModifyTablePropertiesOpsetslightSchemaChange = false, and then the row-binlog guard rejects it withonly support light schema change operator when use table with binlog<Row>.
So the wrong message is caused by routing binlog.format through the schema-change path before the binlog-config merge/validation path can run.
Recommended next step:
- Extend the binlog-config routing predicate to include
PropertyAnalyzer.PROPERTIES_BINLOG_FORMAT. - Also consider including
PropertyAnalyzer.PROPERTIES_BINLOG_NEED_HISTORICAL_VALUE, becauseBinlogConfig.mergeFromProperties()has the same immutable-change check for it butcheckBinlogConfigChange()currently does not route it either. - Keep/adjust the regression to assert that changing
binlog.formaton an existing ROW-binlog table fails through the binlog config validator withnot support change binlog format, not through the generic row-binlog schema-change guard.
Missing information:
- No additional logs are needed to identify the likely code-level cause for the reported SQL.
- If maintainers want to pin the exact introducing commit, the public issue should include a public branch/PR or full commit SHA reachable from
apache/doris; the reported short SHA was not found from the public repository during this read-only check.
I'd like to work on this. I can keep the patch focused on routing binlog.format through the existing binlog configuration validation, with a regression case that distinguishes the expected immutable-format error from the generic ROW schema-change error. I would leave binlog.need_historical_value out unless maintainers want it handled in the same issue.
Does that scope look right?
fixed by #65810
This is no longer reproducible on current master. It was fixed as a side effect of #65810 (commit f745ddf9e22, 2026-08-07), about a month after this issue was filed.
Root cause at the time
AlterOperations.checkBinlogConfigChange() only recognized binlog.enable, binlog.ttl_seconds, binlog.max_bytes and binlog.max_history_nums. binlog.format was not in that list, so ALTER TABLE ... SET ("binlog.format" = ...) fell through the binlog branch of Alter.processAlterOlapTableInternal() and was dispatched to hasSchemaChangeOp() → SchemaChangeHandler.process(), where the row-binlog light-schema-change guard rejected it with the generic message. The dedicated check in BinlogConfig.mergeFromProperties() was never reached, which is why "not support change binlog format" never showed up.
The fix
f745ddf9e22 added the two missing keys:
// fe/fe-core/src/main/java/org/apache/doris/alter/AlterOperations.java
+ || clause.getProperties().containsKey(PropertyAnalyzer.PROPERTIES_BINLOG_FORMAT)
+ || clause.getProperties().containsKey(PropertyAnalyzer.PROPERTIES_BINLOG_NEED_HISTORICAL_VALUE));
On current master the statement routes to SchemaChangeHandler.updateBinlogConfig() → BinlogConfig.mergeFromProperties(properties, force = false) and fails with:
errCode = 2, detailMessage = not support change binlog format from ROW to STATEMENT_AND_SNAPSHOT
which is what the case expects. The same commit also fixed binlog.need_historical_value, which had exactly the same problem.
I verified this on current master (71a63249bbd) with a local FE unit test built on TestWithFeService, running the exact statements from the report against a binlog.format = ROW MOW table:
| statement | error message on current master |
|---|---|
SET ("binlog.format" = "STATEMENT_AND_SNAPSHOT") |
not support change binlog format from ROW to STATEMENT_AND_SNAPSHOT |
SET ("binlog.need_historical_value" = "false") |
not support change binlog.need_historical_value from true to false |
SET ("binlog.enable" = "false") |
can't disable binlog when format is [Row] |
SET ("binlog.format" = "ROW") (same value) |
accepted, no-op |
SET ("binlog.ttl_seconds" = "7200") |
accepted |
Follow-up
There was no regression coverage for this, so I am adding regression-test/suites/table_stream_p0/test_binlog_property_alter_exception.groovy to lock the behaviour in. It covers binlog.format, binlog.need_historical_value and binlog.enable on a ROW binlog table, the no-op case of setting the same value, and the mirror case on a table without binlog.
One thing worth noting for anyone hitting this again: the whole checkBinlogConfigChange branch is guarded by Config.enable_feature_binlog (Alter.java:270). With the feature off the statement is still rejected, but with Binlog feature is not enabled instead. That is not a problem in practice because table stream consumption already requires enable_feature_binlog = true (InsertIntoTableCommand.java:296).
This issue can be closed.