malo-denielou opened a new pull request, #40880:
URL: https://github.com/apache/beam/pull/40880
When runners require deterministic pipeline graphs across restarts (such as
for pipeline graph equality checks on controller failover), two map-iteration
paths in the Go SDK can produce non-deterministic ordering:
1. In `pipelinex.computeRoots`, root transform IDs are collected by ranging
over `xforms` (`map[string]*pipepb.PTransform`) and passed directly to
`TopologicalSort(xforms, roots)`. While `TopologicalSort` already sorts its
internal frontier (`ret.next`) and output keys for determinism, the initial
`roots` slice was left in random map iteration order. Sorting `roots` with
`sort.Sort(idSorted(roots))` makes the root topological order deterministic.
2. In `xlangx.HandlerParams.Inputs()` and `Outputs()`, `PCol` entries are
collected by ranging over `InputsMap` and `OutputsMap` (`map[string]int`) in
random order, which can cause expansion handlers to register cross-language
inputs or outputs in varying orders across runs. Sorting the returned slice by
`PCol.Index` (with `PCol.Local` as a tie-breaker) ensures a consistent order
while still supporting sparse index maps (such as when `xlang.SetOutputCoder`
rewrites `OutputsMap` to a single entry at an index greater than 0).
------------------------
Thank you for your contribution! Follow this checklist to help us
incorporate your contribution quickly and easily:
- [x] Mention the appropriate issue in your description (for example:
`addresses %23123`), if applicable. This will automatically add a link to the
pull request in the issue. If you would like the issue to automatically close
on merging the pull request, comment `fixes %23<ISSUE NUMBER>` instead.
- [ ] Update `CHANGES.md` with noteworthy changes.
- [ ] If this contribution is large, please file an Apache [Individual
Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
See the [Contributor Guide](https://beam.apache.org/contribute) for more
tips on [how to make review process
smoother](https://github.com/apache/beam/blob/master/CONTRIBUTING.md%23make-the-reviewers-job-easier).
To check the build health, please visit
[https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md](https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md)
GitHub Actions Tests Status (on master)
------------------------------------------------------------------------------------------------
[![Build python source distribution and
wheels](https://github.com/apache/beam/actions/workflows/build_wheels.yml/badge.svg%3Fevent=schedule
--
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]