NginxL opened a new pull request, #71467: URL: https://github.com/apache/doris/pull/71467
### Background The CDC client commits task offsets and table schemas to the FE through JSON HTTP PUT requests. The request declares UTF-8 in its content type, while the Apache HttpCore `StringEntity` constructors used by these paths select their own default charset. ### What problem does this PR solve? Issue Number: close #71466 Related PR: None PR Type: Bugfix Problem Summary: Non-ASCII table names, column names, enum members, or defaults in the offset-commit payload can be encoded as ISO-8859-1 despite the declared UTF-8 content type, causing FE JSON parsing failures or corrupted schema metadata. This change explicitly encodes the affected JSON request bodies as UTF-8. Existing users with non-ASCII schema metadata can commit offsets without that encoding mismatch. ### Details - **Frequency:** Always when the commit-offset payload contains non-ASCII schema text and HttpCore uses the reported default encoding. Found from the report's code path and source inspection; no live MySQL/FE reproduction was run here. - **Root cause:** `DorisBatchStreamLoad.commitOffset` constructs `new StringEntity(param)` even though the JSON content type is UTF-8. In HttpCore 4.4.13 that constructor defaults to ISO-8859-1, so non-ASCII bytes are not valid UTF-8 or are decoded incorrectly by the FE. - **Why existing tests missed it:** `DorisBatchStreamLoadTest.commitOffsetPreservesFailureReasonAfterRetries` reads and discards the request bytes and checks only failure-message propagation and retry count. No existing test checks the encoded request body for non-ASCII schema content. The `*ITCase` integration tests require external MySQL/PostgreSQL and Doris services and do not provide a lightweight encoding assertion for this path. - **Fix:** Pass `StandardCharsets.UTF_8` when constructing the commit-offset entity. Apply the same explicit encoding to the neighboring best-effort task-failure report in the same class, whose reason field can also contain non-ASCII text. - **Behavior change:** Offset and task-failure JSON request bodies are encoded as UTF-8; the JSON schema, endpoints, and defaults are unchanged. - **Other paths and branches:** The neighboring `reportTaskFailure` path is fixed here. No other `new StringEntity(param)` occurrence remains in this class. The issue reporter observed the commit-offset line on master, branch-4.1, and branch-4.0; this checkout verified current master only and did not independently inspect the release branches. ### Testing Added `commitOffsetEncodesTableSchemasAsUtf8`, which runs the real `commitOffset` request path against a local HTTP server, captures the raw request bytes, decodes them as UTF-8, and asserts that `été` survives in `tableSchemas`. The pre-existing failure-reason test remains unchanged. NOT_RUN: Maven/JDK 17 test execution. This macOS environment has no Java runtime or Maven, and new toolchain/dependency downloads are prohibited, so the new test was not executed and no baseline failure was observed locally. `git diff --check` passed, and Surefire's default unit-test selection includes `DorisBatchStreamLoadTest`. CI must compile and run the test. ### Release note Fixed CDC offset commits and task-failure reports encoding JSON with the platform HttpCore default instead of UTF-8, which could break non-ASCII table schema metadata. ### Check List (For Author) - Behavior changed: Yes (see Details) - Does this need documentation: No - Pre-submission status: Partially verified: source review and `git diff --check` only; JDK/Maven unit test execution remains unverified. ### AI Disclosure - Tool: DSH agent, AI-assisted coding. - Generated: Production change, regression test, and this description. - Human review: No independent human review; the agent reviewed the final diff and traced the request path. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
