WO2016101165A1 - 事务处理的方法、装置及计算机系统 - Google Patents

事务处理的方法、装置及计算机系统 Download PDF

Info

Publication number
WO2016101165A1
WO2016101165A1 PCT/CN2014/094779 CN2014094779W WO2016101165A1 WO 2016101165 A1 WO2016101165 A1 WO 2016101165A1 CN 2014094779 W CN2014094779 W CN 2014094779W WO 2016101165 A1 WO2016101165 A1 WO 2016101165A1
Authority
WO
WIPO (PCT)
Prior art keywords
transaction
state
volatile memory
data
status
Prior art date
Application number
PCT/CN2014/094779
Other languages
English (en)
French (fr)
Inventor
王华卿
黄文龙
徐君
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2014/094779 priority Critical patent/WO2016101165A1/zh
Priority to CN201480045678.XA priority patent/CN106716395B/zh
Priority to JP2017534214A priority patent/JP6401866B2/ja
Priority to KR1020177020304A priority patent/KR101910759B1/ko
Priority to EP14908733.0A priority patent/EP3229147A4/en
Publication of WO2016101165A1 publication Critical patent/WO2016101165A1/zh
Priority to US15/631,585 priority patent/US10467044B2/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1474Saving, restoring, recovering or retrying in transactions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/466Transaction processing
    • G06F9/467Transactional memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/466Transaction processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1471Saving, restoring, recovering or retrying involving logging of persistent data for recovery
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3636Software debugging by tracing the execution of the program
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0238Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication

Definitions

  • the present application relates to the field of transaction processing technologies, and in particular, to a transaction processing method, apparatus, and computer system.
  • the existing transaction processing usually adopts the method of Write-Ahead Logging (English: Write-Ahead Logging, WAL).
  • the existing computer system includes a processor, a memory and an external memory.
  • the memory is a dynamic random access memory (English: Dynamic Random Access Memory, DRAM for short), and the external storage is provided with a log area.
  • the processor Upon receiving a request for a transaction, the processor first writes the transaction data of the transaction from the cache of the computer system to the memory, and then writes the transaction data written to the memory to the externally stored log area. After all transaction data of the transaction is written to the log area, the processor writes the transaction data to the external memory to implement the commit of the transaction.
  • the application provides a method, device and computer system for transaction processing, which can improve the processing speed of transaction data.
  • an embodiment of the present invention provides a method for transaction processing, the method being used in a computer system including non-volatile memory, the method comprising: receiving a transaction request, where the transaction request is carried Transaction data with transactions; record in non-volatile memory State information of the transaction, wherein the state information of the transaction includes a transaction state and a transaction identifier and an address assigned to the transaction according to the transaction request, the transaction state being an uncommitted state, and the uncommitted state indicating The transaction data is not all written into the non-volatile memory; according to the address, the transaction data is written into the non-volatile memory; and the transaction status of the transaction is modified according to the transaction identifier to a commit status indicating that transaction data of the transaction has all been written into the non-volatile memory and not fully written into the external memory of the computer system; the transaction data is from the non-easy Loss of memory written to the external memory of the computer system; modifying a transaction state of the transaction to a backup state according to the transaction
  • the method further comprises: if the computer system is restarted, before modifying the transaction state of the transaction to a commit state according to the transaction identifier And determining, according to the status information of the transaction recorded in the non-volatile memory, that the transaction status of the transaction is an uncommitted state; deleting the transaction data and status information of the transaction.
  • the method further includes: if the computer system is restarted, determining, according to status information of the transaction recorded in the non-volatile memory, that a transaction status of the transaction is a commit status, and executing the transaction data An action of writing the external memory of the computer system from the non-volatile memory.
  • the marking the transaction status of the transaction as a backup status according to the transaction identifier further includes deleting transaction data of the transaction.
  • an embodiment of the present invention provides a device for transaction processing, where the device is used in a computer system including a non-volatile memory, the device includes: a receiving module, configured to receive a transaction request, The transaction request carries the transaction data of the transaction; the recording module is configured to record the state information of the transaction in the non-volatile memory, wherein the state information of the transaction includes the transaction identifier and according to the transaction Requesting a transaction identifier and an address assigned to the transaction, the transaction state being an uncommitted state, the uncommitted state indicating that the transaction data is not all written into the non-volatile memory; According to the address, Writing the transaction data to the non-volatile memory; the recording module is further configured to: after the memory write module writes the transaction data into the non-volatile memory, according to the transaction identifier Modifying a transaction state of the transaction to a commit state, the commit state indicating that transaction data of the transaction has all been written into the non-volatile memory and not fully written into the
  • the method further includes: a state determining module, configured to: if the recording module modifies a transaction state of the transaction to a commit state, if the computer system is re- Starting, determining, according to the status information of the transaction recorded in the non-volatile memory, that the transaction status of the transaction is an uncommitted state; and deleting a module, configured to determine, by the status determining module, the transaction of the transaction When the state is the uncommitted state, the transaction data and the state information of the transaction are deleted.
  • a state determining module configured to: if the recording module modifies a transaction state of the transaction to a commit state, if the computer system is re- Starting, determining, according to the status information of the transaction recorded in the non-volatile memory, that the transaction status of the transaction is an uncommitted state
  • deleting a module configured to determine, by the status determining module, the transaction of the transaction When the state is the uncommitted state, the transaction data and the state information of the transaction are deleted.
  • the state determining module is further configured to: after the recording module changes a transaction state of the transaction to a commit state, If the computer is restarted, determining, according to status information of the transaction recorded in the non-volatile memory, that a transaction status of the transaction is a commit status, and triggering the external storage write module to execute the The transaction data is written from the non-volatile memory to an external memory of the computer system.
  • the deleting module is further configured to mark, in the recording module, a transaction status of the transaction as a backup status After that, the transaction data of the transaction is deleted.
  • an embodiment of the present invention provides a computer system, where the computer system includes a processor and a non-volatile memory, wherein: the non-volatile memory is configured to store data; and the processor is configured to: Receiving a transaction request, the transaction request carrying transaction data of the transaction; recording status information of the transaction in the non-volatile memory, wherein the status information of the transaction includes the transaction identifier and according to the The transaction request is allocated for the transaction a transaction identifier and an address, the transaction state being an uncommitted state, the uncommitted state indicating that the transaction data is not all written into the non-volatile memory; and the transaction data is written according to the address Non-volatile memory; modifying a transaction state of the transaction to a commit state according to the transaction identifier, the commit state indicating that transaction data of the transaction has all been written into the non-volatile memory and is not fully Writing to the external memory of the computer system; writing the transaction data from the non-volatile memory to the external memory of the
  • the processor is further configured to: before performing, according to the transaction identifier, modifying a transaction state of the transaction to a commit state When the computer system restarts, determining, according to the status information of the transaction recorded in the non-volatile memory, that the transaction status of the transaction is an uncommitted state; deleting the transaction data and status information of the transaction.
  • the processor after performing the modifying the transaction state of the transaction according to the transaction identifier to a commit state, is further configured to: when the computer restarts, determine, according to status information of the transaction recorded in the non-volatile memory, a transaction status of the transaction as a commit status, and execute the The act of writing transaction data from the non-volatile memory to the external memory of the computer system.
  • the performing, according to the transaction identifier, modifying a transaction state of the transaction to a backup After the state is further configured to: delete the transaction data of the transaction.
  • the non-volatile memory power-off data is not lost, and the transaction data of the transaction is written into the non-volatile memory and directly written to the external memory without Transaction data is written to the log area, which simplifies the transaction process and speeds up transaction processing.
  • in the embodiment of the present invention in the non-volatile memory, by setting different transaction states to record whether transaction data of the transaction is all written into the non-volatile memory or whether all is written to the external memory, so that the computer system can The transaction state of the current transaction is determined according to the state of the transaction, thereby ensuring the atomicity and consistency of the transaction.
  • FIG. 1 is a schematic structural diagram of a computer system according to an embodiment of the present invention.
  • FIG. 2 is a flowchart of a method for transaction processing according to an embodiment of the present invention
  • FIG. 3 is a flowchart of another method for transaction processing according to an embodiment of the present invention.
  • FIG. 4 is a schematic structural diagram of an apparatus for transaction processing according to an embodiment of the present invention.
  • FIG. 5 is a schematic structural diagram of another apparatus for processing a transaction according to an embodiment of the present invention.
  • FIG. 1 is a schematic structural diagram of a computer system according to an embodiment of the present invention.
  • computer system 100 includes a processor 110, a non-volatile memory 120, and an external memory 130.
  • the transaction may include the processor 110 writing data to the external memory 130 through the non-volatile memory 120, wherein the data to be written to the external memory is transaction data of the transaction.
  • Non-Volatile Memory (NVM) 120 for temporarily storing transactional transaction data and status information.
  • the data area 121 and the data status area 122 may be set in the non-volatile memory 120.
  • the data area 121 is used to store transaction data of the transaction
  • the data status area 122 is used to save state information of the transaction.
  • the non-volatile memory means that the memory is a non-volatile memory.
  • the non-volatile memory 120 may include a phase change memory (PCM), a resistive random access memory (RRAM), and a magnetic random access memory.
  • PCM phase change memory
  • RRAM resistive random access memory
  • NVM Non-Volatile Memory
  • MRAM Magnetic Random Access Memory
  • FRAM Ferroelectric Random Access Memory
  • the external storage 130 is used to permanently store the transaction data of the transaction.
  • the external storage 130 can be a hard disk drive (English: Hard Disk Drive, HDD for short), a solid state hard disk (English: Solid State Drive, SDD for short) or other memory.
  • the processor 110 is configured to execute the transaction processing method of the present application to implement writing of transaction data to the external memory 130 through the memory 120. It is to be understood that the processor may include a CPU, and may also include other application specific integrated circuits (ASICs) or one or more integrated circuits configured to implement embodiments of the present invention.
  • ASICs application specific integrated circuits
  • FIG. 2 is a flowchart of a method for transaction processing according to an embodiment of the present invention.
  • the transaction processing method is used in the computer system 100 shown in FIG. 1 , and the transaction processing method executed by the processor 110 of the computer system 100 may include:
  • the processor receives a transaction request, where the transaction request carries transaction data of the transaction.
  • the transaction request may be triggered by a user or by another program executed by the processor, such as a write command input for the user.
  • the processor After receiving the transaction request, the processor allocates a transaction identifier and address for the transaction according to the transaction request.
  • the transaction identifier is used to distinguish between different transactions.
  • the address is a write address of the transaction data of the transaction in the non-volatile memory.
  • the processor records state information of the transaction in a non-volatile memory, wherein the state information of the transaction includes a transaction state and a transaction identifier and an address allocated for the transaction according to the transaction request, The transaction status is uncommitted.
  • the processor After the processor assigns the transaction ID and address of the transaction, the processor establishes state information for the transaction.
  • the status information of a transaction may include a transaction identifier, a transaction status, and an address.
  • the transaction state is used to indicate the write status of the transaction data, and is mainly divided into an uncommitted state, a committed state, and a backup state. state.
  • the uncommitted state indicates that the transaction data of the transaction is not all written into the non-volatile memory.
  • the uncommitted state can be used to instruct the processor not to use transaction data for the transaction when executing other programs or when the computer system is restarted.
  • the commit status indicates that the transaction data for the transaction has all been written to non-volatile memory and not fully written to the external memory.
  • the commit status can be used to instruct the processor to use transaction data for the transaction in non-volatile memory when executing other programs or when the computer system is restarted.
  • the backup status indicates that the transaction data of the transaction has all been written to the external memory.
  • the backup state can be used to instruct the processor to use transaction data for the transaction in the foreign memory when executing other programs or when the computer system is restarted. In another way, when the transaction state of a transaction is a backup state, it indicates that the transaction and processing are completed.
  • the processor 110 passes the transaction data, transaction identifier, and address of the transaction through a dual in-line storage module (English: Dual-Inline-Memory-Modules, DIMM for short) or a fast peripheral interconnection standard (English: Peripheral) Interfaces such as Component Interconnect Express (PCIe) are written into the data status area of the non-volatile memory as the status information of this transaction.
  • the transaction identifier of the transaction is the first transaction, and the transaction data of the first transaction includes four, and the following table 1 is established in the data status area to record the state information of the first transaction.
  • Transaction identifier Transaction status address First transaction Uncommitted status Transaction data address 1 First transaction Uncommitted status Transaction data address 2 First transaction Uncommitted status Transaction data address 3 First transaction Uncommitted status Transaction data address 4
  • the manner of recording the status information of the transaction of the present application is not specifically limited. It should be noted that in practical applications, the computer system can record the status information of multiple transactions being processed.
  • the processor writes transaction data of the transaction into the non-volatile memory according to the address.
  • the processor writes the transaction data of the first transaction carried in the transaction request into the data area of the non-volatile memory via an interface such as DIMM or PCIe.
  • the processor modifies a transaction status of the transaction to a commit status according to the transaction identifier.
  • the processor After the processor writes all transaction data of the first transaction to the data area of the non-volatile memory, it looks for the transaction identifier as the status information of the first transaction in the data status area of the non-volatile memory, and The transaction status in the status information of the first transaction is modified to the commit status, as shown in Table 2 below. At this point, the first transaction completes the commit.
  • Transaction identifier Transaction status address First transaction Submit status Transaction data address 1 First transaction Submit status Transaction data address 2 First transaction Submit status Transaction data address 3 First transaction Submit status Transaction data address 4
  • the processor writes the transaction data from the non-volatile memory to an external memory of the computer system.
  • the processor transfers the transaction data of the first transaction from the data area of the non-volatile memory to the serial hard disk interface technology (English: Serial Advanced Technology Attachment, SATA for short) or network driver ( English: Network Drivers) and other interfaces write external memory.
  • serial hard disk interface technology English: Serial Advanced Technology Attachment, SATA for short
  • network driver English: Network Drivers
  • the processor modifies a transaction status of the transaction to a backup status according to the transaction identifier.
  • the processor searches for the status information of the transaction identifier as the first transaction in the data status area of the non-volatile memory, and identifies the transaction as the status of the first transaction.
  • the transaction status in the message is changed to the backup status, as shown in Table 3 below. At this point, the transaction data of the first transaction has been successfully written to the external memory, and the first transaction ends.
  • the user creates a new file A in the computer system and writes the file A.
  • the processor receives the write operation instruction of the user, it needs to process the transaction in which the file A is written into the external file system.
  • the processor allocates a transaction identifier and an address for the transaction, and records status information of the transaction in a data status area of the non-volatile memory, where the status information The transaction status in the transaction is uncommitted; after the status information of the transaction is established, the file A is written into the data area of the non-volatile memory; after the file A is written, the status information of the transaction is The transaction status is marked as the commit status.
  • the processor can read the file from the non-volatile memory if it receives the instruction to read the file A.
  • file A is not written to the external file system, that is, the permanent storage of file A by the computer system cannot be realized. Therefore, after the transaction is committed, the file A in the data area is written to the external file system, and the transaction ends.
  • the processor may delete the transaction data of the transaction in the non-volatile memory, and may further Deleting state information of the transaction in the non-volatile memory, wherein when the transaction data and the state information of the transaction are deleted, the sequence of deleting the transaction data of the transaction and deleting the state information of the transaction is not performed limited.
  • the processor may not delete the transaction data of the transaction in the non-volatile memory. In order to facilitate the subsequent use of the transaction data of the transaction, without reading from the external memory, it can be directly read from the memory to speed up the reading.
  • the non-volatile memory power-off data is not lost, and the transaction data of the transaction is written into the non-volatile memory and directly written to the external memory without writing the transaction data to the log area.
  • in the embodiment of the present invention, in the non-volatile memory, whether the transaction data of the transaction is all written into the non-volatile memory or all of the external storage is recorded by setting different transaction states. The computer system can determine the transaction data of the current transaction according to the transaction state, thereby ensuring the atomicity and consistency of the transaction.
  • the non-volatile memory since the non-volatile memory does not need to erase the previously saved data first, and the read/write data speed of the non-volatile memory is much higher than that of the ordinary DRAM, the non-volatile memory is used as the memory for writing the transaction data. It can greatly improve the read and write speed of transaction data, which further increases the speed of transaction processing.
  • the transaction processing method of the present application may also implement transaction recovery, that is, during execution of the above transaction processing method, if the computer system is restarted, the transaction may be based on the transaction status of the transaction in the non-volatile memory.
  • the transaction is transaction recovery.
  • FIG. 3 is a flowchart of another method for transaction processing according to an embodiment of the present invention.
  • the method is used in a computer system including a non-volatile memory, the method being performed by a processor of the computer system, the method comprising:
  • the processor receives a transaction request, where the transaction request carries transaction data of the transaction.
  • the processor records state information of the transaction in a non-volatile memory, wherein the state information of the transaction includes a transaction state and a transaction identifier and an address allocated for the transaction according to the transaction request, The transaction status is uncommitted.
  • the processor writes the transaction data into the non-volatile memory according to the address.
  • the processor determines whether the computer system is restarted, if yes, executes 305, and if not, executes 307.
  • the processor determines, according to the status information of the transaction recorded in the non-volatile memory, that the transaction status of the transaction is an uncommitted state.
  • the processor executes the transaction data of the first transaction into the non-volatile memory
  • the computer system is powered down or restarted after the crash.
  • the processor according to the state information of the first transaction in the non-volatile memory. As shown in Table 1 above, it is determined that the transaction status of the first transaction is an uncommitted state.
  • the processor deletes the transaction data and status information of the transaction.
  • the processor determines that the transaction status of the first transaction is an uncommitted state, that is, the transaction data of the first transaction is not completely updated into the data area of the non-volatile memory before the computer system is restarted. Therefore, according to the atomicity of the transaction, the transaction data of the first transaction in the non-volatile memory cannot be updated to the external memory. Therefore, the processor deletes all of the first transaction in the data area of the non-volatile memory. Transaction data, and delete the state information of the first transaction in the data status area, delete the above table 1 to achieve the rollback of the transaction.
  • the processor modifies a transaction status of the transaction to a commit status according to the transaction identifier.
  • the processor determines whether the computer system is restarted, if yes, executes 309, and if not, executes 310.
  • the processor determines, according to the status information of the transaction recorded in the non-volatile memory, that the transaction status of the transaction is a commit status, and executes 310.
  • the processor After the processor performs the process of modifying the transaction state of the first transaction to the commit state, the computer system is powered down or restarted after the crash. At this time, the processor according to the state information of the first transaction in the non-volatile memory is as shown in Table 2 above.
  • the transaction state of the first transaction is determined to be the commit state, that is, the transaction data of the first transaction has been completely updated into the data area of the non-volatile memory before the computer system is restarted. Therefore, according to the consistency of the transaction, the processor executes 310 to write the transaction data of the first transaction in the data area into the external memory.
  • the processor writes the transaction data from the non-volatile memory to an external memory of the computer system.
  • the processor modifies a transaction status of the transaction to a backup status according to the transaction identifier.
  • the processor deletes transaction data of the transaction.
  • the processor After the processor performs the process of modifying the transaction state of the transaction to the backup state, if the computer system is restarted, the processor determines the transaction state of the transaction according to the state information of the transaction in the non-volatile memory as in Table 3 above. For the backup state, it means that the transaction data of the transaction has been completely updated into the external memory before the computer system is restarted. Therefore, the processor can perform an action of deleting transaction data and status information of the transaction to implement storage of the storage space of the non-volatile memory.
  • the processor does not necessarily perform an action of determining whether the computer system is restarted.
  • the step of the processor in FIG. 3 to determine whether the computer system is restarted only indicates a description of the state of the computer system, that is, if a computer system restart occurs at this time, Then the processor performs the step corresponding to "Yes" in FIG. 3, if not Now that the computer system is restarted, the steps corresponding to "No" in Figure 3 are performed.
  • the state in which the computer system is restarted is not necessarily limited to 303, 307, but may occur before or after the processor performs any one of the steps shown in FIG. 1, or during the execution of any of the steps shown in FIG. 1. .
  • the processor of the present application performs a corresponding transaction recovery step according to the following principle: if the execution of the transaction state of the transaction is changed to the commit state according to the transaction identifier, if Rebooting the computer system, determining that the transaction state of the transaction is an uncommitted state, performing transaction recovery steps 305 and 306; after performing a modification of the transaction state of the transaction to a commit state according to the transaction identifier, if a computer system restart occurs Then, the transaction state of the transaction is determined to be the commit state, and transaction recovery steps 310 and 311 are performed.
  • the non-volatile memory power-down data is not lost, and the transaction data is saved in the early non-volatile memory, so that when the non-volatile memory is restarted during the transaction, the non-volatile The transaction data of the in-memory transaction is not lost, and the transaction data of the transaction can be directly recovered from the non-volatile memory, thereby improving the recovery speed of the transaction.
  • the transaction data of the transaction can be determined, and when the transaction data of the transaction is not completely written into the non-volatile memory, the transaction data of the transaction is not written to the external storage, but directly The transaction data of the transaction is deleted, and the transaction data is written to the external memory when the transaction data of the transaction is all written into the non-volatile memory and is not written to the external memory, thereby ensuring the atomicity and consistency of the transaction.
  • FIG. 4 is a schematic structural diagram of a device for transaction processing according to an embodiment of the present invention.
  • the apparatus is for a computer system including non-volatile memory and external storage.
  • the non-volatile memory can be provided with a data area and a data status area.
  • the data area is used to store the transaction data of the transaction, and the data status area is used to save the status information of the transaction.
  • the application utilizes the non-volatile memory to have the characteristics of power loss without loss of data, and ensures the reliability of transaction data and status information.
  • the transaction processing device 420 includes a receiving module 423, a recording module 421, a memory writing module 422, and an external memory writing module 424.
  • the receiving module 423 is configured to receive a transaction request, where the transaction request carries transaction data of the transaction.
  • the transaction request may be input by a user or executed by a processor It is triggered by his program, such as a write command entered for the user.
  • the receiving module 423 may also allocate a transaction identifier and an address for the transaction according to the transaction request.
  • the transaction identifier is used to distinguish between different transactions.
  • the address is a write address of the transaction data of the transaction in the non-volatile memory.
  • the recording module 421 is configured to record status information of the transaction in a non-volatile memory, wherein the status information of the transaction includes the transaction identifier and a transaction identifier and address allocated for the transaction according to the transaction request
  • the transaction status is an uncommitted state.
  • the recording module 421 establishes state information for the transaction.
  • the status information of the transaction may include a transaction identification, a transaction status, and an address.
  • the transaction state is used to indicate the write status of the transaction data of the transaction, and is mainly divided into an uncommitted state, a committed state, and a backup state.
  • the uncommitted state indicates that the transaction data of the transaction is not all written into the non-volatile memory, that is, the transaction data for indicating that the computer system cannot use the transaction when executing other programs or when the computer system is restarted;
  • the transaction data indicating the transaction has been written into the non-volatile memory and is not completely written into the external memory, that is, used to indicate that the computer system can use non-volatile memory when executing other programs or when the computer system is restarted.
  • Transaction data of the transaction; the backup status indicates that the transaction data of the transaction has been completely written into the external memory, that is, used to indicate that the computer system can use the transaction in the external storage when executing other programs or when the computer system is restarted.
  • Transaction data, that is, the transaction has ended.
  • the upper table 1 is established in the data status area to record the status information of the first transaction.
  • only one state information may be established for all transaction data of the same transaction, and the address in the state information is an address of all transaction data of the transaction in the non-volatile memory. Therefore, the manner of recording the status information of the transaction of the present application is not specifically limited.
  • the memory write module 422 is configured to write the transaction data into the non-volatile memory according to the address.
  • the memory writing module 422 writes the transaction data of the first transaction carried in the transaction request into the non-volatile memory according to the address in the status information of the first transaction. In the data area.
  • the recording module 421 is further configured to write the transaction data to the memory write module 422. After the non-volatile memory is described, the transaction status of the transaction is modified to a commit status according to the transaction identifier.
  • the record module 421 looks up the transaction identifier as the first transaction in the data status area of the non-volatile memory. Status information, and modify the transaction status in the status information of the first transaction to the commit status, as shown in Table 2. At this point, the first transaction completes the commit.
  • the external storage module 424 is configured to write the transaction data from the non-volatile memory to the external storage of the computer system after the recording module modifies the transaction state of the transaction to a commit state.
  • the foreign memory write module 424 writes the transaction data of the first transaction from the data area of the non-volatile memory to the external memory.
  • the recording module 421 is further configured to modify the transaction state of the transaction to a backup state according to the transaction identifier after the external storage write module 424 writes the transaction data to the external storage of the computer system.
  • the recording module 421 searches the data status area of the non-volatile memory for the status information of the transaction identifier as the first transaction, and The transaction state in the status information of a transaction is modified to the backup state, as shown in Table 3 above. At this point, the transaction data of the first transaction has been successfully written into the external memory, and the first transaction ends.
  • the non-volatile memory may delete the transaction data of the transaction in the non-volatile memory after modifying the transaction state of the transaction to the backup state.
  • State information wherein the order in which the processor can delete the transaction data of the transaction and delete the state information of the transaction is not limited.
  • the processor may not delete the transaction data of the transaction in the non-volatile memory. In order to facilitate the subsequent use of the transaction data of the transaction, without reading from the external memory, it can be directly read from the memory to speed up the reading.
  • the transaction processing apparatus of the present application may also implement transaction recovery, that is, during execution of the above transaction processing method, if the computer system is restarted, the transaction status may be based on the transaction status of the transaction in the non-volatile memory. The transaction is resumed.
  • FIG. 5 is another apparatus for processing a transaction according to an embodiment of the present invention. Schematic. Optimized in the transaction processing apparatus 420 of the previous embodiment, the transaction processing apparatus 520 of the present embodiment further includes a state determination module 525 and a deletion module 526.
  • the state determining module 525 is configured to: according to the state information of the transaction recorded in the non-volatile memory, if the computer system is restarted before the recording module 421 modifies the transaction state of the transaction to the commit state, Determine that the transaction status of the transaction is uncommitted.
  • the memory write module 422 performs the write of the transaction data of the first transaction to the non-volatile memory
  • the computer system is powered down or restarted after the crash.
  • the state determination module 525 is based on the non-volatile memory.
  • the status information of a transaction is as shown in Table 1, and the transaction status of the first transaction is determined to be an uncommitted state.
  • the delete module 526 is configured to delete the transaction data and the state information of the transaction when the state determination module 525 determines that the transaction state of the transaction is an uncommitted state.
  • the delete module 526 deletes all transaction data of the first transaction in the data area of the non-volatile memory, and deletes the state information of the first transaction in the data status area of the non-volatile memory, that is, deletes the above table 1 to implement Rollback of the transaction.
  • the state determining module 525 is further configured to: after the recording module 421 changes the transaction state of the transaction to the commit state, if the computer is restarted, according to the recorded in the non-volatile memory Determining state information of the transaction, determining a transaction state of the transaction as a commit state, and triggering the external memory write module 424 to perform the writing of the transaction data from the non-volatile memory to the computer system External action.
  • the computer system is powered down or restarted after the crash.
  • the state determining module 525 is based on the state information of the first transaction in the non-volatile memory. As shown in Table 2 above, it is determined that the transaction state of the first transaction is the commit state, and the transaction data of the first transaction in the non-volatile memory is written into the external memory.
  • the deleting module 526 is further configured to delete the transaction data of the transaction after the recording module 421 marks the transaction status of the transaction as a backup state, so as to implement Recycling of storage space for non-volatile memory.
  • the transaction processing device 520 does not perform any operation after the transaction state of the transaction data is modified to the backup state.
  • FIG. 1 is the computer of the present application.
  • the computer system 100 of the present embodiment includes a processor 110, a non-volatile memory 120, and an external memory 130.
  • the processor 110 and the non-volatile memory 120 can be connected through an interface such as a DIMM or a PCIe.
  • the non-volatile memory 120 and the external storage can be connected through an interface such as a SATA or a network driver.
  • non-volatile memory 120 and external memory 130 are used to store data.
  • the non-volatile memory 120 is used to temporarily store processing data of the processor 110, such as transaction data and status information of a transaction processed by the processor 110
  • the external storage 130 is used to permanently store data of the computer system, such as the processor 110. Transaction data processed.
  • the processor 110 may also be referred to as a CPU (Central Processing Unit) for:
  • the processor 110 before performing the modifying the transaction state of the transaction to the commit state according to the transaction identifier, the processor 110 is configured to:
  • the transaction data and status information of the transaction are deleted.
  • the processor 110 is further configured to:
  • the processor 110 is further configured to delete transaction data of the transaction.
  • the non-volatile memory 120 can include a data area 121 for storing transaction data of a transaction, and a data status area for storing status information of the transaction.
  • Processor 110 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method may be completed by an integrated logic circuit of hardware in the processor 110 or an instruction in a form of software.
  • the processor 110 described above may be a general purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, or discrete hardware. Component.
  • DSP digital signal processor
  • ASIC application specific integrated circuit
  • FPGA off-the-shelf programmable gate array
  • the methods, steps, and logical block diagrams disclosed in the embodiments of the present invention may be implemented or carried out.
  • the general purpose processor may be a microprocessor or the processor or any conventional processor or the like.
  • the steps of the method disclosed in the embodiments of the present invention may be directly implemented by the hardware decoding processor, or may be performed by a combination of hardware and software modules in the decoding processor.
  • the software module can be located in a conventional storage medium such as random access memory, flash memory, read only memory, programmable read only memory or electrically erasable programmable memory, registers, and the like.
  • the storage medium is located in the external storage 130, and the processor 110 reads the information in the external storage 130, and completes the steps of the foregoing method in combination with the hardware thereof.
  • the non-volatile memory power-off data is not lost, and the transaction data of the transaction is written into the non-volatile memory and directly written to the external memory without writing the transaction data into the log area, thereby It simplifies the process of transaction processing and speeds up transaction processing.
  • in the embodiment of the present invention by setting different transaction states to record whether transaction data of the transaction is all written into the non-volatile memory or whether all is written to the external memory, so that the computer system can The transaction state of the current transaction is determined according to the state of the transaction, thereby ensuring the atomicity and consistency of the transaction.
  • the disclosed system, apparatus, and method may be implemented in other manners.
  • the device embodiments described above are only for example, the division of the module or unit is only a logical function division, and the actual implementation may have another division manner, for example, multiple units or components may be combined or integrated into another system, or Some features can be ignored or not executed.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be in an electrical, mechanical or other form.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
  • the integrated unit if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable storage medium.
  • a computer readable storage medium A number of instructions are included to cause a computer device (which may be a personal computer, server, or network device, etc.) or a processor to perform all or part of the steps of the methods described in various embodiments of the present application.
  • the foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Quality & Reliability (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Computer Hardware Design (AREA)
  • Mathematical Physics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

本发明公开了一种事务处理的方法、装置及计算机系统。该事务处理方法包括:接收事务处理请求,所述事务处理请求中携带有事务的事务数据;在非易失性内存中记录所述事务的状态信息,其中,所述事务的状态信息包括事务状态以及事务标识和地址,所述事务状态为未提交状态;根据所述地址,将所述事务数据写入所述非易失性内存;根据所述事务标识将所述事务的事务状态修改为提交状态;将所述事务数据从所述非易失性内存写入所述计算机系统的外存;根据所述事务标识将所述事务的事务状态修改为备份状态。通过上述方式,能够提高事务数据的处理速度。

Description

事务处理的方法、装置及计算机系统 【技术领域】
本申请涉及事务处理技术领域,尤其涉及一种事务处理的方法、装置及计算机系统。
【背景技术】
在许多大型、关键的应用程序中,计算机每秒钟都在执行大量的任务。当多个任务结合在一起完成一个业务要求,该业务要求可以被称为事务。其中,事务具有原子性和一致性。
为保证事务的原子性和一致性,现有事务处理通常采用写前日志(英文:Write-Ahead Logging,简称:WAL)的方法,具体的,现有计算机系统包括处理器、内存和外存,所述内存为动态随机存取存储器(英文:Dynamic Random Access Memory,简称:DRAM),外存设置有日志区。在接收到事务处理的请求时,处理器先将事务的事务数据从计算机系统的缓存中写入到内存,再将已写入内存的事务数据写入到外存的日志区。当事务的所有事务数据均写入到日志区后,处理器再将事务数据写入到外存中,实现所述事务的提交。
然而,上述现有事务处理方法的所有事务数据必须在写入内存之后再写入日志区中,且当所有事务数据均写入日志区时,才能提交事务。即,事务处理过程中必须对事务数据进行两次的写入动作,导致事务处理的速度缓慢。
【发明内容】
本申请提供了事务处理的方法、装置及计算机系统,能够提高事务数据的处理速度。
第一方面,本发明实施例提供了一种事务处理的方法,所述方法用于包括非易失性内存的计算机系统中,所述方法包括:接收事务处理请求,所述事务处理请求中携带有事务的事务数据;在非易失性内存中记录所述 事务的状态信息,其中,所述事务的状态信息包括事务状态以及根据所述事务处理请求为所述事务分配的事务标识和地址,所述事务状态为未提交状态,所述未提交状态表示所述事务数据未全部写入所述非易失性内存中;根据所述地址,将所述事务数据写入所述非易失性内存;根据所述事务标识将所述事务的事务状态修改为提交状态,所述提交状态表示所述事务的事务数据已经全部写入所述非易失性内存中且未完全写入所述计算机系统的外存中;将所述事务数据从所述非易失性内存写入所述计算机系统的外存;根据所述事务标识将所述事务的事务状态修改为备份状态,所述备份状态表示所述事务的事务数据已全部写入所述计算机系统的外存中。
结合第一方面,在第一方面的第一可能实施例中,所述根据所述事务标识将所述事务的事务状态修改为提交状态之前,所述方法还包括:如果所述计算机系统重新启动,则根据所述非易失性内存中记录的所述事务的状态信息,确定所述事务的事务状态为未提交状态;删除所述事务数据以及所述事务的状态信息。
结合第一方面或第一方面的第一可能实施例,在第一方面的第二可能实施例中,所述根据所述事务标识将所述事务的事务状态修改为提交状态之后,所述方法还包括:如果所述计算机系统重新启动,则根据所述非易失性内存中记录的所述事务的状态信息,确定所述事务的事务状态为提交状态,并执行所述将所述事务数据从所述非易失性内存写入所述计算机系统的外存的动作。
结合第一方面、或第一方面的第一或第二可能实施例,在第一方面的第三可能实施例中,所述根据所述事务标识将所述事务的事务状态标记为备份状态之后,所述方法还包括:删除所述事务的事务数据。
第二方面,本发明实施例提供了一种事务处理的装置,所述装置用于包括非易失性内存的计算机系统中,所述装置包括:接收模块,用于接收事务处理请求,所述事务处理请求中携带有事务的事务数据;记录模块,用于在非易失性内存中记录所述事务的状态信息,其中,所述事务的状态信息包括所述事务标识以及根据所述事务处理请求为所述事务分配的事务标识和地址,所述事务状态为未提交状态,所述未提交状态表示所述事务数据未全部写入所述非易失性内存中;内存写入模块,用于根据所述地址, 将所述事务数据写入所述非易失性内存;所述记录模块还用于在所述内存写入模块将所述事务数据写入所述非易失性内存后,根据所述事务标识将所述事务的事务状态修改为提交状态,所述提交状态表示所述事务的事务数据已经全部写入所述非易失性内存中且未完全写入所述计算机系统的外存中;外存写入模块,用于在所述记录模块将所述事务的事务状态修改为提交状态后,将所述事务数据从所述非易失性内存写入所述计算机系统的外存;所述记录模块还用于在所述外存写入模块将所述事务数据写入所述计算机系统的外存后,根据所述事务标识将所述事务的事务状态修改为备份状态,所述备份状态表示所述事务的事务数据已全部写入所述计算机系统的外存中。
结合第二方面,在第二方面的第一可能实施例中,还包括:状态确定模块,用于在所述记录模块将所述事务的事务状态修改为提交状态之前,如果所述计算机系统重新启动,则根据所述非易失性内存中记录的所述事务的状态信息,确定所述事务的事务状态为未提交状态;删除模块,用于在所述状态确定模块确定所述事务的事务状态为未提交状态时,删除所述事务数据以及所述事务的状态信息。
结合第二方面的第一可能实施例,在第二方面的第二可能实施例中,所述状态确定模块,还用于在所述记录模块将所述事务的事务状态修改为提交状态之后,若所述计算机重新启动,则根据所述非易失性内存中记录的所述事务的状态信息,确定所述事务的事务状态为提交状态,并触发所述外存写入模块执行所述将所述事务数据从所述非易失性内存写入所述计算机系统的外存的动作。
结合第二方面的第一或第二可能实施例,在第二方面的第三可能实施例中,所述删除模块,还用于在所述记录模块将所述事务的事务状态标记为备份状态之后,删除所述事务的事务数据。
第三方面,本发明实施例提供了一种计算机系统,所述计算机系统包括处理器和非易失性内存,其中:所述非易失性内存,用于存储数据;所述处理器用于:接收事务处理请求,所述事务处理请求中携带有事务的事务数据;在非易失性内存中记录所述事务的状态信息,其中,所述事务的状态信息包括所述事务标识以及根据所述事务处理请求为所述事务分配的 事务标识和地址,所述事务状态为未提交状态,所述未提交状态表示所述事务数据未全部写入所述非易失性内存中;根据所述地址,将所述事务数据写入所述非易失性内存;根据所述事务标识将所述事务的事务状态修改为提交状态,所述提交状态表示所述事务的事务数据已经全部写入所述非易失性内存中且未完全写入所述计算机系统的外存中;将所述事务数据从所述非易失性内存写入所述计算机系统的外存;根据所述事务标识将所述事务的事务状态修改为备份状态,所述备份状态表示所述事务的事务数据已全部写入所述计算机系统的外存中。
结合第三方面,在第三方面的第一可能实施例中,在执行所述根据所述事务标识将所述事务的事务状态修改为提交状态之前,所述处理器还用于:在所述计算机系统重新启动时,根据所述非易失性内存中记录的所述事务的状态信息,确定所述事务的事务状态为未提交状态;删除所述事务数据以及所述事务的状态信息。
结合第三方面或第三方面的第一可能实施例,在第三方面的第二可能实施例中,在执行所述根据所述事务标识将所述事务的事务状态修改为提交状态之后,所述处理器还用于:在所述计算机重新启动时,根据所述非易失性内存中记录的所述事务的状态信息,确定所述事务的事务状态为提交状态,并执行所述将所述事务数据从所述非易失性内存写入所述计算机系统的外存的动作。
结合第三方面、或第三方面的第一或第二可能实施例,在第三方面的第三可能实施例中,在执行所述根据所述事务标识将所述事务的事务状态修改为备份状态之后,所述处理器还用于:删除所述事务的事务数据。
在本发明实施例提供的事务处理方法中,利用非易失性内存断电数据不丢失的特性,将事务的事务数据写入到非易失性内存后直接写入到外存,而无需将事务数据写入日志区,从而简化了事务处理的过程,提高了事务处理的速度。并且,在本发明实施例中,在非易失性内存中还通过设置不同的事务状态来记录事务的事务数据是否全部写入非易失性内存或是否全部写入外存,使得计算机系统可根据事务状态确定当前事务的事务数据的写入情况,进而保证了事务的原子性和一致性。
【附图说明】
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例的附图。
图1是本发明实施例提供的一种计算机系统的结构示意图;
图2是本发明实施例提供的一种事务处理的方法的流程图;
图3是本发明实施例提供的另一种事务处理的方法的流程图;
图4是本发明实施例提供的一种事务处理的装置的结构示意图;
图5是本发明实施例提供的另一种事务处理的装置的结构示意图。
【具体实施例】
以下描述中,为了说明而不是为了限定,提出了诸如特定系统结构、接口、技术之类的具体细节,以便透彻理解本申请。然而,本领域的技术人员应当清楚,在没有这些具体细节的其它实施例中也可以实现本申请。在其它情况中,省略对众所周知的装置、电路以及方法的详细说明,以免不必要的细节妨碍本申请的描述。
为便于理解本申请事务处理的方法,先对应用所述方法的计算机系统和事务进行说明。请参阅图1,图1是本发明实施例提供的一种计算机系统的结构示意图。如图1所示,计算机系统100包括处理器110、非易失性内存120和外存130。在本发明实施例中,事务可以包括处理器110通过非易失性内存120将数据写入外存130,其中,要写入外存的数据为所述事务的事务数据。
非易失性内存(Non Volatile Memory,NVM)120,用于临时存储事务的事务数据和状态信息。具体的,在非易失性内存120中可以设置数据区121和数据状态区122。其中,数据区121用于保存事务的事务数据,数据状态区122用于保存事务的状态信息。
在本发明实施例中,非易失性内存是指内存为非易失性存储器。具体的,非易失性内存120可以包括相变存储器(Phase Change Memory,PCM)、阻变存储器(Resistive Random Access Memory,RRAM)、磁性随机存储器 (Magnetic Random Access Memory,MRAM)和铁电式随机存储器(Ferroelectric Random Access Memory,FRAM)等为代表的下一代非易失性存储器(Non-Volatile Memory,NVM)。由于下一代NVM具有访问速度快,并且能够按字节(Byte)寻址,将数据以位(bit)为单位写入非易失性存储器中,因此,下一代非易失性存储器能够挂在内存总线上,作为内存被CPU直接访问。当计算机系统100关闭电源后,非易失性内存120中的信息依然存在。
外存130用于永久存储事务的事务数据。外存130可以为硬盘驱动器(英文:Hard Disk Drive,简称:HDD)、固态硬盘(英文:Solid State Drive,简称:SDD)或者其他存储器。
处理器110用于执行本申请事务处理方法,以实现将事务数据通过内存120写入到外存130。可以理解的是,处理器可以包括CPU,还可以包括其他特定集成电路ASIC(Application Specific Integrated Circuit),或者是被配置成实施本发明实施例的一个或多个集成电路。
请继续参阅图2,图2是本发明实施例提供的一种事务处理的方法的流程图。所述事务处理方法用于图1所示的计算机系统100,并由计算机系统100的处理器110执行该事务处理方法可以包括:
201:处理器接收事务处理请求,所述事务处理请求中携带有事务的事务数据。
其中,所述事务处理请求可以是用户输入的或者由处理器所执行的其他程序触发的,如为用户输入的写指令。
处理器在接收到事务处理请求后,根据所述事务处理请求,为此次事务分配事务标识和地址。所述事务标识用于区分不同事务。所述地址为所述事务的事务数据在非易失性内存的写入地址。
202:处理器在非易失性内存中记录所述事务的状态信息,其中,所述事务的状态信息包括事务状态以及根据所述事务处理请求为所述事务分配的事务标识和地址,所述事务状态为未提交状态。
处理器在分配此次事务的事务标识和地址后,为此次事务建立状态信息。事务的状态信息可包括事务标识、事务状态以及地址。所述事务状态用于表示事务数据的写入状态,主要分为未提交状态、提交状态和备份状 态。其中,未提交状态表示所述事务的事务数据未全部写入非易失性内存中。未提交状态可以用于指示处理器在执行其他程序时或者计算机系统重启时不能使用所述事务的事务数据。提交状态表示所述事务的事务数据已经全部写入非易失性内存中且未完全写入外存中。提交状态可以用于指示处理器在执行其他程序时或者计算机系统重启时可以使用非易失性内存中的所述事务的事务数据。备份状态表示所述事务的事务数据已全部写入外存中。备份状态可以用于指示处理器在执行其他程序时或者计算机系统重启时可以使用外存中的所述事务的事务数据。换一种表达方式,当某个事务的事务状态为备份状态时,表示所述事务以及处理完成。
例如,处理器110将此次事务的事务数据、事务标识和地址经过双列直插式存储模块(英文:Dual-Inline-Memory-Modules,简称:DIMM)或快捷外设互联标准(英文:Peripheral Component Interconnect Express,简称:PCIe)等接口写入非易失性内存的数据状态区中,以作为此次事务的状态信息。其中,此次事务的事务标识为第一事务,第一事务的事务数据包括四个,则在数据状态区中建立下表1,以记录第一事务的状态信息。
表1
事务标识 事务状态 地址
第一事务 未提交状态 事务数据地址1
第一事务 未提交状态 事务数据地址2
第一事务 未提交状态 事务数据地址3
第一事务 未提交状态 事务数据地址4
当然,在其他实施例中,也可为同一事务的所有事务数据只建立一个状态信息,该状态信息中的地址,则为该事务所有的事务数据分别在非易失性内存中的地址。故对本申请事务的状态信息的记录方式不作具体限定。需要说明的是,实际应用中,计算机系统可以记录正在处理的多个事务的状态信息。
203:处理器根据所述地址,将所述事务的事务数据写入所述非易失性内存。
例如,在数据状态区中记录完事务的状态信息之后,按照第一事务的 状态信息中的地址,处理器将事务处理请求中携带的第一事务的事务数据经DIMM或PCIe等接口写入非易失性内存的数据区中。
204:处理器根据所述事务标识将所述事务的事务状态修改为提交状态。
例如,处理器将第一事务的所有事务数据都写入到非易失性内存的数据区后,在非易失性内存的数据状态区中查找事务标识为第一事务的状态信息,并将第一事务的状态信息中的事务状态修改为提交状态,如下表2。此时,第一事务完成提交。
表2
事务标识 事务状态 地址
第一事务 提交状态 事务数据地址1
第一事务 提交状态 事务数据地址2
第一事务 提交状态 事务数据地址3
第一事务 提交状态 事务数据地址4
205:处理器将所述事务数据从所述非易失性内存写入所述计算机系统的外存。
例如,在第一事务提交完成后,处理器将第一事务的事务数据从非易失性内存的数据区经串行硬盘接口技术(英文:Serial Advanced Technology Attachment,简称:SATA)或者网络驱动(英文:Network Drivers)等接口写入外存。
206:处理器根据所述事务标识将所述事务的事务状态修改为备份状态。
例如,处理器将第一事务的事务数据全部写入外存后,在非易失性内存的数据状态区中查找事务标识为第一事务的状态信息,并将事务标识为第一事务的状态信息中的事务状态修改为备份状态,如下表3。此时,第一事务的事务数据已成功写入外存,第一事务结束。
表3
事务标识 事务状态 地址
第一事务 备份状态 事务数据地址1
第一事务 备份状态 事务数据地址2
第一事务 备份状态 事务数据地址3
第一事务 备份状态 事务数据地址4
结合实际应用进行说明:用户在计算机系统中新建文件A并对文件A进行写操作。此时,处理器接收到用户的写操作指令,则需要处理将文件A写入外存的文件系统中的事务。具体的,处理器在接收到用户的写指令时,为此次事务分配事务标识和地址,并将要此次事务的状态信息记录在非易失性内存的数据状态区中,其中,该状态信息中的事务状态为未提交状态;建立此次事务的状态信息后,将文件A写入到非易失性内存的数据区中;在文件A写入完成后,将此次事务的状态信息的事务状态标记为提交状态,此时,完成了事务的提交,即实现了用户的写操作,虽然,此时处理器如果接收到读文件A的指令则可从非易失性内存中读取文件A,但实际上文件A并未写入到外存的文件系统中,即无法实现计算机系统对文件A的永久保存。故在事务提交后,将数据区中的文件A写入到外存的文件系统上,此时,事务结束。
可选地,为节省非易失性内存的存储空间,在将所述事务的事务状态修改为备份状态后,处理器可删除非易失性内存中所述事务的事务数据,且还可进一步删除非易失性内存中所述事务的状态信息,其中,当所述事务的事务数据和状态信息均删除时,对处理器删除所述事务的事务数据和删除事务的状态信息的先后顺序不作限定。
又或者,如果非易失性内存的存储空间比较充足,则在将所述事务的事务状态修改为备份状态后,处理器可先不删除非易失性内存中的所述事务的事务数据,以便于在后续需要使用所述事务的事务数据时,无需从外存读取,可直接从内存中读取,加快读取的速度。
本发明实施例中,利用非易失性内存断电数据不丢失的特性,将事务的事务数据写入到非易失性内存后直接写入到外存,而无需将事务数据写入日志区,从而简化了事务处理的过程,提高了事务处理的速度。并且,在本发明实施例中,在非易失性内存中还通过设置不同的事务状态来记录事务的事务数据是否全部写入非易失性内存或是否全部写入外存,使得计 算机系统可根据事务状态确定当前事务的事务数据的写入情况,进而保证了事务的原子性和一致性。
另外,由于非易失性存储器写入数据时无需先擦除原先保存的数据,且本身的读写数据速度远高于普通的DRAM,故利用非易失性存储器作为写入事务数据的内存,可极大提高了事务数据的读写速度,即进一步提高了事务处理的速度。
优化地,本申请事务处理方法还可实现事务恢复,即,处理器在执行上述事务处理方法过程中,如果计算机系统重新启动,则可根据非易失性内存中的事务的事务状态对所述事务进行事务恢复。
具体请参阅图3,图3是本发明实施例提供的另一种事务处理的方法的流程图。本实施例中,所述方法用于包括非易失性内存的计算机系统中,所述方法由所述计算机系统的处理器执行,所述方法包括:
301:处理器接收事务处理请求,所述事务处理请求中携带有事务的事务数据。
302:处理器在非易失性内存中记录所述事务的状态信息,其中,所述事务的状态信息包括事务状态以及根据所述事务处理请求为所述事务分配的事务标识和地址,所述事务状态为未提交状态。
303:处理器根据所述地址,将所述事务数据写入所述非易失性内存。
304:处理器判断计算机系统是否重新启动,如果是,则执行305,如果否,则执行307。
305:处理器根据所述非易失性内存中记录的所述事务的状态信息,确定所述事务的事务状态为未提交状态。
例如,在处理器执行将第一事务的事务数据写入非易失性内存时,计算机系统掉电或者崩溃后重新启动,此时,处理器根据非易失性内存中第一事务的状态信息如上表1,确定第一事务的事务状态为未提交状态。
306:处理器删除所述事务数据以及所述事务的状态信息。
例如,处理器确定第一事务的事务状态为未提交状态,即表示在计算机系统重启前,第一事务的事务数据没有完全更新到非易失性内存的数据区中。故根据事务的原子性,非易失性内存中的第一事务的事务数据不可更新到外存上。故,处理器删除非易失性内存的数据区中第一事务的所有 事务数据,并删除数据状态区中的第一事务的状态信息即删除上表1,以实现事务的回滚。
307:处理器根据所述事务标识将所述事务的事务状态修改为提交状态。
308:处理器判断计算机系统是否重新启动,如果是,则执行309,如果否,则执行310。
309:处理器根据所述非易失性内存中记录的所述事务的状态信息,确定所述事务的事务状态为提交状态,并执行310。
例如,在处理器执行将第一事务的事务状态修改为提交状态之后,计算机系统掉电或者崩溃后重新启动,此时,处理器根据非易失性内存中第一事务的状态信息如上表2,确定第一事务的事务状态为提交状态,也即表示在计算机系统重启前,该第一事务的事务数据已经完全更新到非易失性内存的数据区中。故根据事务的一致性,处理器执行310,以将数据区中的第一事务的事务数据写入外存中。
310:处理器将所述事务数据从所述非易失性内存写入所述计算机系统的外存。
311:处理器根据所述事务标识将所述事务的事务状态修改为备份状态。
312:处理器删除所述事务的事务数据。
在处理器执行将所述事务的事务状态修改为备份状态之后,如果计算机系统重新启动,则处理器根据非易失性内存中所述事务的状态信息如上表3,确定所述事务的事务状态为备份状态,也即表示在计算机系统重启前,所述事务的事务数据已经完全更新到外存中。故处理器可执行删除所述事务的事务数据和状态信息的动作,以实现对非易失性内存的存储空间的回收。
需要说明的是,图3所示的流程图仅为更清楚说明本申请事务恢复的过程,而不应理解为对本申请方法步骤的限定。实质上,处理器也未必执行判断计算机系统是否重启的动作,图3中的处理器执行判断计算机系统是否重启的步骤仅表示对计算机系统的状态的说明,即表示此时如果出现计算机系统重启,则处理器执行图3中对应“是”指向的步骤,如果不出 现计算机系统重启,则执行图3中对应“否”执行的步骤。而且,计算机系统是否重启的状态未必限定在303、307之后,而是可能出现在处理器执行图1所示的任意一个步骤的之前或之后、或者执行图1所示的任意一个步骤的过程中。然而,无论计算机系统重启出现在哪一步骤中,本申请处理器均根据以下原则执行对应的事务恢复步骤:在执行根据所述事务标识将所述事务的事务状态修改为提交状态之前,如果出现计算机系统重启,则确定所述事务的事务状态为未提交状态,执行事务恢复步骤305和306;在执行根据所述事务标识将所述事务的事务状态修改为提交状态之后,如果出现计算机系统重启,则确定所述事务的事务状态为提交状态,并执行事务恢复步骤310和311。
本实施例,利用非易失性内存掉电数据不丢失的特性,将事务数据保存早非易失性内存中,使得当事务处理过程中非易失性内存出现重新启动时,非易失性内存中事务的事务数据不会丢失,可直接从非易失性内存中恢复事务的事务数据,故提高了事务的恢复速度。而且,通过在非易失性内存中设置事务状态来记录事务的事务数据是否全部写入非易失性内存和是否写入外存,当事务处理过程中非易失性内存出现重新启动时,根据事务状态可确定所述事务的事务数据的写入情况,并在事务的事务数据未全部写入非易失性内存时,不将所述事务的事务数据写入外存,而是直接将所述事务的事务数据删除,在事务的事务数据全部写入非易失性内存且未写入外存时,才将事务数据写入到外存,保证了事务的原子性和一致性。
请参阅图4,图4是本发明实施例提供的一种事务处理的装置的结构示意图。本实施例中,所述装置用于包括非易失性内存和外存的计算机系统。该非易失性内存可设置有数据区和数据状态区。数据区用于保存事务的事务数据,数据状态区用于保存事务的状态信息。本申请利用非易失性内存具有掉电不丢失数据的特性,保证了事务数据和状态信息的可靠性。事务处理的装置420包括接收模块423、记录模块421、内存写入模块422和外存写入模块424。
接收模块423用于接收事务处理请求,所述事务处理请求中携带有事务的事务数据。
其中,所述事务处理请求可以是用户输入的或者由处理器所执行的其 他程序触发的,如为用户输入的写指令。
接收模块423在接收到事务处理请求后,还可根据所述事务处理请求,为此次事务分配事务标识和地址。所述事务标识用于区分不同事务。所述地址为所述事务的事务数据在非易失性内存的写入地址。
记录模块421用于在非易失性内存中记录所述事务的状态信息,其中,所述事务的状态信息包括所述事务标识以及根据所述事务处理请求为所述事务分配的事务标识和地址,所述事务状态为未提交状态。
当接收模块423为此次事务分配好事务标识和地址时,记录模块421为此次事务建立状态信息。所述事务的状态信息可包括事务标识、事务状态以及地址。所述事务状态用于表示事务的事务数据的写入状态,主要分为未提交状态、提交状态和备份状态。其中,未提交状态表示所述事务的事务数据未全部写入非易失性内存中,即用于指示计算机系统在执行其他程序时或者计算机系统重启时不能使用所述事务的事务数据;提交状态表示所述事务的事务数据已经全部写入非易失性内存中且未完全写入外存中,即用于指示计算机系统在执行其他程序时或者计算机系统重启时可以使用非易失性内存中的所述事务的事务数据;备份状态表示所述事务的事务数据已全部写入外存中,即用于指示计算机系统在执行其他程序时或者计算机系统重启时可以使用外存中的所述事务的事务数据,即所述事务已经结束。
例如,此次事务的事务标识为第一事务,第一事务的事务数据包括四个,则在数据状态区中建立上表1,以记录第一事务的状态信息。
当然,在其他实施例中,也可为同一事务的所有事务数据只建立一个状态信息,该状态信息中的地址,则为该事务所有的事务数据分别在非易失性内存中的地址。故对本申请事务的状态信息的记录方式不作具体限定。
内存写入模块422用于根据所述地址,将所述事务数据写入所述非易失性内存。
例如,在记录模块421记录完事务的状态信息之后,内存写入模块422按照第一事务的状态信息中的地址,将事务处理请求中携带的第一事务的事务数据写入非易失性内存的数据区中。
记录模块421还用于在所述内存写入模块422将所述事务数据写入所 述非易失性内存后,根据所述事务标识将所述事务的事务状态修改为提交状态。
例如,当内存写入模块422将第一事务的事务数据都写入到非易失性内存的数据区后,记录模块421在非易失性内存的数据状态区中查找事务标识为第一事务的状态信息,并将第一事务的状态信息中的事务状态修改为提交状态,如上表2。此时,第一事务完成提交。
外存写入模块424用于在所述记录模块将所述事务的事务状态修改为提交状态后,将所述事务数据从所述非易失性内存写入所述计算机系统的外存。
例如,在第一事务提交完成后,外存写入模块424将第一事务的事务数据从非易失性内存的数据区写入到外存。
记录模块421还用于在所述外存写入模块424将所述事务数据写入所述计算机系统的外存后,根据所述事务标识将所述事务的事务状态修改为备份状态。
例如,在外存写入模块424将第一事务的事务数据全部写入外存后,记录模块421在非易失性内存的数据状态区中查找事务标识为第一事务的状态信息,并将第一事务的状态信息中的事务状态修改为备份状态,如上表3。此时,第一事务的事务数据已成功写入外存中,第一事务处理结束。
可选地,为节省非易失性内存的存储空间,非易失性在将所述事务的事务状态修改为备份状态后,处理器可删除非易失性内存中所述事务的事务数据和状态信息,其中,对处理器可在删除所述事务的事务数据和删除事务的状态信息的先后顺序不作限定。又或者,如果非易失性内存的存储空间比较充足,则在将所述事务的事务状态修改为备份状态后,处理器可先不删除非易失性内存中的所述事务的事务数据,以便于在后续需要使用所述事务的事务数据时,无需从外存读取,可直接从内存中读取,加快读取的速度。
优化地,本申请事务处理装置还可实现事务恢复,即,事务处理装置在执行上述事务处理方法过程中,如果计算机系统重新启动,则可根据非易失性内存中的事务的事务状态对所述事务进行事务恢复。
具体请参阅图5,图5是本发明实施例提供的另一种事务处理的装置的 结构示意图。优化于上一实施例的事务处理装置420,本实施例的事务处理装置520还包括状态确定模块525、删除模块526。
状态确定模块525用于在记录模块421将所述事务的事务状态修改为提交状态之前,如果所述计算机系统重新启动,则根据所述非易失性内存中记录的所述事务的状态信息,确定所述事务的事务状态为未提交状态。
例如,在内存写入模块422执行将第一事务的事务数据写入非易失性内存时,计算机系统掉电或者崩溃后重新启动,此时,状态确定模块525根据非易失性内存中第一事务的状态信息如上表1,确定第一事务的事务状态为未提交状态。
删除模块526用于在所述状态确定模块525确定所述事务的事务状态为未提交状态时,删除所述事务数据以及所述事务的状态信息。
例如,删除模块526删除非易失性内存的数据区中第一事务的所有事务数据,并删除非易失性内存的数据状态区中的第一事务的状态信息即删除上表1,以实现事务的回滚。
可选地,状态确定模块525还用于在所述记录模块421将所述事务的事务状态修改为提交状态之后,若所述计算机重新启动,则根据所述非易失性内存中记录的所述事务的状态信息,确定所述事务的事务状态为提交状态,并触发所述外存写入模块424执行所述将所述事务数据从所述非易失性内存写入所述计算机系统的外存的动作。
例如,在记录模块421执行将第一事务的事务状态修改为提交状态之后,计算机系统掉电或者崩溃后重新启动,此时,状态确定模块525根据非易失性内存中第一事务的状态信息如上表2,确定第一事务的事务状态为提交状态,则将非易失性内存中的第一事务的事务数据写入外存中。
可选地,为节省非易失性内存的存储空间,删除模块526还用于在所述记录模块421将所述事务的事务状态标记为备份状态之后,删除所述事务的事务数据,以实现对非易失性内存的存储空间的回收。
可以理解的是,在其他实施例中,如果非易失性内存的存储空间比较充足,事务处理装置520在事务数据的事务状态修改为备份状态之后,不作任何操作。
本申请还提供一种计算机系统。请结合参阅图1,图1是本申请计算机 系统一实施例的结构示意图。本实施例的计算机系统100包括处理器110、非易失性内存120和外存130。其中,处理器110与非易失性内存120间可通过DIMM或PCIe等接口进行连接,非易失性内存120与外存可通过SATA或网络驱动等接口进行连接。
非易失性内存120和外存130均用于存储数据。具体地,非易失性内存120用于暂存处理器110的处理数据,如处理器110处理的事务的事务数据和状态信息,外存130用于永久存储计算机系统的数据,如处理器110处理的事务数据。
处理器110还可以称为CPU(Central Processing Unit,中央处理单元),用于:
接收事务处理请求,所述事务处理请求中携带有事务的事务数据;
在非易失性内存120中记录所述事务的状态信息,其中,所述事务的状态信息包括所述事务标识以及根据所述事务处理请求为所述事务分配的事务标识和地址,所述事务状态为未提交状态,所述未提交状态表示所述事务数据未全部写入所述非易失性内存中;
根据所述地址,将所述事务数据写入所述非易失性内存120;
根据所述事务标识将所述事务的事务状态修改为提交状态,所述提交状态表示所述事务的事务数据已经全部写入所述非易失性内存中且未完全写入所述计算机系统的外存中;
将所述事务数据从所述非易失性内存120写入所述计算机系统的外存130;
根据所述事务标识将所述事务的事务状态修改为备份状态,所述备份状态表示所述事务的事务数据已全部写入所述计算机系统的外存中。
可选地,在执行所述根据所述事务标识将所述事务的事务状态修改为提交状态之前,处理器110用于:
在所述计算机系统重新启动时,根据所述非易失性内存120中记录的所述事务的状态信息,确定所述事务的事务状态为未提交状态;
删除所述事务数据以及所述事务的状态信息。
可选地,在执行所述根据所述事务标识将所述事务的事务状态修改为提交状态之后,处理器110还用于:
在所述计算机重新启动时,根据所述非易失性内存120中记录的所述事务的状态信息,确定所述事务的事务状态为提交状态,并执行所述将所述事务数据从所述非易失性内存120写入所述计算机系统的外存130的动作。
可选地,在执行所述根据所述事务标识将所述事务的事务状态修改为备份状态之后,处理器110还用于删除所述事务的事务数据。
可选地,非易失性内存120可包括数据区121和数据状态区122,其中,数据区用于存储事务的事务数据,数据状态区用于存储事务的状态信息。
在本发明实施例中,
处理器110可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器110中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器110可以是通用处理器、数字信号处理器(DSP)、专用集成电路(ASIC)、现成可编程门阵列(FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本发明实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本发明实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于外存130,处理器110读取外存130中的信息,结合其硬件完成上述方法的步骤。
上述方案中,利用非易失性内存断电数据不丢失的特性,将事务的事务数据写入到非易失性内存后直接写入到外存,而无需将事务数据写入日志区,从而简化了事务处理的过程,提高了事务处理的速度。并且,在本发明实施例中,在非易失性内存中还通过设置不同的事务状态来记录事务的事务数据是否全部写入非易失性内存或是否全部写入外存,使得计算机系统可根据事务状态确定当前事务的事务数据的写入情况,进而保证了事务的原子性和一致性。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅 是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器(processor)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。

Claims (12)

  1. 一种事务处理的方法,所述方法用于包括非易失性内存的计算机系统中,其特征在于,包括:
    接收事务处理请求,所述事务处理请求中携带有事务的事务数据;
    在非易失性内存中记录所述事务的状态信息,其中,所述事务的状态信息包括事务状态以及根据所述事务处理请求为所述事务分配的事务标识和地址,所述事务状态为未提交状态,所述未提交状态表示所述事务数据未全部写入所述非易失性内存中;
    根据所述地址,将所述事务数据写入所述非易失性内存;
    根据所述事务标识将所述事务的事务状态修改为提交状态,所述提交状态表示所述事务的事务数据已经全部写入所述非易失性内存中且未完全写入所述计算机系统的外存中;
    将所述事务数据从所述非易失性内存写入所述计算机系统的外存;
    根据所述事务标识将所述事务的事务状态修改为备份状态,所述备份状态表示所述事务的事务数据已全部写入所述计算机系统的外存中。
  2. 根据权利要求1所述的方法,其特征在于,所述根据所述事务标识将所述事务的事务状态修改为提交状态之前,所述方法还包括:
    如果所述计算机系统重新启动,则根据所述非易失性内存中记录的所述事务的状态信息,确定所述事务的事务状态为未提交状态;
    删除所述事务数据以及所述事务的状态信息。
  3. 根据权利要求1所述的方法,其特征在于,所述根据所述事务标识将所述事务的事务状态修改为提交状态之后,所述方法还包括:
    如果所述计算机系统重新启动,则根据所述非易失性内存中记录的所述事务的状态信息,确定所述事务的事务状态为提交状态,并执行所述将所述事务数据从所述非易失性内存写入所述计算机系统的外存的动作。
  4. 根据权利要求1所述的方法,其特征在于,所述根据所述事务标识将所述事务的事务状态标记为备份状态之后,所述方法还包括:
    删除所述事务的事务数据。
  5. 一种事务处理的装置,所述装置用于包括非易失性内存的计算机系统中,其特征在于,所述装置包括:
    接收模块,用于接收事务处理请求,所述事务处理请求中携带有事务的事务数据;
    记录模块,用于在非易失性内存中记录所述事务的状态信息,其中,所述事务的状态信息包括所述事务标识以及根据所述事务处理请求为所述事务分配的事务标识和地址,所述事务状态为未提交状态,所述未提交状态表示所述事务数据未全部写入所述非易失性内存中;
    内存写入模块,用于根据所述地址,将所述事务数据写入所述非易失性内存;
    所述记录模块还用于在所述内存写入模块将所述事务数据写入所述非易失性内存后,根据所述事务标识将所述事务的事务状态修改为提交状态,所述提交状态表示所述事务的事务数据已经全部写入所述非易失性内存中且未完全写入所述计算机系统的外存中;
    外存写入模块,用于在所述记录模块将所述事务的事务状态修改为提交状态后,将所述事务数据从所述非易失性内存写入所述计算机系统的外存;
    所述记录模块还用于在所述外存写入模块将所述事务数据写入所述计算机系统的外存后,根据所述事务标识将所述事务的事务状态修改为备份状态,所述备份状态表示所述事务的事务数据已全部写入所述计算机系统的外存中。
  6. 根据权利要求5所述的装置,其特征在于,还包括:
    状态确定模块,用于在所述记录模块将所述事务的事务状态修改为提交状态之前,如果所述计算机系统重新启动,则根据所述非易失性内存中记录的所述事务的状态信息,确定所述事务的事务状态为未提交状态;
    删除模块,用于在所述状态确定模块确定所述事务的事务状态为未提交状态时,删除所述事务数据以及所述事务的状态信息。
  7. 根据权利要求6所述的装置,其特征在于,
    所述状态确定模块,还用于在所述记录模块将所述事务的事务状态修改为提交状态之后,若所述计算机重新启动,则根据所述非易失性内存中记录的所述事务的状态信息,确定所述事务的事务状态为提交状态,并触发所述外存写入模块执行所述将所述事务数据从所述非易失性内存写入所 述计算机系统的外存的动作。
  8. 根据权利要求6或7所述的装置,其特征在于,
    所述删除模块,还用于在所述记录模块将所述事务的事务状态标记为备份状态之后,删除所述事务的事务数据。
  9. 一种计算机系统,其特征在于,所述计算机系统包括处理器和非易失性内存,其中:
    所述非易失性内存,用于存储数据;
    所述处理器用于:
    接收事务处理请求,所述事务处理请求中携带有事务的事务数据;
    在非易失性内存中记录所述事务的状态信息,其中,所述事务的状态信息包括所述事务标识以及根据所述事务处理请求为所述事务分配的事务标识和地址,所述事务状态为未提交状态,所述未提交状态表示所述事务数据未全部写入所述非易失性内存中;
    根据所述地址,将所述事务数据写入所述非易失性内存;
    根据所述事务标识将所述事务的事务状态修改为提交状态,所述提交状态表示所述事务的事务数据已经全部写入所述非易失性内存中且未完全写入所述计算机系统的外存中;
    将所述事务数据从所述非易失性内存写入所述计算机系统的外存;
    根据所述事务标识将所述事务的事务状态修改为备份状态,所述备份状态表示所述事务的事务数据已全部写入所述计算机系统的外存中。
  10. 根据权利要求9所述的计算机系统,其特征在于,在执行所述根据所述事务标识将所述事务的事务状态修改为提交状态之前,所述处理器还用于:
    在所述计算机系统重新启动时,根据所述非易失性内存中记录的所述事务的状态信息,确定所述事务的事务状态为未提交状态;
    删除所述事务数据以及所述事务的状态信息。
  11. 根据权利要求9所述的计算机系统,其特征在于,在执行所述根据所述事务标识将所述事务的事务状态修改为提交状态之后,所述处理器还用于:
    在所述计算机重新启动时,根据所述非易失性内存中记录的所述事务 的状态信息,确定所述事务的事务状态为提交状态,并执行所述将所述事务数据从所述非易失性内存写入所述计算机系统的外存的动作。
  12. 根据权利要求9所述的计算机系统,其特征在于,在执行所述根据所述事务标识将所述事务的事务状态修改为备份状态之后,所述处理器还用于:
    删除所述事务的事务数据。
PCT/CN2014/094779 2014-12-24 2014-12-24 事务处理的方法、装置及计算机系统 WO2016101165A1 (zh)

Priority Applications (6)

Application Number Priority Date Filing Date Title
PCT/CN2014/094779 WO2016101165A1 (zh) 2014-12-24 2014-12-24 事务处理的方法、装置及计算机系统
CN201480045678.XA CN106716395B (zh) 2014-12-24 2014-12-24 事务处理的方法、装置及计算机系统
JP2017534214A JP6401866B2 (ja) 2014-12-24 2014-12-24 トランザクション処理方法及び装置、並びにコンピュータシステム
KR1020177020304A KR101910759B1 (ko) 2014-12-24 2014-12-24 트랜잭션 처리 방법, 장치 및 컴퓨터 시스템
EP14908733.0A EP3229147A4 (en) 2014-12-24 2014-12-24 Transaction processing method, device and computer system
US15/631,585 US10467044B2 (en) 2014-12-24 2017-06-23 Transaction processing method and apparatus, and computer system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2014/094779 WO2016101165A1 (zh) 2014-12-24 2014-12-24 事务处理的方法、装置及计算机系统

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US15/631,585 Continuation US10467044B2 (en) 2014-12-24 2017-06-23 Transaction processing method and apparatus, and computer system

Publications (1)

Publication Number Publication Date
WO2016101165A1 true WO2016101165A1 (zh) 2016-06-30

Family

ID=56148902

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/094779 WO2016101165A1 (zh) 2014-12-24 2014-12-24 事务处理的方法、装置及计算机系统

Country Status (6)

Country Link
US (1) US10467044B2 (zh)
EP (1) EP3229147A4 (zh)
JP (1) JP6401866B2 (zh)
KR (1) KR101910759B1 (zh)
CN (1) CN106716395B (zh)
WO (1) WO2016101165A1 (zh)

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10268502B2 (en) * 2017-06-29 2019-04-23 Intel Corporation Methods and apparatus to perform atomic transactions in nonvolatile memory under hardware transactional memory
KR20190046169A (ko) * 2017-10-25 2019-05-07 에스케이하이닉스 주식회사 데이터 처리 시스템 및 데이터 처리 시스템의 동작방법
US10445238B1 (en) * 2018-04-24 2019-10-15 Arm Limited Robust transactional memory
KR102450411B1 (ko) * 2018-05-09 2022-09-30 삼성에스디에스 주식회사 블록체인 기반 트랜잭션 처리 방법, 장치 및 그 시스템
CN111240851B (zh) * 2018-11-29 2024-05-24 合肥优荃信息科技有限公司 基于切面编程的事务处理方法、装置、设备及系统
KR102180592B1 (ko) * 2018-12-14 2020-11-18 주식회사 엘지씨엔에스 It 시스템 검증 방법 및 시스템
JP7313458B2 (ja) * 2019-09-18 2023-07-24 華為技術有限公司 ストレージシステム、ストレージノード及びデータ記憶方法
KR102412423B1 (ko) 2020-01-09 2022-06-23 성균관대학교산학협력단 비휘발성 메모리 장치, 이것을 포함하는 컴퓨팅 시스템 및 이것의 동작 방법
CN113296683B (zh) * 2020-04-07 2022-04-29 阿里巴巴集团控股有限公司 数据存储方法、装置、服务器和存储介质
CN112286909B (zh) * 2020-10-29 2023-09-05 平安科技(深圳)有限公司 执行状态确定方法、装置、服务器及存储介质
CN117480484A (zh) * 2021-09-15 2024-01-30 英特尔公司 存储器事务的路由

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1455334A (zh) * 2003-05-19 2003-11-12 清华大学 用普通scsi磁盘代替存储光纤网络中光纤磁盘的方法
CN101089857A (zh) * 2007-07-24 2007-12-19 中兴通讯股份有限公司 一种内存数据库事务管理方法及系统
US20110321015A1 (en) * 2010-06-23 2011-12-29 Yen Hsiang Chew Hardware triggering mechanism for software debugger
CN103077222A (zh) * 2012-12-31 2013-05-01 中国科学院计算技术研究所 机群文件系统分布式元数据一致性保证方法及系统

Family Cites Families (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS5386111A (en) * 1977-01-07 1978-07-29 Toshiba Corp Monitor device
US4507751A (en) * 1982-06-21 1985-03-26 International Business Machines Corporation Method and apparatus for logging journal data using a log write ahead data set
JPH06332777A (ja) * 1993-05-18 1994-12-02 Hitachi Ltd トランザクション処理方式
US5386111A (en) * 1993-10-08 1995-01-31 Zimmerman; H. Allen Optical detection of water droplets using light refraction with a mask to prevent detection of unrefracted light
JP4287900B2 (ja) * 2001-03-19 2009-07-01 株式会社リコー 書き込み遅延データベース管理システム、及びプログラム
JP3607658B2 (ja) * 2001-10-05 2005-01-05 株式会社東芝 携帯可能電子装置
CA2422176C (en) * 2003-03-14 2009-07-21 Ibm Canada Limited - Ibm Canada Limitee Method and apparatus for interrupting updates to a database to provide read-only access
US8850141B2 (en) * 2003-07-15 2014-09-30 International Business Machines Corporation System and method for mirroring data
US20070220059A1 (en) * 2006-03-20 2007-09-20 Manyi Lu Data processing node
JP5386111B2 (ja) * 2008-05-22 2014-01-15 株式会社日立ソリューションズ ファイルシステムの記録方法
FR2991796A1 (fr) * 2012-06-12 2013-12-13 Inside Secure Procede de sauvegarde de donnees, a l'exterieur d'un microcircuit securise
CN102831069B (zh) * 2012-06-30 2016-03-30 华为技术有限公司 内存处理方法、内存管理设备
WO2014142908A1 (en) * 2013-03-14 2014-09-18 Hewlett-Packard Development Company, L.P. Multiversioned nonvolatile memory hierarchy for persistent memory

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1455334A (zh) * 2003-05-19 2003-11-12 清华大学 用普通scsi磁盘代替存储光纤网络中光纤磁盘的方法
CN101089857A (zh) * 2007-07-24 2007-12-19 中兴通讯股份有限公司 一种内存数据库事务管理方法及系统
US20110321015A1 (en) * 2010-06-23 2011-12-29 Yen Hsiang Chew Hardware triggering mechanism for software debugger
CN103077222A (zh) * 2012-12-31 2013-05-01 中国科学院计算技术研究所 机群文件系统分布式元数据一致性保证方法及系统

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3229147A4 *

Also Published As

Publication number Publication date
KR20170098900A (ko) 2017-08-30
US20170286150A1 (en) 2017-10-05
CN106716395B (zh) 2019-04-19
JP2018504692A (ja) 2018-02-15
US10467044B2 (en) 2019-11-05
KR101910759B1 (ko) 2018-12-19
EP3229147A1 (en) 2017-10-11
JP6401866B2 (ja) 2018-10-10
EP3229147A4 (en) 2017-12-27
CN106716395A (zh) 2017-05-24

Similar Documents

Publication Publication Date Title
WO2016101165A1 (zh) 事务处理的方法、装置及计算机系统
US10318324B2 (en) Virtualization support for storage devices
JP6556911B2 (ja) 注釈付きアトミック書き込み操作を行う方法および装置
US9703816B2 (en) Method and system for forward reference logging in a persistent datastore
CN108431783B (zh) 访问请求处理方法、装置及计算机系统
US8935458B2 (en) Drive assisted system checkpointing via system restore points
US20170185354A1 (en) Techniques for a Write Transaction at a Storage Device
US20160124639A1 (en) Dynamic storage channel
WO2019090493A1 (zh) 内存块回收方法和装置
EP3496356A1 (en) Atomic cross-media writes on storage devices
CN106469119B (zh) 一种基于nvdimm的数据写缓存方法及其装置
US9547460B2 (en) Method and system for improving cache performance of a redundant disk array controller
CN108628760B (zh) 原子写命令的方法与装置
US10402101B2 (en) System and method for using persistent memory to accelerate write performance
US20240086113A1 (en) Synchronous write method and device, storage system and electronic device
CN108628761B (zh) 原子命令执行方法与装置
US11748259B2 (en) System and method to conserve device lifetime for snapshot generation
US9946656B2 (en) Completion packet return based on eviction or flush
US20240126435A1 (en) Storage system and method of data management of the same
US11068175B2 (en) Technology to manage capacity loss in storage drives
CN112416812B (zh) 访问请求处理方法、装置及计算机系统
WO2018209733A1 (zh) 一种串行闪存数据保护方法和装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14908733

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2017534214

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

REEP Request for entry into the european phase

Ref document number: 2014908733

Country of ref document: EP

ENP Entry into the national phase

Ref document number: 20177020304

Country of ref document: KR

Kind code of ref document: A