Skip to content

Address Pipe, REST, and CLI edge cases - #19523

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

Caideyipi wants to merge 6 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 and task-startup handling, secure normalized Pipe credentials, allow delete-progress queries through REST v1, and append successful server messages to CLI output.

Changes

  • Reject built-in attribute keys that collide after trimming and case normalization instead of selecting a value based on map iteration order.
  • Preserve case-sensitive timestamp and consensus identifiers during built-in parameter normalization.
  • Treat blank connector selectors as absent so default connector attributes are normalized.
  • Normalize source and sink attributes before plugin validation and authentication, preventing case/space variants from bypassing password hashing.
  • Detect credential overrides in ALTER PIPE requests after trimming and case-insensitive key comparison, before merging the request with existing metadata.
  • Apply now to trimmed, case-insensitive source time-key variants.
  • Retain the first serialized duplicate key so legacy Pipe metadata remains deserializable.
  • Route SHOW DELETE TIMESERIES PROGRESS through REST v1 query handling.
  • Move first-execution waits outside the PipeTaskAgent metadata write lock and share a deadline across tasks started by one metadata push.
  • Keep first-execution deadline expiry non-fatal so queued subtasks remain eligible to run; roll back and report actual startup or wait failures.
  • Append a server-provided success message after the generic CLI success message on the same output line.

Examples

  • Before: source.path='root.sg.**' and Source.Path ='root.other.**' silently select a value based on map iteration. After: the ambiguous built-in configuration is rejected as a duplicate key.
  • Before: SOURCE.START-TIME with value 2024-01-01T00:00:00Z can be lowercased and fail timestamp parsing, and a trimmed SOURCE.START-TIME=now is not substituted. After: case-sensitive timestamp values are preserved and now is applied to the trimmed key.
  • Before: WITH SINK (' Connector.Password ' = '<password>') can skip password hashing because the raw key is not recognized. After: the sink key is normalized and its password is hashed before Pipe metadata is persisted.
  • Before: ALTER PIPE p SET SOURCE (' SOURCE.PASSWORD ' = '<password>') or the equivalent sink update can skip authentication when the key contains case or whitespace variants. After: both source and sink credential updates are detected and authenticated before metadata is changed.
  • Before: SHOW DELETE TIMESERIES PROGRESS is classified by REST v1 as an execution statement. After: REST v1 routes it through query result handling.
  • For DROP TABLE test_table with a server status message, before the server message and generic success text print on separate lines. After they print on one line, for example: The statement is executed successfully.Table deletion task 123 has been submitted for asynchronous execution.
  • When sink workers are saturated and a subtask misses its first-execution deadline, before the timeout can fail startup and drop the task while metadata handling holds the write lock. After the wait runs outside the lock; timeout logs a warning and leaves queued work eligible to run. Actual startup or wait failures still trigger rollback and are reported to the coordinator.

Validation

  • Spotless formatting passed.
  • The initial focused Pipe unit tests passed (59 tests); the latest clean focused ConfigNode/DataNode run passed 15 tests with 0 failures or errors.
  • Full-reactor English and Chinese test-compile -DskipTests passed before the authentication follow-up.
  • The previous Unit-Test run exposed two existing alias fixtures that now correctly violate duplicate-key rejection; those fixtures were adjusted and their test class passes in the latest local run. The updated Unit-Test workflow run 47153148235 completed successfully with all four jobs passing.

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

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