Database Session Drain Rules Engine for Planned Failover
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current database management systems face challenges in gracefully terminating database sessions during planned maintenance, especially when applications use non-compliant connection pool managers, leading to disruptions and errors due to incomplete or long-running requests, and the inability to safely disconnect sessions without impacting applications.
Innovation Solution
The implementation of a rules engine within the database management system that proactively identifies safe points for session termination by monitoring session activity and applying rules based on historical statistics and configuration data to determine when a session can be safely drained or disconnected, minimizing application errors during planned operations.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If the database management system waits for request completion before disconnecting sessions, then application continuity is maintained, but maintenance window is exceeded and system availability is reduced
Solution Approach 1:
The system performs preliminary actions by identifying safe termination points and proactively draining sessions before the maintenance operation begins. The DBMS monitors session activity and identifies points where requests can be safely terminated, allowing connections to be disconnected in advance rather than waiting for natural completion.
Solution Approach 2:
The session termination process is segmented into multiple phases: identification of safe termination points, gradual draining of sessions, and final disconnection. This segmentation allows the system to terminate sessions at optimal points rather than forcing immediate termination or waiting for all sessions to complete naturally.
2Loss of time
If the database management system forcibly terminates long-running requests, then maintenance window is met, but application errors and disruptions occur
Solution Approach 1:
The system identifies safe termination points in advance before forcing any session termination. By monitoring session activity and identifying points where requests can be safely interrupted, the system minimizes application errors when maintenance operations require connection disconnection.
Solution Approach 2:
The DBMS continuously monitors session activity and provides feedback on the state of each session. This feedback mechanism allows the system to identify when a session has reached a safe termination point, enabling intelligent decision-making about when to disconnect connections without causing application errors.
3Productivity
If connection pools are used to reuse sessions, then connection overhead is reduced, but session termination becomes complex and maintenance operations are hindered
Solution Approach 1:
The system introduces an intermediary mechanism that sits between the connection pool and the database sessions. This intermediary monitors session activity, identifies safe termination points, and coordinates with the connection pool manager to drain sessions appropriately, simplifying the overall termination process while maintaining connection pool efficiency.
4Adaptability or versatility
If non-compliant connection pool managers are used, then application compatibility is improved, but safe session draining cannot be performed and disruptions occur
Solution Approach 1:
The DBMS implements a feedback mechanism that monitors session activity and provides information to non-compliant connection pool managers. This feedback allows the system to identify safe termination points and coordinate session draining even when the connection pool manager does not fully support the draining protocol, improving termination success while maintaining compatibility.
Solution Approach 2:
The system acts as an intermediary between non-compliant connection pool managers and the session termination process. By monitoring session activity and identifying safe termination points, the DBMS can guide the termination process even when the connection pool manager lacks full compliance, ensuring successful session drainage without requiring application changes.
Data Source
AI summary
Techniques are described for performing session termination(s) for active sessions in response to a planned operation on a database server of a DBMS. In an embodiment, the DBMS receives a request for a planned operation on a database server. The database server may have session(s) established with a client system to receive request(s) to execute database command(s) on the DBMS. In response, the DBMS transmits to the client system a notification to drain a session with the database server, and the DBMS marks the sessions at the database to drain. The DBMS is configured to terminate any drain-marked sessions by the database server when a rule is satisfied, and the failover is expected to succeed, and/or that the session is unlikely to drain or to failover at a later point in the session lifecycle. The DBMS may identify, in a rule set, a rule having rule instructions to detect a possible termination point for the session before the drain timeout period expires. Based on the execution of the rule instructions before the drain timeout expires, the DBMS determines that a termination point for the session is detected where that session will failover. In such a way, sessions are failed over early and at points where the failover is expected to succeed.


