+

CN110059115A - A kind of method for reading data and device - Google Patents

A kind of method for reading data and device Download PDF

Info

Publication number
CN110059115A
CN110059115A CN201910208212.1A CN201910208212A CN110059115A CN 110059115 A CN110059115 A CN 110059115A CN 201910208212 A CN201910208212 A CN 201910208212A CN 110059115 A CN110059115 A CN 110059115A
Authority
CN
China
Prior art keywords
affairs
field
operation instruction
aiming field
field value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201910208212.1A
Other languages
Chinese (zh)
Other versions
CN110059115B (en
Inventor
张森
尹博学
王光树
曹栖锋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Advanced New Technologies Co Ltd
Advantageous New Technologies Co Ltd
Original Assignee
Alibaba Group Holding Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201910208212.1A priority Critical patent/CN110059115B/en
Publication of CN110059115A publication Critical patent/CN110059115A/en
Application granted granted Critical
Publication of CN110059115B publication Critical patent/CN110059115B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2471Distributed queries
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computational Linguistics (AREA)
  • Mathematical Physics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Probability & Statistics with Applications (AREA)
  • Software Systems (AREA)
  • Fuzzy Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

This application discloses a kind of method for reading data and devices, this method comprises: receiving the read operation instruction of the second affairs, the read operation instructs the aiming field for reading target record in target matrix, the aiming field is modified based on the write operation instruction of the first affairs, first affairs are distributed transaction, and are executed parallel with second affairs;If first affairs are not carried out end, the then field value before reading the aiming field modification in preset data table, and the field value before the modification is returned into second affairs, the preset data table is used for before being modified based on the instruction of the write operation of first affairs to the aiming field, and the field value of the aiming field is stored.

Description

A kind of method for reading data and device
Technical field
This application involves data processing field more particularly to a kind of method for reading data and device.
Background technique
Distributed transaction can be understood as the participant of affairs, support server, Resource Server and the affairs of affairs Manager is located on the different nodes of different distributions formula system.In general, distributed transaction has final consistency, example Such as, a certain data are revised as B by A by distributed transaction, then, during executing distributed transaction, which be can be A, B or other data, but after distributed transaction, which can only be A (transaction rollback) or B (affairs submission).
In practical applications, for distributed transaction when carrying out write operation to data, other affairs can be concurrently to the number According to progress read operation.However, distributed transaction the case where there are transaction rollbacks after execution, in this case, in order to Guarantee the final consistency of distributed transaction, it will revocation distributed transaction causes other affairs to read the write operation of data Data invalid.
Summary of the invention
The embodiment of the present application provides a kind of method for reading data and device, carries out in distributed transaction to data for solving Write operation, will if occurring rollback after distributed transaction in the case that other affairs concurrently carry out read operation to the data The problem of will lead to the data invalid of other affairs reading.
In order to solve the above technical problems, the embodiment of the present application is achieved in that
In a first aspect, proposing a kind of method for reading data, comprising:
The read operation instruction of the second affairs is received, the read operation instruction is for reading target record in target matrix Aiming field, the aiming field are modified based on the write operation instruction of the first affairs, and first affairs are distributed thing Business, and executed parallel with second affairs;
Field if first affairs are not carried out end, before reading the aiming field modification in preset data table Value, and the field value before the modification is returned into second affairs, the preset data table is used for according to described first Before the write operation instruction of affairs modifies to the aiming field, the field value of the aiming field is stored.
Second aspect proposes a kind of reading data device, comprising:
Receiving unit receives the read operation instruction of the second affairs, and the read operation instruction is for reading in target matrix The aiming field of target record, the aiming field are modified based on the write operation instruction of the first affairs, first affairs For distributed transaction, and executed parallel with second affairs;
Reading unit reads the aiming field from preset data table and repairs if first affairs are not carried out end Field value before changing, and the field value before the modification is returned into second affairs, the preset data table is used in root Before modifying according to the write operation instruction of first affairs to the aiming field, the field value of the aiming field is stored.
The third aspect, proposes a kind of electronic equipment, which includes:
Processor;And
It is arranged to the memory of storage computer executable instructions, which makes the processor when executed Execute following operation:
The read operation instruction of the second affairs is received, the read operation instruction is for reading target record in target matrix Aiming field, the aiming field are modified based on the write operation instruction of the first affairs, and first affairs are distributed thing Business, and executed parallel with second affairs;
Field if first affairs are not carried out end, before reading the aiming field modification in preset data table Value, and the field value before the modification is returned into second affairs, the preset data table is used for according to described first Before the write operation instruction of affairs modifies to the aiming field, the field value of the aiming field is stored.
Fourth aspect, proposes 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 electronics Equipment executes following methods:
The read operation instruction of the second affairs is received, the read operation instruction is for reading target record in target matrix Aiming field, the aiming field are modified based on the write operation instruction of the first affairs, and first affairs are distributed thing Business, and executed parallel with second affairs;
Field if first affairs are not carried out end, before reading the aiming field modification in preset data table Value, and the field value before the modification is returned into second affairs, the preset data table is used for according to described first Before the write operation instruction of affairs modifies to the aiming field, the field value of the aiming field is stored.
The embodiment of the present application use at least one above-mentioned technical solution can reach it is following the utility model has the advantages that
Technical solution provided by the embodiments of the present application executes write operation to the aiming field in tables of data in distributed transaction Before, the field value of the aiming field is stored in preset data table, when receiving reading of other affairs to the aiming field When operational order, if distributed transaction is not carried out end, the field value of the aiming field in preset data table can be returned Other affairs are given, in this way, before distributed transaction is not carried out end distributed transaction can be being read just to avoid other affairs In the data of modification, and then other affairs is avoided to read invalid data, avoids the occurrence of " dirty reading " problem.
Detailed description of the invention
In order to illustrate the technical solutions in the embodiments of the present application or in the prior art more clearly, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this The some embodiments recorded in application, for those of ordinary skill in the art, in the premise of not making the creative labor property Under, it is also possible to obtain other drawings based on these drawings.
Fig. 1 is a kind of schematic diagram for method for reading data that the prior art provides;
Fig. 2 is the flow diagram of one embodiment method for reading data of the application;
Fig. 3 is the flow diagram of one embodiment method for reading data of the application;
Fig. 4 is the schematic diagram of one embodiment method for reading data of the application;
Fig. 5 is the structural schematic diagram of one embodiment electronic equipment of the application;
Fig. 6 is the structural schematic diagram of one embodiment reading data device of the application.
Specific embodiment
In general, distributed transaction can execute parallel with other affairs.In a typical application scenarios, distributed thing It is engaged in when carrying out write operation to the data in tables of data, other affairs concurrently can carry out read operation to the data.For example, point Cloth affairs 1 carry out write operation to the data A in tables of data, and when data A is revised as data B, distributed transaction 2 can be with logarithm Read operation is carried out according to B.
However, in practical applications, distributed transaction after, terminating state includes submitting and two kinds of rollback, works as knot When pencil state is rollback, in order to guarantee the final consistency of distributed transaction, distributed transaction can be cancelled to the write operation of data, There is asking for " dirty reading " in this way, will lead to the data invalid that other affairs are read in the data convert that will be modified before Topic.
Specifically referring to Figure 1.In Fig. 1, t is time shaft, and distributed transaction 1 and distributed transaction 2 execute parallel.Specifically Ground:
Distributed transaction 1 executes SQL1, is updated to a field of id=1 row in tables of data 1, and a field is updated by 10 It is 15.After the completion of update, distributed transaction 2 executes SQL2, a field of id=1 row in tables of data 1 is inquired, at this point, distributed The data that affairs 2 inquire are 15.
Distributed transaction 1 leads to transaction rollback after execution for some reason, at this point, distributed transaction 1 will To the update of a field of id=1 row in tables of data 1 between revocation, i.e., a word of id=1 row is reduced to 10 by 15 in tables of data 1.
At this point, the data inquired will be if distributed transaction 2 inquires a field of id=1 row in tables of data 1 again 10, with 15 inconsistent, the data invalids for causing 2 first time of distributed transaction to inquire inquired before, there is " dirty reading " Problem.
When the problem of appearance " dirty reading ", although will not influence data final consistency (distributed transaction after rollback, Can re-execute), still, it will lead to and read chaotic data, needle for a user, can bring certain interference to user.
To solve the above-mentioned problems, the embodiment of the present application provides a kind of method for reading data and device, this method comprises: connecing The read operation instruction of the second affairs is received, the read operation instructs the aiming field for reading target record in target matrix, The aiming field based on the first affairs write operation instruction modify, first affairs be distributed transaction, and with institute The second affairs are stated to execute parallel;If first affairs are not carried out end, the aiming field is read from preset data table Field value before modification, and the field value before the modification is returned into second affairs, the preset data table is used for Before modifying according to the instruction of the write operation of first affairs to the aiming field, the field of the aiming field is stored Value.
Technical solution provided by the embodiments of the present application executes write operation to the aiming field in tables of data in distributed transaction Before, the field value of the aiming field is stored in preset data table, when receiving reading of other affairs to the aiming field When operational order, if distributed transaction is not carried out end, the field value of the aiming field in preset data table can be returned Other affairs are given, in this way, before distributed transaction is not carried out end distributed transaction can be being read just to avoid other affairs In the data of modification, and then other affairs is avoided to read invalid data, avoids the occurrence of " dirty reading " problem.
In order to make those skilled in the art better understand the technical solutions in the application, below in conjunction with the application reality The attached drawing in example is applied, the technical scheme in the embodiment of the application is clearly and completely described, it is clear that described implementation Example is merely a part but not all of the embodiments of the present application.Based on the embodiment in the application, this field is common The application protection all should belong in technical staff's every other embodiment obtained without creative efforts Range.
Below in conjunction with attached drawing, the technical scheme provided by various embodiments of the present application will be described in detail.
Fig. 1 is the flow diagram of one embodiment method for reading data of the application.It the described method comprises the following steps.
S102: the read operation instruction of the second affairs is received, the read operation instruction is for reading target in target matrix The aiming field of record, the aiming field are modified based on the write operation instruction of the first affairs, and first affairs are point Cloth affairs, and executed parallel with second affairs.
In S102, receive the second affairs read operation instruction before, can with the following steps are included:
Firstly, receiving the write operation instruction of the first affairs;
Secondly, the field value of the aiming field of target record in target matrix is deposited before response write operation instruction Storage is in preset data table.
The write operation instruction of first affairs can be used for carrying out writing behaviour to the aiming field of target record in target matrix Make.After the write operation instruction for receiving the first affairs, before responding write operation instruction, it can be instructed based on the write operation The field value of the aiming field of target record in target matrix is inquired, and the field value of the aiming field is stored in present count According in table.Wherein, preset data tableau format can be identical as target data tableau format.
In one implementation, it is preferable that can be by the preset data table with the shape of cancel daily record (" undo log ") Formula storage.
After the field value of aiming field is stored in preset data table, the write operation that can respond the first affairs refers to It enables, i.e., is instructed based on the write operation, modify, be somebody's turn to do to the field value of the aiming field of target record in target matrix The modified field value of aiming field.
After obtaining the modified field value of aiming field, it can receive the second affairs to target record in target matrix Aiming field read operation instruction.
In the present embodiment, the second affairs can be distributed transaction, be also possible to local matter, not do specific limit here It is fixed.
After the read operation instruction for receiving the second affairs, S104 can be executed.
S104: if first affairs are not carried out end, before reading the aiming field modification in preset data table Field value, and the field value before the modification is returned into second affairs.
In S104, after the read operation instruction for receiving the second affairs, it can be determined that whether the first affairs, which execute, terminates.
If the first affairs are not carried out end, the aiming field can be read from the preset data table recorded in S102 Field value, and the field value is returned into the second affairs.Wherein, the field value read from preset data table is the first affairs pair The aiming field modify before field value.
In this way, not allowing the second affairs to read the first affairs due to before the first affairs are not carried out end and modifying Data, it can thus be avoided the second affairs read invalid data, and then avoid the problem that " dirty reading ".
If the execution of the first affairs terminates, the field value of aiming field can be read from target matrix, and will read Field value return to the second affairs.Specifically:
If the end state of the first affairs is rollback, it can be said that bright, the first affairs fail to the modification of aiming field, this When, it can be from the field value after the aiming field rollback for reading target record in target matrix, and by the field after the rollback Value returns to the second affairs, wherein the field value after the rollback can be understood as before the first affairs modify to aiming field Field value;
If the end state of the first affairs is to submit, it can be said that bright, the first affairs to the successfully modified of aiming field, this When, the modified field value of aiming field of target record can be read from target matrix, and by the modified field Value returns to the second affairs.
In this way, the second affairs can read effective data in the case where the execution of the first affairs terminates.
In the present embodiment, if the execution of the first affairs terminates, the aiming field stored in preset data table can also be emptied Field value, to save memory space.
Technical solution provided by the embodiments of the present application executes write operation to the aiming field in tables of data in distributed transaction Before, the field value of the aiming field is stored in preset data table, when receiving reading of other affairs to the aiming field When operational order, if distributed transaction is not carried out end, the field value of the aiming field in preset data table can be returned Other affairs are given, in this way, before distributed transaction is not carried out end distributed transaction can be being read just to avoid other affairs In the data of modification, and then other affairs is avoided to read invalid data, avoids the occurrence of " dirty reading " problem.
Entire technical solution in order to facilitate understanding, may refer to Fig. 3.Fig. 3 is a kind of data of one embodiment of the application The flow diagram of read method, embodiment shown in Fig. 3 the following steps are included:
S301: the write operation instruction of the first affairs is received, the write operation instruction is for remembering target in target matrix The aiming field of record carries out write operation.
Wherein, the first affairs are distributed transaction.
S302: the field value of the aiming field is stored in preset data table.
In S302, after the write operation instruction for receiving the first affairs, the write operation instructions query target can be based on The field value of the aiming field of target record in tables of data, and the field value inquired is stored in preset data table.Wherein, Preset data tableau format can be identical as target data tableau format, it is preferable that preset data table can be with cancel daily record Form stored.
S303: the write operation instruction is responded, modifies to the aiming field, obtains modified field value.
It, can writing based on the first affairs after the field value of aiming field is stored in preset data table in S303 Operational order modifies to the field value of aiming field.
S304: the read operation instruction of the second affairs is received, the read operation instruction is for reading in the target matrix The aiming field of the target record.
Second affairs are the affairs executed parallel with first, specifically can be distributed transaction, are also possible to local matter, Here it is not specifically limited.
S305: judging whether first affairs execute terminates.
If the first affairs are not carried out end, S306 can be executed;If the execution of the first affairs terminates, can execute S307。
S306: the field value before reading the aiming field modification in the preset data table, and will be before the modification Field value return to second affairs.
In this way, at the end of the first affairs are not carried out, due to not allowing the second affairs to read what the first affairs were being modified Data it can thus be avoided the second affairs read invalid data, and then avoid the appearance of " dirty reading " problem.
After the field value before modifying aiming field returns to the second affairs, S309 can be executed.
S307: the field value of the aiming field is read from the target matrix, and the field value of reading is returned To second affairs.
Specifically, if the end state of the first affairs is rollback, the field value for returning to the second affairs is the first affairs Field value before modifying to aiming field;The end state of first affairs is to submit, then returns to the field of the second affairs Value is the field value after the first affairs modify to aiming field.
After the field value of reading is returned to the second affairs, S308 can be executed.
S308: the field value of the aiming field stored in the preset data table is emptied.
S309: terminate.
Based on the content that above-mentioned S301 to S309 is recorded, carried out by the data before distributed transaction is executed write operation It saves, before distributed transaction terminates, when other affairs read the data, returns to previously stored number to other affairs According to the data that distributed transaction is being modified can be read to avoid other business, and then avoid the occurrence of " dirty reading " problem.
" dirty reading " problem how the embodiment of the present application solves in order to facilitate understanding, may refer to Fig. 4.Fig. 4 is the application One embodiment method for reading data schematic diagram.It is that SQL is grasped with the write operation instruction and read operation instruction of affairs in Fig. 4 It is illustrated for vertical order.
In Fig. 4, t is time shaft, and distributed transaction 1 and distributed transaction 2 execute parallel.Specifically:
Distributed transaction 1 executes SQL1, and a field to id=1 row in tables of data 1 is needed to be updated.Before the update, The field value 10 of a field of id=1 row in tables of data 1 can be stored in tables of data 2, tables of data 2 is with " undo log " Form storage.
After being stored the field value 10 of a field, SQL1 can be responded, and the field value of a field is updated by 10 It is 15.
After executing SQL1, the distributed transaction 2 executed parallel with distributed transaction 1 executes SQL2, and SQL2 is used for Inquire a field of id=1 row in tables of data 1.At this point, since distributed transaction 1 is also not carried out end, it can be from tables of data 2 The middle field value 10 read before the modification of a field, and return to distributed transaction 2, i.e., the data that distributed transaction 2 inquires are 10。
After distributed transaction 1 executes, it is assumed that there is rollback in distributed transaction 1 for some reason, then, and tables of data 1 The field value of a field of middle id=1 row will be rolled back to unmodified preceding field value, i.e. the field value of a field becomes 10 from 15.
At this point, if distributed transaction 2 executes SQL2 again, and inquire a field of id=1 row in tables of data 1, then, due to Distributed transaction 1, which has executed, to be terminated, and therefore, the data for returning to distributed transaction 2 are 10, i.e. distributed transaction 2 inquires Data are 10, consistent with the data inquired in 1 implementation procedure of distributed transaction.
Based on above-mentioned whole process it is recognized that while distributed transaction 1 the case where rollback occurs after execution, but It is that distributed transaction 2 does not read invalid data.
It is above-mentioned that the application specific embodiment is described.Other embodiments are within the scope of the appended claims. In some cases, the movement recorded in detail in the claims or step can be executed according to the sequence being different from embodiment And desired result still may be implemented.In addition, process depicted in the drawing not necessarily require the particular order shown or Person's consecutive order is just able to achieve desired result.In some embodiments, multitasking and parallel processing are also possible Or it may be advantageous.
Fig. 5 is the structural schematic diagram of one embodiment electronic equipment of the application.Referring to FIG. 5, in hardware view, the electricity Sub- equipment includes processor, optionally further comprising internal bus, network interface, memory.Wherein, memory may be comprising interior It deposits, such as high-speed random access memory (Random-Access Memory, RAM), it is also possible to further include non-volatile memories Device (non-volatile memory), for example, at least 1 magnetic disk storage etc..Certainly, which is also possible that other Hardware required for business.
Processor, network interface and memory can be connected with each other by internal bus, which can be ISA (Industry Standard Architecture, industry standard architecture) bus, PCI (Peripheral Component Interconnect, Peripheral Component Interconnect standard) bus or EISA (Extended Industry Standard Architecture, expanding the industrial standard structure) bus etc..The bus can be divided into address bus, data/address bus, control always Line etc..Only to be indicated with a four-headed arrow in Fig. 5, it is not intended that an only bus or a type of convenient for indicating Bus.
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 Reading data device is formed on face.Processor executes the program that memory is stored, and is specifically used for executing following operation:
The read operation instruction of the second affairs is received, the read operation instruction is for reading target record in target matrix Aiming field, the aiming field are modified based on the write operation instruction of the first affairs, and first affairs are distributed thing Business, and executed parallel with second affairs;
Field if first affairs are not carried out end, before reading the aiming field modification in preset data table Value, and the field value before the modification is returned into second affairs, the preset data table is used for according to described first Before the write operation instruction of affairs modifies to the aiming field, the field value of the aiming field is stored.
The method that reading data device disclosed in the above-mentioned embodiment illustrated in fig. 5 such as the application executes can be applied to processor In, or realized by processor.Processor may be a kind of IC chip, the processing capacity with signal.It was realizing Each step of Cheng Zhong, the above method can be complete by the integrated logic circuit of the hardware in processor or the instruction of software form At.Above-mentioned processor can be general processor, including central processing unit (Central Processing Unit, CPU), Network processing unit (Network Processor, NP) etc.;It can also be digital signal processor (Digital Signal Processor, DSP), it is specific integrated circuit (Application Specific Integrated Circuit, ASIC), existing Field programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic device are divided Vertical door or transistor logic, discrete hardware components.It may be implemented or execute and is in the embodiment of the present application disclosed each Method, step and logic diagram.General processor can be microprocessor or the processor is also possible to any conventional place Manage device etc..The step of method in conjunction with disclosed in the embodiment of the present application, can be embodied directly in hardware decoding processor and execute At, or in decoding processor hardware and software module combination execute completion.Software module can be located at random access memory, This fields such as flash memory, read-only memory, programmable read only memory or electrically erasable programmable memory, register maturation In storage medium.The storage medium is located at memory, and processor reads the information in memory, completes above-mentioned side in conjunction with its hardware The step of method.
The method that the electronic equipment can also carry out Fig. 2 to Fig. 4, and realize the implementation shown in Fig. 2 to Fig. 4 of reading data device Function in example, details are not described herein for the embodiment of the present application.
Certainly, other than software realization mode, other implementations are not precluded in the electronic equipment of the application, for example patrol Collect device or the mode of software and hardware combining etc., that is to say, that the executing subject of following process flow is not limited to each patrol Unit is collected, hardware or logical device are also possible to.
The embodiment of the present application also proposed a kind of computer readable storage medium, the computer-readable recording medium storage one A or multiple programs, the one or more program include instruction, and the instruction is when by the portable electronic including multiple application programs When equipment executes, the method that the portable electronic device can be made to execute Fig. 2 to embodiment illustrated in fig. 4, and be specifically used for executing It operates below:
The read operation instruction of the second affairs is received, the read operation instruction is for reading target record in target matrix Aiming field, the aiming field are modified based on the write operation instruction of the first affairs, and first affairs are distributed thing Business, and executed parallel with second affairs;
Field if first affairs are not carried out end, before reading the aiming field modification in preset data table Value, and the field value before the modification is returned into second affairs, the preset data table is used for according to described first Before the write operation instruction of affairs modifies to the aiming field, the field value of the aiming field is stored.
Fig. 6 is the structural schematic diagram of one embodiment reading data device 60 of the application.Referring to FIG. 6, a kind of soft In part embodiment, the reading data device 60 can include: receiving unit 61 and reading unit 62, in which:
Receiving unit 61 receives the read operation instruction of the second affairs, and the read operation instruction is for reading target matrix The aiming field of middle target record, the aiming field are modified based on the write operation instruction of the first affairs, first thing Business is distributed transaction, and is executed parallel with second affairs;
Reading unit 62 reads the aiming field if first affairs are not carried out end from preset data table Field value before modification, and the field value before the modification is returned into second affairs, the preset data table is used for Before modifying according to the instruction of the write operation of first affairs to the aiming field, the field of the aiming field is stored Value.
Optionally, the reading data device 60 further includes processing unit 63, in which:
The receiving unit 61, before receiving the read operation instruction of the second affairs, receive first affairs writes behaviour It instructs, the write operation instruction carries out writing behaviour for the aiming field to target record described in the target matrix Make;
The field value of the aiming field is stored in by the processing unit 63 before responding the write operation instruction In the preset data table.
Optionally, the preset data table is stored in the form of cancel daily record.
Optionally, the field value of the aiming field is being stored in the preset data table by the processing unit 63 Afterwards, the write operation requests are responded, are modified to the aiming field, modified field value is obtained.
Optionally, second affairs are distributed transaction or local matter.
Optionally, the reading unit 62, however, it is determined that the first affairs execution terminates, then:
If the end state of first affairs is rollback, the aiming field is read from the target matrix and is returned Field value after rolling, and the field value after the rollback is returned into second affairs;
If the end state of first affairs is to submit, the aiming field is read from the target matrix and is repaired Field value after changing, and the modified field value is returned into second affairs.
Optionally, the reading unit 62 is emptied and is deposited in the preset data table if first affairs execution terminates The field value of the aiming field of storage.
The method that reading data device 60 provided by the embodiments of the present application can also carry out Fig. 2 to Fig. 4, and realize reading data Device is in the function of Fig. 2 to embodiment illustrated in fig. 4, and details are not described herein for the embodiment of the present application.
In short, being not intended to limit the protection scope of the application the foregoing is merely the preferred embodiment of the application. Within the spirit and principles of this application, any modification, equivalent replacement, improvement and so on should be included in the application's Within protection scope.
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 the application, same and similar part between each embodiment It may refer to each other, each embodiment focuses on the differences from other embodiments.Implement especially for system For example, since it is substantially similar to the method embodiment, so being described relatively simple, related place is referring to embodiment of the method Part illustrates.

Claims (10)

1. a kind of method for reading data, comprising:
The read operation instruction of the second affairs is received, the read operation instructs the target for reading target record in target matrix Field, the aiming field are modified based on the write operation instruction of the first affairs, and first affairs are distributed transaction, and It is executed parallel with second affairs;
If first affairs are not carried out end, field value before reading aiming field modification in preset data table, And the field value before the modification is returned into second affairs, the preset data table is used for according to first affairs Write operation instruction modify to the aiming field before, store the field value of the aiming field.
2. the method as described in claim 1, before receiving the read operation instruction of the second affairs, the method also includes:
The write operation instruction of first affairs is received, the write operation instruction is for target described in the target matrix The aiming field of record carries out write operation;
Before responding the write operation instruction, the field value of the aiming field is stored in the preset data table.
3. method according to claim 2,
The preset data table is stored in the form of cancel daily record.
4. the field value of the aiming field is being stored in the preset data table by method as claimed in claim 2 or claim 3 Afterwards, the method also includes:
The write operation requests are responded, are modified to the aiming field, modified field value is obtained.
5. the method as described in claim 1,
Second affairs are distributed transaction or local matter.
6. the method as described in claim 1, the method also includes:
If the first affairs execution terminates:
If the end state of first affairs is rollback, after reading the aiming field rollback in the target matrix Field value, and the field value after the rollback is returned into second affairs;
If the end state of first affairs is to submit, after reading the aiming field modification in the target matrix Field value, and the modified field value is returned into second affairs.
7. the method as described in claim 1, the method also includes:
If the first affairs execution terminates, the field value of the aiming field stored in the preset data table is emptied.
8. a kind of reading data device, comprising:
Receiving unit receives the read operation instruction of the second affairs, and the read operation instruction is for reading target in target matrix The aiming field of record, the aiming field are modified based on the write operation instruction of the first affairs, and first affairs are point Cloth affairs, and executed parallel with second affairs;
Reading unit, if first affairs are not carried out end, before reading the aiming field modification in preset data table Field value, and the field value before the modification is returned into second affairs, the preset data table is used to be based on institute State the first affairs write operation instruction modify to the aiming field before, store the field value of the aiming field.
9. a kind of electronic equipment, comprising:
Processor;And
It is arranged to the memory of storage computer executable instructions, which when executed execute the processor It operates below:
The read operation instruction of the second affairs is received, the read operation instructs the target for reading target record in target matrix Field, the aiming field are modified based on the write operation instruction of the first affairs, and first affairs are distributed transaction, and It is executed parallel with second affairs;
If first affairs are not carried out end, field value before reading aiming field modification in preset data table, And the field value before the modification is returned into second affairs, the preset data table is used to be based on first affairs Write operation instruction modify to the aiming field before, store the field value of the aiming field.
10. a kind of computer readable storage medium, the computer-readable recording medium storage one or more program, described one A or multiple programs are when the electronic equipment for being included multiple application programs executes, so that the electronic equipment is executed with lower section Method:
The read operation instruction of the second affairs is received, the read operation instructs the target for reading target record in target matrix Field, the aiming field are modified based on the write operation instruction of the first affairs, and first affairs are distributed transaction, and It is executed parallel with second affairs;
If first affairs are not carried out end, field value before reading aiming field modification in preset data table, And the field value before the modification is returned into second affairs, the preset data table is used to be based on first affairs Write operation instruction modify to the aiming field before, store the field value of the aiming field.
CN201910208212.1A 2019-03-19 2019-03-19 Data reading method and device Active CN110059115B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910208212.1A CN110059115B (en) 2019-03-19 2019-03-19 Data reading method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910208212.1A CN110059115B (en) 2019-03-19 2019-03-19 Data reading method and device

Publications (2)

Publication Number Publication Date
CN110059115A true CN110059115A (en) 2019-07-26
CN110059115B CN110059115B (en) 2023-08-11

Family

ID=67317199

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910208212.1A Active CN110059115B (en) 2019-03-19 2019-03-19 Data reading method and device

Country Status (1)

Country Link
CN (1) CN110059115B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114297217A (en) * 2021-12-31 2022-04-08 深圳市兆珑科技有限公司 Transaction concurrency control method and device, electronic equipment and readable storage medium
CN114327800A (en) * 2021-12-28 2022-04-12 中国邮政储蓄银行股份有限公司 Method and device for writing in topic, processor and stream processing platform
WO2023186087A1 (en) * 2022-04-02 2023-10-05 北京奥星贝斯科技有限公司 Constraint relationship check method and apparatus for database
CN117648288A (en) * 2022-09-05 2024-03-05 华为技术有限公司 File processing method and electronic equipment

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104572506A (en) * 2013-10-18 2015-04-29 阿里巴巴集团控股有限公司 Method and device for concurrent access to memory

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104572506A (en) * 2013-10-18 2015-04-29 阿里巴巴集团控股有限公司 Method and device for concurrent access to memory

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114327800A (en) * 2021-12-28 2022-04-12 中国邮政储蓄银行股份有限公司 Method and device for writing in topic, processor and stream processing platform
CN114297217A (en) * 2021-12-31 2022-04-08 深圳市兆珑科技有限公司 Transaction concurrency control method and device, electronic equipment and readable storage medium
WO2023186087A1 (en) * 2022-04-02 2023-10-05 北京奥星贝斯科技有限公司 Constraint relationship check method and apparatus for database
CN117648288A (en) * 2022-09-05 2024-03-05 华为技术有限公司 File processing method and electronic equipment

Also Published As

Publication number Publication date
CN110059115B (en) 2023-08-11

Similar Documents

Publication Publication Date Title
CN110059115A (en) A kind of method for reading data and device
CN114925084B (en) Distributed transaction processing method, system, equipment and readable storage medium
US11138034B2 (en) Method and apparatus for collecting information, and method and apparatus for releasing memory
KR20080031039A (en) A method and computer readable medium for managing memory access to a shared memory location
CN112181902B (en) Database storage method and device and electronic equipment
CN110837480A (en) Processing method and device of cache data, computer storage medium and electronic equipment
CN101326494A (en) Coordinates access to memory cells by hardware transactional memory transactions and software transactional memory transactions
CN109634974A (en) A kind of data processing method, system and associated component
CN108647075A (en) Listview method for refreshing, device and the electronic equipment of five application page
CN110175306A (en) A kind of processing method and processing device of advertising information
CN110750530B (en) Service system and data checking method thereof
CN109614270A (en) Data reading and writing method, device, equipment and storage medium based on Hbase
CN109344296A (en) Realize domain life cycle control method, system, server and the storage medium of the HASH key of Redis
CN106227769B (en) Date storage method and device
CN113592506A (en) Repeated payment processing method and device, electronic equipment and storage medium
CN109298941A (en) A kind of document generating method and device
CN110188297B (en) Resource information display method, computing device and computer storage medium
CN108984117B (en) Data reading and writing method, medium and equipment
CN115269199B (en) Data processing method, device, electronic device and computer-readable storage medium
CN110032564A (en) A kind of determination method and apparatus of tables of data incidence relation
CN114064725A (en) A data processing method, device, equipment and storage medium
CN103246611A (en) File processing method and system
CN109491766B (en) Method, device and system for delivering transaction message and message server
CN109271277A (en) Access method, device and system after database delay machine
CN118349579B (en) Data processing method and data processing device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20200922

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman, British Islands

Applicant after: Innovative advanced technology Co.,Ltd.

Address before: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman, British Islands

Applicant before: Advanced innovation technology Co.,Ltd.

Effective date of registration: 20200922

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman, British Islands

Applicant after: Advanced innovation technology Co.,Ltd.

Address before: A four-storey 847 mailbox in Grand Cayman Capital Building, British Cayman Islands

Applicant before: Alibaba Group Holding Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载