CN101556597B - Self-adaptive optimistic concurrency control method - Google Patents
Self-adaptive optimistic concurrency control method Download PDFInfo
- Publication number
- CN101556597B CN101556597B CN2009100256869A CN200910025686A CN101556597B CN 101556597 B CN101556597 B CN 101556597B CN 2009100256869 A CN2009100256869 A CN 2009100256869A CN 200910025686 A CN200910025686 A CN 200910025686A CN 101556597 B CN101556597 B CN 101556597B
- Authority
- CN
- China
- Prior art keywords
- affairs
- concurrent
- result
- optimistic
- concurrency control
- 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.)
- Expired - Fee Related
Links
- 238000000034 method Methods 0.000 title claims abstract description 63
- 230000009466 transformation Effects 0.000 claims description 14
- 239000012141 concentrate Substances 0.000 claims description 9
- 238000011217 control strategy Methods 0.000 claims description 5
- 238000009825 accumulation Methods 0.000 claims description 3
- 238000011426 transformation method Methods 0.000 claims description 2
- 230000007547 defect Effects 0.000 abstract 1
- 230000007246 mechanism Effects 0.000 description 9
- 230000003044 adaptive effect Effects 0.000 description 7
- 238000002474 experimental method Methods 0.000 description 5
- 230000007423 decrease Effects 0.000 description 3
- 230000015572 biosynthetic process Effects 0.000 description 2
- 238000006243 chemical reaction Methods 0.000 description 2
- 238000013500 data storage Methods 0.000 description 2
- 238000007726 management method Methods 0.000 description 2
- 238000004088 simulation Methods 0.000 description 2
- 238000013459 approach Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000000903 blocking effect Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000004321 preservation Methods 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 230000001105 regulatory effect Effects 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 239000004576 sand Substances 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
Images
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a self-adaptive optimistic concurrency control method, which is substantially applied to a multiple user concurrent environment based on a main memory. The method comprises twoconcurrency control methods that an optimistic concurrency control is converted into a pessimistic concurrency control and the pessimistic concurrency control is converted into the optimistic concurr ency control; when the system is under the environment of high collision rate, a concurrency control policy is converted into the pessimistic concurrency control from the optimistic concurrency control; and when the system is under the environment of low collision rate, the concurrency control policy is converted into the optimistic concurrency control from the pessimistic concurrency control. According to the elf-adaptive optimistic concurrency control method, compared with the pure optimistic concurrency control method or the pessimistic concurrency control method, the defect that the concurrency capability is reduced under the environment of high collision rate or the unlocking of a lock is avoided, and the concurrency capability of the system can be greatly improved.
Description
Technical field
The present invention relates to a kind of self-adaptive optimistic concurrency control method, be mainly used in belonging to database technical field in the multi-user concurrent environment based on main memory.
Background technology
The application that makes database that develops rapidly of infotech has obtained popularizing greatly, for more effective and more safely create and manage lot of data, and with the data long preservation, data base management system (DBMS) (Database Management System, DBMS) become the kernel software of data storage and data processing, wherein the concurrent control mechanism of DBMS becomes the important research direction of database field.
Concurrent control is the base unit of affairs as scheduling.Concurrent transaction mainly contains three kinds of conflicts, is respectively to cause lost update, destroys integrity constraint and inconsistent reading, and these conflicts have different influences to data base integrity and consistance.The purpose of concurrent control is exactly rationally to arrange the concurrent scheduling of affairs to avoid conflict, and improves the correctness and the utilization factor of system.Concurrent control mechanism is dispatched concurrent affairs, finally forms the dispatch list (Scheduler) of transaction concurrency sequence of operation.Dispatch list has decisive influence to the consistance of database, and the target of concurrent control algolithm forms a serializable dispatch list exactly.
The concurrent control mechanism of existing his-and-hers watches data mainly comprises two big classes:
(1) pessimistic concurrent control (PCC) generally is the concurrent control mechanism that adopts based on the lock agreement, if the operation application that the user carries out certain lock, then the owner up to this lock discharges this lock, other user could carry out and the operation of this lock conflict.This method mainly is used in the fierce environment of data contentions, and the cost that comes protected data with lock when concurrency conflict occurring is than in the low environment of the cost of rollback affairs, so claims that this method is pessimistic concurrent control.
(2) optimistic concurrent control (OCC), in the concurrent control of optimism, locking data not during user's read data, when carrying out renewal, system checks whether check has other users to upgrade data after this user runs through data, if another user has upgraded data, will produce a mistake.Generally speaking, the user who receives error message is with the rollback affairs and restart.This method mainly is used under the few environment of data contention, and under the environment of the cost of rollback affairs once in a while cost of locking data when being no more than read data, therefore claims that this method is optimistic concurrent control.
At present in database based on main memory, there is not the special concurrent control mechanism of realizing at main memory mechanism, it all is the database concurrent control mechanism of continuing to use based on disk, the existing patent relevant with the concurrent control of database mainly contains pessimistic concurrent control and optimistic concurrent control two big classes, but these concurrent control mechanisms all have the shortcoming of oneself in the main memory environment:
(1) pessimistic concurrent control, because data storage is in internal memory, the affairs execution time is shorter, it is also shorter to hold the lock time, conflict is less in the system, blocking the CPU cost that produces can produce serious influence to performance, and therefore traditional concurrent control strategy of the database based on disk can have a strong impact on concurrent performance.Existing patented claim situation is as follows:
1. Multiple version database concurrency control system (date of application: 1991.11.26, application number: US005280612A);
2. Database system concurrency control apparatus using timestamps andprocessing time estimation (date of application: 1990.10.10, application number: US005471614A).
(2) optimistic concurrent control, though avoided the expense that locks, the cost that affairs are restarted is higher, so can cause the rapid decline of concurrency under the serious environment of conflict.Existing patented claim situation is as follows:
1. a kind of real-time security concurrency control protocol (date of application: 2006.10.13, application number: 200610130104.X) of suitable moving distributing real-time data base;
2. Efficient optimistic concurrency control and lazy queries for B-trees andother database structures (date of application: 1997.4, application number: US005920857A);
3. Method, system, and program for optimistic concurrency control forscrollable cursors in a database (date of application: 2000.12.28, application number: US006665678B2).
Summary of the invention
The purpose of this invention is to provide the concurrent control of a kind of adaptive optimism (AOCC) method, this method can improve concurrent performance in based on the multi-user concurrent environment of main memory.
The present invention is achieved through the following technical solutions the foregoing invention purpose:
A kind of self-adaptive optimistic concurrency control method, this method comprise by the concurrent control transformation of optimism and are pessimistic concurrent control, are two kinds of concurrent control transformation methods of optimistic concurrent control by the concurrent control transformation of pessimism; What system default was carried out is optimistic concurrency control method, and when system is in the high environment of collision rate, concurrent control strategy is pessimistic concurrent control by the concurrent control transformation of optimism; When system is in the low environment of collision rate, concurrent control strategy is optimistic concurrent control by the concurrent control transformation of pessimism again, and concrete steps are as follows:
(1) optimistic concurrent control transformation is pessimistic concurrency control method, comprises the steps:
The first step is each the affairs T in the system
jDistribute a process;
In second step, the affairs node in the shared authentication district is carried out initialization;
The 3rd step entered read phase, carried out affairs in the private room of oneself;
The 4th step is to affairs node logging timestamp in the shared authentication district and interpolation read-write collection;
In the 5th step, the application semaphore locks to the shared authentication district, and success then continues next step when locking; Otherwise, enter sleep state, wait for that other processes wake up;
The 6th step is for affairs T
jEach affairs T of concentrating of conflict range
i, carried out for the 7th step to the 11 step, as affairs T
jEach affairs T of concentrating of conflict range
iForwarded for the 12 step to after all being finished;
In the 7th step, judge affairs T
jWrite set and affairs T
jEach affairs T of concentrating of conflict range
iThe common factor of write set whether be empty, when the result for not, then directly entered for the 14 step; When the result for being then to continue next step;
In the 8th step, judge affairs T
jThe affairs T that concentrates of conflict range
iDeadline whether stab greater than affairs T
jProving time stab, when the result for being then directly to enter for the 14 step; When the result is otherwise the continuation next step;
The 9th step is with affairs T
jReadset and affairs T
jThe affairs T that concentrates of conflict range
iThe common factor of write set compose to set β;
In the tenth step, each the element α among the set β carried out for the 11 step; Each element α in set β travels through and finishes, and then enters for the 12 step;
In the 11 step, judge affairs T
jAt affairs T
jThe affairs T that concentrates of conflict range
iBefore finishing whether each the element α among the pair set β carried out read-write operation, when the result for being, then entered for the 14 step, as the result be otherwise returned for the tenth step;
In the 12 step, release semaphore is finished the exclusive reference to the shared authentication district;
The 13 step entered write phase and submitted affairs to, successfully withdrawed from;
The 14 step, the amount of collisions of Accumulation System;
The 15 step, judge the accumulative total amount of collisions whether less than the threshold value of system, when the result for being directly to enter for the 18 step; When the result is not, then enter next step;
The 16 step, judge whether current concurrent strategy is optimistic concurrency control method, when the result for being then concurrent strategy to be converted to pessimistic concurrency control method; When the result is not, then enter next step;
In the 17 step, will add up amount of collisions and be made as system thresholds;
In the 18 step, release semaphore returned for second step;
(2) pessimistic concurrent control transformation is an optimistic concurrency control method, comprises the steps:
A, make CPU sleep t second, 0<t<3;
B, application semaphore lock to the shared authentication district, and success continues next step when locking; When the failure that locks then enters sleep state, wait for that other processes wake up;
C, submit speed to, reduce the accumulative total amount of collisions of system according to system;
D, whether judge the accumulative total amount of collisions greater than 0, when the result for being then to return the A step; When the result is not, then enter next step;
E, judge whether current concurrent strategy is optimistic concurrent control, when the result for being directly to enter the G step; When the result is not, then concurrent strategy is converted to optimistic concurrent control, enter next step;
F, will add up amount of collisions and be made as 0;
G, release semaphore;
H, return the A step.
Beneficial effect
1, the present invention compares with pessimistic concurrency control method (PCC) and deadlock situation can not take place, and has avoided the expense that locks;
2, the present invention compares with optimistic concurrency control method (OCC), by the self-adaptation to concurrent strategy, has overcome the shortcoming that OCC causes concurrent performance to descend under the higher environment of collision rate;
3, the present invention has adopted one " hourglass " as adaptive regulator, what acquiescence was used in the system is optimistic concurrency control method, in operational process, control the change of concurrent strategy according to " hourglass " state, so both the expense that can avoid affairs to lock at run duration can prevent the optimistic concurrent performance decrease under the serious situation of conflict that is controlled at again.Can avoid the problem of the concurrent strategy of frequent switching that causes because of accidental height conflict like this.
Description of drawings
Fig. 1 is the structural representation of shared authentication district in internal memory.Comprise a stature node among the figure, point to the formation of a hourglass configuration and an affairs node respectively.
Fig. 2 is the workflow diagram of issued transaction process.Affairs are when carrying out, at first the affairs node in the shared authentication district is carried out initialization, the initialization laggard read phase of going into that finishes, each affairs is carried out affairs and is not needed to lock in the private room of oneself, safeguard the affairs node (comprise logging timestamp and add read-write collection etc.) of oneself simultaneously, then the application of shared authentication district is locked, begin affairs are verified after the success, then enter write phase if the verification passes and submit affairs to, operate the notice affair of laying equal stress on otherwise carry out IncSand.
Fig. 3 is the flowchart of adaptive controller.Create a subprocess by host process and carry out on the backstage as adaptive controller, this process checks that periodically the state of " hourglass " determines whether to carry out the conversion of concurrent strategy.
Fig. 4 is the performance comparison of concurrent control under low collision rate environment.Be respectively PCC, OCC, AOCC collision rate and the execution time contrast under low collision rate environment.
Fig. 5 is the performance comparison of concurrent control under high collision rate environment.Be respectively PCC, OCC, AOCC collision rate and the execution time contrast under high collision rate environment.
Embodiment
Further describe technical scheme of the present invention below.
Core concept of the present invention is to adopt one " hourglass " as adaptive controller, what acquiescence was used in the system is optimistic concurrent control, in operational process, control the change of concurrent strategy according to the state of " husky amount " in " hourglass ", the so both expenses that can avoid affairs to lock at run duration, can prevent the optimistic concurrent performance decrease under the serious situation of conflict that is controlled at again, " husky amount " is meant the accumulative total amount of collisions in the system, and " the husky amount " of regulating in " hourglass " is meant the amount of collisions that increases or reduce system.
The place that the self-adaptive optimistic concurrency control method that the present invention adopts is different from original optimistic concurrency control method is to have introduced the mechanism that the accumulative total amount of collisions detects at Qualify Phase.Affairs arrive at its Qualify Phase, carry out collision detection, if do not detect conflict, the checking affairs are allowed to submit to.If detect conflict, can regulate the sand amount of " hourglass " when then affairs are restarted, when surpassing threshold value, the accumulative total amount of collisions then switches concurrent strategy.Affairs have adopted one " hourglass " as adaptive regulator in the process of carrying out, and can avoid the problem of the concurrent strategy of frequent switching that causes because of accidental height conflict like this.
In the middle of implementation, if current " the husky amount " of " hourglass " surpasses its capacity, then system thinks that collision rate is very high this moment, will be converted to the pessimistic strategy that does not need to restart affairs; If current husky amount equals 0, then system thinks that collision rate is very low this moment, does not need the optimistic strategy that locks with being converted to.Because " hourglass " is the controller of an overall situation, so must guarantee exclusive reference by semaphore to " hourglass ".
The conflict range collection:
Affairs T
i∈ ST,
Wherein ST is the affairs set that enters system, if condition:
(T
i(start)<T
j(end)) set up, then claim ST
iBe T
iThe conflict range collection.
The read-write set:
ReadSet (T
i)={<α
m, t
n| α
mAt T
iT in the implementation
nConstantly be read };
WriteSet (T
i)={<α
m, t
n| α
mAt T
iT in the implementation
nConstantly be updated }.
The affairs node:
The corresponding affairs node of each affairs of carrying out has write down the information of affairs in operational process, comprises timestamp, read-write collection and the conflict range collection of affairs different phase.Each affairs is recorded into the affairs node in the different stages respectively with timestamp, and will add the read-write collection to the read-write operation of data in the process of carrying out.
The shared authentication district:
What the shared authentication district stored is the relevant information of each affairs of carrying out, affairs judge whether and need restart by the concentrated transaction information of the conflict range in the shared authentication district is verified after entering Qualify Phase, are by the communication between the multi-process of Sharing Memory Realization.The shared authentication district comprises two parts: " hourglass " structure of the overall situation and the chained list formation of affairs node.The structure in shared authentication district as shown in Figure 1.
The shared authentication district need be at Qualify Phase by the serial access of mutex amount, and in the read-write stage of each affairs, because corresponding oneself the affairs node of each affairs, so fully can concurrent access shared authentication district.
Further specify concrete steps of the present invention below in conjunction with accompanying drawing 2-3, shown in Fig. 2-3.
(1) optimistic concurrent control transformation is pessimistic concurrency control method, comprises the steps:
The first step is each the affairs T in the system
jDistribute a process;
In second step, the affairs node in the shared authentication district is carried out initialization;
The 3rd step entered read phase, carried out affairs in the private room of oneself;
The 4th step is to affairs node logging timestamp in the shared authentication district and interpolation read-write collection;
In the 5th step, the application semaphore locks to the shared authentication district, and success then continues next step when locking; Otherwise, enter sleep state, wait for that other processes wake up;
The 6th step is for affairs T
jEach affairs T of concentrating of conflict range
i, carried out for the 7th step to the 11 step, as affairs T
jEach affairs T of concentrating of conflict range
iForwarded for the 12 step to after all being finished;
In the 7th step, judge affairs T
jWrite set and affairs T
jEach affairs T of concentrating of conflict range
iThe common factor of write set whether be empty, when the result for being then directly to enter for the 14 step; When the result is otherwise the continuation next step;
In the 8th step, judge affairs T
jThe affairs T that concentrates of conflict range
iDeadline whether stab greater than affairs T
jProving time stab, when the result for being then directly to enter for the 14 step; When the result is otherwise the continuation next step;
The 9th step is with affairs T
jReadset and affairs T
jThe affairs T that concentrates of conflict range
iThe common factor of write set compose to set β;
In the tenth step, each the element α among the set β carried out for the 11 step; Each element α in set β travels through and finishes, and then enters for the 12 step;
In the 11 step, judge affairs T
jAt affairs T
jThe affairs T that concentrates of conflict range
iBefore finishing whether each the element α among the pair set β carried out read-write operation, when the result for being, then entered for the 14 step, as the result be otherwise returned for the tenth step;
In the 12 step, release semaphore is finished the exclusive reference to the shared authentication district;
The 13 step entered write phase and submitted affairs to, successfully withdrawed from;
The 14 step, the amount of collisions of Accumulation System;
The 15 step, judge the accumulative total amount of collisions whether less than the threshold value of system, when the result for being directly to enter for the 18 step; When the result is not, then enter next step;
The 16 step, judge whether current concurrent strategy is optimistic concurrency control method, when the result for being then concurrent strategy to be converted to pessimistic concurrency control method; When the result is not, then enter next step;
In the 17 step, will add up amount of collisions and be made as system thresholds;
In the 18 step, release semaphore returned for second step;
(2) pessimistic concurrent control transformation is an optimistic concurrency control method, comprises the steps:
A, make CPU sleep t second, 0<t<3;
B, application semaphore lock to the shared authentication district, and success continues next step when locking; When the failure that locks then enters sleep state, wait for that other processes wake up;
C, submit speed to, reduce the accumulative total amount of collisions of system according to system;
D, whether judge the accumulative total amount of collisions greater than 0, when the result for being then to return the A step; When the result is not, then enter next step;
E, judge whether current concurrent strategy is optimistic concurrent control, when the result for being directly to enter the G step; When the result is not, then concurrent strategy is converted to optimistic concurrent control, enter next step;
F, will add up amount of collisions and be made as 0;
G, release semaphore;
H, return the A step.
Below, shown in Fig. 4-5, be example with secure database manugement system-NHSecure, further specify the course of work of the present invention:
When A, NHSecure start " hourglass " carried out initialization;
B, the PCC module is loaded, native system is two sections lock concurrency control protocols;
C, the OCC module is loaded, native system is the optimistic concurrency control protocol based on timestamp;
D, be that each affairs creates a process;
If this process of E is the adaptive controller process, then forwards the J step to, otherwise continue following steps;
F, in the shared authentication district to the initialization of affairs node;
G, affairs continue to carry out in privately owned memory block;
H, it is verified, if, then the content in the privately owned memory block is written back to public data area by checking according to the information of the affairs in the shared authentication district; Otherwise " hourglass " state that the upgrades notice of laying equal stress on is engaged in;
I, successfully withdraw from;
J, sleep t second, 0<t<3;
K, " hourglass " state is upgraded;
L, check the state of " hourglass ", carry out concurrent strategy conversion if desired, then revise global variable status and change concurrent strategy; Otherwise forward the E step to.
Experimental results show that
The environment of experiment is: NHSecure, this is a secure database manugement system.On this basis, (PCC, 0CC AOCC) compare by loading different concurrent control modules.What PCC adopted in the experiment is two sections common lock agreements, and what OCC adopted is the optimistic concurrency control protocol of band timestamp.
In the experiment, database comprise 2 relation: Student (Sno, Sname, Sdept), Course (Cno, Cname, Sno), in NHSecure, affairs realize that by carrying out the sql script each sql script comprises some transaction sequence, and these affairs order after script is triggered is carried out.Experimental data is 3 script TS1.sql, the TS2.sql, the TS3.sql that comprise 50000 affairs, and particular content is as follows:
I, TS1.sql: have 45000 to be to concerning the query manipulation of Student, having 5000 to be to concerning the query manipulation of Course;
Ii, a TS2.sql:50000 affairs all are to the inquiry that concerns Course or upgrade operation;
Iii, a TS3.sql:50000 affairs all are to the inquiry that concerns Student or upgrade operation.
In these three sql files, the affairs among TS1.sql and the TS2.sql have only 5000 to be that the same Course of relation is read and write, and collision rate is lower; Affairs among TS1.sql and the TS3.sql have 45000 may take place concerning the read/write conflict of Student, and collision rate is higher.
Experimental procedure is as follows:
I, the different concurrent control module of loading: PCC, OCC, AOCC;
II, carry out TS1.sql and TS2.sql simultaneously, the number of times of affairs conflict and system carry out the used time in the statistical log, have only 5000 affairs to clash among TS1.sql and the TS2.sql, so simulation is the performance of concurrent control under low collision rate environment, the result as shown in Figure 4.As can be seen from the figure, when the affairs collision rate is very low, the PCC execution time is 140 seconds, and OCC and AOCC execution time than PCC much shorter, be respectively 78 seconds and 83 seconds, and collision rate is also low than PCC, this is because the expense that OCC does not lock in whole process, the time that each affairs is carried out shortens, and the possibility of conflict also just reduces, so system performance is higher.
III, carry out TS1.sql and TS3.sql simultaneously, the number of times of affairs conflict and system carry out the used time in the statistical log, have 45000 affairs to clash among TS1.sql and the TS3.sql, so simulation is the performance of concurrent control under high collision rate environment, the result as shown in Figure 5.As can be seen from the figure, when the affairs collision rate is very high, the OCC execution time is 680 seconds, the AOCC execution time is 550 seconds, and the PCC execution time is 500 seconds, this be because OCC in the process of implementation along with the rollback and the affairs of restarting get more and more, the vicious cycle phenomenon has appearred, and AOCC can change concurrent strategy along with the variation of collision rate in the process of carrying out, and has therefore avoided the appearance of vicious cycle phenomenon, keeps stable concurrent performance.
This experiment shows, adopts the system performance of AOCC more stable, and when collision rate was low, performance and original OCC were suitable; When collision rate was high, performance was compared with OCC and is had a distinct increment.Therefore in real system, self-adaptation OCC always approaches the highest concurrent strategy of performance.
Claims (1)
1. self-adaptive optimistic concurrency control method is characterized in that this method comprises by the concurrent control transformation of optimism and is pessimistic concurrent control, is two kinds of concurrent control transformation methods of optimistic concurrent control by the concurrent control transformation of pessimism; What system default was carried out is optimistic concurrency control method, and when system is in the high environment of collision rate, concurrent control strategy is pessimistic concurrent control by the concurrent control transformation of optimism; When system is in the low environment of collision rate, concurrent control strategy is optimistic concurrent control by the concurrent control transformation of pessimism again, and concrete steps are as follows:
(1) optimistic concurrent control transformation is pessimistic concurrency control method, comprises the steps:
The first step is each the affairs T in the system
jDistribute a process;
In second step, the affairs node in the shared authentication district is carried out initialization;
The 3rd step entered read phase, carried out affairs in the private room of oneself;
The 4th step is to affairs node logging timestamp in the shared authentication district and interpolation read-write collection;
In the 5th step, the application semaphore locks to the shared authentication district, and success then continues next step when locking; Otherwise, enter sleep state, wait for that other processes wake up;
The 6th step is for affairs T
jEach affairs T of concentrating of conflict range
i, carried out for the 7th step to the 11 step, as affairs T
jEach affairs T of concentrating of conflict range
iForwarded for the 12 step to after all being finished;
In the 7th step, judge affairs T
jWrite set and affairs T
jEach affairs T of concentrating of conflict range
iThe common factor of write set whether be empty, when the result for not, then directly entered for the 14 step; When the result for being then to continue next step;
In the 8th step, judge affairs T
jThe affairs T that concentrates of conflict range
iDeadline whether stab greater than affairs T
jProving time stab, when the result for being then directly to enter for the 14 step; When the result is otherwise the continuation next step;
The 9th step is with affairs T
jReadset and affairs T
jThe affairs T that concentrates of conflict range
iThe common factor of write set compose to set β;
In the tenth step, each the element α among the set β carried out for the 11 step; Each element α in set β travels through and finishes, and then enters for the 12 step;
In the 11 step, judge affairs T
jAt affairs T
jThe affairs T that concentrates of conflict range
iBefore finishing whether each the element α among the pair set β carried out read-write operation, when the result for being, then entered for the 14 step, as the result be otherwise returned for the tenth step;
In the 12 step, release semaphore is finished the exclusive reference to the shared authentication district;
The 13 step entered write phase and submitted affairs to, successfully withdrawed from;
The 14 step, the amount of collisions of Accumulation System;
The 15 step, judge the accumulative total amount of collisions whether less than the threshold value of system, when the result for being directly to enter for the 18 step; When the result is not, then enter next step;
The 16 step, judge whether current concurrent strategy is optimistic concurrency control method, when the result for being then concurrent strategy to be converted to pessimistic concurrency control method; When the result is not, then enter next step;
In the 17 step, will add up amount of collisions and be made as system thresholds;
In the 18 step, release semaphore returned for second step;
(2) pessimistic concurrent control transformation is an optimistic concurrency control method, comprises the steps:
A, make CPU sleep t second, 0<t<3;
B, application semaphore lock to the shared authentication district, and success continues next step when locking; When the failure that locks then enters sleep state, wait for that other processes wake up;
C, submit speed to, reduce the accumulative total amount of collisions of system according to system;
D, whether judge the accumulative total amount of collisions greater than 0, when the result for being then to return the A step; When the result is not, then enter next step;
E, judge whether current concurrent strategy is optimistic concurrent control, when the result for being directly to enter the G step; When the result is not, then concurrent strategy is converted to optimistic concurrent control, enter next step;
F, will add up amount of collisions and be made as 0;
G, release semaphore;
H, return the A step.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2009100256869A CN101556597B (en) | 2009-03-06 | 2009-03-06 | Self-adaptive optimistic concurrency control method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2009100256869A CN101556597B (en) | 2009-03-06 | 2009-03-06 | Self-adaptive optimistic concurrency control method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN101556597A CN101556597A (en) | 2009-10-14 |
CN101556597B true CN101556597B (en) | 2011-03-30 |
Family
ID=41174714
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2009100256869A Expired - Fee Related CN101556597B (en) | 2009-03-06 | 2009-03-06 | Self-adaptive optimistic concurrency control method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN101556597B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8775708B2 (en) * | 2006-03-29 | 2014-07-08 | Intel Corporation | Increasing functionality of a reader-writer lock |
Families Citing this family (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103714090B (en) * | 2012-10-09 | 2018-04-10 | 阿里巴巴集团控股有限公司 | More index data base transaction methods and database |
CN104714837A (en) * | 2013-12-11 | 2015-06-17 | 北京慧正通软科技有限公司 | Technical method for example concurrent processing under workflow engine cluster environment |
CN105389161B (en) * | 2014-09-09 | 2018-11-30 | 龙芯中科技术有限公司 | Collision detection method, transactional memory system and the microprocessor of transaction internal memory |
CN104317944B (en) * | 2014-10-31 | 2018-07-06 | 上海实方软件有限公司 | A kind of timestamp dynamic adjustment concurrency control method based on formula |
CN108733471A (en) * | 2017-04-25 | 2018-11-02 | 深圳市优网科技有限公司 | A kind of task dissemination system and method |
CN110502525A (en) * | 2019-08-16 | 2019-11-26 | 华东师范大学 | A kind of optimistic concurrency control method of hybrid working load |
CN111797107B (en) * | 2020-07-08 | 2024-02-09 | 贵州易鲸捷信息技术有限公司 | Database transaction concurrency control method for hybrid optimistic lock and pessimistic lock |
-
2009
- 2009-03-06 CN CN2009100256869A patent/CN101556597B/en not_active Expired - Fee Related
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8775708B2 (en) * | 2006-03-29 | 2014-07-08 | Intel Corporation | Increasing functionality of a reader-writer lock |
Also Published As
Publication number | Publication date |
---|---|
CN101556597A (en) | 2009-10-14 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101556597B (en) | Self-adaptive optimistic concurrency control method | |
CN101615203B (en) | Concurrency control method and device | |
US5241675A (en) | Method for enforcing the serialization of global multidatabase transactions through committing only on consistent subtransaction serialization by the local database managers | |
Wu et al. | Transaction healing: Scaling optimistic concurrency control on multicores | |
US20130262423A1 (en) | Controlled lock violation for data transactions | |
CN102521007B (en) | Network management system object concurrency editing method based on affair scheduling | |
KR20170132873A (en) | Method for processing database transactions in a distributed computing system | |
CN103647669A (en) | System and method for guaranteeing distributed data processing consistency | |
US20140040208A1 (en) | Early release of transaction locks based on tags | |
US5561794A (en) | Early commit optimistic projection-based computer database protocol | |
Muth et al. | Atomic commitment for integrated database systems | |
CN106354732A (en) | Offline data version conflict resolution method for supporting concurrent cooperation | |
JP5754301B2 (en) | Transaction concurrency control system, transaction concurrency control method, and program | |
Lam et al. | Evaluation of concurrency control strategies for mixed soft real-time database systems | |
Shanker et al. | SWIFT—A new real time commit protocol | |
Aldarmi | Real-time database systems: concepts and design | |
CN112100188A (en) | Concurrent control method and system based on machine learning | |
Abdallah et al. | Dictatorial transaction processing: Atomic commitment without veto right | |
CN112612647B (en) | Log parallel replay method, device, equipment and storage medium | |
Liao et al. | Concurrency control of real-time transactions with disconnections in mobile computing environment | |
Kobus et al. | The correctness criterion for deferred update replication | |
Qin et al. | A commit strategy for distributed real-time transaction | |
Kiviniemi et al. | Transaction processing in the RODAIN real-time database system | |
Haritsa et al. | Real-time commit processing | |
Makni et al. | Performance evaluation of an optimistic concurrency control algorithm for temporal databases |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20110330 Termination date: 20210306 |