The present invention is illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings and in which like reference numerals refer to similar elements and in which:
In the following description, for the purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the present invention. It will be apparent, however, that the present invention may be practiced without these specific details. In other instances, well-known structures and devices are shown in block diagram form in order to avoid unnecessarily obscuring the present invention.
Described herein are techniques for preserving the state of locks maintained in volatile memory by the master for the resources after termination of the master. The locks are preserved by storing persistent copies of the locks. The persistently stored copies of the locks are accessible to other nodes in a multi-node system of the master. The copy of the lock does not have to be an exact replica of a lock, but may contain or represent a portion of the lock, and may contain additional information. Locks for which persistent copies are stored in this way are referred to as persistent locks.
A persistent copy of data is a copy that is stored in a form of memory that is able to store the copy after the volatile memory storing the data is unable to do so. Examples of such memory include disk storage and the volatile memory of another computer that could survive a malfunction and failure of the computer whose volatile memory stores the data.
The persistent storage 110 may be the volatile memory of another node in the multi-node system. In another embodiment of the invention, an additional persistent copy of lock 106 is stored and maintained in the volatile memories of more than one node in the multi-node system. This approach provides some additional reliability because a persistent copy is more likely to survive a failure involving multiple nodes.
In yet another embodiment of the invention, a copy of a lock is stored in non-volatile memory, for example, on a shared disk. A shared disk can be accessed directly by all nodes in a multi-node system rather than having to be accessed via another node, that is, all nodes may access data on the shared disk without first transferring the data to another node. This approach ensures persistency because the shared nonvolatile memory may not be affected by the termination of any node.
Persistence reduces recovery processing. Rather than locking all of failed master's resources, the only resources for which locks need to be acquired and recovery procedures performed are those resources for which there is a persistent copy of a lock held by the failed master at the time the master failed.
Fail-Over Processing of Transactions in a Database System
Lock persistence can also facilitate transaction failover processing, in which a surviving node (“recovery node”) in a multi-node database system finishes an uncompleted transactions that was being executed by a failed node. The uncompleted transaction is executed as a “fail-over transaction” on the surviving node. From the persistent copies of locks held by the failed node when it failed, the recovery node is able determine which resources needed to be locked in order to continue executing the transaction in a way that avoids re-performing work that was already performed by the failed node before the failure. Without such information, the recovery node needs to rollback the database to a transaction consistent state possessed prior to the node failure and then continue fail-over processing of transactions from that point. (In a transaction consistent state, a database reflects all the changes made by transactions which are committed and none of the changes made by transactions which are not committed.) Using these persistent copies, the recovery node is able obtain locks held for a fail-over transaction without having to contend with other nodes acquiring a conflicting lock.
In addition, information about the state of a transaction may be stored in a persistent copy of locks acquired for the transaction (“transaction locks”). This information may be useful for allowing transaction fail-over processing to be performed more efficiently.
Computer system 200 may be coupled via bus 202 to a display 212, such as a cathode ray tube (CRT), for displaying information to a computer user. An input device 214, including alphanumeric and other keys, is coupled to bus 202 for communicating information and command selections to processor 204. Another type of user input device is cursor control 216, such as a mouse, a trackball, or cursor direction keys for communicating direction information and command selections to processor 204 and for controlling cursor movement on display 212. This input device typically has two degrees of freedom in two axes, a first axis (e.g., x) and a second axis (e.g., y), that allows the device to specify positions in a plane.
The invention is related to the use of computer system 200 for implementing the techniques described herein. According to one embodiment of the invention, those techniques are performed by computer system 200 in response to processor 204 executing one or more sequences of one or more instructions contained in main memory 206. Such instructions may be read into main memory 206 from another machine-readable medium, such as storage device 210. Execution of the sequences of instructions contained in main memory 206 causes processor 204 to perform the process steps described herein. In alternative embodiments, hard-wired circuitry may be used in place of or in combination with software instructions to implement the invention. Thus, embodiments of the invention are not limited to any specific combination of hardware circuitry and software.
The term “machine-readable medium” as used herein refers to any medium that participates in providing data that causes a machine to operation in a specific fashion. In an embodiment implemented using computer system 200, various machine-readable media are involved, for example, in providing instructions to processor 204 for execution. Such a medium may take many forms, including but not limited to, non-volatile media, volatile media, and transmission media. Non-volatile media includes, for example, optical or magnetic disks, such as storage device 210. Volatile media includes dynamic memory, such as main memory 206. Transmission media includes coaxial cables, copper wire and fiber optics, including the wires that comprise bus 202. Transmission media can also take the form of acoustic or light waves, such as those generated during radio-wave and infra-red data communications. All such media must be tangible to enable the instructions carried by the media to be detected by a physical mechanism that reads the instructions into a machine.
Common forms of machine-readable media include, for example, a floppy disk, a flexible disk, hard disk, magnetic tape, or any other magnetic medium, a CD-ROM, any other optical medium, punchcards, papertape, any other physical medium with patterns of holes, a RAM, a PROM, and EPROM, a FLASH-EPROM, any other memory chip or cartridge, a carrier wave as described hereinafter, or any other medium from which a computer can read.
Various forms of machine-readable media may be involved in carrying one or more sequences of one or more instructions to processor 204 for execution. For example, the instructions may initially be carried on a magnetic disk of a remote computer. The remote computer can load the instructions into its dynamic memory and send the instructions over a telephone line using a modem. A modem local to computer system 200 can receive the data on the telephone line and use an infra-red transmitter to convert the data to an infra-red signal. An infra-red detector can receive the data carried in the infra-red signal and appropriate circuitry can place the data on bus 202. Bus 202 carries the data to main memory 206, from which processor 204 retrieves and executes the instructions. The instructions received by main memory 206 may optionally be stored on storage device 210 either before or after execution by processor 204.
Computer system 200 also includes a communication interface 218 coupled to bus 202. Communication interface 218 provides a two-way data communication coupling to a network link 220 that is connected to a local network 222. For example, communication interface 218 may be an integrated services digital network (ISDN) card or a modem to provide a data communication connection to a corresponding type of telephone line. As another example, communication interface 218 may be a local area network (LAN) card to provide a data communication connection to a compatible LAN. Wireless links may also be implemented. In any such implementation, communication interface 218 sends and receives electrical, electromagnetic or optical signals that carry digital data streams representing various types of information.
Network link 220 typically provides data communication through one or more networks to other data devices. For example, network link 220 may provide a connection through local network 222 to a host computer 224 or to data equipment operated by an Internet Service Provider (ISP) 226. ISP 226 in turn provides data communication services through the world wide packet data communication network now commonly referred to as the “Internet” 228. Local network 222 and Internet 228 both use electrical, electromagnetic or optical signals that carry digital data streams. The signals through the various networks and the signals on network link 220 and through communication interface 218, which carry the digital data to and from computer system 200, are exemplary forms of carrier waves transporting the information.
Computer system 200 can send messages and receive data, including program code, through the network(s), network link 220 and communication interface 218. In the Internet example, a server 230 might transmit a requested code for an application program through Internet 228, ISP 226, local network 222 and communication interface 218.
The received code may be executed by processor 204 as it is received, and/or stored in storage device 210, or other non-volatile storage for later execution. In this manner, computer system 200 may obtain application code in the form of a carrier wave.
In the foregoing specification, embodiments of the invention have been described with reference to numerous specific details that may vary from implementation to implementation. Thus, the sole and exclusive indicator of what is the invention, and is intended by the applicants to be the invention, is the set of claims that issue from this application, in the specific form in which such claims issue, including any subsequent correction. Any definitions expressly set forth herein for terms contained in such claims shall govern the meaning of such terms as used in the claims. Hence, no limitation, element, property, feature, advantage or attribute that is not expressly recited in a claim should limit the scope of such claim in any way. The specification and drawings are, accordingly, to be regarded in an illustrative rather than a restrictive sense.