Skip to content

Fix Pipe startup, attribute handling, and LOAD diagnostics - #19523

Draft
Caideyipi wants to merge 10 commits into
apache:masterfrom
Caideyipi:codex/fix-pipe-attribute-normalization-master
Draft

Caideyipi wants to merge 10 commits into
apache:masterfrom
Caideyipi:codex/fix-pipe-attribute-normalization-master

Conversation

@Caideyipi

@Caideyipi Caideyipi commented Dec 3, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Fix Pipe attribute normalization, credential handling, and task-startup edge cases, and improve LOAD fallback diagnostics. REST v1 delete-progress handling and CLI server-status output are split into #19538 and #19539.

Pipe changes

  • Reject built-in attribute keys that collide after trimming and case normalization; preserve case-sensitive timestamp and consensus identifiers.
  • Treat blank connector selectors as absent, normalize source and sink attributes before plugin validation and authentication, detect credential overrides before merging ALTER PIPE requests, and apply now to normalized source time keys.
  • Preserve exact canonical keys when deserializing legacy Pipe metadata while rejecting normalized duplicates in new DDL; accept explicit source.loose-range=false.
  • Keep first-execution waits outside the PipeTaskAgent metadata write lock, share a bounded deadline across tasks, and leave queued subtasks eligible after deadline expiry; roll back actual startup or wait failures.
  • Read pending-count snapshots without blocking metadata updates during source startup or file supply.

LOAD example

For a point-count mismatch in x.tsfile at root.sg.d1.s1, LOAD reports expected and actual counts instead of a generic iteration failure.

Other split changes

@Caideyipi

Copy link
Copy Markdown
Collaborator Author

Initial self-review summary for candidate a8c53cfd2aae6a477311c81ce0955d87c4f5a05b (reviewed SHA, final local SHA, and confirmed PR head):

  • Mainline-confirmed findings from [To dev/1.3] Normalize topic and pipe attributes #19476 fixed: normalized built-in key collisions, whitespace-only connector selector fallback, case-sensitive time-value preservation, source normalization before plugin checks and authentication, and now substitution for normalized time-key variants.
  • Legacy metadata recovery remains tolerant: deserialization preserves serialized order and keeps the first normalized duplicate.
  • The credential-display and sink-log findings from Backport #19468 to dev/1.3 #19474 are already sanitized on master. The reported consensus creation failure is specific to the backport's earlier normalization point; master reads the raw group ID before metadata normalization, and normalized metadata now preserves its case.
  • No further issues were found in the candidate diff. Spotless passed; 18 focused tests passed; full-reactor English and Chinese test-compile passed; git diff --check passed.
  • Reviewed base: master at fffd7d4d9db551ff4dc723970a2be829cff0fe22. Local, pushed branch, and PR head all match a8c53cfd2aae6a477311c81ce0955d87c4f5a05b.

@Caideyipi
Caideyipi marked this pull request as draft December 3, 2026 09:40
@luoluoyuyu

Copy link
Copy Markdown
Member

major iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/pipe/task/CreatePipeProcedureV2.java:188 — Sink attributes are still unnormalized before sink password hashing

Only the extractor attributes are normalized (L173-176); checkAndEnrichSinkAuthentication still receives the raw connector map. With WITH SINK (' Connector.Password '='p', connector.username='u') hasAnyAttributes misses the key (no trim/case fold), so login4Pipe is skipped: the plaintext password is persisted in PipeStaticMeta and WriteBackSink's later login (useEncryptedPassword = regionId >= 0) throws PipePasswordCheckException.

Fix: Normalize before the check, e.g. setConnectorAttributes(normalizeSinkParameters(new PipeParameters(createPipeRequest.getConnectorAttributes())).getAttribute()) next to the extractor normalization at L173.

@luoluoyuyu

Copy link
Copy Markdown
Member

minor iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/pipe/task/AlterPipeProcedureV2.java:119 — ALTER PIPE auth gate reads raw attributes, so case/space password keys skip hashing

checkSource/checkSink are computed with hasAnyAttributes on the raw request maps; checkAndUpdateRequestBeforeAlterPipe (L138) normalizes them only afterwards. So ALTER PIPE p SET SOURCE (' SOURCE.PASSWORD '='p') skips checkAndEnrichSourceAuthentication, the plaintext password is stored as source.password, and the runtime login (useEncryptedPassword = regionId >= 0) fails.

Fix: Normalize the request's extractor/connector attributes (normalizeSourceParameters / normalizeSinkParameters) before computing checkSource and checkSink, mirroring the fix in CreatePipeProcedureV2.

@Caideyipi Caideyipi changed the title Fix pipe attribute normalization edge cases Address Pipe, REST, and CLI edge cases Dec 3, 2026
@Caideyipi

Copy link
Copy Markdown
Collaborator Author

Thanks for catching this. CreatePipeProcedureV2 now normalizes connector attributes before plugin validation and authentication, matching the source-attribute path. This ensures whitespace/case variants of connector credential keys are recognized and the Pipe metadata receives the hashed password. The regression test verifies that the sink password is hashed.

@Caideyipi

Copy link
Copy Markdown
Collaborator Author

Thanks for catching this. AlterPipeProcedureV2 now detects credential keys after trimming and case-insensitive comparison before request normalization and merging, so authentication still runs for source and sink overrides with whitespace/case variants. The regression test verifies that both passwords are hashed.

@Caideyipi

Copy link
Copy Markdown
Collaborator Author

Review round for PR head 2bdf5663be81644d52a03d102a6204772fe1ade0:

  • Confirmed both authentication findings: CREATE PIPE now normalizes sink attributes before authentication, and ALTER PIPE detects case/whitespace variants of source and sink credential keys before merging request attributes.
  • Added regression coverage for both paths. Updated the existing source-alias test fixtures to remove duplicate keys that now correctly collide after normalization; the dedicated duplicate-rejection test remains in place.
  • Validation: Spotless passed; a clean focused ConfigNode/DataNode run passed 15 tests with 0 failures or errors. The earlier 59-test focused run and full-reactor English/Chinese compiles also passed before this follow-up.
  • The previous Unit-Test run failed on the two source-alias fixtures at the reviewed head. The updated-head Unit-Test run is currently pending/in progress; it is not reported as passed.
  • Final local SHA: 2d616be35b1a308b57fae36cb155b186e4fc9158. Confirmed fork branch and PR head are the same SHA. PR remains draft for a fresh independent re-review.

@Caideyipi

Caideyipi commented Dec 3, 2026 •

Copy link
Copy Markdown
Collaborator Author

Review round for PR head 2d616be35b1a308b57fae36cb155b186e4fc9158:

  • Reviewed the complete diff against the current master; no additional actionable issues found. The branch is 10 commits behind master, but those target changes do not overlap the PR paths, and GitHub reports it mergeable.
  • Compared the startup handling with the referenced downstream-first change: metadata sync starts tasks under the write lock, waits after releasing it, keeps first-execution timeouts non-fatal, and rolls back/reports actual wait failures.
  • Confirmed the CLI appends the server message to the success text on one line, REST validation permits the delete-progress query, and Pipe credential-key variants are normalized before authentication.
  • Verification: the final focused local reactor run passed 15 tests; Spotless passed. Updated Unit-Test run 47153148235 completed successfully with all four jobs passing. Earlier English and Chinese full-reactor compiles passed before the final authentication follow-up.
  • Reviewed SHA, final local SHA, and confirmed fork/PR head: 2d616be35b1a308b57fae36cb155b186e4fc9158.

@Caideyipi
Caideyipi marked this pull request as ready for review December 3, 2026 17:43
@Caideyipi
Caideyipi marked this pull request as draft December 4, 2026 01:44
@Caideyipi

Copy link
Copy Markdown
Collaborator Author

CI failure follow-up for PR head 2d616be35b1a308b57fae36cb155b186e4fc9158:

  • Both reported CI jobs failed in the tree- and table-model IoTDBPipePermissionIT.testSourcePermission cases when ALTER PIPE supplied the legacy unprefixed username and password aliases.
  • Root cause: the ALTER authentication gate checked only prefixed keys, although PipeParameters also recognizes prefix-stripped aliases. The gate now checks those normalized equivalents after trimming and case-insensitive comparison, preserving authentication for both source and sink aliases.
  • Added unit coverage for unprefixed source/sink credentials while retaining the prefixed-key regression case. Spotless passed; a clean ConfigNode reactor test passed with 3 tests, 0 failures, and 0 errors. The distributed integration tests were not rerun locally; updated-head CI is pending.
  • Reviewed CI head: 2d616be35b1a308b57fae36cb155b186e4fc9158. Final local commit and confirmed fork branch/PR head: 0634a64c158a28211f76241aa741ab8c9321e4b6. PR remains draft for a fresh independent re-review.

@Caideyipi

Copy link
Copy Markdown
Collaborator Author

Review round update for PR #19523:

  • Reviewed starting head: 0634a64c158a28211f76241aa741ab8c9321e4b6.
  • Fixed the duplicate-normalized-key error mapping: CREATE PIPE source normalization now runs inside the existing plugin-validation handler, which maps the rejection to PIPE_ERROR.
  • Added a CREATE regression test asserting the error code. The previously reviewed source/sink authentication fixes remain in the current branch.
  • Verification: Spotless passed; the clean focused DataNode reactor test passed (1 test, 0 failures/errors); commit whitespace check passed.
  • Final local and confirmed PR head: 47e45c7ee28265ea8ad03e69e7e6d474ce231e83. PR remains open and draft.

@Caideyipi

Copy link
Copy Markdown
Collaborator Author

Review follow-up for PR #19523 (starting head 47e45c7ee28265ea8ad03e69e7e6d474ce231e83):

  • Reviewed comments posted from November 27 through December 4 on recent dev/1.3 PRs. Added the mainline-applicable fixes for explicit false loose-range values, lock-free historical pending-count snapshots, mods-aware LOAD fallback and count diagnostics, bounded first-execution waits, executor-safe rollback, subscription sink wait routing, and canonical-key precedence for legacy metadata.
  • Kept branch-specific findings out: deletion-event rate classification depends on the dev/1.3 event type, while the corresponding master-base behavior uses a separate delete event. The display-ID findings from Backport #19468 to dev/1.3 #19474 are already covered by the current master base; no duplicate change was needed.
  • Validation: Spotless passed; 124 focused tests passed with 0 failures, 0 errors, and 0 skips; full-reactor English and Chinese test-compile -DskipTests passed.
  • Reviewed starting PR head: 47e45c7ee28265ea8ad03e69e7e6d474ce231e83. Final local and confirmed remote head: 5773071825296d76f432ff4e48b6dc7f1121d7c0.
  • PR remains Draft. GitHub CI for the updated head is pending.

@Caideyipi
Caideyipi marked this pull request as ready for review December 4, 2026 08:23
PipeSinkConstant.CONNECTOR_IOTDB_PASSWORD_KEY,
PipeSinkConstant.SINK_IOTDB_PASSWORD_KEY);

pipeTaskInfo.get().checkAndUpdateRequestBeforeAlterPipe(alterPipeRequest);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

major iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/pipe/task/AlterPipeProcedureV2.java:138 — ALTER PIPE REPLACE mode still skips credential hashing for trimmed/case-variant keys

With ALTER PIPE ... REPLACE SOURCE/SINK (' SOURCE.PASSWORD '='p'), checkAndUpdateRequestBeforeAlterPipe (L138) skips normalization when isReplaceAll*Attributes is true, so L141/L146 get padded/mixed-case keys. getStringOrDefault/hasAttribute are exact-key lookups, so authentication is skipped and PipeStaticMeta persists the plaintext password, breaking the WriteBackSink login (useEncryptedPassword). The new AlterPipeProcedureV2Test mocks normalization away.

Fix: Normalize the request maps (normalizeSourceParameters/normalizeSinkParameters) before L138 instead of relying on checkAndUpdateRequestBeforeAlterPipe, and test the isReplaceAll*=true path without mocking normalization.


public static boolean validateStatement(Statement statement) {
return !(statement instanceof QueryStatement)
&& !(statement instanceof ShowDeleteTimeSeriesProgressStatement)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

major external-service-impl/rest/src/main/java/org/apache/iotdb/rest/protocol/v1/handler/ExecuteStatementHandler.java:37 — REST v1 still cannot return SHOW DELETE TIMESERIES PROGRESS results

ShowDeleteTimeSeriesProgressStatement extends Statement, not ShowStatement, and QueryDataSetHandler.fillQueryDataSet (L61-83) only special-cases ShowStatement, ShowModelsStatement, ShowAIDevicesStatement, ShowLoadedModelsStatement, AuthorStatement and GetRegionIdStatement. So /rest/v1/query answers QUERY_PROCESS_ERROR "unsupported query data type", and /rest/v1/executeStatement now errors where it previously returned SUCCESS.

Fix: Add a ShowDeleteTimeSeriesProgressStatement branch to QueryDataSetHandler.fillQueryDataSet (same fillShowPlanDataSet path as AuthorStatement) and cover it with a fillQueryDataSet test, not only validateStatement.

@Caideyipi
Caideyipi force-pushed the codex/fix-pipe-attribute-normalization-master branch from cca161f to 1a4dde6 Compare December 4, 2026 09:27
@Caideyipi Caideyipi changed the title Address Pipe, REST, and CLI edge cases Fix Pipe startup, attribute handling, and LOAD diagnostics Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants