Error detection/correction and fault detection/recovery – Data processing system error or fault handling – Reliability and availability
Reexamination Certificate
2000-12-22
2003-11-11
Le, Dieu-Minh (Department: 2184)
Error detection/correction and fault detection/recovery
Data processing system error or fault handling
Reliability and availability
Reexamination Certificate
active
06647510
ABSTRACT:
FIELD OF THE INVENTION
The present invention relates to database management systems (DBMS). More specifically, the present invention relates to a method and apparatus for making available data that was locked by a dead transaction before rolling back the entire dead transaction.
BACKGROUND OF THE INVENTION
In typical database systems, users store, update and retrieve information by submitting commands to a database application. To be correctly processed, the commands must comply with the database language that is supported by the database application. One popular database language is known as Structured Query Language (SQL).
A logical unit of work that is atomic and comprised of one or more database language statements is referred to as a transaction. In a database server, an area of system memory is allocated and one or more processes are started to execute one or more transactions. The database server communicates with connected user processes and performs tasks on behalf of the user. These tasks typically include the execution of transactions. The combination of the allocated system memory and the processes executing transactions is commonly termed a database instance.
A buffer cache resides in a portion of the system memory and holds database information. Buffers in the buffer cache hold copies of data blocks that have been read from data files. The buffers are shared by all user processes concurrently connected to the instance. When a transaction desires to make a change to a data block, a copy of the data block is loaded into a buffer and the change is made to the copy of the data block stored in the database buffer cache in dynamic memory. Afterwards, a database writer writes the modified blocks of data from the database buffer cache to the data files on disk.
The system memory also contains a redo log buffer. A redo log buffer is a buffer that holds information about update operations recently performed by transactions. This information is stored in redo entries. Redo entries contain the information necessary to reconstruct, or redo, changes made by operations such as INSERT, UPDATE, DELETE, CREATE, ALTER, or DROP, for example. Redo entries are generated for each change made to a copy of a data block stored in the database buffer cache. The redo log buffer is written to online redo log file(s) on disk. The records in the online redo log file(s) on disk are referred to as redo logs.
An instance failure can occur when a problem arises that prevents an instance from continuing work. Instance failures may result from hardware problems such as a power outage, or software problems such as an operating system or database system crash. Instance failures can also occur expectedly, for example, when a shutdown/abort statement is issued.
Due to the way in which database updates are performed to data files in some database systems, at any given point in time, a data file may contain some data blocks that (1) have been tentatively modified by uncommitted transactions and/or (2) do not yet reflect updates performed by committed transactions. Thus, an instance recovery operation must be performed after an instance failure to restore a database to the transaction consistent state it possessed just prior to the instance failure. 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.
A typical DBMS performs several steps during an instance recovery. First, the DBMS rolls forward, or reapplies to the data files all of the changes recorded in the redo log. Rolling forward proceeds through as many redo log files as necessary to bring the database forward in time to reflect all of the changes made prior to the time of the crash. Rolling forward usually includes applying the changes in online redo log files, and may also include applying changes recorded in archived redo log files (online redo files which are archived before being reused). After rolling forward, the data blocks contain all committed changes as well as any uncommitted changes that were recorded in the redo log prior to the crash. Rollback segments include records for undoing uncommitted changes made during the roll-forward operation. In database recovery, the information contained in the rollback segments is used to undo the changes made by transactions that were uncommitted at the time of the crash. The process of undoing changes made by the uncommitted transactions is referred to as “rolling back” the transactions.
FIG. 1
illustrates rolling forward and rolling back. Database
110
is a database requiring recovery at time t
1
. Database
120
represents the database after a redo log is applied at time t
2
. The database
120
comprises both changes made by committed transactions
121
and changes made by uncommitted transactions
122
. Database
130
represents the database at time t
3
after a rollback segment is applied. The database
130
comprises only changes made by committed transactions
121
.
When rolling back a transaction, the DBMS releases any resources (locked resources) held by the transaction at the time of failure. Lastly, the DBMS resolves any pending distributed transactions that were undergoing a two-phase commit coordinated by the DBMS at the time of the instance failure.
One disadvantage of the prior method of recovering after a crash of an instance of a database is that undo records for all uncommitted (dead) transactions must be applied before a user is allowed to execute a new transaction to access the database system. This can take a long period of time if there are a large number of dead transactions that need to be rolled back, even if many of the undo records for dead transactions are directed to data blocks that will not be accessed by the new transaction.
One enhancement that can be used to reduce the period of time that a user must wait before executing a new transaction is by rolling back changes, on an as needed transaction-by-transaction basis, depending on the particular data blocks that are of interest to the new transaction.
However, this enhancement also suffers from inefficiencies if the rollback of a dead transaction requires undo changes to be applied to a large number of data blocks, but the new transaction only requires access to a small number of those data blocks. Thus, a user may be required to wait a large period of time for undo changes to be applied to data blocks that are not of interest to the new transaction.
Based on the foregoing, it is highly desirable to provide a method and apparatus for reducing the number of undo changes that need to be applied when a new transaction encounters a resource that is locked by a dead transaction.
SUMMARY OF THE INVENTION
The present invention provides a method and apparatus for removing changes made by a dead transaction. According to the method, a first change is performed by the dead transaction prior to a second change. The first change made by the dead transaction is then undone prior to undoing the second change made by the dead transaction.
According to another aspect of the invention, the first change is undone by applying one or more undo changes contained in a first undo record to a first resource. The second change is undone by applying one or more undo changes contained in a second undo record to a second resource; the first resource and the second resource not being the same resource.
According to another aspect of the invention, a method and apparatus for applying changes in redo records to make a particular resource reflect changes made to the particular resource in volatile memory before a failure is provided. The method includes establishing links that link together a set of redo records that contain changes made to the particular resource. The links are then followed to apply the changes contained in the set of redo records to cause the particular resource to reflect the changes made to the particular resource in volatile memory before the failure.
According to another aspect of the invention,
Ganesh Amit
Gawlick Dieter
Ngai Gary C.
Bingham Marcel K.
Hickman Palermo & Truong & Becker LLP
Le Dieu-Minh
Oracle International Corporation
LandOfFree
Method and apparatus for making available data that was... does not yet have a rating. At this time, there are no reviews or comments for this patent.
If you have personal experience with Method and apparatus for making available data that was..., we encourage you to share that experience with our LandOfFree.com community. Your opinion is very important and Method and apparatus for making available data that was... will most certainly appreciate the feedback.
Profile ID: LFUS-PAI-O-3128589