A kind of distributed transaction processing method and device
Technical field
This specification embodiment is related to network technique field more particularly to a kind of distributed transaction processing method and device.
Background technique
Distributed structure/architecture is mostly used greatly particularly with regard to the affairs of financial industry business in Internet technical field
Realize effectively service.
In distributed structure/architecture, multiple databases or multiple tables of data can be related to mostly, therefore, same transaction may need
It to access across multiple databases (specific access operation can be read operation and/or write operation).In order to guarantee across multiple numbers
According to the consistency of library access data, the processing that distributed transaction carries out financial transaction can be used.
However, a distributed transaction can read the data that unfinished distributed transaction is accessing, easily go out
The dirty reading of existing data, unreal reading, dirty the problems such as writing.Current distributing real time system can only guarantee to access the final of data as a result,
Consistency not can guarantee the strong consistency of access data.
Summary of the invention
This specification embodiment provides a kind of distributed transaction processing method and device, is distributed in the prior art to solve
Formula affairs not can guarantee the problem of strong consistency of access data.
In order to solve the above-mentioned technical problem, this specification embodiment adopts the following technical solutions:
In a first aspect, providing a kind of distributed transaction processing method, comprising:
In response to distributed transaction to the access operation of target record in the object table of node database, in the number of nodes
According to write-in target line lock record in the row lock record sheet in library, wherein include the name of the object table in the target line lock record
The major key information of title and the target record in the object table;
Write-in based on target line lock record is as a result, determine access of the distributed transaction to the target record
Permission;
Based on the access authority, the corresponding transaction operation of the distributed transaction is executed.
Second aspect provides a kind of distributing real time system device, comprising:
Row lock writing module grasps the access of target record in the object table of node database in response to distributed transaction
Make, the write-in target line lock record in the row lock record sheet of the node database, wherein include in the target line lock record
The major key information of the title of the object table and the target record in the object table;
Permission determining module, the write-in based on target line lock record is as a result, determine the distributed transaction to described
The access authority of target record;
Transaction model is based on the access authority, executes the corresponding transaction operation of the distributed transaction.
The third aspect provides a kind of electronic equipment, comprising: memory, processor and is stored on the memory simultaneously
The computer program that can be run on the processor, the computer program are executed by the processor:
In response to distributed transaction to the access operation of target record in the object table of node database, in the number of nodes
According to write-in target line lock record in the row lock record sheet in library, wherein include the name of the object table in the target line lock record
The major key information of title and the target record in the object table;
Write-in based on target line lock record is as a result, determine access of the distributed transaction to the target record
Permission;
Based on the access authority, the corresponding transaction operation of the distributed transaction is executed.
Fourth aspect provides a kind of computer readable storage medium, the computer-readable recording medium storage one
Or multiple programs, one or more of programs are when the electronic equipment for being included multiple application programs executes, so that the electricity
Sub- equipment executes following operation:
In response to distributed transaction to the access operation of target record in the object table of node database, in the number of nodes
According to write-in target line lock record in the row lock record sheet in library, wherein include the name of the object table in the target line lock record
The major key information of title and the target record in the object table;
Write-in based on target line lock record is as a result, determine access of the distributed transaction to the target record
Permission;
Based on the access authority, the corresponding transaction operation of the distributed transaction is executed.
This specification embodiment use at least one above-mentioned technical solution can reach it is following the utility model has the advantages that
Through the above technical solutions, response distributed transaction grasps the access of target record in the object table of node database
Make, node database row lock record sheet in write-in target line lock record, and based on target line lock record write-in result at
Whether function, decides whether to distribute the access authority to target record for distributed transaction, be then based on access authority, execute distribution
The access operation or rolling back action of formula affairs.In this manner it is ensured that the target note that unfinished distributed transaction is accessing
Record will not be accessed by other distributed transactions, avoided occurring dirty reading, unreal reading, dirty the problems such as writing when access data, promoted distributed
The strong consistency of transactions access data.
Detailed description of the invention
In order to illustrate more clearly of this specification embodiment or technical solution in the prior art, below will to embodiment or
Attached drawing needed to be used in the description of the prior art is briefly described, it should be apparent that, the accompanying drawings in the following description is only
The some embodiments recorded in this specification embodiment are not paying creative labor for those of ordinary skill in the art
Under the premise of dynamic property, it is also possible to obtain other drawings based on these drawings.
Fig. 1 is one of the step schematic diagram of distributed transaction processing method that this specification embodiment provides;
Fig. 2 is the two of the step schematic diagram for the distributed transaction processing method that this specification embodiment provides;
Fig. 3 is the flow diagram for the distributed transaction processing method that this specification embodiment provides;
Fig. 4 is the hardware structural diagram for the electronic equipment that this specification embodiment provides;
Fig. 5 a is one of the structural schematic diagram for the distributing real time system device that this specification embodiment provides;
Fig. 5 b is the second structural representation for the distributing real time system device that this specification embodiment provides.
Specific embodiment
To keep the purposes, technical schemes and advantages of this specification embodiment clearer, have below in conjunction with this specification
The technical solution of this specification embodiment is clearly and completely described in body embodiment and corresponding attached drawing.Obviously, described
Embodiment be only this specification a part of the embodiment, instead of all the embodiments.The embodiment of base in this manual, this
Field those of ordinary skill every other embodiment obtained without making creative work, belongs to this explanation
The range of book embodiment protection.
The new processing scheme of one kind that this specification embodiment is proposed primarily directed to distributed transaction, wherein distributed
Affairs refer to affairs participant, support affairs server, Resource Server and task manager be located at it is different
On the different nodes of distributed system.When responding the access operation of a distributed transaction, it can only guarantee accessed data
Final consistency, and not can guarantee the strong consistency of accessed data, therefore, often will appear accessed data dirty reading,
Unreal reading, dirty the defects of writing.
For this purpose, this specification embodiment provides a kind of distributing real time system scheme, especially by the distributed thing of response
Target is written in the row lock record sheet of node database in the access operation being engaged in target record in the object table of node database
Row lock record, and the write-in result success or not based on target line lock record, decide whether to distribute for distributed transaction to target
The access authority of record, is then based on access authority, executes the access operation or rolling back action of distributed transaction.In this way, can
It will not be accessed by other distributed transactions with the target record for guaranteeing that unfinished distributed transaction is accessing, avoid access number
According to when occur it is dirty read, it is unreal read, dirty the problems such as writing, promoted distributed transaction access data strong consistency.
Scene interpretation is carried out to some words that this specification embodiment is related to below.
Strong consistency refers to that target record (i.e. data) is revised as another state B from state A by an affairs, in thing
Before business execution, in affairs execution and after affairs execution, the external world not can be appreciated that other states in addition to state A, B.
Final consistency refers to that target record (i.e. data) is revised as another state B from state A by an affairs,
During affairs execute, the external world can be appreciated that other state C in addition to state A, B, but after affairs, the external world will only see shape
State A or state B, wherein state A can be understood as transaction rollback, and state B can be understood as affairs submission.
Dirty reading, the also known as reading of invalid data, refer in database access, and affairs T1 modifies a certain value, then thing
Business T2 reads the value, and hereafter because certain reason cancels the modification to the value, which results in the data that T2 is read to be T1
Invalid.
Unreal reading refers to a kind of phenomenon occurred when affairs are not to independently execute;In database access, affairs T1 is repaired
Change the total data in tables of data, affairs T2 is added to data line into tables of data, and affairs T1 is after modification terminates, discovery
Occur the data oneself not being modified in tables of data, illusion seemingly occurs in affairs T1, there are some data not to be accessed.
It is dirty to write, refer in database access, two affairs all update data line simultaneously, and an affairs T1 is to data
Update covers another affairs T2 to the update of data.
Below in conjunction with attached drawing, the technical solution that each embodiment of this specification provides is described in detail.
Embodiment one
Shown in referring to Fig.1, for the step schematic diagram for the distributed transaction processing method that this specification embodiment provides, this point
The executing subject of cloth issued transaction scheme can be server;The distributed transaction processing method mainly comprises the steps that
Step 102: in response to distributed transaction to the access operation of target record in the object table of node database, in institute
State write-in target line lock record in the row lock record sheet of node database, wherein include the mesh in the target line lock record
Mark the major key information of the title and the target record of table in the object table.
In this specification embodiment, distributed transaction can target record hair in the object table to any node database
Access is played, server responds the access operation, start the write-in target line lock record in the row lock record sheet of node database, this
Sample, the target record are labeled by way of row lock, will not be accessed by other distributed transactions.
It should be understood that corresponding row lock record sheet can be set in each node database in this specification embodiment,
Row lock record sheet is used to carry out the data (i.e. target record) being accessed row lock record in this node database.
In fact, in this specification embodiment, it may include: target that writing line, which locks the target line in record sheet and locks record,
Major key information of the title and target record of table in object table.Wherein, the title of object table can be any character string structure
At being also possible to digital composition, for example, " tables of data 1 ";Major key information can be Major key.Due in a node database
It is interior, the title of tables of data (i.e. traffic table) be it is unique, and the Major key inside each tables of data be also it is unique, therefore, mesh
Major key information of the title and target record of mark table in object table can uniquely determine a data (i.e. target record).
Step 104: the write-in based on target line lock record is as a result, determine that the distributed transaction remembers the target
The access authority of record.
In this specification embodiment, target line lock record can be not necessarily successfully written in row lock record sheet, therefore, be needed
The write-in result of record is locked according to target line to decide whether to distribute the access authority to target record for distributed transaction.
It should be understood that distributed transaction to the access authority of target record may include: to target record carry out write operation or
Read operation.Wherein, carrying out write operation to target record can further comprise: grasp to modification, deletion, increase of target record etc.
Make.
Step 106: being based on the access authority, execute the corresponding transaction operation of the distributed transaction.
It should be understood that the transaction operation involved in this specification embodiment may include: access operation, rolling back action with
And it does not deal with.
Through the above technical solutions, response distributed transaction grasps the access of target record in the object table of node database
Make, node database row lock record sheet in write-in target line lock record, and based on target line lock record write-in result at
Whether function, decides whether to distribute the access authority to target record for distributed transaction, be then based on access authority, execute distribution
The access operation or rolling back action of formula affairs.In this manner it is ensured that the target note that unfinished distributed transaction is accessing
Record will not be accessed by other distributed transactions, avoided occurring dirty reading, unreal reading, dirty the problems such as writing when access data, promoted distributed
The strong consistency of transactions access data.
In this specification embodiment, it is contemplated that mainly by row lock record sheet in record as a result, come decide whether for
Therefore current distributed transaction allocation of access rights can specifically include following at least two implementation.
Mode one
-- the title of tables of data and the major key of tables of data of the row lock record sheet using node database are locked as the row
The major key of record sheet, the major key of the target line lock record is by the title and the target record of the object table in the target
Major key in table is constituted.
Correspondingly, step 104 is locking the write-in of record based on the target line as a result, determining institute in this specification embodiment
When stating access authority of the distributed transaction to the target record, can specifically it execute are as follows:
If the target line lock record is written successfully, it is determined that the distributed transaction, which has the target record, visits
Ask permission;
If the target line lock record write-in failure, it is determined that the distributed transaction does not have the target record
Access authority.
It should be understood that this is because target line lock record composition determine, just because of target line lock record major key by
Major key of the title and target record of object table in object table is constituted, and therefore, target line lock record, which is expert at, to be locked in record sheet
Be exactly it is unique, here be uniquely not offered as a similar record, and refer to the target of only unique corresponding target record
Row lock record.So, would not allow in row lock record sheet by other distributed transactions for same target record write-in
Therefore target line lock record will have at least two write-in results: being written successfully, remember for distributed transaction distribution to target
The access authority of record, the i.e. distributed transaction have access authority to target record;Write-in failure will not be distributed transaction point
The access authority of target record is matched, i.e. the distributed transaction does not have access authority to target record.
Optionally, in this specification embodiment, the target line lock record is written and can successfully implement are as follows: the row
It has not been recorded in lock record sheet and has recorded identical major key with target line lock, determined that the target line lock record is written successfully;
Correspondingly,
The target line lock record write-in failure can implement are as follows: recording in the row lock record sheet has and the target
Row lock records identical major key, determines the target line lock record write-in failure.
Specifically, it is contemplated that target line lock record is to be indicated with major key, and the major key is by the title and target of object table
The major key being recorded in object table is constituted, and therefore, can be directly recorded according to the corresponding target line lock of current distributed transaction
It searches whether that record has same major key in row lock record sheet, is recorded if row lock record sheet has not recorded to lock with target line
Identical other major keys, it is determined that the target line lock record is written successfully;If record has and target line in row lock record sheet
Lock records identical major key, it is determined that the target line lock record write-in failure.
For example, the target note in the object table (table name is known as S1) that the distributed transaction 1 initiates to node database C
After the access operation for recording (Major key 1), server responds the access operation, and attempts the row lock record in node database C
Target line lock record 1 is written in table, the Major key of target line lock record 1 is S1+1, if in the mistake of write-in target line lock record 1
Major key conflict occurs for Cheng Zhong, then it represents that having been recorded with the Major key that other distributed transactions 2 are written in row lock record sheet is S1
+ 1 target line lock record 2, then, the 1 write-in failure of target line lock record, in turn, distributed transaction 1 does not have to number of nodes
According to the access authority of target record in the object table of library C;If during target line lock record 1 is written, in row lock record sheet
It has not recorded and has recorded identical Major key with target line lock, then, target line lock record 1 is written successfully, in turn, distributed thing
Business 1 has the access authority to target record in the object table of node database C.
Mode two
-- row lock record sheet be not using the major key of the title of the tables of data of node database and tables of data described in
The major key of row lock record sheet.
Although it should be understood that this mode be not it is optimal, equally can be very good to realize the row lock to target record,
It avoids being accessed when the target record is accessed by some distributed transaction by other distributed transactions.
Optionally, step 104 is locking the write-in of record based on the target line as a result, determining institute in this specification embodiment
When stating access authority of the distributed transaction to the target record, can specifically it execute are as follows:
Based on the title and the target record for including the object table in row lock record sheet in the object table
Major key information record number, determine the distributed transaction to the access authority of the target record.
It should be understood that the information content recorded in row lock record sheet can be indifferent in this specification embodiment, but only
It is concerned about the number of record recorded in row lock record sheet, and is decided whether with the record number of record as distributed transaction distribution
To the access authority of target record.The simple violence for aforesaid way one of this implementation, can more it is intuitive just
Access authority of the prompt determination distributed transaction to target record.
Further, step 104 includes the title and target note of the object table in based on row lock record sheet
The number for recording the record of the major key information in the object table, determines access of the distributed transaction to the target record
When permission, can specifically it execute are as follows:
If the title for including the object table in the row lock record sheet and the target record are in the object table
Major key information record number be 1, it is determined that the distributed transaction to the target record have access authority;
If title and the target record including the object table are in the object table in the row lock record sheet
Major key information record number be greater than 1, it is determined that the distributed transaction to the target record do not have access authority.
It should be noted that the comparison threshold value of the record number of row lock record sheet here is set as 1, and row lock record
Just writing line is allowed to lock in record sheet when carrying out row lock operation to target record in table, and then can be locked and be recorded by writing line
Whether the record number in table, which is greater than, is compared threshold value 1, to decide whether allocation of access rights.
For example, the target note in the object table (table name is known as S1) that the distributed transaction 1 initiates to node database C
After the access operation for recording (Major key 1), server responds the access operation, and in the row lock record sheet of node database C
Target line lock record 1 is written, target line lock record 1 is not provided with Major key.If after write-in target line lock record 1, row lock
Of the record of the major key information of title and the target record in the object table in record sheet including the object table
Number is greater than 1, then it represents that and another target line, which is had been recorded with, in row lock record sheet locks 2 (belonging to distributed transaction 2) of record, that
, distributed transaction 1 is without the access authority to target record in the object table of node database C;If in write-in target line
After lock record 1, the record of the major key information of title and the target record including the object table in the object table
Number is 1, then, distributed transaction 1 has the access authority to target record in the object table of node database C.
Optionally, in this specification embodiment, step 106 is executing the distributed transaction based on the access authority
When corresponding transaction operation, can specifically it execute are as follows:
If the distributed transaction has access authority to the target record, and the access operation is write operation,
Then execute the access operation;
If the distributed transaction does not have access authority to the target record, and the access operation is to write behaviour
Make, then distributed transaction described in rollback.
Optionally, in this specification embodiment, step 106 is executing the distributed transaction based on the access authority
When corresponding transaction operation, can specifically it execute are as follows:
If the distributed transaction has access authority to the target record, and the access operation is read operation,
Then execute the access operation;
If the distributed transaction does not have access authority to the target record, and the access operation is to read behaviour
Make, does not then execute the access operation.
It should be understood that related transaction operation can wrap during the distributing real time system of this specification embodiment
Include the write operation for target record, read operation.
Optionally, referring to shown in Fig. 2, after executing step 106, further includes:
Step 108: the target line lock record is deleted in row lock record sheet.
In this manner it is ensured that the record in row lock record sheet empties, so that other distributed transactions can be to node data
Target record in the object table in library accesses.
Embodiment two
The distributing real time system process in this specification embodiment is described in detail below by specific embodiment.
Referring to shown in Fig. 3, distributed data base involved in the distributed transaction framework includes multiple node datas,
In a node database C is only shown, the processing of other databases is similar.It may include having multiple tables of data in node database C
(also referred to as traffic table) and a row lock record sheet.
When distributed transaction 1 is initiated to a certain record access of tables of data 1 in node database C, firstly, starting thing
Business, capable lock then is carried out to the tables of data 1 to be accessed in the first stage, that is, be expert at lock in record sheet be written tables of data title with
And the major key information for the record to be accessed, the major key as target line lock record.In this way, being achieved that the row lock to tables of data 1.
Before the submission that distributed transaction 1 is also not carried out second stage, distributed transaction 2 initiates the access to same record, starts
After affairs, also attempt to carry out capable lock to the record, still, at this time row lock record sheet in have been recorded with tables of data title and
The major key information for the record to be accessed, therefore, it is impossible to be normally written, i.e. write-in failure;In turn, the second of distributed transaction 2
Stage starts to carry out data rewind, and then executes transaction rollback.Access operation is executed (i.e. in the second stage of distributed transaction 1
Affairs are submitted) after, it releases and the row of above-mentioned record is locked, the affairs of distributed transaction 1 run succeeded.At this point, distributed transaction 3 is sent out
The access to same record is played, after starting affairs, trial carries out capable lock to the record, since distributed transaction 1 has released row
Lock operation, therefore, the target line lock record of distributed transaction 3 can be successfully written;In turn, in the second-order of distributed transaction 3
After Duan Zhihang access operation, releases and the row of above-mentioned record is locked, the affairs of distributed transaction 3 run succeeded.
In this way, being saved by response distributed transaction to the access operation of target record in the object table of node database
Write-in target line lock record in the row lock record sheet of point data base, and the write-in result success or not based on target line lock record,
Decide whether to distribute the access authority to target record for distributed transaction, is then based on access authority, executes distributed transaction
Access operation or rolling back action.In this manner it is ensured that the target record that unfinished distributed transaction is accessing will not
It is accessed by other distributed transactions, avoids occurring dirty reading, unreal reading, dirty the problems such as writing when access data, promote distributed transaction and visit
Ask the strong consistency of data.
Embodiment three
The server of this specification embodiment is discussed in detail referring to Fig. 4 (wherein, server can be described as electronic equipment).
Referring to FIG. 4, in hardware view, the electronic equipment includes processor, optionally further comprising internal bus, network interface, storage
Device.Wherein, memory may include memory, such as high-speed random access memory (Random-Access Memory, RAM),
It may also further include nonvolatile memory (Non-Volatile Memory), for example, at least 1 magnetic disk storage etc..Certainly,
The electronic equipment is also possible that hardware required for other business.
Processor, network interface and memory can be connected with each other by internal bus, which can be industry
Standard architecture (Industry Standard Architecture, ISA) bus, Peripheral Component Interconnect standard
(Peripheral Component Interconnect, PCI) bus or expanding the industrial standard structure (Extended
Industry Standard Architecture, EISA) bus etc..The bus can be divided into address bus, data/address bus,
Control bus etc..Only to be indicated with a four-headed arrow in Fig. 4, it is not intended that an only bus or one kind convenient for indicating
The bus of type.
Memory, for storing program.Specifically, program may include program code, and said program code includes calculating
Machine operational order.Memory may include memory and nonvolatile memory, and provide instruction and data to processor.
Processor is from the then operation into memory of corresponding computer program is read in nonvolatile memory, in logical layer
Content recommendation device is formed on face.Processor executes the program that memory is stored, and is specifically used for executing:
In response to distributed transaction to the access operation of target record in the object table of node database, in the number of nodes
According to write-in target line lock record in the row lock record sheet in library, wherein include the name of the object table in the target line lock record
The major key information of title and the target record in the object table;
Write-in based on target line lock record is as a result, determine access of the distributed transaction to the target record
Permission;
Based on the access authority, the corresponding transaction operation of the distributed transaction is executed.
Method disclosed in the above-mentioned implementation example figure 1- embodiment illustrated in fig. 3 such as this specification can be applied in processor, or
Person is realized by processor.Processor may be a kind of IC chip, the processing capacity with signal.During realization,
Each step of the above method can be completed by the integrated logic circuit of the hardware in processor or the instruction of software form.On
The processor stated can be at general processor, including central processing unit (Central Processing Unit, CPU), network
Manage device (Network Processor, NP) etc.;Can also be digital signal processor (Digital Signal Processor,
DSP), specific integrated circuit (Application Specific Integrated Circuit, ASIC), field programmable gate
Array (Field-Programmable Gate Array, FPGA) either other programmable logic device, discrete gate or crystalline substance
Body pipe logical device, discrete hardware components.It may be implemented or execute disclosed each method, the step in this specification embodiment
And logic diagram.General processor can be microprocessor or the processor is also possible to any conventional processor etc..Knot
The step of closing method disclosed in this specification embodiment can be embodied directly in hardware decoding processor and execute completion, Huo Zheyong
Hardware and software module combination in decoding processor execute completion.Software module can be located at random access memory, flash memory, read-only
The storage medium of this fields such as memory, programmable read only memory or electrically erasable programmable memory, register maturation
In.The storage medium is located at memory, and processor reads the information in memory, and the step of the above method is completed in conjunction with its hardware
Suddenly.
The method that the electronic equipment can also carry out Fig. 1-Fig. 3, and realize distributing real time system device shown in Fig. 1-Fig. 3
The function of embodiment, details are not described herein for this specification embodiment.
Certainly, other than software realization mode, other realization sides are not precluded in the electronic equipment of this specification embodiment
Formula, such as logical device or the mode of software and hardware combining etc., that is to say, that the executing subject of following process flow is simultaneously unlimited
Due to each logic unit, it is also possible to hardware or logical device.
Example IV
This specification embodiment also provides a kind of computer readable storage medium, the computer-readable recording medium storage
One or more programs, one or more of programs are when the electronic equipment for being included multiple application programs executes, so that institute
It states electronic equipment and executes following operation:
In response to distributed transaction to the access operation of target record in the object table of node database, in the number of nodes
According to write-in target line lock record in the row lock record sheet in library, wherein include the name of the object table in the target line lock record
The major key information of title and the target record in the object table;
Write-in based on target line lock record is as a result, determine access of the distributed transaction to the target record
Permission;
Based on the access authority, the corresponding transaction operation of the distributed transaction is executed.
Wherein, the computer readable storage medium, such as read-only memory (Read-Only Memory, ROM), at random
Access memory (Random Access Memory, RAM), magnetic or disk etc..
Embodiment five
It, should for the structural schematic diagram for the distributing real time system device that this specification embodiment provides referring to shown in Fig. 5 a
Device specifically includes that
Row lock writing module 502, the access in response to distributed transaction to target record in the object table of node database
Operation, the write-in target line lock record in the row lock record sheet of the node database, wherein wrapped in the target line lock record
Include the major key information of the title and the target record of the object table in the object table;
Permission determining module 504, the write-in based on target line lock record is as a result, determine the distributed transaction to institute
State the access authority of target record;
Transaction model 506 is based on the access authority, executes the corresponding transaction operation of the distributed transaction.
Optionally, the title of tables of data of the row lock record sheet using node database and the major key of tables of data are described in
The major key of row lock record sheet, the major key of the target line lock record is by the title and the target record of the object table described
Major key in object table is constituted.
Optionally, the permission determining module 504 is specifically used for:
If the target line lock record is written successfully, it is determined that the distributed transaction, which has the target record, visits
Ask permission;
If the target line lock record write-in failure, it is determined that the distributed transaction does not have the target record
Access authority.
Optionally, the permission determining module 504 is specifically used for when determining that target line lock record is written successfully:
It has not been recorded in the row lock record sheet and has recorded identical major key with target line lock, determined the target line lock
Record is written successfully;
The permission determining module 504 is specifically used for when determining target line lock record write-in failure:
There is record in the row lock record sheet records identical major key with target line lock, determines the target line lock note
Record write-in failure.
Optionally, row lock record sheet be not using the major key of the title of the tables of data of node database and tables of data as
The major key of the row lock record sheet.
Optionally, the permission determining module 504 is specifically used for:
Based in row lock record sheet, title and the target record including the object table are in the object table
Major key information record number, determine the distributed transaction to the access authority of the target record.
Optionally, the permission determining module 504 is in based on row lock record sheet, the title including the object table
And the number of the record of major key information of the target record in the object table, determine the distributed transaction to the mesh
When marking the access authority of record, it is specifically used for:
If title and the target record including the object table are in the object table in the row lock record sheet
Major key information record number be 1, it is determined that the distributed transaction to the target record have access authority;
If title and the target record including the object table are in the object table in the row lock record sheet
Major key information record number be greater than 1, it is determined that the distributed transaction to the target record do not have access authority.
Optionally, the transaction model 506 is specifically used for:
If the distributed transaction has access authority to the target record, and the access operation is write operation,
Then execute the access operation;
If the distributed transaction does not have access authority to the target record, and the access operation is to write behaviour
Make, then distributed transaction described in rollback.
Optionally, the transaction model 506 is specifically used for:
If the distributed transaction has access authority to the target record, and the access operation is read operation,
Then execute the access operation;
If the distributed transaction does not have access authority to the target record, and the access operation is to read behaviour
Make, does not then execute the access operation.
Optionally, referring to shown in Fig. 5 b, the distributing real time system device further include:
Row lock removing module 508, for executing the corresponding affairs of the distributed transaction in the transaction model 506
After operation, the target line lock record is deleted in row lock record sheet.
By this specification embodiment, access of the distributed transaction to target record in the object table of node database is responded
Operation, the write-in target line lock record in the row lock record sheet of node database, and the write-in result based on target line lock record
Success or not decides whether to distribute the access authority to target record for distributed transaction, is then based on access authority, executes and divide
The access operation or rolling back action of cloth affairs.In this manner it is ensured that the target that unfinished distributed transaction is accessing
Record will not be accessed by other distributed transactions, avoided occurring dirty reading, unreal reading, dirty the problems such as writing when access data, promoted distribution
The strong consistency of formula transactions access data.
In short, being not intended to limit this specification the foregoing is merely the preferred embodiment of this specification embodiment
The protection scope of embodiment.It is all this specification embodiment spirit and principle within, made any modification, equivalent replacement,
Improve etc., it should be included within the protection scope of this specification embodiment.
System, device, module or the unit that above-described embodiment illustrates can specifically realize by computer chip or entity,
Or it is realized by the product with certain function.It is a kind of typically to realize that equipment is computer.Specifically, computer for example may be used
Think personal computer, laptop computer, cellular phone, camera phone, smart phone, personal digital assistant, media play
It is any in device, navigation equipment, electronic mail equipment, game console, tablet computer, wearable device or these equipment
The combination of equipment.
Computer-readable medium includes permanent and non-permanent, removable and non-removable media can be by any method
Or technology come realize information store.Information can be computer readable instructions, data structure, the module of program or other data.
The example of the storage medium of computer includes, but are not limited to phase change memory (PRAM), static random access memory (SRAM), moves
State random access memory (DRAM), other kinds of random access memory (RAM), read-only memory (ROM), electric erasable
Programmable read only memory (EEPROM), flash memory or other memory techniques, read-only disc read only memory (CD-ROM) (CD-ROM),
Digital versatile disc (DVD) or other optical storage, magnetic cassettes, tape magnetic disk storage or other magnetic storage devices
Or any other non-transmission medium, can be used for storage can be accessed by a computing device information.As defined in this article, it calculates
Machine readable medium does not include temporary computer readable media (transitory media), such as the data-signal and carrier wave of modulation.
It should also be noted that, the terms "include", "comprise" or its any other variant are intended to nonexcludability
It include so that the process, method, commodity or the equipment that include a series of elements not only include those elements, but also to wrap
Include other elements that are not explicitly listed, or further include for this process, method, commodity or equipment intrinsic want
Element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including described want
There is also other identical elements in the process, method of element, commodity or equipment.
Various embodiments are described in a progressive manner in this specification embodiment, identical phase between each embodiment
As partially may refer to each other, each embodiment focuses on the differences from other embodiments.Especially for
For system embodiment, since it is substantially similar to the method embodiment, so being described relatively simple, related place is referring to method
The part of embodiment illustrates.