A deadlock management system for a database system, the database system comprising a set of applications selectively requesting and holding locks on database resources, a pool of worker agents comprising normal worker agents and overflow worker agents, an application scheduler, a wait queue, a priority queue, and a deadlock detector, the database system supporting an application holding a lock while disassociated from a worker agent, the deadlock management system comprising:
- means for marking an application with a flag value based on an existing application flag value and on a state of applications requesting and holding locks on database resources, comprising;
- means for marking an application with a flag value W where the application becomes disassociated from a worker agent and holds a lock on a database resource;
- means for marking an application with a flag value H where the application has a flag value W and where the database resource is requested by another application;
- means for marking an application with a flag value D where the application requests a worker agent, has a flag value H and a normal worker agent or overflow worker agent is not available for the application;
- means for marking an application with the flag value Q where the application has a flag value W and a normal worker agent is not available upon request, wherein the application is placed on the wait queue;
- and
- means for marking an application with the flag value D where the application has the flag value Q and another application requests a lock held by the application having the flag value Q;
- means for the application scheduler to respond to an application request for a worker agent from the pool and to selectively provide a normal worker agent, an overflow worker agent, or place the application on the wait queue or on the priority queue, based on the application flag value, comprising:
- means for responding to a request for a worker agent from an application with flag value H by obtaining a normal worker agent if available and alternatively providing an overflow worker agent, further comprising means for placing the application on the priority queue where an overflow worker agent is not available;
- and
- means for responding to a request for a worker agent from an application with flag value W by obtaining a normal worker agent if available and alternatively by placing the application on the wait queue;
- means for clearing the application flag value when an application is provided with a worker agent,
- means for the deadlock detector to poll an application;
- and
- means for the deadlock detector to declare a deadlock where the application has a specified flag value and the application holds a lock on a database resource requested by another application;
- comprising:
- means for declaring a deadlock where an application has a flag value D and the application holds a lock on a database resource that is requested by another application,
- the deadlock detector further comprising a lock wait deadlock graph and a resource representation, the lock wait deadlock graph comprising means to represent applications requesting and holding locks on database resources whereby the deadlock detector determines if an application holds a lock requested by another application;
- and
- means to select an application holding a lock and to require the application to release the lock, following detection of a deadlock on the lock.