The operational approach and device of data baseTechnical field
The present invention relates to the communications field, in particular to the operational approach and device of a kind of data base.
Background technology
As traditional database technology reaches its maturity, and the high speed development of internet, applications, database application is universalOccur on the Internet.And traditional centralized data base system also shows its weak point simultaneously:Using centralizedManagement, certainly will cause performance bottleneck, and the big data quantity that single raising hardware performance can not meet current the Internet is high simultaneouslyThe demand of inquiry write is sent out, while substantial amounts of hardware maintenance and upgrade cost can be produced.Additionally, the centralized management of data baseMultiple database association is often resulted in, once a certain database corruption, will cause whole system to collapse.Count in a distributed mannerTo progressively replace traditional centralized data base system according to storehouse system.
Affairs are the key properties of relevant database, it is commonly known that the ACID principles of relevant database affairs are:It is formerSub- property (Atomicity), concordance (Consistency), isolation or independence (Isolation) and persistency(Durabilily), wherein the read consistency of data is realized by the mechanism of Multi version concurrency control (MVCC).It is accompanied byThe fast development of distributed data base, some comparative maturity and widely used function and skills in centralized data base systemArt encounters greatly challenge, such as affairs (Transaction) function under distributed environment.In order to distributedTransaction functionality is realized in data base, current industry generally uses two-phase commitment protocol (two phase commitProtocol, 2PC).
As its name suggests, two-phase commitment protocol is made up of two stages.Under normal execution, the execution in the two stagesProcess is as described below:
Stage 1:Request stage (commit-request phase, or claim voting stage, voting phase)
In request stage, coordinator will notify that affairs participant prepares to submit or cancel affairs to, subsequently into voting process.During voting, participant will inform the decision-making of coordinator oneself:Agree to (the local Job execution success of affairs participant)Or cancel (local Job execution failure).
Stage 2:Presentation stage (commit phase)
In the stage, coordinator will carry out decision-making based on the voting results of first stage:Submit to or cancel.And if only ifAll of participant agrees to submit to transaction coordination person just to notify that all of participant submits to affairs, otherwise coordinator to notify instituteSome participants cancel affairs.Participant will perform the operation of response after the message that coordinator sends is received.
At present two-phase commitment protocol have the shortcomings that one it is very big, it is impossible to completely in accordance with the ACID principles of affairs, that is, do not haveThere is concordance (Consistency) problem in view of affairs, cause the result inquired about not to be global coherency.Such as,For the node A and node B of distributed data base system, if affairs 1 carry out data renewal to node A and node BAfterwards, the presentation stage in stage 2 is entered into, i.e., state now is:Node A affairs are submitted to be completed, node B thingsBusiness is in state to be committed, if there are an affairs 2 at this moment inquired about node A and node B, thenThe result of inquiry just violates the principle of congruity of affairs, i.e., what on node a inquiry obtained is amended data, andOn nodeb what inquiry was obtained is the data before modification.Because two-phase commitment protocol is deposited in distributed data base systemIn the time difference of affairs commit, cause two-phase commitment protocol itself that this data overall situation discordance cannot be avoided to askTopic.
In sum, in current distributed data base system, the distributed transaction realized using two-phase commitment protocolHow the globally consistent sex chromosome mosaicism of data is solved, and correlation technique there is no effective solution.
The content of the invention
The invention provides the operational approach and device of a kind of data base, at least to solve in correlation technique in distributed transactionData be unable to reach the problem of global coherency.
According to an aspect of the invention, there is provided a kind of operational approach of data base, including:In the first receptionOne transaction information and Current transaction snapshot, wherein, the first transaction information is used to indicate at least to perform first to the first data baseOperation indicated by affairs, Current transaction snapshot includes:The affairs for having started to perform in database collection are engraved when firstMark and state, data base set is combined into including one or more data bases including the first data base;Judge that mark is indicatedThe affairs for having started to perform in the presence or absence of target transaction, wherein, the state of target transaction is not to complete submission, and meshData item involved by mark affairs includes part or all of in the data item involved by the first affairs;If having started to what is performedThere is target transaction in affairs, then include the situation of deletion action and/or modification operation in the operation indicated by the first affairsUnder, after the State Transferring of target transaction is to have completed to submit to just to the part in the data item involved by the first affairs orAll perform the operation indicated by the first affairs.
Alternatively, judge to include with the presence or absence of target transaction in the indicated affairs for having started to perform of mark:Having started toCurrent transaction in the affairs of execution performs the operation indicated by Current transaction to the current database in database collectionIn the case of, judge whether Current transaction is complete submission on each current database, wherein, current database is oneIndividual or multiple data bases;If judging, Current transaction is not complete submission on each current database, will be currentThe state of affairs is set to not complete submission;Judge to perform the data item for not completing the operation indicated by the Current transaction submitted toWhether include part or all of in the data item for perform the operation indicated by the first affairs;If including the first office of executionIt is part or all of in the data item of the operation of instruction, then using Current transaction as one of target transaction, and judge existTarget transaction.
Alternatively, just in the data item involved by the first affairs after the State Transferring of target transaction is to have completed to submit toThe affairs of part or all of execution first indicated by operation include at least one of:In the operation indicated by the first affairsWhen being to perform deletion action to the second collection of data items in the first data base, part or complete will be removed in the second collection of data itemsData item outside portion is deleted, and to all or part of after the State Transferring of target transaction to complete submissionData item is deleted;It is that the second collection of data items in the first data base is performed to delete in the operation indicated by the first affairsDuring division operation, the data item in the second collection of data items in addition to partly or entirely is deleted, and in target transactionState Transferring is whether the data item for having completed judgment part or whole after submission meets carrying in the first transaction informationDeletion condition corresponding with deletion action, the data item to meeting deletion condition in all or part of data item is deleted;When the operation indicated by the first affairs is that modification operation is performed to the 3rd collection of data items in the first data base, to the 3rdData item in collection of data items in addition to partly or entirely performs modification operation, and target transaction State Transferring forModification is performed after completing to submit to all or part of data item to operate;It is to first in the operation indicated by the first affairsWhen the 3rd collection of data items in data base performs modification operation, in the 3rd collection of data items in addition to partly or entirelyData item perform modification operation, and target transaction State Transferring be completed submit to after judgment part or whole numberThe modification condition corresponding with modification operation carried in the first transaction information whether is met according to item, to all or part of dataThe data item that modification condition is met in performs modification operation.
Alternatively, if having started to there is target transaction in the affairs for performing, method also includes:Indicated by the first affairsOperation be in the first data base the first collection of data items perform inquiry operation when, return the first collection of data items in removeThe current information of the data item outside partly or entirely, and return all or part of data item in the first collection of data itemsHistorical information.
Alternatively, the current information of the data item in the first collection of data items is returned in addition to partly or entirely includes:After the State Transferring of target transaction to complete to submit to, the current information of the data item of returning part or whole.
Alternatively, the historical information of all or part of data item in the first collection of data items is returned includes:In targetAfter the State Transferring of affairs to complete to submit to, the historical information of the data item of returning part or whole.
Alternatively, the data base in database collection is distributed data base.
According to a further aspect in the invention, there is provided a kind of operation device of data base, including:Receiving unit, is used forIn first the first transaction information of reception and Current transaction snapshot, wherein, the first transaction information is used to indicate at least to theOne data base performs the operation indicated by the first affairs, and Current transaction snapshot includes:Engrave when first in database collectionStart the mark and state of the affairs of execution, data base set is combined into including one or more data bases including the first data base;Judging unit, with the presence or absence of target transaction in the affairs for having started to perform indicated for judging mark, wherein, targetThe state of affairs is not to complete submission, and the data item involved by target transaction is included in the data item involved by the first affairsIt is part or all of;Processing unit, for when there is target transaction in having started to the affairs for performing, in the first officeIt is to complete to carry in the State Transferring of target transaction in the case that the operation of instruction includes deletion action and/or modification operationAfter friendship just to the data item involved by the first affairs in the affairs of part or all of execution first indicated by operation.
Alternatively, judging unit includes:First judge module, for the Current transaction pair in the affairs for performing are had started toIn the case that current database in database collection performs the operation indicated by Current transaction, judge that whether Current transaction existsSubmission is complete on each current database, wherein, current database is one or more data bases;Setup module,For when judging that Current transaction is not complete submission on each current database, the state of Current transaction being setIt is set to unfinished submission;Second judge module, for judging that execution does not complete the operation indicated by the Current transaction submitted toIt is part or all of in the data item for perform the operation indicated by the first affairs whether data item includes;Determining module, is used forDuring part or all of in the data item for judging to include to perform the operation indicated by the first affairs, using Current transaction asOne of target transaction, and judge there is target transaction.
Alternatively, processing unit includes at least one of:First processing module, in the behaviour indicated by the first affairsAs in the first data base the second collection of data items perform deletion action when, will in the second collection of data items except part orData item outside whole is deleted, and to part or all of after the State Transferring of target transaction to complete submissionData item deleted;Or, it is to the second item set in the first data base in the operation indicated by the first affairsWhen closing execution deletion action, the data item in the second collection of data items in addition to partly or entirely is deleted, and in meshThe State Transferring of mark affairs is whether the data item for having completed judgment part or whole after submission meets the first transaction informationThe deletion condition corresponding with deletion action of middle carrying, the data item to meeting deletion condition in all or part of data itemDeleted;Second processing module, for being to the 3rd data in the first data base in the operation indicated by the first affairsWhen item set performs modification operation, modification operation is performed to the data item in the 3rd collection of data items in addition to part or all of,And in the State Transferring of target transaction change operation to complete all or part of data item to be performed after submitting to;Or,When the operation indicated by the first affairs is that modification operation is performed to the 3rd collection of data items in the first data base, to the 3rdData item in collection of data items in addition to partly or entirely performs modification operation, and target transaction State Transferring forComplete submit to after judgment part or whole data item whether meet in the first transaction information carry with modification operation it is rightThe modification condition answered, the data item to meeting modification condition in all or part of data item performs modification operation.
Alternatively, also include:3rd processing module, for there is target transaction in the affairs for performing are had started to, firstWhen operation indicated by affairs is to perform inquiry operation to the first collection of data items in the first data base, the first data are returnedThe current information of the data item in item set in addition to partly or entirely, and return to the part in the first collection of data items or completeThe historical information of the data item in portion.
Alternatively, the 3rd processing module includes:First processes submodule, in the State Transferring of target transaction for completeInto after submission, the current information of the data item of returning part or whole.
Alternatively, the 3rd processing module includes:Second processing submodule, in the State Transferring of target transaction for completeInto after submission, the historical information of the data item of returning part or whole.
Alternatively, the data base in database collection is distributed data base.
By the present invention, in first the first transaction information of reception and Current transaction snapshot, wherein, Current transaction snapshotInclude engraving the mark and state of the affairs for having started to perform in database collection when first.By judging to have started to performAffairs in the presence or absence of state be do not complete submit to target transaction, if it is above-mentioned have started to perform affairs in exist it is above-mentionedTarget transaction, then just in the data item involved by the first affairs after the State Transferring of target transaction is to have completed to submit toThe affairs of part or all of execution first indicated by operation, so as to realize the global coherency to the first moment all affairsOperation.
Description of the drawings
Accompanying drawing described herein is used for providing a further understanding of the present invention, constitutes the part of the application, the present inventionSchematic description and description be used for explain the present invention, do not constitute inappropriate limitation of the present invention.In the accompanying drawings:
Fig. 1 is the flow chart of the operational approach of a kind of optional data base according to embodiments of the present invention;
Fig. 2 is the application schematic diagram of the operational approach of a kind of optional data base according to embodiments of the present invention;
Fig. 3 is the flow chart of the operational approach of the optional data base of another kind according to embodiments of the present invention;
Fig. 4 is the flow chart of the operational approach of another optional data base according to embodiments of the present invention;And
Fig. 5 is the schematic diagram of the operation device of a kind of optional data base according to embodiments of the present invention.
Specific embodiment
Below with reference to accompanying drawing and in conjunction with the embodiments describing the present invention in detail.It should be noted that in the feelings not conflictedUnder condition, the feature in embodiment and embodiment in the application can be mutually combined.
It should be noted that description and claims of this specification and term " first ", " second " in above-mentioned accompanying drawingEtc. being object for distinguishing similar, without for describing specific order or precedence.
Embodiment 1
A kind of operational approach of data base is provided in the present embodiment, and Fig. 1 is data base according to embodiments of the present inventionThe flow chart of operational approach, as shown in figure 1, the flow process comprises the steps:
Step S102, in first the first transaction information of reception and Current transaction snapshot, wherein, the first transaction information is usedIn indicating at least to perform the operation indicated by the first affairs to the first data base, Current transaction snapshot includes:Engrave when firstThe mark and state of the affairs of execution are had started in database collection, data base set is combined into including including the first data baseIndividual or multiple data bases;
Step S104, judges in the indicated affairs for having started to perform of mark with the presence or absence of target transaction, wherein, targetThe state of affairs is not to complete submission, and the data item involved by target transaction is included in the data item involved by the first affairsIt is part or all of;
Step S106, if having started to there is target transaction in the affairs for performing, includes in the operation indicated by the first affairsIn the case of deletion action and/or modification operation, just to first after the State Transferring of target transaction to complete submissionThe operation indicated by the affairs of part or all of execution first in data item involved by affairs.
Alternatively, in the present embodiment, Fig. 2 is the operational approach of a kind of optional data base according to embodiments of the present inventionApplication schematic diagram, the operational approach of above-mentioned data base can be, but not limited to be applied in applied environment as shown in Figure 2,Client 202 is between coordinator 204, global transaction manager 206, the three of database service 208 by transmitting controlAgreement (TCP, Transmission Control Protocol) processed or User Datagram Protocol (UDP, User Datagram) etc. Protocol communications protocol is realizing link link communication.Wherein, in database server 208 can include but notIt is limited to database service node A and data base server node B.Each data base's clothes in above-mentioned database service 208Business node reports incessantly the last state of its internal all affairs to global transaction manager 206, while from global thingBusiness manager 206 obtains the transaction snapshot of distributed data base system current time all affairs, in order to pass through the affairsSnapshot judging whether include the target transaction in submission state is not completed in the affairs for performing are had started to, so as to realizeProcess is operated come the global coherency of database data according to the state of affairs, to avoid to distributed dataAffairs in system in the different conditions problem for being unable to reach data global coherency caused when being operated, and thenEnsure the global coherency of data.
It should be noted that in the present embodiment, coordinator 204, global transaction manager 206 in above-mentioned applied environment,The function of database service 208 can be as follows:
1) above-mentioned coordinator 204 can be, but not limited to for receive client 202 transmission SQL (SQL,Structured Query Language) statement block request;Then it is (unique to the application GXID of global transaction manager 206And orderly affairs ID, referred to as GXID);The transaction snapshot of Current transaction is reported to global transaction manager 206;AndSQL is sent to multiple database server nodes (such as database service node A and data base server node B)Perform, and collect SQL implementing results, and return result to client 202.
2) above-mentioned global transaction manager 206 is used to generate unique and orderly GXID for each affairs;It is additionally operable to monitoringThe state of all affairs in tracking distributed data base system, receives and preserves the transaction status report for reporting;Response dataThe transaction status request of service node, sends the transaction snapshot at current time to data serving node.
3) the database service node in above-mentioned database service 208 is used for executed in parallel sql command;To global transactionAll transaction snapshot information in the distributed data base system at the acquisition current time of manager 206, are carried out according to transaction snapshotThe process operation of the global coherency of data.
Alternatively, in the present embodiment, the state of the above-mentioned affairs for having started to perform can including but not limited to below at leastOne of:(running) is currently running, (committed) is had been filed on, is stopped (aborted), wherein, in not completeInvolved data item can include one or more in the target transaction of the state of submission to.
Alternatively, in the present embodiment, the operation indicated by above-mentioned first affairs can including but not limited to it is following at least itOne:Modification, deletion and inquiry.
It should be noted that in the present embodiment, when having started to there is target transaction in the affairs for performing, if the first affairsIndicated operation is that deletion action and/or modification operation are carried out to data item, then the State Transferring in target transaction isComplete submit to after just to the data item involved by the first affairs in the affairs of part or all of execution first indicated by deleteDivision operation and/or modification operation;If the operation indicated by the first affairs is to carry out inquiry operation to data item, can returnReturn after the State Transferring of target transaction to complete to submit to, it is current that the data item involved by the first affairs of inquiry is obtainedInformation, it is also possible to return in the case where the state of target transaction is not submitted to yet, inquire about the data item involved by the first affairsThe historical information for obtaining, wherein, the historical information that above-mentioned inquiry is obtained can be, but not limited to include involved by the first affairsThe object information of the last time operation that data item was completed before performance objective affairs.
Alternatively, in the present embodiment, the data base in above-mentioned database collection can include but is not limited to distributed dataStorehouse.
Alternatively, in the present embodiment, can be including but not limited in the above-mentioned affairs for having started to perform:Current transaction,Wherein, above-mentioned Current transaction is the affairs performed in distributed data base before the first affairs are performed.
Specifically combine and illustrated shown in Fig. 2, the operational approach of above-mentioned data base can be as follows:
S1, global transaction manager (GTM, Global Transaction Manager) is distributed data base systemIn each affairs provide and generate unique and orderly affairs ID, referred to as GXID;And the distributed number of Collection and conservationAccording to all of transaction status in the system of storehouse;
When S2, GTM receive coordinator node acquisition new transactions requests, a unique and orderly GXID is generated to coordinationDevice node;
When S3, GTM receiving data storehouse service node obtains current time system transaction snapshot request, the institute of Collection and conservationThere are transaction status to be sent to database service node;
S4, database service node receives SQL statement and parses execution, and returns implementing result.
Alternatively, in the present embodiment, start in affairs, affairs terminate, the preparatory stage of two-phase commitment protocol, numberThe state report of Current transaction is sent to GTM according to storehouse service node.
Alternatively, in the present embodiment, when the inquiry operation indicated by the first affairs is performed, the data for inquiring are returnedCan be including but not limited to following at least one during item:
1) when Transaction service is to submit to read (read committed), database service node is performing firstDuring each SQL statement of affairs, all first will be to all affairs of GTM request current times whole distributed data base systemState snapshot;
2) when Transaction service is repeatable read (read repeatable) and serializing (serializable),Database service node is busy to GTM request current times whole distributed data base system institute when Current transaction startsThe state snapshot of business.
The embodiment provided by the application, in first the first transaction information of reception and Current transaction snapshot, wherein,Current transaction snapshot includes engraving the mark and state of the affairs for having started to perform in database collection when first.By sentencingWith the presence or absence of the target transaction that state is unfinished submission in the disconnected affairs for having started to perform, if the above-mentioned thing for having started to performThere is above-mentioned target transaction in business, then just to involved by the first affairs after the State Transferring of target transaction to complete submissionAnd data item in the affairs of part or all of execution first indicated by operation, so as to realize affairs all to the first momentGlobal coherency operation.
As a kind of optional scheme, judge in the indicated affairs for having started to perform of mark with the presence or absence of target transaction bagInclude:
S1, the Current transaction in the affairs for performing are had started to performs Current transaction to the current database in database collectionIn the case of indicated operation, judge whether Current transaction is complete submission on each current database, wherein,Current database is one or more data bases;
S2, if judging, Current transaction is not complete submission on each current database, by the shape of Current transactionState is set to not complete submission;
S3, judges to perform whether the data item for not completing the operation indicated by the Current transaction submitted to includes performing the first affairsIt is part or all of in the data item of indicated operation;
S4, if part or all of in including the data item for performing the operation indicated by the first affairs, Current transaction is madeFor one of target transaction, and judge there is target transaction.
Alternatively, in the present embodiment, the current database for performing Current transaction can include but is not limited to one or moreData base.Wherein, when current database is multiple data bases, if at least one data base is not completed indicated by Current transactionOperation, then it is state in unfinished submission to identify Current transaction, and otherwise, it is to complete what is submitted to identify Current transactionState.
Alternatively, in the present embodiment, after judging that Current transaction is in unfinished submission state, in judging Current transactionWhether involved data item includes the part or all of of the data item involved by the operation indicated by the first affairs, if judgingAs a result it is yes, then judges that Current transaction is target transaction.Further, to have started to perform affairs in other affairsAbove-mentioned judgement is repeated, to obtain having started to all target transactions in the affairs of execution, so as to realize to target transactionIn data item State Transferring for complete submit to after, then start perform the first affairs indicated by operation.
The embodiment provided by the application, has started to the target transaction in the affairs for performing to realize holding by acquisitionDuring operation indicated by the affairs of row first, target transaction is performed etc. it is to be operated, until the State Transferring of target transaction is forComplete to submit to, so as to realize the control of the global coherency to distributed data base, to avoid being obtained by distributed data baseGet different data caused by the inconsistent problem of data.
As a kind of optional scheme, just to involved by the first affairs after the State Transferring of target transaction to complete submissionAnd data item in the affairs of part or all of execution first indicated by operation include at least one of:
S1, when the operation indicated by the first affairs is to perform deletion action to the second collection of data items in the first data base,Data item in second collection of data items in addition to partly or entirely is deleted, and the State Transferring in target transaction isComplete to delete all or part of data item after submitting to;
S2, when the operation indicated by the first affairs is to perform deletion action to the second collection of data items in the first data base,Data item in second collection of data items in addition to partly or entirely is deleted, and the State Transferring in target transaction isWhether the data item of judgment part or whole meets carry in the first transaction information and deletion action after completing to submit toCorresponding deletion condition, the data item to meeting deletion condition in all or part of data item is deleted;
S3, when the operation indicated by the first affairs is that modification operation is performed to the 3rd collection of data items in the first data base,Modification operation is performed to the data item in the 3rd collection of data items in addition to partly or entirely, and the state in target transaction turnsTo be changed to complete after submission and all or part of data item is performed modification operation;
S4, when the operation indicated by the first affairs is that modification operation is performed to the 3rd collection of data items in the first data base,Modification operation is performed to the data item in the 3rd collection of data items in addition to partly or entirely, and the state in target transaction turnsBe changed to complete submit to after judgment part or whole data item whether meet in the first transaction information carry with modificationCorresponding modification condition is operated, the data item to meeting modification condition in all or part of data item performs modification operation.
Alternatively, in the present embodiment, the operation indicated by above-mentioned first affairs can including but not limited to it is following at least itOne:Deletion action, modification operation.Wherein, in the data item of the operation indicated by above-mentioned first affairs part or completeWhen portion's data item is data item involved in target transaction, the data in distributed data base are performed unanimously in order to reachProperty control operation, in the present embodiment, after in the State Transferring of target transaction to complete to submit to, then to firstThe operation partly or entirely performed indicated by above-mentioned first affairs in the data item involved by operation indicated by affairs.
That is, being that the second collection of data items in the first data base is operated in the operation indicated by the first affairsWhen, the data item in the second collection of data items in addition to the part or all of data item involved by target transaction is directly performedOperation indicated by first affairs;And after the State Transferring of target transaction is to have been filed on, then to the second collection of data itemsPart or all of data item involved by middle target transaction performs the operation indicated by the first affairs.It should be noted thatOperation indicated by first affairs is performed to the part or all of data item involved by target transaction in the second collection of data itemsBefore, also include:The data item of judgment part or whole whether meet in the first transaction information carry it is corresponding with operationOperating condition, after judging to meet operating condition, then to meeting the data of operating condition in all or part of data itemItem carries out performing the operation indicated by the first affairs.
For example, the affairs for currently having started to perform include:Affairs 1, affairs 2 and affairs 3, wherein, affairs 1 and thingBusiness 2 is target transaction, and involved data item includes D1, D2, D3, D4 and D5 in affairs 1, involved in affairs 2And data item include D2, D4, D5 and D6, the first affairs that the first reception is arrived be affairs 4, wherein, affairs 4In involved data item include D1, D2, D4 and D7, that is to say, that the data item involved by the first affairs includes meshPartial data item in mark affairs, i.e.,:D1, D2, D4, thus, above-mentioned data item is performed indicated by the first affairsDuring operation (such as change), then the State Transferring of target transaction such as need to complete to perform modification operation after submission state again.
Again for example, still the partial data item in target transaction included with the data item involved by the first affairs, i.e.,:D1、D2、As a example by D4, then before the operation indicated by the first affairs (such as deleting) is performed to data item D1, D2, D4, alsoNeed to judge whether above-mentioned data item meets the deletion condition corresponding with deletion action carried in the first transaction information, for example,Deletion condition is that the data item to space shared by data more than 2M is deleted.Hypothesis judges that data item D1, D2 meetsAbove-mentioned deletion condition, then to meet deletion condition data item D1, D2 perform the first affairs indicated by deletion action.
The embodiment provided by the application, include to the part in target transaction in the operation indicated by the first affairs orWhen total data item performs modification operation and deletion action, need to be after the State Transferring of target transaction be to complete to submit to againAbove-mentioned modification operation or deletion action are performed to above-mentioned all or part of data item, so as to avoid being obtained in the first affairsThe inconsistence problems to caused by the different data institute of data item content.
Used as a kind of optional scheme, if having started to there is target transaction in the affairs for performing, method also includes:
S1, when the operation indicated by the first affairs is to perform inquiry operation to the first collection of data items in the first data base,The current information of the data item in the first collection of data items in addition to partly or entirely is returned, and returns the first collection of data itemsIn all or part of data item historical information.
It should be noted that when the operation indicated by the first affairs is inquiry operation, during the first collection of data items can be returnedThe current information of the data item in addition to partly or entirely that inquiry is obtained, it is also possible to return in the first collection of data items and inquire aboutThe historical information of all or part of data item for obtaining.Wherein, the historical information that above-mentioned inquiry is obtained can be, but not limited toThe object information of the last time operation completed before performance objective affairs including the data item involved by the first affairs.
The embodiment provided by the application, include to the part in target transaction in the operation indicated by the first affairs orWhen total data item performs inquiry operation, if having completed the operation of Current transaction, current information is returned, if do not complete working asThe operation of front affairs, then return the historical information before operation.
As a kind of optional scheme, the data item in the first collection of data items is returned in addition to partly or entirely it is currentInformation, and return the historical information of all or part of data item in the first collection of data items and include:
S1, after the State Transferring of target transaction to complete to submit to, the current letter of the data item of returning part or wholeBreath.
Specifically illustrate with reference to the example below, Fig. 3 is the flow process of the operational approach of data base according to embodiments of the present inventionFigure, as shown in figure 3, distributed transaction isolation level is repeatable read (read repeatable) and serializing(serializable) when, detailed process is as follows:
Step S301, coordinator node receives the SQL statement block request that client sends;
Step S302, coordinator node asks the snapshot of GXID and current time all affairs to global transaction manager;
Step S303, global transaction manager is sent to coordinator node newly-generated GXID and transaction snapshot;
Global transaction manager receives coordinator node and obtains after new GXID requests, and generation one is unique and orderlyGXID is sent to coordinator node.Simultaneously global transaction manager preserves the status information of this newly-generated affairs.
Transaction snapshot refers to all of affairs and status information in current time whole distributed data base system, state bagInclude:(running) is currently running, (committed) is had been filed on, is stopped (aborted).
Step S304, coordinator node is sent to multiple database service nodes SQL statement block, GXID, transaction snapshot;
Coordinator is sent to SQL statement the database service node of multiple correlations, to facilitate multiple database service nodesCan executed in parallel SQL query.
Step S305, database service node performs first SQL, and carries out global coherency reading behaviour according to transaction snapshotMake;
Database service node judges to realize the global coherency of data according to the SNAPSHOT INFO of current time all affairsRead.
Step S306, coordinator node collects all database service node implementing results and is sent to client;
Step S307, database service node continues executing with next SQL, and carries out global coherency according to transaction snapshotRead operation;
When Transaction service is repeatable read (read repeatable) and serializing (serializable),According to the ACID characteristics of affairs, it is only necessary to using this affairs start time transaction snapshot carrying out the overall situation one of dataCause property judges that this transaction snapshot is to obtain and pass to data base to global transaction manager application by coordinator nodeService node.
Step S308, coordinator node collects all database service node implementing results and is sent to client;
The embodiment provided by the application, it is globally consistent to realize data by the snapshot for obtaining current time all affairsProperty read, i.e., database service node by the transaction status of itself and the distributed data base system at current time ownOther transaction snapshots are analyzed to judge that the global coherency for realizing data is read.
As a kind of optional scheme, the data item in the first collection of data items is returned in addition to partly or entirely it is currentInformation, and return the historical information of all or part of data item in the first collection of data items and include:
S1, after the State Transferring of target transaction to complete to submit to, the history letter of the data item of returning part or wholeBreath.
Specifically illustrate with reference to the example below, Fig. 4 is the flow process of the operational approach of data base according to embodiments of the present inventionFigure, as shown in figure 4, distributed transaction isolation level is to have been filed on reading (read committed), detailed process is as follows:
Step S401, coordinator node receives the SQL statement block request that client sends;
Step S402, coordinator node asks the snapshot of GXID and current time all affairs to global transaction manager;
Step S403, global transaction manager is sent to coordinator node newly-generated GXID and transaction snapshot;
Global transaction manager receives coordinator node and obtains after new GXID requests, and generation one is unique and orderlyGXID is sent to coordinator node.Simultaneously global transaction manager preserves the status information of this newly-generated affairs.
Transaction snapshot refers to all of affairs and status information in current time whole distributed data base system, state bagInclude:(running) is currently running, (committed) is had been filed on, is stopped (aborted).
Step S404, coordinator node is sent to multiple database service nodes SQL statement block, GXID, transaction snapshot;
Coordinator is sent to SQL statement the database service node of multiple correlations, to facilitate multiple database service nodesCan executed in parallel SQL query.
Step S405, database service node performs first SQL, and carries out global coherency reading behaviour according to transaction snapshotMake;
Database service node judges to realize the global coherency of data according to the SNAPSHOT INFO of current time all affairsRead.
Step S406, coordinator node collects all database service node implementing results and is sent to client;
Step S407, database service node asks current time before next SQL is performed to global transaction managerThe snapshot of all affairs;
When Transaction service is to have been filed on reading (read committed), according to the ACID characteristics of affairs, dataStorehouse service node perform Current transaction each SQL statement when, all first will to global transaction manager request it is current whenCarve the state snapshot of all affairs of whole distributed data base system.
Step S408, global transaction manager is sent to database service node current time transaction snapshot;
Step S409, database service node performs next SQL according to transaction snapshot, and carries out global coherency reading behaviourMake;
Database service node judges to realize the global coherency of data according to the SNAPSHOT INFO of current time all affairsRead.
Step S410, coordinator node collects all database service node implementing results and is sent to client.
Above-described embodiment Transaction service be have been filed on read (read committed) when, by obtain current timeThe snapshot of all affairs is read realizing data global coherency, i.e., database service node by the transaction status itself andEvery other transaction snapshot is analyzed to judge to realize data in the distributed data base system at current timeGlobal coherency is read.
Through the above description of the embodiments, those skilled in the art can be understood that according to above-described embodimentMethod can add the mode of required general hardware platform to realize by software, naturally it is also possible to by hardware, but a lotIn the case of the former be more preferably embodiment.Based on such understanding, technical scheme is substantially in other words to existingThere is the part that technology contributes to embody in the form of software product, the computer software product is stored in oneIn storage medium (such as ROM/RAM, magnetic disc, CD), including some instructions use so that a station terminal equipment (can be withIt is mobile phone, computer, server, or network equipment etc.) perform method described in each embodiment of the invention.
Embodiment 2
Additionally provide a kind of operation device of data base in the present embodiment, the device is used to realizing above-described embodiment and preferablyEmbodiment, had carried out repeating no more for explanation.As used below, term " module " can be realized making a reservation forThe software of function and/or the combination of hardware.Although the device described by following examples is preferably realized with software,It is hardware, or the realization of the combination of software and hardware is also may and to be contemplated.
Fig. 5 is the schematic diagram of the operation device of data base according to embodiments of the present invention, as shown in figure 5, the device includes
1) receiving unit 502, in first the first transaction information of reception and Current transaction snapshot, wherein, firstTransaction information is used to indicate at least to perform the operation indicated by the first affairs to the first data base, and Current transaction snapshot includes:The mark and state of the affairs for having started to perform in database collection are engraved when first, data base set is combined into including the first dataStorehouse is in one or more interior data bases;
2) judging unit 504, with the presence or absence of target transaction in the affairs for having started to perform indicated for judging mark,Wherein, the state of target transaction is not to complete submission, and the data item involved by target transaction is included involved by the first affairsData item in it is part or all of;
3) processing unit 506, for when there is target transaction in having started to the affairs for performing, indicated by the first affairsOperation include deletion action and/or modification operation in the case of, target transaction State Transferring to complete submissionAfterwards just to the data item involved by the first affairs in the affairs of part or all of execution first indicated by operation.
Alternatively, in the present embodiment, Fig. 2 is the operational approach of a kind of optional data base according to embodiments of the present inventionApplication schematic diagram, the operation device of above-mentioned data base can be, but not limited to be applied in applied environment as shown in Figure 2,Client 202 is between coordinator 204, global transaction manager 206, the three of database service 208 by transmitting controlAgreement (TCP, Transmission Control Protocol) processed or User Datagram Protocol (UDP, User Datagram) etc. Protocol communications protocol is realizing link link communication.Wherein, in database server 208 can include but notIt is limited to database service node A and data base server node B.Each data base's clothes in above-mentioned database service 208Business node reports incessantly the last state of its internal all affairs to global transaction manager 206, while from global thingBusiness manager 206 obtains the transaction snapshot of distributed data base system current time all affairs, in order to pass through the affairsSnapshot judging whether include the target transaction in submission state is not completed in the affairs for performing are had started to, so as to realizeProcess is operated come the global coherency of database data according to the state of affairs, to avoid to distributed dataAffairs in system in the different conditions problem for being unable to reach data global coherency caused when being operated, and thenEnsure the global coherency of data.
It should be noted that in the present embodiment, coordinator 204, global transaction manager 206 in above-mentioned applied environment,The function of database service 208 can be as follows:
1) above-mentioned coordinator 204 can be, but not limited to for receive client 202 transmission SQL (SQL,Structured Query Language) statement block request;Then it is (unique to the application GXID of global transaction manager 206And orderly affairs ID, referred to as GXID);The transaction snapshot of Current transaction is reported to global transaction manager 206;AndSQL is sent to multiple database server nodes (such as database service node A and data base server node B)Perform, and collect SQL implementing results, and return result to client 202.
2) above-mentioned global transaction manager 206 is used to generate unique and orderly GXID for each affairs;It is additionally operable to monitoringThe state of all affairs in tracking distributed data base system, receives and preserves the transaction status report for reporting;Response dataThe transaction status request of service node, sends the transaction snapshot at current time to data serving node.
3) the database service node in above-mentioned database service 208 is used for executed in parallel sql command;To global transactionAll transaction snapshot information in the distributed data base system at the acquisition current time of manager 206, are carried out according to transaction snapshotThe process operation of the global coherency of data.
Alternatively, in the present embodiment, the state of the above-mentioned affairs for having started to perform can including but not limited to below at leastOne of:(running) is currently running, (committed) is had been filed on, is stopped (aborted), wherein, in not completeInvolved data item can include one or more in the target transaction of the state of submission to.
Alternatively, in the present embodiment, the operation indicated by above-mentioned first affairs can including but not limited to it is following at least itOne:Modification, deletion and inquiry.
It should be noted that in the present embodiment, when having started to there is target transaction in the affairs for performing, if the first affairsIndicated operation is that deletion action and/or modification operation are carried out to data item, then the State Transferring in target transaction isComplete submit to after just to the data item involved by the first affairs in the affairs of part or all of execution first indicated by deleteDivision operation and/or modification operation;If the operation indicated by the first affairs is to carry out inquiry operation to data item, can returnReturn after the State Transferring of target transaction to complete to submit to, it is current that the data item involved by the first affairs of inquiry is obtainedInformation, it is also possible to return in the case where the state of target transaction is not submitted to yet, inquire about the data item involved by the first affairsThe historical information for obtaining, wherein, the historical information that above-mentioned inquiry is obtained can be, but not limited to include involved by the first affairsThe object information of the last time operation that data item was completed before performance objective affairs.
Alternatively, in the present embodiment, the data base in above-mentioned database collection can include but is not limited to distributed dataStorehouse.
Alternatively, in the present embodiment, can be including but not limited in the above-mentioned affairs for having started to perform:Current transaction,Wherein, above-mentioned Current transaction is the affairs performed in distributed data base before the first affairs are performed.
Specifically combine and illustrated shown in Fig. 2, the operation device of above-mentioned data base can be as follows:
S1, global transaction manager (GTM, Global Transaction Manager) is distributed data base systemIn each affairs provide and generate unique and orderly affairs ID, referred to as GXID;And the distributed number of Collection and conservationAccording to all of transaction status in the system of storehouse;
When S2, GTM receive coordinator node acquisition new transactions requests, a unique and orderly GXID is generated to coordinationDevice node;
When S3, GTM receiving data storehouse service node obtains current time system transaction snapshot request, the institute of Collection and conservationThere are transaction status to be sent to database service node;
S4, database service node receives SQL statement and parses execution, and returns implementing result.
Alternatively, in the present embodiment, start in affairs, affairs terminate, the preparatory stage of two-phase commitment protocol, numberThe state report of Current transaction is sent to GTM according to storehouse service node.
Alternatively, in the present embodiment, when the inquiry operation indicated by the first affairs is performed, the data for inquiring are returnedCan be including but not limited to following at least one during item:
1) when Transaction service is to submit to read (read committed), database service node is performing firstDuring each SQL statement of affairs, all first will be to all affairs of GTM request current times whole distributed data base systemState snapshot;
2) when Transaction service is repeatable read (read repeatable) and serializing (serializable),Database service node is busy to GTM request current times whole distributed data base system institute when Current transaction startsThe state snapshot of business.
The embodiment provided by the application, in first the first transaction information of reception and Current transaction snapshot, wherein,Current transaction snapshot includes engraving the mark and state of the affairs for having started to perform in database collection when first.By sentencingWith the presence or absence of the target transaction that state is unfinished submission in the disconnected affairs for having started to perform, if the above-mentioned thing for having started to performThere is above-mentioned target transaction in business, then just to involved by the first affairs after the State Transferring of target transaction to complete submissionAnd data item in the affairs of part or all of execution first indicated by operation, so as to realize affairs all to the first momentGlobal coherency operation.
Used as a kind of optional scheme, judging unit includes:
1) the first judge module, for have started to perform affairs in Current transaction to database collection in it is currentIn the case that data base performs the operation indicated by Current transaction, judge Current transaction whether on each current databaseComplete to submit to, wherein, current database is one or more data bases;
2) setup module, for when judging that Current transaction is not complete submission on each current database,The state of Current transaction is set to not complete submission;
3) the second judge module, for judging that performing the data item for not completing the operation indicated by the Current transaction submitted to isIt is part or all of in the data item of the no operation including indicated by the first affairs of execution;
4) determining module, in the part for judging to include to perform in the data item of the operation indicated by the first affairs orWhen whole, using Current transaction as one of target transaction, and judge there is target transaction.
Alternatively, in the present embodiment, the current database for performing Current transaction can include but is not limited to one or moreData base.Wherein, when current database is multiple data bases, if at least one data base is not completed indicated by Current transactionOperation, then it is state in unfinished submission to identify Current transaction, and otherwise, it is to complete what is submitted to identify Current transactionState.
Alternatively, in the present embodiment, after judging that Current transaction is in unfinished submission state, in judging Current transactionWhether involved data item includes the part or all of of the data item involved by the operation indicated by the first affairs, if judgingAs a result it is yes, then judges that Current transaction is target transaction.Further, to have started to perform affairs in other affairsAbove-mentioned judgement is repeated, to obtain having started to all target transactions in the affairs of execution, so as to realize to target transactionIn data item State Transferring for complete submit to after, then start perform the first affairs indicated by operation.
The embodiment provided by the application, has started to the target transaction in the affairs for performing to realize holding by acquisitionDuring operation indicated by the affairs of row first, target transaction is performed etc. it is to be operated, until the State Transferring of target transaction is forComplete to submit to, so as to realize the control of the global coherency to distributed data base, to avoid being obtained by distributed data baseGet different data caused by the inconsistent problem of data.
Used as a kind of optional scheme, processing unit includes at least one of:
1) first processing module, for being to the second data item in the first data base in the operation indicated by the first affairsWhen set performs deletion action, the data item in the second collection of data items in addition to partly or entirely is deleted, andThe State Transferring of target transaction is to complete to delete all or part of data item after submitting to;Or, describedWhen operation indicated by first affairs is to perform the deletion action to the second collection of data items in first data base,By in second collection of data items except it is described partly or entirely in addition to data item deleted, and in the target transactionState Transferring to complete to judge whether all or part of data item meets first affairs letter after submitting toThe deletion condition corresponding with the deletion action carried in breath, to deleting described in satisfaction in all or part of data itemExcept the data item of condition is deleted;
2) Second processing module, for being to the 3rd data item in the first data base in the operation indicated by the first affairsWhen set performs modification operation, modification operation is performed to the data item in the 3rd collection of data items in addition to partly or entirely,And in the State Transferring of target transaction change operation to complete all or part of data item to be performed after submitting to;Or,It is that the modification is performed to the 3rd collection of data items in first data base in the operation indicated by first affairsDuring operation, in the 3rd collection of data items except it is described partly or entirely in addition to data item perform the modification operation,And judge whether all or part of data item is full after the State Transferring of the target transaction to complete submissionThe modification condition corresponding with the modification operation carried in foot first transaction information, to all or part of numberThe modification operation is performed according to the data item that the modification condition is met in item.
Alternatively, in the present embodiment, the operation indicated by above-mentioned first affairs can including but not limited to it is following at least itOne:Deletion action, modification operation.Wherein, in the data item of the operation indicated by above-mentioned first affairs part or completeWhen portion's data item is data item involved in target transaction, the data in distributed data base are performed unanimously in order to reachProperty control operation, in the present embodiment, after in the State Transferring of target transaction to complete to submit to, then to firstThe operation partly or entirely performed indicated by above-mentioned first affairs in the data item involved by operation indicated by affairs.
That is, being that the second collection of data items in the first data base is operated in the operation indicated by the first affairsWhen, the data item in the second collection of data items in addition to the part or all of data item involved by target transaction is directly performedOperation indicated by first affairs;And after the State Transferring of target transaction is to have been filed on, then to the second collection of data itemsPart or all of data item involved by middle target transaction performs the operation indicated by the first affairs.It should be noted thatOperation indicated by first affairs is performed to the part or all of data item involved by target transaction in the second collection of data itemsBefore, also include:The data item of judgment part or whole whether meet in the first transaction information carry it is corresponding with operationOperating condition, after judging to meet operating condition, then to meeting the data of operating condition in all or part of data itemItem carries out performing the operation indicated by the first affairs.
For example, the affairs for currently having started to perform include:Affairs 1, affairs 2 and affairs 3, wherein, affairs 1 and thingBusiness 2 is target transaction, and involved data item includes D1, D2, D3, D4 and D5 in affairs 1, involved in affairs 2And data item include D2, D4, D5 and D6, the first affairs that the first reception is arrived be affairs 4, wherein, affairs 4In involved data item include D1, D2, D4 and D7, that is to say, that the data item involved by the first affairs includes meshPartial data item in mark affairs, i.e.,:D1, D2, D4, thus, above-mentioned data item is performed indicated by the first affairsDuring operation (such as change), then the State Transferring of target transaction such as need to complete to perform modification operation after submission state again.
Again for example, still the partial data item in target transaction included with the data item involved by the first affairs, i.e.,:D1、D2、As a example by D4, then before the operation indicated by the first affairs (such as deleting) is performed to data item D1, D2, D4, alsoNeed to judge whether above-mentioned data item meets the deletion condition corresponding with deletion action carried in the first transaction information, for example,Deletion condition is that the data item to space shared by data more than 2M is deleted.Hypothesis judges that data item D1, D2 meetsAbove-mentioned deletion condition, then to meet deletion condition data item D1, D2 perform the first affairs indicated by deletion action.
The embodiment provided by the application, include to the part in target transaction in the operation indicated by the first affairs orWhen total data item performs modification operation and deletion action, need to be after the State Transferring of target transaction be to complete to submit to againAbove-mentioned modification operation or deletion action are performed to above-mentioned all or part of data item, so as to avoid being obtained in the first affairsThe inconsistence problems to caused by the different data institute of data item content.
As a kind of optional scheme, also include:
1) the 3rd processing module, for there are the target transaction, the first affairs in the affairs for having started to and performingWhen indicated operation is to perform inquiry operation to the first collection of data items in the first data base, the first item set is returnedThe current information of the data item in conjunction in addition to partly or entirely, and return all or part of in the first collection of data itemsThe historical information of data item.
It should be noted that when the operation indicated by the first affairs is inquiry operation, during the first collection of data items can be returnedThe current information of the data item in addition to partly or entirely that inquiry is obtained, it is also possible to return in the first collection of data items and inquire aboutThe historical information of all or part of data item for obtaining., wherein, the historical information that above-mentioned inquiry is obtained can with but do not limitIn the result letter of the last time operation completed before performance objective affairs including the data item involved by the first affairsBreath.
The embodiment provided by the application, include to the part in target transaction in the operation indicated by the first affairs orWhen total data item performs inquiry operation, if having completed the operation of Current transaction, current information is returned, if do not complete working asThe operation of front affairs, then return the historical information before operation.
Used as a kind of optional scheme, the 3rd processing module includes:
1) first process submodule, for the State Transferring of target transaction for complete submit to after, returning part orThe current information of whole data item.
Specifically illustrate with reference to the example below, Fig. 3 is the flow process of the operational approach of data base according to embodiments of the present inventionFigure, as shown in figure 3, distributed transaction isolation level is repeatable read (read repeatable) and serializing(serializable) when, detailed process is as follows:
Step S301, coordinator node receives the SQL statement block request that client sends;
Step S302, coordinator node asks the snapshot of GXID and current time all affairs to global transaction manager;
Step S303, global transaction manager is sent to coordinator node newly-generated GXID and transaction snapshot;
Global transaction manager receives coordinator node and obtains after new GXID requests, and generation one is unique and orderlyGXID is sent to coordinator node.Simultaneously global transaction manager preserves the status information of this newly-generated affairs.
Transaction snapshot refers to all of affairs and status information in current time whole distributed data base system, state bagInclude:(running) is currently running, (committed) is had been filed on, is stopped (aborted).
Step S304, coordinator node is sent to multiple database service nodes SQL statement block, GXID, transaction snapshot;
Coordinator is sent to SQL statement the database service node of multiple correlations, to facilitate multiple database service nodesCan executed in parallel SQL query.
Step S305, database service node performs first SQL, and carries out global coherency reading behaviour according to transaction snapshotMake;
Database service node judges to realize the global coherency of data according to the SNAPSHOT INFO of current time all affairsRead.
Step S306, coordinator node collects all database service node implementing results and is sent to client;
Step S307, database service node continues executing with next SQL, and carries out global coherency according to transaction snapshotRead operation;
When Transaction service is repeatable read (read repeatable) and serializing (serializable),According to the ACID characteristics of affairs, it is only necessary to using this affairs start time transaction snapshot carrying out the overall situation one of dataCause property judges that this transaction snapshot is to obtain and pass to data base to global transaction manager application by coordinator nodeService node.
Step S308, coordinator node collects all database service node implementing results and is sent to client;
The embodiment provided by the application, it is globally consistent to realize data by the snapshot for obtaining current time all affairsProperty read, i.e., database service node by the transaction status of itself and the distributed data base system at current time ownOther transaction snapshots are analyzed to judge that the global coherency for realizing data is read.
Used as a kind of optional scheme, the 3rd processing module includes:
1) second processing submodule, for the State Transferring of target transaction for complete submit to after, returning part orThe historical information of whole data item.
Specifically illustrate with reference to the example below, Fig. 4 is the flow process of the operational approach of data base according to embodiments of the present inventionFigure, as shown in figure 4, distributed transaction isolation level is to have been filed on reading (read committed), detailed process is as follows:
Step S401, coordinator node receives the SQL statement block request that client sends;
Step S402, coordinator node asks the snapshot of GXID and current time all affairs to global transaction manager;
Step S403, global transaction manager is sent to coordinator node newly-generated GXID and transaction snapshot;
Global transaction manager receives coordinator node and obtains after new GXID requests, and generation one is unique and orderlyGXID is sent to coordinator node.Simultaneously global transaction manager preserves the status information of this newly-generated affairs.
Transaction snapshot refers to all of affairs and status information in current time whole distributed data base system, state bagInclude:(running) is currently running, (committed) is had been filed on, is stopped (aborted).
Step S404, coordinator node is sent to multiple database service nodes SQL statement block, GXID, transaction snapshot;
Coordinator is sent to SQL statement the database service node of multiple correlations, to facilitate multiple database service nodesCan executed in parallel SQL query.
Step S405, database service node performs first SQL, and carries out global coherency reading behaviour according to transaction snapshotMake;
Database service node judges to realize the global coherency of data according to the SNAPSHOT INFO of current time all affairsRead.
Step S406, coordinator node collects all database service node implementing results and is sent to client;
Step S407, database service node asks current time before next SQL is performed to global transaction managerThe snapshot of all affairs;
When Transaction service is to have been filed on reading (read committed), according to the ACID characteristics of affairs, dataStorehouse service node perform Current transaction each SQL statement when, all first will to global transaction manager request it is current whenCarve the state snapshot of all affairs of whole distributed data base system.
Step S408, global transaction manager is sent to database service node current time transaction snapshot;
Step S409, database service node performs next SQL according to transaction snapshot, and carries out global coherency reading behaviourMake;
Database service node judges to realize the global coherency of data according to the SNAPSHOT INFO of current time all affairsRead.
Step S410, coordinator node collects all database service node implementing results and is sent to client.
Above-described embodiment Transaction service be have been filed on read (read committed) when, by obtain current timeThe snapshot of all affairs is read realizing data global coherency, i.e., database service node by the transaction status itself andEvery other transaction snapshot is analyzed to judge to realize data in the distributed data base system at current timeGlobal coherency is read.
It should be noted that above-mentioned modules can be by software or hardware to realize, for the latter, Ke YitongCross in the following manner realization, but not limited to this:Above-mentioned module is respectively positioned in same processor;Or, above-mentioned module distinguishes positionIn multiple processors.
Embodiment 3
Embodiments of the invention additionally provide a kind of storage medium.Alternatively, in the present embodiment, above-mentioned storage medium canTo be arranged to store the program code for performing following steps:
S1, in first the first transaction information of reception and Current transaction snapshot, wherein, the first transaction information is used to indicateAt least the operation indicated by the first affairs is performed to the first data base, Current transaction snapshot includes:Data base is engraved when firstThe mark and state of the affairs of execution are had started in set, data base set is combined into including including the first data base or manyIndividual data base;
S2, judges in the indicated affairs for having started to perform of mark with the presence or absence of target transaction, wherein, target transactionState is not to complete submission, and the data item involved by target transaction includes the part in the data item involved by the first affairsOr all;
S3, if having started to there is target transaction in the affairs for performing, includes deleting behaviour in the operation indicated by the first affairsIn the case of making and/or changing operation, just to the first office after the State Transferring of target transaction to complete submissionThe operation indicated by the affairs of part or all of execution first in the data item being related to.
Alternatively, in the present embodiment, above-mentioned storage medium can be including but not limited to:USB flash disk, read only memory (ROM,Read-Only Memory), random access memory (RAM, Random Access Memory), portable hard drive, magneticDish or CD etc. are various can be with the medium of store program codes.
Alternatively, the specific example in the present embodiment may be referred to showing described in above-described embodiment and optional embodimentExample, the present embodiment will not be described here.
Obviously, those skilled in the art should be understood that above-mentioned each module of the invention or each step can be with generalRealizing, they can be concentrated on single computing device computing device, or be distributed in multiple computing devices and constitutedNetwork on, alternatively, they can be realized with the executable program code of computing device, it is thus possible to by theyStorage is performed in the storage device by computing device, and in some cases, can be held with the order being different from hereinThe shown or described step of row, or they are fabricated to respectively each integrated circuit modules, or will be many in themIndividual module or step are fabricated to single integrated circuit module to realize.So, the present invention is not restricted to any specific hardwareCombine with software.
The preferred embodiments of the present invention are the foregoing is only, the present invention is not limited to, for the technology of this areaFor personnel, the present invention can have various modifications and variations.It is all within the spirit and principles in the present invention, made it is anyModification, equivalent, improvement etc., should be included within the scope of the present invention.