Skip to content

fix(amber): drain loop side branches before advancing - #9737

Open
aglinxinyuan wants to merge 1 commit into
apache:mainfrom
aglinxinyuan:fix/loop-side-sink-barrier
Open

aglinxinyuan wants to merge 1 commit into
apache:mainfrom
aglinxinyuan:fix/loop-side-sink-barrier

Conversation

@aglinxinyuan

@aglinxinyuan aglinxinyuan commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Loop End rewinds the materialized schedule as soon as it requests another iteration. A side sink later in the schedule can miss that iteration. On exit, a downstream consumer can open before the final side write.

Record the repeat request and apply it after the last batch in the loop body finishes. Schedule Loop End’s consumers after the side branches and replay only the regions in the loop. An inner loop finishes its pending repeats before an enclosing loop restarts.

Any related issues, documentation, discussions?

Closes #9736.

How was this PR tested?

sbt "WorkflowExecutionService/testOnly *JumpToOperatorRegionHandlerSpec *ScheduleSpec *WorkflowExecutionManagerSpec *CostBasedScheduleGeneratorSpec *RegionPlanSpec" "WorkflowOperator/testOnly *LoopStartOpDescSpec *LoopEndOpDescSpec"

The 78 focused tests passed. The native loop suite also passed all 10 tests with AMBER_TEST_FILTER=integration-only sbt "WorkflowExecutionService/testOnly *LoopIntegrationSpec -- -z exactly".

The regression failed on main with one side-sink dispatch across two iterations. With Python workers and Iceberg, the same two-iteration workflow passed at concurrency limits of 1 and 4. In both runs, the side sink wrote turn 1 before the next Loop Start and turn 2 before the downstream consumer opened. The consumer returned both rows.

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

Generated-by: OpenAI Codex (GPT-6)

Copilot AI balanced review requested due to automatic review settings November 28, 2026 12:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@Yicong-Huang Yicong-Huang added release/v1.3 back porting to release/v1.3 release/v1.2 back porting to release/v1.2 labels Nov 28, 2026
@github-actions
github-actions Bot requested review from mengw15 and xuang7 November 28, 2026 12:12
@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Backport auto-label report

This fix: PR was checked against each actively-supported release branch. A release/* label nominates a backport target; the branch's release manager approving this PR is what sends the fix there. The required Backport Approvals check stays red until every label below is approved, so each manager either approves or removes their own label — which is why the labels left on a merged PR are exactly the branches it reached.

Release branch Analysis
✅ release/v1.3 Already labeled — this fix is queued to backport here. @mengw15 decides: approving sends the fix here, removing this label declines it. The merge waits on one or the other.
✅ release/v1.2 Already labeled — this fix is queued to backport here. @xuang7 decides: approving sends the fix here, removing this label declines it. The merge waits on one or the other.

Auto-label run.

@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: @Yicong-Huang, @VuMartin, @aicam
    You can notify them by mentioning @Yicong-Huang, @VuMartin, @aicam in a comment.

@codecov-commenter

codecov-commenter commented Nov 28, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.56250% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.75%. Comparing base (e8c37e6) to head (26827f2).

Files with missing lines Patch % Lines
...mber/engine/architecture/scheduling/Schedule.scala 67.56% 4 Missing and 8 partials ⚠️
...er/engine/architecture/scheduling/RegionPlan.scala 85.00% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9737      +/-   ##
============================================
- Coverage     91.77%   91.75%   -0.02%     
- Complexity     5136     5161      +25     
============================================
  Files          1308     1308              
  Lines         58013    58061      +48     
  Branches       7552     7562      +10     
============================================
+ Hits          53240    53273      +33     
- Misses         2887     2893       +6     
- Partials       1886     1895       +9     
Flag Coverage Δ *Carryforward flag
access-control-service 77.44% <ø> (ø)
agent-service 99.56% <ø> (ø) Carriedforward from e8c37e6
amber 85.91% <76.56%> (-0.04%) ⬇️
computing-unit-managing-service 63.81% <ø> (ø)
config-service 87.50% <ø> (ø)
file-service 82.16% <ø> (ø)
frontend 96.45% <ø> (ø) Carriedforward from e8c37e6
notebook-migration-service 83.84% <ø> (ø)
pyamber 98.70% <ø> (ø) Carriedforward from e8c37e6
result-service 86.48% <ø> (ø)
workflow-compiling-service 80.90% <ø> (ø)

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Benchmark changes need a look

🟢 5 better · 🔴 5 worse · ⚪ 5 noise (<±5%) · 0 without baseline

Compared against main e8c37e6 benchmarked on this same runner, so the delta is largely free of cross-runner hardware noise. The "7d avg" column still reflects the gh-pages dashboard. Treat <±5% as noise unless repeated.

Dashboard · Run

config throughput MB/s latency max Δ latest / 7d
🔴 bs=10 sw=10 sl=64 549 0.335 17,846/29,590/29,590 us 🔴 +18.4% / 🔴 +118.1%
🟢 bs=100 sw=10 sl=64 1,237 0.755 81,635/101,329/101,329 us 🟢 -5.5% / 🔴 +10.9%
🟢 bs=1000 sw=10 sl=64 1,375 0.839 702,205/975,720/975,720 us 🟢 -8.1% / 🟢 -14.3%
Baseline details

Latest main e8c37e6 from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 549 tuples/sec 629 tuples/sec 951.49 tuples/sec -12.7% -42.3%
bs=10 sw=10 sl=64 MB/s 0.335 MB/s 0.384 MB/s 0.581 MB/s -12.8% -42.3%
bs=10 sw=10 sl=64 p50 17,846 us 15,075 us 10,659 us +18.4% +67.4%
bs=10 sw=10 sl=64 p95 29,590 us 25,849 us 13,570 us +14.5% +118.1%
bs=10 sw=10 sl=64 p99 29,590 us 25,849 us 16,744 us +14.5% +76.7%
bs=100 sw=10 sl=64 throughput 1,237 tuples/sec 1,200 tuples/sec 1,256 tuples/sec +3.1% -1.5%
bs=100 sw=10 sl=64 MB/s 0.755 MB/s 0.733 MB/s 0.767 MB/s +3.0% -1.5%
bs=100 sw=10 sl=64 p50 81,635 us 83,884 us 84,170 us -2.7% -3.0%
bs=100 sw=10 sl=64 p95 101,329 us 107,277 us 91,401 us -5.5% +10.9%
bs=100 sw=10 sl=64 p99 101,329 us 107,277 us 104,021 us -5.5% -2.6%
bs=1000 sw=10 sl=64 throughput 1,375 tuples/sec 1,281 tuples/sec 1,299 tuples/sec +7.3% +5.8%
bs=1000 sw=10 sl=64 MB/s 0.839 MB/s 0.782 MB/s 0.793 MB/s +7.3% +5.8%
bs=1000 sw=10 sl=64 p50 702,205 us 764,006 us 819,011 us -8.1% -14.3%
bs=1000 sw=10 sl=64 p95 975,720 us 1,007,392 us 859,723 us -3.1% +13.5%
bs=1000 sw=10 sl=64 p99 975,720 us 1,007,392 us 909,957 us -3.1% +7.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,364.28,200,128000,549,0.335,17846.11,29590.37,29590.37
1,100,10,64,20,1616.40,2000,1280000,1237,0.755,81635.28,101329.11,101329.11
2,1000,10,64,20,14548.57,20000,12800000,1375,0.839,702204.83,975719.52,975719.52

This branch has not been deployed

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

Labels

common engine fix release/v1.2 back porting to release/v1.2 release/v1.3 back porting to release/v1.3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Loop iteration can finish before its side sinks run

4 participants