justinsiek opened a new pull request, #5678:
URL: https://github.com/apache/texera/pull/5678
### What changes were proposed in this PR?
`AutoClosingIterator.hasNext` only set `alreadyClosed = true` after calling
`onClose()`, and so if `onClose()` throws, `alreadyClosed` would stay false,
and so a subsequent `hasNext` would reinvoke `onClose()`, running cleanup a
second time on a resource whose close already failed.
The change makes `alreadyClosed = true` run before `onClose()`.
### Any related issues, documentation, discussions?
Closes #5660
### How was this PR tested?
Updated AutoClosingIteratorSpec — replaced the existing characterization
test ("re-invoke onClose on a retry when the previous onClose threw") with a
positive assertion that a second hasNext after a throwing close does NOT
re-invoke onClose (closeCount stays at 1) and returns false.
`sbt "WorkflowOperator/testOnly
org.apache.texera.amber.operator.source.scan.AutoClosingIteratorSpec"`
- 10/10 pass. `sbt scalafmtCheckAll` passes.
### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 4.8)
--
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]