[SPARK-58021][CONNECT] Add local server pool acquisition engine - #57687
[SPARK-58021][CONNECT] Add local server pool acquisition engine#57687ericm-db wants to merge 4 commits into
Conversation
Expose the per-user runtime directory and startup seed configuration, and let LocalConnectServer start isolated daemons with an ephemeral port and precomputed configuration. Keep persistent-server reuse on the same launch path and add focused unit coverage.
Co-authored-by: Isaac Claude-Session: https://claude.ai/code/session_011tpdLYqY4VRw4s1KjDb2fi
Co-authored-by: Isaac Claude-Session: https://claude.ai/code/session_011tpdLYqY4VRw4s1KjDb2fi
Co-authored-by: Isaac Claude-Session: https://claude.ai/code/session_011tpdLYqY4VRw4s1KjDb2fi
HyukjinKwon
left a comment
There was a problem hiding this comment.
0 blocking, 0 non-blocking, 0 nits.
Correctly designed concurrent acquisition; the lock discipline avoids both deadlock and over-spawning. No issues found.
Verification
Verified: acquire mutates only under with self._directory: and deliberately releases the lock between polls so attendants can publish (holding it would deadlock the wait); refill counts and spawns entirely under the lock, so concurrent cold-starters share one complement of launches rather than each spawning target (no over-spawn); a dead launch is recounted only after janitor reaps it, and janitor runs first each pass; the loop is bounded by _ACQUIRE_TIMEOUT so a never-ready pool fails loudly. Build/test: python/run-tests --testnames 'pyspark.sql.tests.connect.test_connect_local_server_pool'. (Note: the contract-claim scanner zombied on infra and was skipped after a retry; the acquire/refill concurrency claims were verified manually against the code.)
What changes were proposed in this pull request?
This is layer 4 of the local Connect pool stack: #57684 -> #57685 -> #57686 -> this PR. Until the lower layers merge, GitHub shows their cumulative diff; the new review unit here is commit
f3a02502293.This layer adds the acquisition engine:
--attendplus user-invoked--purgeentry points.SparkSession integration and JIT warmup remain in later PRs.
Why are the changes needed?
The storage and lifecycle layers define safe state transitions, but a pool also needs one owner for launching and supervising each server. Isolating that orchestration makes the attendant boundary, environment sanitization, retry behavior, and refill concurrency independently reviewable.
Does this PR introduce any user-facing change?
No. The acquisition engine is not selected by SparkSession in this layer.
How was this patch tested?
Expanded
LocalConnectServerPoolUnitTestswith acquisition coverage for fingerprint-aware refill, re-entrant acquisition of an existing claim, and the POSIX platform gate, in addition to all storage and lifecycle cases.All 17 tests passed. Ruff check, Ruff format check, and
git diff --checkalso passed.Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Fable 5) and OpenAI Codex (GPT-5)