failover: implement offline detection, reuse active connection and connection expiration - #8982
failover: implement offline detection, reuse active connection and connection expiration#8982pbrezina wants to merge 43 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a connection state machine (enum sss_failover_state) to track the failover context's status (DISCONNECTED, CONNECTED, or OFFLINE). It implements offline marking capabilities, updates transactions to return ERR_OFFLINE when no servers are available, and significantly improves robustness by adding numerous out-of-memory (OOM) checks for talloc_reference operations. I have no additional feedback to provide as there are no review comments.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
4b7e387 to
4dd9f94
Compare
c357995 to
04266f6
Compare
|
@alexey-tikhonov @justin-stephenson I think this is ready for review. It is a pile of commits, but they are well organized and very small. It's actually less then 1000 lines of code. |
…ider (cherry picked from commit 0f5f3b6)
so it can be directly modified
…can easily pass new fctx
So it can be modified later.
…kup and user authentication
ERR_NO_MORE_SERVERS is translated to ERR_OFFLINE as the failover context is set to an offline state and this is a clearer message.
This was previously omitted.
This is a helper to get reference to the active server.
The original idea was that kinit and connect will be always called and the decision to reuse existing connection will be here. But this is unnecessary difficult, it can be reused as long as the connection works and the very simple logic has been implemented in the transaction code. The LDAP connection code will however implement expiration and idle timers in subsequent commits.
Be more explicit on the exact place where the current connection was dropped. This simplifies the logic and state maintenance. Also add debug messages around reference handling.
This is just for information purpose (backend may choose to set a flag in the connection), the actually disconnect must happen in a talloc destructor.
It makes sense to unify the naming pattern as "sss_failover_active_server_*" when we have multiple functions now.
It makes sense to unify the naming pattern as "sss_failover_connection_*" when we have multiple functions now.
These helpers compare what we want to remove to what is stored and only removes the active server or connection if there is a match to avoid removing active server or connection if it was set to something else in the mean time.
This is not strictly needed as the connection is terminated by the sdap_handle destructor which is called automatically when the connection is being freed, but it is better to be explicit about it.
This will be used to determine whether the connection is idle or busy.
justin-stephenson
left a comment
There was a problem hiding this comment.
I will probably have more questions later after implementing this but so far it LGTM.
This PR implements three missing functionality, they all depends on the previous patches so I'm sending it in single PR.