damccorm opened a new pull request, #41798:
URL: https://github.com/apache/beam/pull/41798
Note: this PR was auto-generated by tooling. Before moving it out of draft,
the author has done a full review of the PR, specifically evaluating it on the
following criteria:
- The PR is an appropriate fix for the issue (e.g. we're not changing a test
to avoid a bug)
- The PR is a simple fix to the issue (e.g. we're not adding infra when we
could just modify a test)
- The PR is not covering for other problems (e.g. if we're bumping timeouts,
it is not because we're covering for a performance problem)
Full details of the methodology of generation and review can be found here -
https://docs.google.com/document/d/14lj7ECVov4T4EdwmIzNlWrRGE3lLDMOwX5xUMGzaLoc/edit?usp=sharing
If you have concerns with the PR or with the underlying methodology used to
generate this, please comment below - they will be addressed by the author not
the tooling :)
## Summary
Computes `startTime` inside the pipeline immediately before
`PeriodicSequence.create()` and increases `interval` from `250ms` to `500ms` in
`PeriodicSequenceTest.testOutputsProperElements` so pipeline startup latency
under heavy CI load cannot make the entire sequence overdue before
`PeriodicSequence` runs.
## Root Cause
`PeriodicSequenceTest.testOutputsProperElements` computed `startTime =
Instant.now().plus(Duration.standardSeconds(2))` and `stopTime =
startTime.plus(Duration.millis(750))` **before** `p.run()`. Under heavy
`beam_PreCommit_Java` CPU contention, pipeline construction and `DirectRunner`
initialization can exceed `2.75s`, so by the time
`PeriodicSequenceFn.processElement` executes, `Instant.now()` is already past
`stopTime`. Because `SequenceDefinition(startTime, stopTime, interval)`
defaults to `catchUpToNow = true`, `PeriodicSequenceFn` emits all 4 overdue
elements immediately in a single `processElement` loop, collapsing `maxTs -
minTs` in `ExtractTsDoFn` below `interval / 2`:
- [46461098665](https://github.com/apache/beam/actions/runs/46461098665)
(attempt 1, job `141997222584`, `2026-11-30T17:22:09Z`): `PeriodicSequenceTest
> testOutputsProperElements FAILED` — `java.lang.AssertionError: Expected
processing-time diff at least 125, got 12`
## Fix
- Generate `SequenceDefinition` inside a `MapElements` stage immediately
upstream of `PeriodicSequence.create()` with `startTime =
Instant.now().plus(Duration.standardSeconds(1))` so runner startup lag is
excluded from the timing window.
- Increase `interval` from `250ms` to `500ms` (`duration = 1500ms`,
`expectedDiff = 250ms`) so brief scheduling pauses between `PeriodicSequence`,
`GroupByKey`, and `ExtractTsDoFn` do not collapse all 4 windows into a single
burst, while keeping normal test duration slightly shorter (~2.5s vs ~2.75s).
- Preserve all correctness assertions inside `PAssert`: verify 4 elements
are emitted, the first element is at or after `testStartTime`, both element
values and event timestamps equal `[first, first + interval, first +
2*interval, first + 3*interval]`, and processing-time spread exceeds `interval
/ 2`.
Test-only change; no production code is modified.
### Verification
- Triggered `beam_PreCommit_Java.yml` workflow run on branch:
[`46492567388`](https://github.com/apache/beam/actions/runs/46492567388)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]