Skip to content

fix(amber, v1.2): persist operator port result URIs through a ClientEvent - #7102

Closed
Yicong-Huang wants to merge 1 commit into
apache:release/v1.2from
Yicong-Huang:backport/5434-persist-operator-port-result-uris-throug-v1.2
Closed

fix(amber, v1.2): persist operator port result URIs through a ClientEvent#7102
Yicong-Huang wants to merge 1 commit into
apache:release/v1.2from
Yicong-Huang:backport/5434-persist-operator-port-result-uris-throug-v1.2

Conversation

@Yicong-Huang

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Backport of #5434 to release/v1.2, cherry-picked from e42f6b3.

Follows the Direct Backport Push convention; opened as a PR (rather than a direct push) as part of a backport-coverage audit for fixes merged to main since early June that were never labeled for backport.

Any related issues, documentation, discussions?

Backport of #5434. Originally linked #5430.

How was this PR tested?

Release-branch CI runs once the conflicts are resolved and this PR is marked ready for review. The cherry-pick conflicted and was committed with conflict markers.

Was this PR authored or co-authored using generative AI tooling?

Yes — backport prepared with Claude Code (mechanical cherry-pick; conflicts left as markers for the original author to resolve; the change itself is #5434 by its original author).

…pache#5434)

### What changes were proposed in this PR?

`WorkflowExecutionsResource.insertOperatorPortResultUri` was a static
method on a JAX-RS resource that the engine (`RegionExecutionManager`,
named `RegionExecutionCoordinator` before apache#6123) called directly to
write `operator_port_executions` rows — two layering problems in one
helper: a JAX-RS resource that wasn't an HTTP endpoint, and an engine
actor reaching across into the web layer to write the DB.

The fix follows the codebase's existing engine→web channel. Engine
actors call `asyncRPCClient.sendToClient(event: ClientEvent)`; web
services call `client.registerCallback[T](handler)` to react.
`RuntimeStatisticsPersist` is the closest precedent — engine emits,
`ExecutionStatsService` writes the DB.

Concretely:

- Add `OperatorPortResultUriAvailable(globalPortId, uri)` to
`ClientEvent`. The event is execution-scoped, so it carries no `eid` —
the subscriber already holds its own `executionId`, which also removes
the old `decodeURI(resultURI)` round-trip in `RegionExecutionManager`.
- `RegionExecutionManager` emits this event in place of calling the web
helper.
- `ExecutionResultService.attachToExecution` registers a callback that
inserts the row via the generated `OperatorPortExecutionsDao` (extracted
as `ExecutionResultService.persistOperatorPortResultUri` so tests can
drive the same insert). The registration site carries a comment
documenting the ordering invariant: the callback must be attached before
`startWorkflow`, otherwise result URIs are silently never persisted.
- Delete `WorkflowExecutionsResource.insertOperatorPortResultUri`. The
engine no longer imports `WorkflowExecutionsResource`; the resource spec
inserts its fixture rows through `OperatorPortExecutionsDao` directly.
- E2E specs (`DataProcessingSpec`, reconfiguration specs) register the
same production callback body via
`TestUtils.registerResultUriPersistence` and read results back through
`getResultUriByLogicalPortId`, so the event→DB-insert seam stays covered
end to end.

### Any related issues, documentation, discussions?

Closes apache#5430. Sub-issue of apache#5424 — eliminates one of the four engine→web
import leaks blocking the amber Dropwizard upgrade tracked in apache#5423.

### How was this PR tested?

`sbt 'WorkflowExecutionService/testOnly *ExecutionResultServiceSpec
*WorkflowExecutionsResourceSpec *DataProcessingSpec
*ReconfigurationSpec'` — 58 tests pass across the 4 affected suites.
`sbt scalafmtCheckAll` clean.

### Was this PR authored or co-authored using generative AI tooling?

(backported from commit e42f6b3)

Generated-by: Claude Code (Opus 4.7)
@Yicong-Huang Yicong-Huang self-assigned this Jul 30, 2026
@Yicong-Huang
Yicong-Huang requested a review from xuang7 July 30, 2026 03:49
@Yicong-Huang

Copy link
Copy Markdown
Contributor Author

The cherry-pick conflicted and was committed with conflict markers. Resolve the conflicts on this branch, then mark this PR ready for review.

Conflicting files:

  • amber/src/main/scala/org/apache/texera/web/service/ExecutionResultService.scala
  • amber/src/test/scala/org/apache/texera/amber/engine/e2e/TestUtils.scala
  • amber/src/test/scala/org/apache/texera/web/service/ExecutionResultServiceSpec.scala

@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @kunwp1, @Ma77Ball, @seongjinyoon
    You can notify them by mentioning @kunwp1, @Ma77Ball, @seongjinyoon in a comment.

@codecov-commenter

Copy link
Copy Markdown

⚠️ JUnit XML file not found

The CLI was unable to find any JUnit XML files to upload.
For more help, visit our troubleshooting guide.

@Yicong-Huang

Copy link
Copy Markdown
Contributor Author

this is more of a refactoring, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants