Skip to content

[SPARK-58097][CONNECT] Preserve composite (userId, sessionId) session identity in Connect UI/status store#57219

Open
venkata91 wants to merge 1 commit into
apache:masterfrom
venkata91:SPARK-58097-session-identity
Open

[SPARK-58097][CONNECT] Preserve composite (userId, sessionId) session identity in Connect UI/status store#57219
venkata91 wants to merge 1 commit into
apache:masterfrom
venkata91:SPARK-58097-session-identity

Conversation

@venkata91

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Spark Connect identifies a session by (userId, sessionId), and two users may share the same session UUID. The Connect UI listener/store keyed sessions by sessionId alone, so such sessions collapsed into one record (merged execution counts; one user's close finished/removed the other's row). History Server replay reproduced the same.

This keys SessionInfo's KVStore natural key and the listener's live-session map by a synthesized composite uniqueId = userId/sessionId. The UI session page and its links now pass userId alongside the session id.

Why are the changes needed?

Two users sharing a session UUID are distinct sessions in Spark Connect (see SparkConnectServiceE2ESuite), but the UI/status store merged them, showing incorrect counts and lifecycle state. Surfaced during review of SPARK-57941.

Does this PR introduce any user-facing change?

The Connect session detail page now requires a userId request parameter in addition to id. Existing History Server disk stores written with the old sessionId-only key won't be found by the new lookup (detail page shows no info until regenerated); no store version bump.

How was this patch tested?

Added same-UUID/different-user coverage (live + History Server replay) in SparkConnectServerListenerSuite; updated SparkConnectServerPageSuite. connect/testOnly org.apache.spark.sql.connect.ui.* passes (11 tests).

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

Generated-by: Claude Code (Claude Opus 4.8)

@venkata91 venkata91 force-pushed the SPARK-58097-session-identity branch from 1c8b97e to 2aefcd4 Compare July 13, 2026 05:56
… identity in Connect UI/status store

### What changes were proposed in this pull request?

Spark Connect identifies a session by the composite `(userId, sessionId)` and two
different users may legally share the same session UUID. The Connect UI status
listener and store, however, keyed sessions by `sessionId` alone, so such
sessions collapsed into a single record: their execution counts merged and
whichever user closed first finished/removed the shared row while the other
session was still valid. History Server replay reproduced the same result.

This keys `SessionInfo` (its KVStore natural key) and the listener's live-session
tracking by the composite `(userId, sessionId)`, via a synthesized `uniqueId`.
The UI session page and its links now carry `userId` in addition to the session
id so a single session can be looked up unambiguously.

### Why are the changes needed?

Two users sharing a session UUID are distinct sessions in Spark Connect (see
`SparkConnectServiceE2ESuite`), but the UI/status store merged them, showing
incorrect execution counts and lifecycle state. Surfaced during review of
SPARK-57941.

### Does this PR introduce _any_ user-facing change?

The Connect session detail UI page now requires a `userId` request parameter in
addition to `id`; the links that reach it are updated accordingly. Existing
History Server disk stores written with the old `sessionId`-only key are not
found by the new composite lookup (the detail page shows no info until the store
is regenerated); no store version bump is done.

### How was this patch tested?

Added same-UUID/different-user coverage (live and History Server replay) in
`SparkConnectServerListenerSuite`, updated `SparkConnectServerPageSuite` for the
new parameter. `build/sbt 'connect/testOnly org.apache.spark.sql.connect.ui.*'`
passes.

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

Generated-by: Claude Code (Claude Opus 4.8)
@venkata91 venkata91 force-pushed the SPARK-58097-session-identity branch from 2aefcd4 to f4a0db4 Compare July 13, 2026 06:07
@venkata91 venkata91 marked this pull request as ready for review July 13, 2026 06:07
@venkata91

Copy link
Copy Markdown
Contributor Author

cc @sunchao for review — this is the SPARK-58097 follow-up we discussed on #57016 (composite (userId, sessionId) session identity). Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant