Skip to content

test(amber, 1.1): drop stale Thread.sleep(1000) after COMPLETED state#4874

Merged
Yicong-Huang merged 1 commit into
apache:release/v1.1.0-incubatingfrom
Yicong-Huang:backport/4680-release-v1.1
May 3, 2026
Merged

test(amber, 1.1): drop stale Thread.sleep(1000) after COMPLETED state#4874
Yicong-Huang merged 1 commit into
apache:release/v1.1.0-incubatingfrom
Yicong-Huang:backport/4680-release-v1.1

Conversation

@Yicong-Huang
Copy link
Copy Markdown
Contributor

@Yicong-Huang Yicong-Huang commented May 3, 2026

What changes were proposed in this PR?

Backport #4680 (commit 598ed0f7f037b96ebe5549759158e46ba736b372 on main) onto release/v1.1.0-incubating.

Removes the dead Thread.sleep(1000) + TODO inside the result-reading block in ReconfigurationSpec.scala and DataProcessingSpec.scala, matching what already landed on main.

Any related issues, documentation, discussions?

Backports #4680. Unblocks the backport leg of #4871.

How was this PR tested?

Cherry-pick of an already-reviewed and merged commit; applies cleanly. CI on this PR exercises the change against the release branch's full Python matrix.

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

Generated-by: Claude Code (claude-opus-4-7)

…che#4680)

### What changes were proposed in this PR?

Remove the `Thread.sleep(1000)` workaround inside the result-reading
block of `DataProcessingSpec` and `ReconfigurationSpec`. The sleep was
annotated with a TODO calling it a workaround for "the issue of
reporting `completed` status too early" — the current engine path is
synchronous end-to-end, so the workaround is dead code.

```diff
             .map(terminalOpId => {
-              //TODO: remove the delay after fixing the issue of reporting "completed" status too early.
-              Thread.sleep(1000)
               val uri = getResultUriByLogicalPortId(...)
               ...
             })
```

The synchronous path that emits `COMPLETED`:

1. `DataProcessor.outputOneTuple` handles `FinalizePort` →
`outputManager.closeOutputStorageWriterIfNeeded(portId)`
2. `closeOutputStorageWriterIfNeeded` puts a terminate signal on the
writer thread's queue and `join()`s it
3. The writer thread, on terminate, calls `IcebergTableWriter.close()` →
`flushBuffer()` → `table.newAppend().appendFile(dataFile).commit()`
4. Only then does `DataProcessor` fire `portCompleted` to the controller
5. After all ports complete, controller emits
`ExecutionStateUpdate(COMPLETED)` to the client
6. Read side does `IcebergDocument.get()` → `seekToUsableFile()` →
`table.refresh()` before scan

### Any related issues, documentation, discussions?

Closes apache#4679.

### How was this PR tested?

Ran the two specs together with `-T 1` (sequential) on a clean local
checkout, 5 consecutive runs:

```
sbt 'WorkflowExecutionService / Test / testOnly \
  org.apache.texera.amber.engine.e2e.DataProcessingSpec \
  org.apache.texera.amber.engine.e2e.ReconfigurationSpec'

run 1: 21/21 passed in 39.2 s
run 2: 21/21 passed in 39.5 s
run 3: 21/21 passed in 43.2 s
run 4: 21/21 passed in 37.3 s
run 5: 21/21 passed in 36.9 s
```

Compared to the same two specs with the sleep on the same machine:

| spec | before | after | delta |
|---|---|---|---|
| DataProcessingSpec  | 36.5 s | 16.9 s | -19.6 s |
| ReconfigurationSpec | 27.2 s | 18.7 s | -8.5 s  |

DataProcessingSpec saves more than 16 × 1 s because the sleep was inside
a per-terminal-port `.map(...)` block — workflows with multiple terminal
ports paid the cost more than once per test.

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

Generated-by: Claude Code (Opus 4.7, 1M context)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the engine label May 3, 2026
@Yicong-Huang Yicong-Huang changed the title test(amber): drop stale Thread.sleep(1000) after COMPLETED state (backport #4680 to release/v1.1.0-incubating) test(amber, 1.1): drop stale Thread.sleep(1000) after COMPLETED state (backport #4680 to release/v1.1.0-incubating) May 3, 2026
@Yicong-Huang Yicong-Huang requested a review from bobbai00 May 3, 2026 21:05
@Yicong-Huang Yicong-Huang changed the title test(amber, 1.1): drop stale Thread.sleep(1000) after COMPLETED state (backport #4680 to release/v1.1.0-incubating) test(amber, 1.1): drop stale Thread.sleep(1000) after COMPLETED state May 3, 2026
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 41.51%. Comparing base (408ebb5) to head (2b9f95d).
⚠️ Report is 1 commits behind head on release/v1.1.0-incubating.

Additional details and impacted files
@@                     Coverage Diff                      @@
##             release/v1.1.0-incubating    #4874   +/-   ##
============================================================
  Coverage                        41.50%   41.51%           
- Complexity                        1985     1987    +2     
============================================================
  Files                              952      952           
  Lines                            33796    33796           
  Branches                          3713     3713           
============================================================
+ Hits                             14028    14029    +1     
  Misses                           19002    19002           
+ Partials                           766      765    -1     
Flag Coverage Δ
amber 39.90% <ø> (+<0.01%) ⬆️
python 79.60% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Yicong-Huang Yicong-Huang merged commit 4867fc0 into apache:release/v1.1.0-incubating May 3, 2026
20 checks passed
@Yicong-Huang Yicong-Huang deleted the backport/4680-release-v1.1 branch May 3, 2026 21:12
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.

3 participants