WO2014026611A1 - Rollback method and apparatus of transaction, relational database management system - Google Patents
Rollback method and apparatus of transaction, relational database management system Download PDFInfo
- Publication number
- WO2014026611A1 WO2014026611A1 PCT/CN2013/081469 CN2013081469W WO2014026611A1 WO 2014026611 A1 WO2014026611 A1 WO 2014026611A1 CN 2013081469 W CN2013081469 W CN 2013081469W WO 2014026611 A1 WO2014026611 A1 WO 2014026611A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- lcb
- transaction
- savepoint
- undo record
- rollback
- Prior art date
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/21—Design, administration or maintenance of databases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/28—Databases characterised by their database models, e.g. relational or object models
- G06F16/284—Relational databases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/14—Error detection or correction of the data by redundancy in operation
- G06F11/1402—Saving, restoring, recovering or retrying
- G06F11/1415—Saving, restoring, recovering or retrying at system level
- G06F11/1438—Restarting or rejuvenating
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/23—Updating
- G06F16/2308—Concurrency control
- G06F16/2336—Pessimistic concurrency control approaches, e.g. locking or multiple versions without time stamps
Definitions
- This application relates to the database technology and in particular, to a rollback method and apparatus of transaction, and a relational database management system.
- a "transaction” refers to an exchange between a workstation and a program, two workstations, or two programs that accomplish a particular action or result.
- the transaction begins when the exchange begins; and ends when commitment is made to the particular action or result.
- Savepoints are created between the beginning of the transaction and the commit.
- the savepoints allow modifications made to data since a savepoint to be undone. This is referred to herein as "rollback to a savepoint".
- rollback to a savepoint Most of relational database systems use multi version control using either undo records or some variant of it to keep the different version of the same record to be used by the read transactions.
- LCB Lock Control Block
- Embodiments of the present invention pertain to a rollback method and apparatus of transaction, and a relational database management system.
- a rollback method of transaction applied in a relational database management system, the method includes:
- LCB Lane Control Block
- a rollback apparatus of transaction applied in a relational database management system, the apparatus includes:
- a first acquiring unit configured to acquire an undo record from a transaction block when a rollback to a savepoint is happended
- a first judging unit configured to judge whether the undo record is the first undo record of a piece of data
- a marking unit configured to mark release information on LCB corresponding to the piece of data if the undo record is the first undo record.
- relational database management system includes a rollback apparatus of transaction as described in above content.
- lock release algorithm will be more efficient as it needs to traverse the lock list only once; and lock will be released even if some transactions are already waiting for the same tuple. Furthermore, there is no separate resource to release locks during rollback to savepoint.
- Figure 1 is a flowchart of the method of an embodiment of the present invention
- Figure 2 is an example showing LCB is marked of the present invention
- Figure 3 is another flowchart of the method of an embodiment of the present invention.
- Figure 4 is a schematic diagram of the rollback apparatus of an embodiment of the present invention.
- Figure 5 is another schematic diagram of the rollback apparatus of an embodiment of the present invention.
- PostgreSQL will traverse the lock list 4 times to perform rollback to savepoint in above case.
- the present invention should build upon a common feature of lock manages, the capacity to efficiently release locks owned by a given owning work unit.
- the method should not incur unduly burdensome overhead.
- the present invention addresses such a need. It is based on the fact that, once the last version of a record is used for roll backing, then it is safe to release the lock attach to that record. This will make sure the waiting transaction to be released for operation and further transaction to be able to do write operation on the record.
- the present invention tries to propose a method for doing rollback to savepoint using these multi version records as a mark. This mark will be used to decide on the point to which rollback will be done. So whenever user creates a savepoint, a handle to the last version of the record will be attached to the savepoint and the same will be used during rollback to the savepoint.
- the present invention makes sure that the waiting transaction will be woken up after rollback to save point is done. Furthermore, it makes use of the exiting resource as a mark and thus less resource usage and is less complex in nature. According to the present invention, lock list in the table 1 has to be scanned once irrespective of number of savepoint. So the present invention is better than PostgreSQL incase there are multiple savepoint in a transaction. Embodiment 1
- This embodiment of the present invention provides a rollback method of transaction, applied in a relational database management system.
- Figure 1 is a flowchart of the method of an embodiment of the present invention. As shown in Figure 1, the method includes:
- Step 101 acquiring an undo record from a transaction block when a rollback to a savepoint is happended
- Step 102 judging whether the undo record is the first undo record of a piece of data
- Step 103 marking release information on LCB (Lock Control Block) corresponding to the piece of data if the undo record is the first undo record, such that one or more transactions waiting for the LCB are released after applying the undo operation.
- LCB Lock Control Block
- the changes done to data are recorded using undo records.
- a copy of the original record is stored in the undo segment, before doing modification on the actual record.
- a committed copy of the updated tuple is used for the read purpose.
- This read copy is different from other undo entries and can be identified easily. In fact, this is the first undo record for the tuple for that transaction.
- the idea is to use this information to mark if a lock on the record can be released or not after a rollback to savepoint.
- a transaction want to do some write operation on a record it has to do so by attaching a lock to the record and thus allowing other write transaction to wait by attaching a waiting lock to this lock.
- a lock can be a data structure having parent transaction information and the waiting transactions information. There will be a one to one mapping between the record and lock for a transaction. While doing rollback to savepoint, if the transaction uses the first undo record for undo, then there is no more modification left and thus the lock of the record can be marked for release.
- FIG. 2 is an example showing LCB is marked of the present invention.
- LCB1 corresponds to Tuple 1
- LCB2 corresponds to Tuple2.
- a savepoint is set between Undo2 and Undo3.
- Undol, Undo2, Undo4, Undo6 are used for Tuplel ; Undo3, Undo5, Undo7 are used for Tuple2.
- Undol is the first undo record written for the Tuplel and Undo3 is the first undo record for the Tuple2.
- Undo3 will get replayed and the LCB2 will be marked for release, thus the lock for the Tuple2 will be released.
- Undol will not get replayed and the LCB1 will not be marked for release, thus its locks will not be released.
- the method may further include: judging whether identifier of the undo record matches identifier of the savepoint; and acquiring another undo record from the transaction block if identifier of the undo record does not match identifier of the savepoint.
- the method may further include: acquiring a LCB from the transaction block if identifier of the undo record matches identifier of the savepoint; judging whether the LCB is marked for release; releasing the transaction waiting for the LCB and the LCB if the LCB is marked for release.
- the method may further include: removing the marked release information from the LCB if the LCB is marked for release.
- the method may further include: judging whether end of the LCB list for the transaction is reached; and acquiring another LCB from the transaction block if end of the LCB list for the transaction is not reached.
- FIG 3 is another flowchart of the method of an embodiment of the present invention. As shown in Figure 3, the method includes:
- Step 301 start rollback to a savepoint.
- Step 302 get an undo record from the transaction block.
- Step 303 apply the undo operation.
- Step 304 judge whether the undo record is the first undo record of a piece of data; if yes then execute step 305, if no then execute 306.
- Step 305 mark on LCB corresponding to the piece of data.
- Step 306 judge whether identifier of the undo record matches identifier of the savepoint; if yes then execute 307, if no then execute 302. Step 307, get a LCB from the transaction block.
- Step 308 judge whether the LCB is marked for release; if yes then execute 309, if no then execute 312.
- Step 309 remove the transaction mark from the LCB.
- Step 310 release the transaction waiting for the LCB.
- Step 311, free the LCB.
- Step 312 judge whether end of the LCB list for the transaction is reached; if no then execute 307.
- lock release algorithm will be more efficient as it needs to traverse the lock list only once; and lock will be released even if some transactions are already waiting for the same tuple. Furthermore, there is no separate resource to release locks during rollback to savepoint.
- This embodiment of the present invention provides a rollback apparatus of transaction, applied in a relational database management system. This embodiment corresponds to the method of the above embodiment 1 and the same content will not be described.
- FIG 4 is a schematic diagram of the rollback apparatus of an embodiment of the present invention.
- the rollback apparatus 400 includes: a first acquiring unit 401, a first judging unit 402, a marking unit 403.
- Other parts of the rollback apparatus 400 can refer to the existing technology and not be described in the present application.
- FIG. 5 is another schematic diagram of the rollback apparatus of an embodiment of the present invention.
- the rollback apparatus 500 includes: a first acquiring unit 401, a first judging unit 402, a marking unit 403. As described in above content.
- the rollback apparatus 500 further includes: a second judging unit 504.
- the second judging unit 504 is configured to judge whether identifier of the undo record matches identifier of the savepoint.
- the first acquiring unit 401 is further configured to acquire another undo record from the transaction block if identifier of the undo record does not match identifier of the savepoint.
- the rollback apparatus 500 further includes: a second acquiring unit 505, a third judging unit 506 and a releasing unit 507.
- the second acquiring unit 505 is configured to acquire a LCB from the transaction block if identifier of the undo record matches identifier of the savepoint;
- the third judging unit 506 is configured to judge whether the LCB is marked for release;
- the releasing unit 507 is configured to release the transaction waiting for the LCB and the LCB if the LCB is marked for release.
- the rollback apparatus 500 further includes: a removing unit 508, the removing unit 508 is configured to remove the marked release information from the LCB if the LCB is marked for release.
- the rollback apparatus 500 further includes: a fourth judging unit 509, the fourth judging unit 509 is configured to judge whether end of the LCB list for the transaction is reached. And the second acquiring unit 505 is further configured to acquire another LCB from the transaction block if end of the LCB list for the transaction is not reached.
- This embodiment of the present invention further provides a relational database management system, wherein the relational database management system includes a rollback apparatus of transaction as described in above content.
- lock release algorithm will be more efficient as it needs to traverse the lock list only once; and lock will be released even if some transactions are already waiting for the same tuple. Furthermore, there is no separate resource to release locks during rollback to savepoint.
- each of the parts of the present invention may be implemented by hardware, software, firmware, or a combination thereof.
- multiple steps or methods may be realized by software or firmware that is stored in the memory and executed by an appropriate instruction executing system.
- a discrete logic circuit having a logic gate circuit for realizing logic functions of data signals
- application-specific integrated circuit having an appropriate combined logic gate circuit
- PGA programmable gate array
- FPGA field programmable gate array
- logic and/or steps shown in the flowcharts or described in other manners here may be, for example, understood as a sequencing list of executable instructions for realizing logic functions, which may be implemented in any computer readable medium, for use by an instruction executing system, device or apparatus (such as a system including a computer, a system including a processor, or other systems capable of extracting instructions from an instruction executing system, device or apparatus and executing the instructions), or for use in combination with the instruction executing system, device or apparatus.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Quality & Reliability (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
A rollback method and apparatus of transaction, and a relational database management system. The method includes: acquiring an undo record from a transaction block when a rollback to a savepoint is happended; judging whether the undo record is the first undo record of a piece of data; marking release information on LCB corresponding to the piece of data if the undo record is the first undo record, such that one or more transactions waiting for the LCB are released after applying the undo operation. In the present invention, lock will be released even if some transactions are already waiting for the same tuple. Furthermore, there is no separate resource to release locks during rollback to savepoint.
Description
ROLLBACK METHOD AND APPARATUS OF TRANSACTION, RELATIONAL
DATABASE MANAGEMENT SYSTEM
FIELD OF THE INVENTION
This application relates to the database technology and in particular, to a rollback method and apparatus of transaction, and a relational database management system.
BACKGROUND
In relational database management systems (RDBMS), a "transaction" refers to an exchange between a workstation and a program, two workstations, or two programs that accomplish a particular action or result. The transaction begins when the exchange begins; and ends when commitment is made to the particular action or result.
Several conventional RDBMS support sub-transactions through the use of savepoints. Savepoints are created between the beginning of the transaction and the commit. The savepoints allow modifications made to data since a savepoint to be undone. This is referred to herein as "rollback to a savepoint". Most of relational database systems use multi version control using either undo records or some variant of it to keep the different version of the same record to be used by the read transactions.
For transactions to occur with integrity, two transactions must be prevented from updating the same piece of data at the same time. Locks on the data being updated are typically used. When a transaction locks an object, it keeps one mark on that object using a data structure to inform other transaction, about the lock and type of operation being done on that object. This mark is a control block structure and is some time referred as LCB (Lock Control Block).
When rollback to savepoint occurs, one must consider locks acquired since the savepoint. Those locks taken to keep the changes, now being rolled back, from being seen by other transactions may be released. Accordingly, there exists a need for a method for selectively releasing locks when rolling back to a savepoint and awakening other transactions waiting to operate on locked row.
However, the inventor found that the waiting transaction will not be woken up after rollback to savepoint is done in the prior art. Or even though lock will be released and the waiting transaction will be woken up after rollback to savepoint is done, whole lock list needs
to be scanned to match the corresponding resource. SUMMARY
Embodiments of the present invention pertain to a rollback method and apparatus of transaction, and a relational database management system.
According to a first aspect of the embodiments of the present invention, there is provided a rollback method of transaction, applied in a relational database management system, the method includes:
acquiring an undo record from a transaction block when a rollback to a savepoint is happended;
judging whether the undo record is the first undo record of a piece of data;
marking release information on LCB (Lock Control Block) corresponding to the piece of data if the undo record is the first undo record, such that one or more transactions waiting for the LCB are released after applying the undo operation.
According to a second aspect of the embodiments of the present invention, there is provided a rollback apparatus of transaction, applied in a relational database management system, the apparatus includes:
a first acquiring unit, configured to acquire an undo record from a transaction block when a rollback to a savepoint is happended;
a first judging unit, configured to judge whether the undo record is the first undo record of a piece of data;
a marking unit, configured to mark release information on LCB corresponding to the piece of data if the undo record is the first undo record.
According to a third aspect of the embodiments of the present invention, there is provided a relational database management system, wherein the relational database management system includes a rollback apparatus of transaction as described in above content.
The advantages of the present invention exist in that: lock release algorithm will be more efficient as it needs to traverse the lock list only once; and lock will be released even if some transactions are already waiting for the same tuple. Furthermore, there is no separate resource to release locks during rollback to savepoint.
These and further aspects and features of the present invention will be apparent with
reference to the following description and attached drawings. In the description and drawings, particular embodiments of the invention have been disclosed in detail as being indicative of some of the ways in which the principles of the invention may be employed, but it is understood that the invention is not limited correspondingly in scope. Rather, the invention includes all changes, modifications and equivalents coming within the spirit and terms of the appended claims.
Features that are described and/or illustrated with respect to one embodiment may be used in the same way or in a similar way in one or more other embodiments and/or in combination with or instead of the features of the other embodiments.
It should be emphasized that the term "comprises/comprising" when used in this specification is taken to specify the presence of stated features, integers, steps or components but does not preclude the presence or addition of one or more other features, integers, steps, components or groups thereof.
Many aspects of the invention can be better understood with reference to the following drawings. The components in the drawings are not necessarily to scale, emphasis instead being placed upon clearly illustrating the principles of the present invention. To facilitate illustrating and describing some parts of the invention, corresponding portions of the drawings may be exaggerated in size, e.g., made larger in relation to other parts than in an exemplary device actually made according to the invention. Elements and features depicted in one drawing or embodiment of the invention may be combined with elements and features depicted in one or more additional drawings or embodiments. Moreover, in the drawings, like reference numerals designate corresponding parts throughout the several views and may be used to designate like or similar parts in more than one embodiment.
BRIEF DESCRIPTION OF THE DRAWING
The drawings are included to provide further understanding of the present invention, which constitute a part of the specification and illustrate the preferred embodiments of the present invention, and are used for setting forth the principles of the present invention together with the description. The same element is represented with the same reference number throughout the drawings.
In the drawings:
Figure 1 is a flowchart of the method of an embodiment of the present invention;
Figure 2 is an example showing LCB is marked of the present invention;
Figure 3 is another flowchart of the method of an embodiment of the present invention; Figure 4 is a schematic diagram of the rollback apparatus of an embodiment of the present invention;
Figure 5 is another schematic diagram of the rollback apparatus of an embodiment of the present invention.
DETAILED DESCRIPTION
The many features and advantages of the embodiments are apparent from the detailed specification and, thus, it is intended by the appended claims to cover all such features and advantages of the embodiments that fall within the true spirit and scope thereof. Further, since numerous modifications and changes will readily occur to those skilled in the art, it is not desired to limit the inventive embodiments to the exact construction and operation illustrated and described, and accordingly all suitable modifications and equivalents may be resorted to, falling within the scope thereof.
The preferred embodiments of the present invention are described as follows in reference to the drawings.
Nowadays, many of the commercial DBMS like Oracle supports rollback to savepoint. But they don't wakeup the waiting transaction upon rollback to savepoint. User (such as new or other session) is allowed to operate on rows after rollback to savepoint, if no other session is already waiting to operate on that row.
Furthermore, there are some methods for implementing the save point using nested transaction. In this method, for each savepoint creation a transaction started and is rolled back to support rollback to savepoint. But the problem with the method is that, it requires more resource.
For example, in PostgreSQL technology, after each savepoint a new transaction id (sub-transaction) and corresponding resource owner is allocated. After taking locks (relation, transaction etc.) under each sub-transaction, it associates current sub-transaction resource owner with that lock. So after each savepoint, any new locks will have different resource owner.
While rollback to savepoint, for each savepoint, whole lock list needs to be scanned to match the corresponding resource owner, if it matches then it releases the lock. Incase there
are multiple savepoint in a transaction and rollback to first savepoint is done, PostgreSQL has to traverse the whole lock list equal to intermediate number of Savepoint.
For Example, there is a segment of a transaction. PostgreSQL will traverse the lock list 4 times to perform rollback to savepoint in above case.
Table 1
Start Transaction;
Update tbl, Savepoint mypointl;
Delete from tbl , Savepoint mypoint2;
Update tbl l, Savepoint mypoint3;
Update tbl_2, Savepoint mypoint4;
Delete from tbl_3, Rollback to mypointl;
The present invention should build upon a common feature of lock manages, the capacity to efficiently release locks owned by a given owning work unit. The method should not incur unduly burdensome overhead. The present invention addresses such a need. It is based on the fact that, once the last version of a record is used for roll backing, then it is safe to release the lock attach to that record. This will make sure the waiting transaction to be released for operation and further transaction to be able to do write operation on the record.
The present invention tries to propose a method for doing rollback to savepoint using these multi version records as a mark. This mark will be used to decide on the point to which rollback will be done. So whenever user creates a savepoint, a handle to the last version of the record will be attached to the savepoint and the same will be used during rollback to the savepoint.
The present invention makes sure that the waiting transaction will be woken up after rollback to save point is done. Furthermore, it makes use of the exiting resource as a mark and thus less resource usage and is less complex in nature. According to the present invention, lock list in the table 1 has to be scanned once irrespective of number of savepoint. So the present invention is better than PostgreSQL incase there are multiple savepoint in a transaction.
Embodiment 1
This embodiment of the present invention provides a rollback method of transaction, applied in a relational database management system.
Figure 1 is a flowchart of the method of an embodiment of the present invention. As shown in Figure 1, the method includes:
Step 101, acquiring an undo record from a transaction block when a rollback to a savepoint is happended;
Step 102, judging whether the undo record is the first undo record of a piece of data;
Step 103, marking release information on LCB (Lock Control Block) corresponding to the piece of data if the undo record is the first undo record, such that one or more transactions waiting for the LCB are released after applying the undo operation.
In this embodiment, for system which uses multi version control, the changes done to data (such as a tuple) are recorded using undo records. A copy of the original record is stored in the undo segment, before doing modification on the actual record.
In this embodiment, if a transaction comes for reading a record which is getting updated by a different transaction, a committed copy of the updated tuple is used for the read purpose. This read copy is different from other undo entries and can be identified easily. In fact, this is the first undo record for the tuple for that transaction.
In this embodiment, the idea is to use this information to mark if a lock on the record can be released or not after a rollback to savepoint. When a transaction want to do some write operation on a record, it has to do so by attaching a lock to the record and thus allowing other write transaction to wait by attaching a waiting lock to this lock.
In this embodiment, a lock can be a data structure having parent transaction information and the waiting transactions information. There will be a one to one mapping between the record and lock for a transaction. While doing rollback to savepoint, if the transaction uses the first undo record for undo, then there is no more modification left and thus the lock of the record can be marked for release.
In this embodiment, after rollback is done, the lock of the transaction can be scanned and the marked locks can be released after setting the waiting transaction to free. In case, no transactions are waiting for the tuple, then the transaction stamp from the tuple can be removed, so that the next transaction need not wait for first transaction to commit.
Figure 2 is an example showing LCB is marked of the present invention. As shown in Figure 2, there are two pieces of data (Tuple 1 and Tuple2); and LCB1 corresponds to Tuple 1, LCB2 corresponds to Tuple2. Furthermore, there are 7 records (from Undol to Undo7) and a savepoint is set between Undo2 and Undo3. Wherein Undol, Undo2, Undo4, Undo6 are used for Tuplel ; Undo3, Undo5, Undo7 are used for Tuple2.
As shown in Figure 2, Undol is the first undo record written for the Tuplel and Undo3 is the first undo record for the Tuple2. When rollback to the savepoint is done, Undo3 will get replayed and the LCB2 will be marked for release, thus the lock for the Tuple2 will be released. But for rollback to the savepoint, Undol will not get replayed and the LCB1 will not be marked for release, thus its locks will not be released.
In this embodiment, the method may further include: judging whether identifier of the undo record matches identifier of the savepoint; and acquiring another undo record from the transaction block if identifier of the undo record does not match identifier of the savepoint.
In this embodiment, the method may further include: acquiring a LCB from the transaction block if identifier of the undo record matches identifier of the savepoint; judging whether the LCB is marked for release; releasing the transaction waiting for the LCB and the LCB if the LCB is marked for release.
In this embodiment, the method may further include: removing the marked release information from the LCB if the LCB is marked for release.
In this embodiment, the method may further include: judging whether end of the LCB list for the transaction is reached; and acquiring another LCB from the transaction block if end of the LCB list for the transaction is not reached.
Figure 3 is another flowchart of the method of an embodiment of the present invention. As shown in Figure 3, the method includes:
Step 301, start rollback to a savepoint.
Step 302, get an undo record from the transaction block.
Step 303, apply the undo operation.
Step 304, judge whether the undo record is the first undo record of a piece of data; if yes then execute step 305, if no then execute 306.
Step 305, mark on LCB corresponding to the piece of data.
Step 306, judge whether identifier of the undo record matches identifier of the savepoint; if yes then execute 307, if no then execute 302.
Step 307, get a LCB from the transaction block.
Step 308, judge whether the LCB is marked for release; if yes then execute 309, if no then execute 312.
Step 309, remove the transaction mark from the LCB.
Step 310, release the transaction waiting for the LCB.
Step 311, free the LCB.
Step 312, judge whether end of the LCB list for the transaction is reached; if no then execute 307.
It can be seen from the above embodiment that lock release algorithm will be more efficient as it needs to traverse the lock list only once; and lock will be released even if some transactions are already waiting for the same tuple. Furthermore, there is no separate resource to release locks during rollback to savepoint.
Embodiment 2
This embodiment of the present invention provides a rollback apparatus of transaction, applied in a relational database management system. This embodiment corresponds to the method of the above embodiment 1 and the same content will not be described.
Figure 4 is a schematic diagram of the rollback apparatus of an embodiment of the present invention. As shown in Figure 4, the rollback apparatus 400 includes: a first acquiring unit 401, a first judging unit 402, a marking unit 403. Other parts of the rollback apparatus 400 can refer to the existing technology and not be described in the present application.
Wherein, the first acquiring unit 401 is configured to acquire an undo record from a transaction block when a rollback to a savepoint is happended; the first judging unit 402 is configured to judge whether the undo record is the first undo record of a piece of data; the marking unit 403 is configured to mark release information on LCB corresponding to the piece of data if the undo record is the first undo record.
Figure 5 is another schematic diagram of the rollback apparatus of an embodiment of the present invention. As shown in Figure 5, the rollback apparatus 500 includes: a first acquiring unit 401, a first judging unit 402, a marking unit 403. As described in above content.
As shown in Figure 5, the rollback apparatus 500 further includes: a second judging unit 504. The second judging unit 504 is configured to judge whether identifier of the undo
record matches identifier of the savepoint. And the first acquiring unit 401 is further configured to acquire another undo record from the transaction block if identifier of the undo record does not match identifier of the savepoint.
As shown in Figure 5, the rollback apparatus 500 further includes: a second acquiring unit 505, a third judging unit 506 and a releasing unit 507.
Wherein, the second acquiring unit 505 is configured to acquire a LCB from the transaction block if identifier of the undo record matches identifier of the savepoint; the third judging unit 506 is configured to judge whether the LCB is marked for release; the releasing unit 507 is configured to release the transaction waiting for the LCB and the LCB if the LCB is marked for release.
As shown in Figure 5, the rollback apparatus 500 further includes: a removing unit 508, the removing unit 508 is configured to remove the marked release information from the LCB if the LCB is marked for release.
As shown in Figure 5, the rollback apparatus 500 further includes: a fourth judging unit 509, the fourth judging unit 509 is configured to judge whether end of the LCB list for the transaction is reached. And the second acquiring unit 505 is further configured to acquire another LCB from the transaction block if end of the LCB list for the transaction is not reached.
This embodiment of the present invention further provides a relational database management system, wherein the relational database management system includes a rollback apparatus of transaction as described in above content.
It can be seen from the above embodiment that lock release algorithm will be more efficient as it needs to traverse the lock list only once; and lock will be released even if some transactions are already waiting for the same tuple. Furthermore, there is no separate resource to release locks during rollback to savepoint.
It should be understood that each of the parts of the present invention may be implemented by hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods may be realized by software or firmware that is stored in the memory and executed by an appropriate instruction executing system. For example, if it is realized by hardware, it may be realized by any one of the following technologies known in the art or a combination thereof as in another embodiment: a discrete
logic circuit having a logic gate circuit for realizing logic functions of data signals, application-specific integrated circuit having an appropriate combined logic gate circuit, a programmable gate array (PGA), and a field programmable gate array (FPGA), etc.
The description or blocks in the flowcharts or of any process or method in other manners may be understood as being indicative of comprising one or more modules, segments or parts for realizing the codes of executable instructions of the steps in specific logic functions or processes, and that the scope of the preferred embodiments of the present invention comprise other implementations, wherein the functions may be executed in manners different from those shown or discussed, including executing the functions according to the related functions in a substantially simultaneous manner or in a reverse order, which should be understood by those skilled in the art to which the present invention pertains.
The logic and/or steps shown in the flowcharts or described in other manners here may be, for example, understood as a sequencing list of executable instructions for realizing logic functions, which may be implemented in any computer readable medium, for use by an instruction executing system, device or apparatus (such as a system including a computer, a system including a processor, or other systems capable of extracting instructions from an instruction executing system, device or apparatus and executing the instructions), or for use in combination with the instruction executing system, device or apparatus.
The above literal description and drawings show various features of the present invention. It should be understood that those skilled in the art may prepare appropriate computer codes to carry out each of the steps and processes as described above and shown in the drawings. It should be also understood that all the terminals, computers, servers, and networks may be any type, and the computer codes may be prepared according to the disclosure to carry out the present invention by using the apparatus.
Particular embodiments of the present invention have been disclosed herein. Those skilled in the art will readily recognize that the present invention is applicable in other environments. In practice, there exist many embodiments and implementations. The appended claims are by no means intended to limit the scope of the present invention to the above particular embodiments. Furthermore, any reference to "a device to..." is an explanation of device plus function for describing elements and claims, and it is not desired that any element using no reference to "a device to..." is understood as an element of device
plus function, even though the wording of "device" is included in that claim.
Although a particular preferred embodiment or embodiments have been shown and the present invention has been described, it is obvious that equivalent modifications and variants are conceivable to those skilled in the art in reading and understanding the description and drawings. Especially for various functions executed by the above elements (portions, assemblies, apparatus, and compositions, etc.), except otherwise specified, it is desirable that the terms (including the reference to "device") describing these elements correspond to any element executing particular functions of these elements (i.e. functional equivalents), even though the element is different from that executing the function of an exemplary embodiment or embodiments illustrated in the present invention with respect to structure. Furthermore, although the a particular feature of the present invention is described with respect to only one or more of the illustrated embodiments, such a feature may be combined with one or more other features of other embodiments as desired and in consideration of advantageous aspects of any given or particular application.
Claims
1. A rollback method of transaction, applied in a relational database management system, the method comprising:
acquiring an undo record from a transaction block when a rollback to a savepoint is happended;
judging whether the undo record is the first undo record of a piece of data;
marking release information on LCB (Lock Control Block) corresponding to the piece of data if the undo record is the first undo record, such that one or more transactions waiting for the LCB are released after applying the undo operation.
2. The method according to claim 1, wherein the method further comprising:
judging whether identifier of the undo record matches identifier of the savepoint;
and acquiring another undo record from the transaction block if identifier of the undo record does not match identifier of the savepoint.
3. The method according to claim 2, wherein the method further comprising:
acquiring a LCB from the transaction block if identifier of the undo record matches identifier of the savepoint;
judging whether the LCB is marked for release;
releasing the transaction waiting for the LCB and the LCB if the LCB is marked for release.
4. The method according to claim 3, wherein the method further comprising:
removing the marked release information from the LCB if the LCB is marked for release.
5. The method according to claim 3 or 4, wherein the method further comprising:
judging whether end of the LCB list for the transaction is reached;
and acquiring another LCB from the transaction block if end of the LCB list for the transaction is not reached.
6. A rollback apparatus of transaction, applied in a relational database management system, the apparatus comprising:
a first acquiring unit, configured to acquire an undo record from a transaction block when a rollback to a savepoint is happended;
a first judging unit, configured to judge whether the undo record is the first undo record of a piece of data;
a marking unit, configured to mark release information on LCB corresponding to the piece of data if the undo record is the first undo record.
7. The apparatus according to claim 6, wherein the apparatus further comprising:
a second judging unit, configured to judge whether identifier of the undo record matches identifier of the savepoint;
and the first acquiring unit is further configured to acquire another undo record from the transaction block if identifier of the undo record does not match identifier of the savepoint.
8. The apparatus according to claim 7, wherein the apparatus further comprising:
a second acquiring unit, configured to acquire a LCB from the transaction block if identifier of the undo record matches identifier of the savepoint;
a third judging unit, configured to judge whether the LCB is marked for release;
a releasing unit, configured to release the transaction waiting for the LCB and the LCB if the LCB is marked for release.
9. The apparatus according to claim 8, wherein the apparatus further comprising:
a removing unit, configured to remove the marked release information from the LCB if the LCB is marked for release.
10. The apparatus according to claim 8 or 9, wherein the apparatus further comprising: a fourth judging unit, configured to judge whether end of the LCB list for the transaction is reached;
and the second acquiring unit is further configured to acquire another LCB from the transaction block if end of the LCB list for the transaction is not reached.
11. A relational database management system, wherein the relational database management system comprising a rollback apparatus of transaction as claimed in any one of claims 6-10.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201380027716.4A CN104603775B (en) | 2012-08-14 | 2013-08-14 | The rollback method and device and relational database management system of affairs |
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
IN3370/CHE/2012 | 2012-08-14 | ||
IN3370CH2012 | 2012-08-14 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2014026611A1 true WO2014026611A1 (en) | 2014-02-20 |
Family
ID=50101247
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2013/081469 WO2014026611A1 (en) | 2012-08-14 | 2013-08-14 | Rollback method and apparatus of transaction, relational database management system |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN104603775B (en) |
WO (1) | WO2014026611A1 (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9501386B2 (en) | 2014-12-26 | 2016-11-22 | Microsoft Technology Licensing, Llc | System testing using nested transactions |
CN108363806A (en) * | 2018-03-01 | 2018-08-03 | 上海达梦数据库有限公司 | Multi-version concurrency control method, device, server and the storage medium of database |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6185577B1 (en) * | 1998-06-23 | 2001-02-06 | Oracle Corporation | Method and apparatus for incremental undo |
CN1507597A (en) * | 2001-05-15 | 2004-06-23 | �Ҵ���˾ | Method for managing distributed savepoints across multiple DBMS's within a distributed transaction |
US20060004757A1 (en) * | 2001-06-28 | 2006-01-05 | International Business Machines Corporation | Method for releasing update locks on rollback to savepoint |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1976694A (en) * | 2004-06-28 | 2007-06-06 | 爱尔康公司 | Topical formulations for treating allergic diseases |
CN101419616A (en) * | 2008-12-10 | 2009-04-29 | 阿里巴巴集团控股有限公司 | Data synchronization method and apparatus |
-
2013
- 2013-08-14 WO PCT/CN2013/081469 patent/WO2014026611A1/en active Application Filing
- 2013-08-14 CN CN201380027716.4A patent/CN104603775B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6185577B1 (en) * | 1998-06-23 | 2001-02-06 | Oracle Corporation | Method and apparatus for incremental undo |
CN1507597A (en) * | 2001-05-15 | 2004-06-23 | �Ҵ���˾ | Method for managing distributed savepoints across multiple DBMS's within a distributed transaction |
US20060004757A1 (en) * | 2001-06-28 | 2006-01-05 | International Business Machines Corporation | Method for releasing update locks on rollback to savepoint |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9501386B2 (en) | 2014-12-26 | 2016-11-22 | Microsoft Technology Licensing, Llc | System testing using nested transactions |
CN108363806A (en) * | 2018-03-01 | 2018-08-03 | 上海达梦数据库有限公司 | Multi-version concurrency control method, device, server and the storage medium of database |
CN108363806B (en) * | 2018-03-01 | 2020-07-31 | 上海达梦数据库有限公司 | Multi-version concurrency control method and device for database, server and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN104603775B (en) | 2018-06-19 |
CN104603775A (en) | 2015-05-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108363806B (en) | Multi-version concurrency control method and device for database, server and storage medium | |
US11068447B2 (en) | Directory level atomic commit protocol | |
US9223805B2 (en) | Durability implementation plan in an in-memory database system | |
EP3213230B1 (en) | Efficient maintenance of column store indexes on memory-optimized tables | |
EP2825957B1 (en) | Systems and methods for supporting inline delegation of middle-tier transaction logs to database | |
US9747356B2 (en) | Eager replication of uncommitted transactions | |
US9069704B2 (en) | Database log replay parallelization | |
CN108205464B (en) | Database deadlock processing method and device and database system | |
JP5343399B2 (en) | Management program, management method, and management apparatus | |
JP2004532480A5 (en) | ||
CN110727724B (en) | Data extraction method and device, computer equipment and storage medium | |
US10303785B2 (en) | Optimizing online schema processing for busy database objects | |
CN109063005B (en) | Data migration method and system, storage medium and electronic device | |
CN106155838A (en) | A kind of database back-up data restoration methods and device | |
US7752399B2 (en) | Exclusion control method and information processing apparatus | |
US6275832B1 (en) | Providing transaction undo without logging | |
WO2014026611A1 (en) | Rollback method and apparatus of transaction, relational database management system | |
US9348861B2 (en) | Capturing change data of deferred updates | |
CN111694853B (en) | Data increment collection method and device based on lineage, storage medium and electronic equipment | |
CN111240891A (en) | Data recovery method and device based on data consistency among multiple tables of database | |
CN106599006A (en) | Data recovery method and device | |
CN113704277B (en) | Breakpoint continuous transmission method based on database and related device | |
US11157367B1 (en) | Promotional logic during database differential backup | |
CN112817970B (en) | Data table generation method and device | |
CN114297217A (en) | Transaction concurrency control method and device, electronic equipment and readable storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 13829765 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 13829765 Country of ref document: EP Kind code of ref document: A1 |