[LIVY-1073] Add SessionManager refresh and /recovery operator endpoint - #546
[LIVY-1073] Add SessionManager refresh and /recovery operator endpoint#546soumyadeeplogin wants to merge 2 commits into
Conversation
|
Filed https://issues.apache.org/jira/browse/LIVY-1073 for this change. |
(cherry picked from commit d30c643) Co-authored-by: Soumyadeep Roy <soumyadeep.roy@salesforce.com>
5619f1b to
fe7bdc7
Compare
|
Thanks for the PR! Could you please add the required AI tooling disclosure to the PR description? Was this patch authored or co-authored using generative AI tooling?(If yes, include 'Generated-by: ' followed by the tool name and version. If no, write 'No'.) |
|
Thanks, @roczei! Added the AI tooling disclosure section to the PR description. |
|
Nice work on this! I reviewed the core logic and tests. I've left a few small thoughts below to help refine things: Please update docs/rest-api.md with the three new endpoints: /recovery/sessions/refresh Include the auth requirement as well When livy.server.recovery.mode=off consider returning a clear error, so operators don't think they synced state when recovery is disabled. Core logic is well tested, but a small integration test for 403 (non-superuser) vs 200 (superuser) on /recovery/* would increase confidence. |
Extracts the previously-inline anonymous recovery servlet in LivyServer into a standalone RecoveryServlet class, following the existing BatchSessionServlet/InteractiveSessionServlet convention. This makes it unit-testable and adds RecoveryServletSpec, covering the 403 (non-superuser) vs 200 (superuser) authorization path that had no test coverage. Also has the servlet return 409 instead of a silently-empty added=0/failed=0 result when livy.server.recovery.mode=off, since in that case StateStore resolves to a no-op BlackholeStateStore and the previous behavior was misleading. Documents the three /recovery/* endpoints in docs/rest-api.md, which had none. Co-authored-by: Soumyadeep Roy <soumyadeep.roy@salesforce.com>
|
Thanks for the detailed review, @roczei! Pushed a follow-up commit addressing all three points:
As part of this I also extracted the previously-inline anonymous servlet in |
What changes were proposed in this pull request?
Adds a
SessionManagerrefresh capability and a/recoveryoperator endpoint onLivyServer, allowing an operator to trigger a manual re-sync of in-memory session state against the recovery/session-state store without restarting the Livy server process.The
/recovery/*endpoints are implemented as a standaloneRecoveryServlet, restricted tolivy.superusers. Iflivy.server.recovery.modeisoff(no state store configured), the endpoints return409rather than a silently-empty result. The three endpoints (/recovery/sessions/refresh,/recovery/batches/refresh,/recovery/refresh) are documented indocs/rest-api.md.How was this patch tested?
Unit tests added in
SessionManagerSpeccovering the refresh path, andRecoveryServletSpeccovering the servlet's authorization (403 vs 200) and recovery-mode-off (409) behavior.Was this patch authored or co-authored using generative AI tooling?
Yes. Generated-by: Claude Code (Sonnet 5, Anthropic), used to scan/plan the extraction of local patches for upstreaming and to draft/iterate on the code and tests in this PR under human review. Please refer to the ASF Generative Tooling Guidance for details.
Note on JIRA
Filed as LIVY-1073.