Movatterモバイル変換


[0]ホーム

URL:


CN101615203B - Concurrency control method and device - Google Patents

Concurrency control method and device
Download PDF

Info

Publication number
CN101615203B
CN101615203BCN2009101608047ACN200910160804ACN101615203BCN 101615203 BCN101615203 BCN 101615203BCN 2009101608047 ACN2009101608047 ACN 2009101608047ACN 200910160804 ACN200910160804 ACN 200910160804ACN 101615203 BCN101615203 BCN 101615203B
Authority
CN
China
Prior art keywords
lock
affairs
granted
control method
carry out
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN2009101608047A
Other languages
Chinese (zh)
Other versions
CN101615203A (en
Inventor
印和平
常二鹏
卢勤元
丁奇鹏
陈河堆
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
ZTE Corp
Original Assignee
ZTE Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by ZTE CorpfiledCriticalZTE Corp
Priority to CN2009101608047ApriorityCriticalpatent/CN101615203B/en
Priority to PCT/CN2009/076082prioritypatent/WO2011009274A1/en
Publication of CN101615203ApublicationCriticalpatent/CN101615203A/en
Application grantedgrantedCritical
Publication of CN101615203BpublicationCriticalpatent/CN101615203B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Images

Classifications

Landscapes

Abstract

The invention provides a concurrency control method, which comprises the following steps: judging whether a lock conflicting with the lock to be granted exists at the position to be operated of the transaction according to a lock relation table, wherein the lock relation table is used for storing the relation between the transaction and the lock; according to the judgment result, a lock is granted to the transaction, and the transaction is executed; when the execution of the transaction is finished, the locks held by the transaction are released, and locks which do not need to continuously wait in the released locks are granted to other concurrent transactions. The present invention also provides a concurrency control device, including: a judgment module; an execution module; and releasing the module. The invention overcomes the problems of lower concurrency of transaction control and poorer system performance of the concurrency control method in the related technology, thereby improving the concurrency of the transaction control and improving the concurrency control effect.

Description

Concurrency control method and device
Technical field
The present invention relates to database field, in particular to a kind of concurrency control method and device.
Background technology
Database is a shared resource, and possibly there are the affairs of a plurality of concurrent execution in synchronization in Database Systems.When a plurality of user concurrents ground carries out accessing operation to database, will cause the situation of the same database of a plurality of affairs access simultaneously.Possibly there are following three kinds of conflicts such as affairs T1, T2 when the concurrent execution:
1) WR (Write/Read writes-read) conflict, promptly T2 reads in the data of just being revised by T1 and not submitting to as yet, and what T2 read in like this is dirty data, is also referred to as " dirty reading ";
2) RW (Read/Write reads-write) conflict, promptly T2 revises the data and the T1 end as yet of just having been read in by T1, and T1 is if read in same target once more like this, and then its value can change, and is also referred to as " non-repeatable read ";
3) WW (Write/Write writes-write) conflict, promptly T2 overrides value and the T1 end of just having been revised by T1 as yet, can cause the inconsistency of data like this.
Serial scheduling can guarantee the consistance of data, but is unfavorable for system performance, so DBMS (Database Management System, data base management system (DBMS)) must provide the transaction concurrency controlling mechanism.Serializability is the criterion of concurrent transaction correctness, thus a given concurrent control, and if only if it when being serializability, be only correct control.
Strict 2PL (Strict 2-Phase Locking, strict two-stage lock) agreement has guaranteed the serializability of concurrent control, and its content is: 1) before the object of read/write data storehouse, must add the read/write lock earlier; 2) affairs execute (submitting to or rollback), discharge the lock that it has again.
A kind of concurrency control method is provided in the correlation technique, and this method is through locking to operated data-base recording, and lets other concurrent transactions wait in line, and prevents that this record is simultaneously by other transactions modify.
The inventor finds that other concurrent transactions that the concurrency control method in the correlation technique makes all requests operate same data-base recording all get into waiting list; After being finished to lock release by last lock-based transaction execution; Other concurrent transactions just are able to database operated again; Cause the concurrency of affairs control lower, concurrent control effect is relatively poor.
Summary of the invention
The present invention aims to provide a kind of concurrency control method and device; Can solve other concurrent transactions that concurrency control method in the correlation technique makes all requests operate same data-base recording and all get into waiting list; After being finished to lock release by last lock-based transaction execution; Other concurrent transactions just are able to database operated again, and cause the concurrency of affairs control lower, the problem that system performance is relatively poor.
In an embodiment of the present invention, a kind of concurrency control method is provided, has may further comprise the steps: whether the operating position of treating of judging affairs according to the lock relation table has and treats the afoul lock of granted lock, locks the relation that relation table is used to preserve affairs and lock; To the affairs granted lock, and carry out affairs according to judged result; When affairs are carried out end, discharge the lock that affairs are held, and the lock that need not in the lock that will discharge to continue to wait for is authorized other concurrent transactions.
Preferably, in above-mentioned concurrency control method, the lock relation table specifically comprises: transaction list is used to the affairs of preserving concurrent execution and not submitting to; The lock Hash table is used to follow the tracks of the lock of waiting in line; The chain table is used for association affairs and lock.
Preferably, in above-mentioned concurrency control method,, and carry out affairs and specifically comprise the affairs granted lock according to judged result:,, and carry out affairs the affairs granted lock if the operating position of treating of affairs does not have lock.
Preferably, in above-mentioned concurrency control method, to the affairs granted lock, and carry out affairs and specifically comprise according to judged result: if affairs treat the existing lock of operating position, the existing lock of inspection with treat whether granted lock exists and conflict; To the affairs granted lock, and carry out affairs according to check result.
Preferably, in above-mentioned concurrency control method, to the affairs granted lock, and carry out affairs and specifically comprise based on check result: if existing lock with treat that granted lock does not exist and conflict, to the affairs granted lock, and the execution affairs.
Preferably, in above-mentioned concurrency control method, to the affairs granted lock, and carry out affairs and specifically comprise based on check result: if existing lock with treat that granted lock exists and conflict, transaction queue's wait is set, treat granted lock until regaining; Carry out affairs.
Preferably, in above-mentioned concurrency control method, carry out affairs comprise following one of at least: increase operation, carry out deletion action, the operation of making amendment, carry out read operation.
Preferably, in above-mentioned concurrency control method, affairs are carried out and finished to comprise: affairs are accomplished and are submitted to or affairs completion rollback.
Preferably, in above-mentioned concurrency control method, authorize other concurrent transactions with the lock that need not in the lock that discharges to continue to wait for and specifically comprise: each lock in the lock place chain table that discharges, detect whether the sign of wait is arranged; As waiting for sign; And when there is not the lock type comflict in other locks on the same operating position of lock to be detected and other concurrent transactions; Authorize other concurrent transactions with lock to be detected, wake other concurrent transactions up and continue to carry out, the lock type comprises shared lock and exclusive lock.
In an embodiment of the present invention, a kind of concurrent control device is provided also, has comprised: judge module is used for judging that according to the lock relation table whether the operating position of treating of affairs has and treat the afoul lock of granted lock, locks the relation that relation table is used to preserve affairs and lock; Execution module is used for according to judged result the affairs granted lock, and carries out affairs; Release module is used for when affairs are carried out end, discharge the lock that affairs are held, and the lock that need not in the lock that will discharge to continue to wait for being authorized other concurrent transactions.
Preferably, in above-mentioned concurrent control device, the lock relation table specifically comprises: transaction list is used to the affairs of preserving concurrent execution and not submitting to; The lock Hash table is used to follow the tracks of the lock of waiting in line; The chain table is used for association affairs and lock.
The foregoing description is because the relation that adopts the lock relation table to preserve its corresponding lock of affairs; So can lock the judgement that whether has conflict to pointing to the same difference of operating position of treating; And carry out differentiated treatment according to judged result; In a single day rather than treat the concurrency control method that in correlation technique operative position is equipped with lock and just all lists the corresponding affairs of every other lock in waiting list, and so it is lower to the concurrency of affairs control to have overcome the concurrency control method in the correlation technique, the problem that system performance is relatively poor; And then improved the concurrency of affairs controls, improved concurrent control effect.
Description of drawings
Accompanying drawing described herein is used to provide further understanding of the present invention, constitutes the application's a part, and illustrative examples of the present invention and explanation thereof are used to explain the present invention, do not constitute improper qualification of the present invention.In the accompanying drawings:
Fig. 1 shows the process flow diagram according to the concurrency control method of first embodiment of the invention;
Fig. 2 shows the synoptic diagram of the lock Hash table that concurrency control method adopts among Fig. 1;
Fig. 3 shows the process flow diagram according to the concurrency control method of second embodiment of the invention;
Fig. 4 shows the structural drawing according to the concurrent control device of third embodiment of the invention.
Embodiment
Below with reference to accompanying drawing and combine embodiment, specify the present invention.
Fig. 1 shows the process flow diagram according to the concurrency control method of first embodiment of the invention, and this method may further comprise the steps:
Step S101 judges according to the lock relation table whether the operating position of treating of affairs has and treat the afoul lock of granted lock, locks the relation that relation table is used to preserve affairs and lock;
Step S102 to the affairs granted lock, and carries out affairs according to judged result;
Step S103 when affairs are carried out end, discharge the lock that affairs are held, and the lock that need not in the lock that will discharge to continue to wait for is authorized other concurrent transactions.
Present embodiment at first judges according to the lock relation table whether the operating position of treating of affairs has and treat the afoul lock of granted lock; Then according to judged result to the affairs granted lock, and carry out affairs, at last when affairs are carried out end; Discharge the lock that affairs are held; And the lock that need not in the lock that will discharge to continue to wait for authorizes other concurrent transactions, because the relation that has adopted the lock relation table to preserve its corresponding locks of affairs, so can lock the judgement that whether has conflict to pointing to the same difference of operating position of treating; And carry out differentiated treatment according to judged result; In a single day rather than treat the concurrency control method that in correlation technique operative position is equipped with lock and just all lists the corresponding affairs of every other lock in waiting list, and so it is lower to the concurrency of affairs control to have overcome the concurrency control method in the correlation technique, the problem that system performance is relatively poor; And then improved the concurrency of affairs controls, improved concurrent control effect.
Preferably, in above-mentioned concurrency control method, the lock relation table specifically comprises: transaction list is used to the affairs of preserving concurrent execution and not submitting to; The lock Hash table is used to follow the tracks of the lock of waiting in line; The chain table is used for association affairs and lock.
Lock relation table in the present embodiment specifically comprises transaction list, lock Hash table and chain table; The concurrency control method that is arranged so that present embodiment of above-mentioned table can effectively be managed affairs and lock; Comprise index location, traversal search etc. apace; And then realized locking the judgement that whether has conflict to pointing to the same difference of operating position of treating, for providing, above-mentioned concurrency control method provides powerful support for.
Transaction list is preserved the current affairs transaction information of other affairs of concurrent execution in the system when carrying out; The principle that is inserted into team's head according to the late comer is inserted, the pointer of node, the meter pointer of chain table etc. before and after transaction information specifically comprises in affairs ID, transaction types, the sensing transaction list.Affairs of each startup all can be inserted into these affairs in the transaction list, promptly can the transaction information of these affairs be saved in the transaction list.Comprise a thread structure information in the transaction structure, wherein comprised event object, when affairs because of waiting for the lock hanging time-out, carry out this event object of thread waits of affairs; When the affairs granted lock thereby when being waken up, the thread of granted lock is provided with this event object.
Fig. 2 shows the synoptic diagram of the lock Hash table that concurrency control method adopts among Fig. 1; As shown in Figure 2; Each list item of lock Hash table is corresponding to the gauge outfit of a chain table; Do like this, make that be that key calculates cryptographic hash with the file space of writing down in the lock construction number with page number, can navigate to corresponding chain table through corresponding lock Hash table list item.
The chain table is used for the affairs of association affairs tabulation record and locks the lock that writes down in the Hash table; As shown in Figure 2; Each chain table comprises a plurality of lock constructions; Each lock construction has write down information such as the file space number, page number, lock-bit figure, the shared bit of lock-bit figure (bit) number, lock type (shared lock, exclusive lock), lock sign (wait for, authorize), affiliated affairs of the data-base recording of the lock locking of waiting in line, and wherein the heap_no position of lock-bit figure is a sign of treating the operating position record.Each affairs is corresponding to a chain table, lock of the every application of affairs, and all chain is gone in corresponding chain table, and this chain table is preserved the lock that these affairs are held, and every pair of record is operated, and just can insert in the corresponding chain table of these affairs locking accordingly.A lock construction can be shared with other lock of the same type on one page; The lock that on other record, adds same type if desired; Only need in the chain table, to search to have or not similar lock; If find then, adopt single linked list promptly to solve hash collision like this, and saved memory headroom effectively with the corresponding heap_no bit of lock-bit figure.
Preferably, in above-mentioned concurrency control method, step S102 specifically comprises: if the operating position of treating that thing 0 is engaged in does not have lock, to the affairs granted lock, and carry out affairs.
If the operating position of treating of affairs does not have lock,, and carry out respective transaction in the present embodiment then to these affairs granted lock.Do like this, make data-base recording to be operated when not having other transaction operations, accept the operation of these affairs, under the prerequisite that guarantees concurrent control correctness, improved the concurrency of control.
Preferably, in above-mentioned concurrency control method, step S102 specifically comprises: if affairs treat the existing lock of operating position, the existing lock of inspection with treat whether granted lock exists and conflict; To the affairs granted lock, and carry out affairs according to check result.
In the present embodiment if affairs treat the existing lock of operating position, then need continue to check existing lock and treat whether granted lock exists and conflict that this conflict comprises: WR conflict, RW conflict and WW are outstanding, and then according to check result to the affairs granted lock, and execution affairs.Do like this, can and not exist two kinds of different situations of conflict to carry out differentiated treatment to the existence conflict, rather than after judgement obtains existing the lock, just every other affairs are hung up wait, improved the concurrency of control.
Preferably, in above-mentioned concurrency control method, to the affairs granted lock, and carry out affairs and specifically comprise based on check result: if existing lock with treat that granted lock does not exist and conflict, to the affairs granted lock, and the execution affairs.
Though in the present embodiment affairs treat the existing lock of operating position, check result for existing lock with treat that granted lock does not exist and conflict, at this moment, still to the affairs granted lock, and the execution affairs.Present embodiment has been caught the execution opportunity of concurrent transaction under situation about being independent of each other, and makes the available resources maximization, and the concurrency control method of comparing in the correlation technique has improved the concurrency of control effectively.
Preferably, in above-mentioned concurrency control method, to the affairs granted lock, and carry out affairs and specifically comprise based on check result: if existing lock with treat that granted lock exists and conflict, transaction queue's wait is set, treat granted lock until regaining; Carry out affairs.
In the present embodiment if affairs treat the existing lock of operating position, and existing lock with treat that granted lock exists and conflict, these affairs then are set hang up insertion waiting list and wait in line, treat granted lock until regaining, and the execution affairs.Do like this; Make affairs to satisfy simultaneously to treat existing lock of operating position and existing lock with treat condition that the granted lock existence conflicts under just can hang up wait; Be that affairs are only just waited for when other concurrent transactions influence definite can receiving; Under the prerequisite that guarantees concurrent control correctness, improved the concurrency of control.
Preferably, in above-mentioned concurrency control method, carry out affairs comprise following one of at least: increase that (insert is also referred to as insertion) operated, carried out deletion action, the operation of making amendment, carry out read operation.
Carrying out affairs in the present embodiment can be for increasing, deletes, revise, read, or its combination.The concurrency control method of present embodiment is not limited to a certain operation, but may extend to above-mentioned four kinds of basic operations, and perhaps range of application has been expanded in its combination.
Fig. 3 shows the process flow diagram according to the concurrency control method of second embodiment of the invention, is operating as the example explanation with insertion in the present embodiment, and this method may further comprise the steps:
Step S301, watcher thread receives SQL (Structured Query Language, SQL) statement query requests, and distributes a worker thread to handle query requests;
Step S302, worker thread is carried out SQL query analysis and SQL query optimization, generates executive plan;
Step S303, worker thread adds the purpose exclusive lock to the latching operation table, shows that soon his-and-hers watches are carried out write operation;
Step S304, worker thread navigates to the record that article one satisfies X<=tuple from being inserted into data recording structure index entry tuple (tuple), navigates to the page or leaf that is inserted into record fast in order to index of reference;
Step S305 judges the Field Count of whether having built unique index and vernier coupling on the table more than or equal to the unique key Field Count, if less than, forward step S314 to;
Step S306 from being inserted into data recording structure index entry tuple (tuple), navigates to the record that article one satisfies X>=tuple, and X is an index record;
Step S307, whether if maximum transaction ID is more than or equal to minimum affairs ID in the current active affairs on the page, then checking has the implicit expression lock, if having, forward step S309 in the current record;
Step S308, this inserts operation and waits in line;
Step S309 obtains the corresponding gathering index record of current index record, if this record is just to insert, the implicit expression lock is arranged on this record then, converts this implicit expression lock into explicit lock;
Step S310 judges whether X=tuple sets up, and X=tuple representes to exist the unique key conflict, and also the unique key constraint is violated in expression, if be false, forwards step S312 to;
Step S311, newspaper repeat key mistake forwards step S305 to;
Step S312, shared lock documentarily;
Step S313 is repositioned onto the record that article one satisfies X<=tuple, and X is an index record;
Whether step S314 exists lock on next bar record of inspection current record, is that key calculates cryptographic hash with file space, record place number with page number promptly; Navigate to certain list item on the lock Hash table; Traversal is the chain table of gauge outfit with this list item, checks among the lock-bit figure of each lock the whether set of heap_no position, if the heap_no position is not set among the lock-bit figure; Promptly there is not lock on this record, forwards step S316 to;
Step S315, if the heap_no position is set among the lock-bit figure, then should upward there be lock in expression by record, continued to judge whether to exist lock conflict, if there is lock conflict, forwarded step S308 to;
Step S316, application locks successfully, inserts data, has prevented this record of other transactions modify;
Step S317 has lock if insert on next bar record that writes down, and then inherits the lock on next bar record, simultaneously waiting status is changed to the state of authorizing;
Step S318, affairs are carried out and are finished, and promptly affairs are accomplished and are submitted to or affairs completion rollback, discharge the lock of holding, and the lock that no longer need wait for is authorized in the formation of scanning lock Hash table lock simultaneously.
Present embodiment is applied in the Database Systems, such as the Database Systems of IPTV electronic program list.Because the number of users that each electronic program system can hold is limited, therefore a cover IPTV system need dispose a lot of electronic program lists.A commercial data base is all moved on each electronic program list backstage in the correlation technique; Cause cost higher; And present embodiment adopts above-mentioned concurrency control method near the commercial data base performance, has reduced cost, has satisfied the demand of IPTV system preferably; Possess the standard database characteristic simultaneously, these characteristics comprise transactional integrity, transaction concurrency control, fault recovery etc.Present embodiment has been controlled the transaction concurrency execution effectively, has guaranteed system performance simultaneously to the full extent.
Preferably, in above-mentioned concurrency control method, affairs are carried out and finished to comprise: affairs are accomplished and are submitted to or affairs completion rollback.
Affairs execution end comprises that the affairs completion is submitted to or affairs are accomplished rollback in the present embodiment, promptly when affairs completion submission or affairs completion rollback, discharges the lock that these affairs are held.When lock is accomplished the locking task, be released at once in the present embodiment, be convenient to other concurrent transactions and obtain corresponding lock, the chance to obtain to be performed helps to improve the concurrency of control.
Preferably, in above-mentioned concurrency control method, the lockset body that the release affairs are held comprises each lock in the lock place chain table that discharges, and it is deleted from this chain table, from the lock Hash table of correspondence, deletes simultaneously.
Carry out end when affairs in the present embodiment, when promptly these affairs are accomplished submission or accomplished rollback, the lock that these affairs are held is deleted from the corresponding chain table of these affairs, the while also deletes from the lock Hash table of correspondence.Present embodiment adopts will lock from corresponding chain table deletes the release that realizes lock with locking the Hash table; Operation is simple; And make and after lock is accomplished the locking task to certain affairs, be released at once; Be convenient to other concurrent transactions and obtain corresponding lock, the chance to obtain to be performed helps to improve the concurrency of control.
Preferably, in above-mentioned concurrency control method, authorize other concurrent transactions with the lock that need not in the lock that discharges to continue to wait for and specifically comprise: each lock in the lock place chain table that discharges, detect whether the sign of wait is arranged; As waiting for sign; And when there is not the lock type comflict in other locks on the same operating position of lock to be detected and other concurrent transactions; Authorize other concurrent transactions with lock to be detected, wake other concurrent transactions up and continue to carry out, the lock type comprises shared lock and exclusive lock.
Present embodiment detects at first whether the sign of wait is arranged in the lock type that is released lock; If the sign of wait is arranged; Showing that then lock is in waiting status, is that key calculates cryptographic hash with the file space, record place of the lock locking of waiting status number with page number then, navigates to the gauge outfit of corresponding chain table on the lock Hash table; Scanning lock place chained list; Whether have other lock to exist with it to each lock inspection in the chained list and lock type comflict, if there is the lock type comflict, lock then to be detected need wait for that existing the lock of locking type comflict to be released with it just might obtain to authorize chance; If there is not the lock type comflict; Lock then to be detected need not to wait for, authorizes other concurrent transactions with lock to be detected, the wait sign of this lock of resetting; Be about to this lock and change the state of authorizing into, and wake other corresponding concurrent transactions of lock to be detected up and continue to carry out by waiting status.
Fig. 4 shows the structural drawing according to the concurrent control device of third embodiment of the invention, and this device comprises:
Judge module 10 is used for judging that according to the lock relation table whether the operating position of treating of affairs has and treat the afoul lock of granted lock, locks the relation that relation table is used to preserve affairs and lock;
Execution module 20 is used for according to judged result the affairs granted lock, and carries out affairs;
Release module 30 is used for when affairs are carried out end, discharge the lock that affairs are held, and the lock that need not in the lock that will discharge to continue to wait for being authorized other concurrent transactions.
Present embodiment at first adoptsjudge module 10 to judge according to the lock relation table whether the operating position of treating of affairs has and treat the afoul lock of granted lock; Adopt thenexecution module 20 according to judged result to the affairs granted lock, and carry out affairs, adoptrelease module 30 at last when affairs are carried out end; Discharge the lock that affairs are held; And the lock that need not in the lock that will discharge to continue to wait for authorizes other concurrent transactions, because the relation that has adopted the lock relation table to preserve its corresponding locks of affairs, so can lock the judgement that whether has conflict to pointing to the same difference of operating position of treating; And carry out differentiated treatment according to judged result; In a single day rather than treat the concurrency control method that in correlation technique operative position is equipped with lock and just all lists the corresponding affairs of every other lock in waiting list, and so it is lower to the concurrency of affairs control to have overcome the concurrency control method in the correlation technique, the problem that system performance is relatively poor; And then improved the concurrency of affairs controls, improved concurrent control effect.
Preferably, in above-mentioned concurrent control device, the lock relation table specifically comprises: transaction list is used to the affairs of preserving concurrent execution and not submitting to; The lock Hash table is used to follow the tracks of the lock of waiting in line; The chain table is used for association affairs and lock.
Lock relation table in the present embodiment specifically comprises transaction list, lock Hash table and chain table; The concurrency control method that is arranged so that present embodiment of above-mentioned table can effectively be managed affairs and lock; Comprise index location, traversal search etc. apace; And then realized locking the judgement that whether has conflict to pointing to the same difference of operating position of treating, for providing, above-mentioned concurrency control method provides powerful support for.
Transaction list is preserved the current affairs transaction information of other affairs of concurrent execution in the system when carrying out; The principle that is inserted into team's head according to the late comer is inserted, the pointer of node, the meter pointer of chain table etc. before and after transaction information specifically comprises in affairs ID, transaction types, the sensing transaction list.Affairs of each startup all can be inserted into these affairs in the transaction list, promptly can the transaction information of these affairs be saved in the transaction list.Comprise a thread structure information in the transaction structure, wherein comprised event object, when affairs because of waiting for the lock hanging time-out, carry out this event object of thread waits of affairs; When the affairs granted lock thereby when being waken up, the thread of granted lock is provided with this event object.
As shown in Figure 2, each list item of lock Hash table is done corresponding to the gauge outfit of a chain table like this, makes that be that key calculates cryptographic hash with the file space of writing down in the lock construction number with page number, can navigate to corresponding chain table through corresponding lock Hash table list item.
The chain table is used for the affairs of association affairs tabulation record and locks the lock that writes down in the Hash table; As shown in Figure 2; Each chain table comprises a plurality of lock constructions; Each lock construction has write down information such as the file space number, page number, lock-bit figure, the shared bit of lock-bit figure (bit) number, lock type (shared lock, exclusive lock), lock sign (wait for, authorize), affiliated affairs of the data-base recording of the lock locking of waiting in line, and wherein the heap_no position of lock-bit figure is a sign of treating the operating position record.Each affairs is corresponding to a chain table, lock of the every application of affairs, and all chain is gone in corresponding chain table, and this chain table is preserved the lock that these affairs are held, and every pair of record is operated, and just can insert in the corresponding chain table of these affairs locking accordingly.A lock construction can be shared with other lock of the same type on one page; The lock that on other record, adds same type if desired; Only need in the chain table, to search to have or not similar lock; If find then, adopt single linked list promptly to solve hash collision like this, and saved memory headroom effectively with the corresponding heap_no bit of lock-bit figure.
As can be seen from the above description, the above embodiments of the present invention have improved the concurrency of affairs controls, have improved concurrent control effect.
Obviously, it is apparent to those skilled in the art that above-mentioned each module of the present invention or each step can realize with the general calculation device; They can concentrate on the single calculation element; Perhaps be distributed on the network that a plurality of calculation element forms, alternatively, they can be realized with the executable program code of calculation element; Thereby; Can they be stored in the memory storage and carry out, perhaps they are made into each integrated circuit modules respectively, perhaps a plurality of modules in them or step are made into the single integrated circuit module and realize by calculation element.Like this, the present invention is not restricted to any specific hardware and software combination.
The above is merely the preferred embodiments of the present invention, is not limited to the present invention, and for a person skilled in the art, the present invention can have various changes and variation.All within spirit of the present invention and principle, any modification of being done, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.

Claims (8)

When said affairs are carried out end; Discharge the lock that said affairs are held; And the lock that need not in the said lock that will discharge to continue to wait for is authorized other concurrent transactions; Wherein, authorize other concurrent transactions with the lock that need not in the said lock that discharges to continue to wait for and specifically comprise: each lock in the said lock place chain table that discharges, detect whether the sign of wait is arranged; As waiting for sign; And when there is not the lock type comflict in other locks on the said lock to be detected and the same operating position of said other concurrent transactions; Authorize said other concurrent transactions with said lock to be detected; Wake said other concurrent transactions up and continue to carry out, said lock type comprises shared lock and exclusive lock.
CN2009101608047A2009-07-232009-07-23Concurrency control method and deviceActiveCN101615203B (en)

Priority Applications (2)

Application NumberPriority DateFiling DateTitle
CN2009101608047ACN101615203B (en)2009-07-232009-07-23Concurrency control method and device
PCT/CN2009/076082WO2011009274A1 (en)2009-07-232009-12-25Method and apparatus of concurrency control

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN2009101608047ACN101615203B (en)2009-07-232009-07-23Concurrency control method and device

Publications (2)

Publication NumberPublication Date
CN101615203A CN101615203A (en)2009-12-30
CN101615203Btrue CN101615203B (en)2012-04-04

Family

ID=41494843

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN2009101608047AActiveCN101615203B (en)2009-07-232009-07-23Concurrency control method and device

Country Status (2)

CountryLink
CN (1)CN101615203B (en)
WO (1)WO2011009274A1 (en)

Families Citing this family (23)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US9104715B2 (en)*2010-06-232015-08-11Microsoft Technology Licensing, LlcShared data collections
CN102103642B (en)*2011-03-252016-08-03北京世纪互联宽带数据中心有限公司Data-erasure method based on OLTP, system and graphic data base server
CN104252386B (en)*2013-06-262017-11-21阿里巴巴集团控股有限公司The locking method and equipment of data renewal
CN106663062B (en)*2014-04-302019-08-16甲骨文国际公司 System and method for providing distributed transaction locks in a transactional middleware machine environment
US20160092488A1 (en)*2014-09-262016-03-31Futurewei Technologies, Inc.Concurrency control in a shared storage architecture supporting on-page implicit locks
CN104252545B (en)*2014-10-112017-05-31南京国电南自维美德自动化有限公司A kind of implementation method of the object type attributes type lock of real-time internal memory database
CN104657237A (en)*2015-03-122015-05-27浪潮集团有限公司Method for detecting disk array
CN104679881B (en)*2015-03-132019-03-08华为技术有限公司 Concurrency control method and device
CN106156126B (en)*2015-04-082019-10-11阿里巴巴集团控股有限公司Handle the data collision detection method and server in data task
CN107291371B (en)*2016-03-312019-11-19华为技术有限公司 Method and device for implementing a read-write lock
CN106250487B (en)*2016-07-292020-07-03新华三技术有限公司Database concurrency control method and device
CN107016041B (en)*2017-01-192020-05-05阿里巴巴集团控股有限公司Method and device for controlling single data to be exported
CN109388645B (en)*2017-08-112023-02-24腾讯科技(深圳)有限公司Instruction execution method, instruction execution device, and storage medium
CN109376165A (en)*2018-11-142019-02-22深圳市金证科技股份有限公司The implementation method and device and computer readable storage medium of memory database lock
CN109933606B (en)*2019-03-192021-04-27上海达梦数据库有限公司Database modification method, device, equipment and storage medium
CN110750356B (en)*2019-09-092022-03-29华南师范大学Multi-core interaction method, system and storage medium suitable for nonvolatile memory
CN110909012B (en)*2019-12-042020-09-04上海达梦数据库有限公司Method, device, equipment and storage medium for blocking database object
CN111198872B (en)*2020-01-062021-06-11中科驭数(北京)科技有限公司Method and device for processing transactions by database
CN111858626B (en)*2020-06-042024-06-21武汉达梦数据库股份有限公司Parallel execution-based data synchronization method and device
CN111984379B (en)*2020-07-142023-04-07上海金仕达软件科技股份有限公司Read-write transaction control method, system, terminal device and storage medium
CN112199391B (en)*2020-09-302024-02-23深圳前海微众银行股份有限公司Data locking detection method, equipment and computer readable storage medium
CN114676115A (en)*2022-04-012022-06-28上海达梦数据库有限公司Database modification method, device, equipment and medium
CN114817287A (en)*2022-05-092022-07-29南方电网大数据服务有限公司Electric power data access conflict processing method and device and computer equipment

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN100353325C (en)*2004-08-232007-12-05华为技术有限公司Method for realing sharing internal stored data base and internal stored data base system
US7689561B2 (en)*2005-12-072010-03-30Sap AgSystem and method for handling parallel updates of objects requiring time sensitive acknowledgement
CN1808389A (en)*2006-02-202006-07-26南京联创科技股份有限公司Autonomous locking method based on shared memory for account background memory database
CN100568184C (en)*2007-12-272009-12-09电子科技大学 Locking Method of Data Conflict Module in Collaborative Editing

Also Published As

Publication numberPublication date
CN101615203A (en)2009-12-30
WO2011009274A1 (en)2011-01-27

Similar Documents

PublicationPublication DateTitle
CN101615203B (en)Concurrency control method and device
US11580134B1 (en)Method and apparatus for resolving source database precommitted transactions that are replicated to a target database of a database replication system
CA2537411C (en)A database management system with efficient version control
CN101495976B (en) Method and system for directly updating software transactional memory
US5333316A (en)Locking and row by row modification of a database stored in a single master table and multiple virtual tables of a plurality of concurrent users
US5983225A (en)Parameterized lock management system and method for conditional conflict serializability of transactions
US7233947B2 (en)Timestamping in databases
Wu et al.Transaction healing: Scaling optimistic concurrency control on multicores
CN114207577A (en)Database implementation for different application versions
CN106354732B (en)A kind of off-line data version conflict solution for supporting concurrently to cooperate with
CN101714167B (en)Method and device for accessing monofile database
Chen et al.Plor: General transactions with predictable, low tail latency
CN101788922A (en)Method and device for realizing transaction storage system based on auxiliary thread
Perrizo et al.Hydro: A heterogeneous distributed database system
CA2414980A1 (en)Deferred incremental integrity maintenance of base tables having contiguous data blocks
Ammann et al.A two snapshot algorithm for concurrency control in multi-level secure databases
US12380086B2 (en)Method and apparatus for fine-grained hierarchical locking in a multi-master database system
US7617212B2 (en)System and method for controlling access to a database
US20090204967A1 (en)Reporting of information pertaining to queuing of requests
Lomet et al.Using the lock manager to choose timestamps
GB2356950A (en)System for improving concurrency through early release of unnecessary locks
CN117348977A (en)Method, device, equipment and medium for controlling transaction concurrency in database
Park et al.Priority-driven secure multiversion locking protocol for real-time secure database systems
Wang et al.TXSQL: Lock Optimizations Towards High Contented Workloads
HeSupporting Low-latency Transactions in Shared-memory Deterministic Databases

Legal Events

DateCodeTitleDescription
C06Publication
PB01Publication
C10Entry into substantive examination
SE01Entry into force of request for substantive examination
C14Grant of patent or utility model
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp