Repository navigation
Commit b47c144
[SPARK-44462][SS][CONNECT][FOLLOWUP] Assert foreachBatch close() unregisters the cloned session
### What changes were proposed in this pull request?
Followup to #55410. The two `ForeachBatchSessionManager` cleanup tests in `StreamingForeachBatchHelperSuite` checked that `close()` is terminal and that the registered cleaner runs, but neither asserted the side effect `close()` exists to guarantee: that the cloned `SessionHolder` is removed from `SparkConnectService.sessionManager`. Because `close()` sets its `closed` flag independently of the `closeSession` call, a future change that dropped or broke the unregister step would still pass both tests while re-introducing the never-expiring-holder leak. This adds assertions that the cloned `SessionKey` is present in the session manager before `close()` and absent after.
### Why are the changes needed?
To make the cloned-session leak-prevention contract regression-sensitive. Spotted in review of #59200, the branch-4.3 backport.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Pass GitHub Actions.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code
Closes #59202 from LuciferYang/SPARK-44462-assert-cloned-session-unregister.
Lead-authored-by: YangJie <yangjie01@baidu.com>
Co-authored-by: reviewer <reviewer@local>
Signed-off-by: yangjie01 <yangjie01@baidu.com>
(cherry picked from commit 38422ae)
Signed-off-by: yangjie01 <yangjie01@baidu.com>1 parent 9cadc90 commit b47c144
1 file changed
Lines changed: 7 additions & 1 deletion
File tree
- sql/connect/server/src/test/scala/org/apache/spark/sql/connect/planner
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
131 | 135 | | |
132 | 136 | | |
| 137 | + | |
| 138 | + | |
133 | 139 | | |
134 | 140 | | |
135 | 141 | | |
| |||
0 commit comments