Repository navigation
feat(amber): record each result port's output mode and row count - #9049
Conversation
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
3 open issues
What changed in this PR
Adds persistence of result-port metadata (declared output mode and row count) into operator_port_executions so completed workflow results can be listed without consulting the computing unit’s physical plan.
Changes:
- Introduces
output_mode_enum, plusoutput_modeandresult_countcolumns foroperator_port_executions(DDL + Liquibase update). - Extends
OperatorPortResultUriAvailableto carryOutputModeand persists it when storing result URIs. - Records table-result row counts into
RESULT_COUNTand adds/updates unit tests around mode/count behavior.
| File | Description |
|---|---|
| sql/updates/52.sql | Adds idempotent migration for enum + new columns |
| sql/texera_ddl.sql | Updates baseline schema with new enum + columns |
| sql/changelog.xml | Registers Liquibase changeSet for update 52 |
| amber/src/main/scala/org/apache/texera/web/service/ExecutionResultService.scala | Persists output mode; writes result_count via resource update |
| amber/src/main/scala/org/apache/texera/web/resource/dashboard/user/workflow/WorkflowExecutionsResource.scala | Adds updateResultCount DB update helper |
| amber/src/main/scala/org/apache/texera/amber/engine/architecture/scheduling/RegionExecutionManager.scala | Includes output mode in result-URI event |
| amber/src/main/scala/org/apache/texera/amber/engine/architecture/coordinator/ClientEvent.scala | Extends event payload to include output mode |
| amber/src/test/scala/org/apache/texera/web/service/ExecutionResultServiceSpec.scala | Adds coverage for output mode mapping and result_count persistence rules |
| amber/src/test/scala/org/apache/texera/web/resource/dashboard/user/workflow/WorkflowExecutionsResourceSpec.scala | Adds test for updateResultCount behavior |
Review effort: Lite
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
2 open issues
3 resolved since last review
Review effort: Lite
Automated Reviewer SuggestionsBased on the
|
6305d59 to
9e316d6
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9049 +/- ##
============================================
- Coverage 92.20% 91.86% -0.35%
- Complexity 4977 5021 +44
============================================
Files 1275 1275
Lines 55568 55957 +389
Branches 7163 7280 +117
============================================
+ Hits 51237 51404 +167
- Misses 2555 2731 +176
- Partials 1776 1822 +46
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
| config | throughput | MB/s | latency | max Δ latest / 7d | |
|---|---|---|---|---|---|
| 🔴 | bs=10 sw=10 sl=64 | 411 | 0.251 | 24,349/30,004/30,004 us | 🔴 +27.9% / 🔴 +132.8% |
| 🔴 | bs=100 sw=10 sl=64 | 831 | 0.508 | 117,348/160,308/160,308 us | 🔴 +14.7% / 🔴 +80.2% |
| ⚪ | bs=1000 sw=10 sl=64 | 976 | 0.596 | 1,023,255/1,069,411/1,069,411 us | ⚪ within ±5% / 🔴 +25.5% |
Baseline details
Latest main e70d67e from same runner
| config | metric | PR | latest main | 7d avg | Δ latest | Δ 7d |
|---|---|---|---|---|---|---|
| bs=10 sw=10 sl=64 | throughput | 411 tuples/sec | 483 tuples/sec | 953.99 tuples/sec | -14.9% | -56.9% |
| bs=10 sw=10 sl=64 | MB/s | 0.251 MB/s | 0.295 MB/s | 0.582 MB/s | -14.9% | -56.9% |
| bs=10 sw=10 sl=64 | p50 | 24,349 us | 19,031 us | 10,584 us | +27.9% | +130.0% |
| bs=10 sw=10 sl=64 | p95 | 30,004 us | 27,470 us | 12,888 us | +9.2% | +132.8% |
| bs=10 sw=10 sl=64 | p99 | 30,004 us | 27,470 us | 16,266 us | +9.2% | +84.5% |
| bs=100 sw=10 sl=64 | throughput | 831 tuples/sec | 875 tuples/sec | 1,242 tuples/sec | -5.0% | -33.1% |
| bs=100 sw=10 sl=64 | MB/s | 0.508 MB/s | 0.534 MB/s | 0.758 MB/s | -4.9% | -33.0% |
| bs=100 sw=10 sl=64 | p50 | 117,348 us | 111,826 us | 83,370 us | +4.9% | +40.8% |
| bs=100 sw=10 sl=64 | p95 | 160,308 us | 139,762 us | 88,966 us | +14.7% | +80.2% |
| bs=100 sw=10 sl=64 | p99 | 160,308 us | 139,762 us | 101,186 us | +14.7% | +58.4% |
| bs=1000 sw=10 sl=64 | throughput | 976 tuples/sec | 989 tuples/sec | 1,276 tuples/sec | -1.3% | -23.5% |
| bs=1000 sw=10 sl=64 | MB/s | 0.596 MB/s | 0.604 MB/s | 0.779 MB/s | -1.3% | -23.5% |
| bs=1000 sw=10 sl=64 | p50 | 1,023,255 us | 1,009,056 us | 815,662 us | +1.4% | +25.5% |
| bs=1000 sw=10 sl=64 | p95 | 1,069,411 us | 1,064,927 us | 864,800 us | +0.4% | +23.7% |
| bs=1000 sw=10 sl=64 | p99 | 1,069,411 us | 1,064,927 us | 896,884 us | +0.4% | +19.2% |
Raw CSV
config_idx,batch_size,schema_width,string_len,num_batches,total_ms,total_tuples,total_bytes,tuples_per_sec,mb_per_sec,lat_p50_us,lat_p95_us,lat_p99_us
0,10,10,64,20,486.55,200,128000,411,0.251,24349.40,30003.97,30003.97
1,100,10,64,20,2405.30,2000,1280000,831,0.508,117348.27,160307.90,160307.90
2,1000,10,64,20,20490.25,20000,12800000,976,0.596,1023254.57,1069410.67,1069410.67operator_port_executions gains output_mode and result_count, so a finished execution's results can be listed without the computing unit: the mode lives only in the engine's physical plan, and the count otherwise needs each table opened. OperatorPortResultUriAvailable carries the port's declared mode, and the count is written where result_size already is, from the result store's own count. Closes apache#8994
- Schema-qualify the type and table in 52.sql: the liquibase runner strips `SET search_path` before applying update scripts. - Return Option from toOutputModeEnum instead of null. - Reword updateResultCount's Scaladoc to name the table it writes.
Merge updateResultSize and updateResultCount into updateResultSizeAndCount: both columns of the same row were written on every result-update tick.
9e316d6 to
af143f8
Compare
bobbai00
left a comment
There was a problem hiding this comment.
🔴 1 must-fix · 1 advisory · 0 polish: the mode is recorded reliably at insert, but the count is only written while a browser session watches the run.
Design & architecture (1)
sql/texera_ddl.sql:105:output_mode_enummirrors the protoOutputModewith no pointer either way (advisory, see inline)
Correctness (1)
ExecutionResultService.scala:459:result_countis written only while a websocket session is subscribed (must-fix, see inline)
Verification trace
Traced when the count write runs at af143f8. updateResultSizeAndCount is reached only from the result store's diff handler, which StateStore calls from the map stage behind getWebsocketEventObservable. Its only production subscriber is WorkflowService.connect, one per websocket session; the poll, the terminal-state callback and SyncExecutionResource never subscribe. Reproduced the operator chain on rxjava 3.1.12, the version amber pins: no subscriber gave 0 handler runs over three state changes, changes after the only subscriber disposed were never processed, and two subscribers ran it twice per change. Leaving the workspace closes the socket while WorkflowLifecycleManager keeps a RUNNING execution alive, and the state is cleaned up 30 s after the run ends.
# Conflicts: # amber/src/test/scala/org/apache/texera/web/resource/dashboard/user/workflow/WorkflowExecutionsResourceSpec.scala
The result store's diff handler runs once per websocket subscriber and not at all without one, so a run that ended after its tab closed kept a stale or empty count. Write size and count from onResultUpdate instead, which runs on every poll and once more when the run ends. Cross-reference OutputMode and output_mode_enum, and store no mode rather than fail the insert for a mode toOutputModeEnum does not know.
bobbai00
left a comment
There was a problem hiding this comment.
LGTM. left some NIT comments
A declared port cannot be Unrecognized, so the Option only covered a case that does not occur. Throw on it, as convertWebResultUpdate does, and walk OutputMode.values in the test so a mode missing from the match fails there.



What changes were proposed in this PR?
Records two facts per result port in
operator_port_executions, so a finished execution's results can be listed without the computing unit (#5363):output_mode(newoutput_mode_enum): whether the port's result is a paginated table or a visualization. Today only the engine's physical plan knows this, and it lives in the CU. The engine already looks up the output port when it creates the port's storage, soOperatorPortResultUriAvailablenow carries the port's declared mode, and the row is inserted with it.result_count: the number of rows, written withresult_sizein one update each time the results are polled and once more when the run ends, so it does not depend on an open browser tab. Visualization (SINGLE_SNAPSHOT) ports keep a null count; they are never paged. Likeresult_size, it is recorded only for an operator's first result port for now, so the other ports of an operator such asSplitkeep a null count.result_sizemoves with it: it was written from the websocket diff handler, which runs once per connected browser and not at all without one.Schema change:
sql/updates/52.sql(idempotent),texera_ddl.sql, and achangelog.xmlentry. Existing rows keep both columns null. Nothing reads the columns yet; that is #8995.Any related issues, documentation, discussions?
Closes #8994. Part of #5363, proposed in #8945.
How was this PR tested?
ExecutionResultServiceSpec: the mode carried by the event is persisted; every output mode maps to the stored value of its name and an unrecognized one is rejected; a run that ends with no browser connected records its table port's size and count (this fails on the previous code), and aSINGLE_SNAPSHOTport records no count.WorkflowExecutionsResourceSpec:updateResultSizeAndCountsets both columns on the matching row.52.sqltwice to a local database (the second run is a no-op), and ran the fulltexera_ddl.sqlinto a scratch database.Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (claude-opus-5-5)