CN113722052A - Nonvolatile memory updating method based on data double versions - Google Patents

Nonvolatile memory updating method based on data double versions Download PDF

Info

Publication number
CN113722052A
CN113722052A CN202110970740.8A CN202110970740A CN113722052A CN 113722052 A CN113722052 A CN 113722052A CN 202110970740 A CN202110970740 A CN 202110970740A CN 113722052 A CN113722052 A CN 113722052A
Authority
CN
China
Prior art keywords
data
update
transaction
version
timestamp
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
CN202110970740.8A
Other languages
Chinese (zh)
Other versions
CN113722052B (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.)
Huazhong University of Science and Technology
Original Assignee
Huazhong University of Science and Technology
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 Huazhong University of Science and Technology filed Critical Huazhong University of Science and Technology
Priority to CN202110970740.8A priority Critical patent/CN113722052B/en
Publication of CN113722052A publication Critical patent/CN113722052A/en
Application granted granted Critical
Publication of CN113722052B publication Critical patent/CN113722052B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores

Abstract

The invention discloses a nonvolatile memory updating method based on data double versions, which comprises the following steps: maintaining old and new versions of data in a persistent transactional memory in a data unit of a non-volatile memory; when the update transaction is executed, the two versions are updated by using the updated data copy in the DRAM in turn; the invention eliminates redundant NVM write operation, reduces the times of calling cache eviction instruction and memory barrier instruction, thereby shortening the execution time of single update transaction; the invention provides a data dual-version-based read-only transaction data reading flow and a transaction data updating reading flow, thereby avoiding read-write conflict in a multi-thread environment and reducing the blockage of the read-only transaction caused by the updating transaction; the invention solves the write conflict in the multithreading environment by using a lock mode; the invention also provides two data consistency recovery mechanisms based on the data double versions, which are respectively data recovery based on global scanning and data recovery based on update address write-back.

Description

Nonvolatile memory updating method based on data double versions
Technical Field
The invention belongs to the field of computer data storage, and particularly relates to a nonvolatile memory updating method based on data double versions.
Background
In the current computer systems, DRAM (Dynamic Random Access Memory) is mostly used as the Memory of the computer system, the DRAM Access delay is low, but the capacity is small, and data is lost after the system is powered down. In recent years, memory technology has been rapidly developed, and non-volatile memory (NVM) technology has been advanced. The NVM has the capacity of hard disk level and the non-volatility after power failure, has the access delay of the same order of magnitude as that of the DRAM, and supports byte addressing. Furthermore, NVM has some drawbacks such as still higher read and write latency than DRAM, asymmetric read and write, faster read than write, and limited write times.
Compared with a traditional magnetic disk, the atomic write granularity on the NVM is only 8 bytes, so when the data written into the NVM is larger than 8 bytes, the data in the NVM can be only partially updated due to unexpected crash of the system, and the consistency of the data is damaged. In addition, to ensure that data is written to NVM in a particular order, a cache write back instruction and a memory barrier instruction may be invoked.
Persistent transactional memory is based on extensions made to NVM by traditional transactional memory, i.e. taking into account the non-volatility of NVM on a transactional memory basis. Persistent transactional memory involves two transactions: one is a read-only transaction, which does not write any data; the other is an update transaction, which writes some data.
When updating data on the NVM in persistent transactional memory, the data cannot be directly modified. This is because if a system crash or machine power down occurs during the modification process, a partial update will be generated. It is common practice to use an undoo or redo log protocol to update data and ensure data consistency. The process of updating transaction write data by adopting the undo log comprises the following steps:
d0: writing the data A into a log to obtain copy data A' of the data A; the log is stored on the NVM;
d1: calling a cache eviction instruction and a memory barrier instruction to ensure that the data A' is persisted; after the persistence operation is completed, if the system is powered down or crashed, the data A' cannot be lost; if the update transaction performs a write operation to multiple data, then the cache eviction instruction and the memory barrier instruction need to be invoked separately for the multiple data.
D2: write operation is performed on data a: the value of data a is updated to D.
When the update transaction is submitted, a cache eviction instruction and a memory barrier instruction need to be called to ensure that the write operation of the data A is persisted; after the persistence operation is completed, if the system is powered down or crashed, the value D of the updated data A cannot be lost; if the update transaction performs a write operation to multiple data, then a cache eviction instruction needs to be invoked on the multiple data individually.
If a system crash occurs when the data A is modified, the data A' in the log can be used for restoring the data A to the state before the write operation is executed, so that the consistency of the data is guaranteed.
When the write operation of a plurality of data is executed, the update transaction based on the undo log needs to call a cache eviction instruction and a memory barrier instruction for the plurality of data separately, because the undo log must wait for the copy of the data to be persisted until the log can execute the write operation when the write operation is executed on the data, and each time the write operation of one data is executed, the cache eviction instruction and the memory barrier instruction need to be called to ensure that the copy data is persisted.
The process of updating transaction modification data by adopting the redo log comprises the following steps:
t0: writing the data B into the log to obtain copy data B' of the data B; the log is stored on the NVM;
t1: a write operation is performed on data B'.
The process of committing the update transaction includes the following steps
S0: calling a cache eviction instruction and a memory barrier instruction ensures that the operation of step T1 is persistent, and if the update transaction performs a write operation on a plurality of data, the cache eviction instruction needs to be called separately on the plurality of data;
s1: updating data B with data B';
s2: invoking the cache eviction instruction and the memory barrier instruction ensures that the operation of step S1 is persisted, and if the update transaction performs a write operation on multiple data, the cache eviction instruction needs to be invoked separately on the multiple data.
If a system crash occurs while the step S1 is performed, the step S1 may be re-performed using the data B' in the log to restore the data B to a state after the write operation is performed, thereby securing the consistency of the data.
The update transaction based on the undo log has one redundant NVM write operation at step D0, and the update transaction based on the redo log has two redundant NVM write operations at steps T0 and S1; whether the update transaction is based on the undo log or the redo log, the cache eviction instruction and the memory barrier instruction are required to be called for many times; redundant NVM write operations and multiple instruction calls may increase the execution time of a single update transaction.
Disclosure of Invention
In view of the defects in the prior art, an object of the present invention is to provide a method for updating a nonvolatile memory based on a data dual version, which aims to solve the problem of time delay when an update transaction is executed.
In order to achieve the above object, the present invention maintains two old and new versions of data in a persistent transactional memory in a data unit of a nonvolatile memory, a start address of the data unit being a multiple of a cache line size of the nonvolatile memory, the two versions including a new version and an old version; each version has a corresponding update timestamp, the version corresponding to the update timestamp with a larger value is a new version, the version corresponding to the update timestamp with a smaller value is an old version, and when the values of the two update timestamps are equal, one version is selected as the new version;
when the update transaction executes write operation on data, directly executing write operation on the data copy; the data copy is a copy of a new version of data copied to the DRAM when the update transaction reads or writes the data for the first time;
when the update transaction is submitted, adding 1 to the current global logic clock and updating, and assigning the updated global logic clock to the update timestamp of the old version; the old version of data is updated and persisted using the copy of data.
The invention eliminates redundant NVM write operation in the prior art by storing the old version and the new version of the data in the same cache line and using the updated data copy in the DRAM to update the two versions in turn, although the write operation delay on the NVM is in the same order of magnitude as the write operation delay on the DRAM, the difference is several times, therefore, the data updating method provided by the invention reduces the execution time of the updating transaction. Meanwhile, the update transaction does not need to call a cache eviction instruction and a memory barrier instruction when the write operation is executed, when the write operation on single data is submitted, the cache eviction instruction and the memory barrier instruction need to be called to ensure that the write operation is endured, and if the update transaction executes the operation of writing a plurality of data, the cache eviction instruction needs to be called separately on the plurality of data when the update transaction is submitted. Compared with the prior art, the invention reduces the times of calling the instruction, thereby shortening the execution time of the update transaction.
Preferably, the data unit comprises five fields: lock, v0, v1, ts0, ts 1; lock is lock, lock 0 indicates unlocked, lock 1 indicates locked v0, lock 2 indicates locked v 1; v0 and v1 are two versions of the data; ts0 is the update timestamp of v0, and ts1 is the update timestamp of v 1.
Preferably, when the update transaction performs a first write operation on the data, the old version of the data is locked; when the update transaction commits, the lock of the data is updated to 0.
Preferably, the flow of the read-only transaction reading data comprises the following steps:
a0: checking the lock of the data and the update timestamp of the new version, and if the new version is locked or the timestamp check fails, performing step a 3; otherwise, go to step A1;
a1: reading a new version of the data;
a2: checking the lock of the data and the update time stamp of the new version again, if the new version is locked or the time stamp check fails, the reading operation of the step A1 fails, and executing the step A3; otherwise, the data reading is successful;
a3: checking the lock of the data and the update timestamp of the old version, and if the old version is locked or the timestamp check fails, the data reading fails; otherwise, go to step A4;
a4: reading an old version of the data;
a5: checking the lock of the data and the update time stamp of the old version again, and if the old version is locked or the time stamp check fails, the data reading fails; otherwise, the data reading is successful;
the timestamp check failure means that the update timestamp is greater than the value of the global logic clock recorded when the transaction started executing.
In the flow of reading data by the read-only transaction provided by the invention, if the data is locked, the write thread executes write operation on the data; if the data is not locked, the timestamp check fails, and the write operation of the write thread on the data is submitted; when the data is locked or the timestamp check fails, the data reading is judged to fail, and the read-write conflict can be effectively avoided.
Preferably, the flow of updating the transactional read data comprises the steps of:
b0: checking the lock of the data and the update time stamp of the new version, and if the data is locked or the time stamp of the new version fails to check, the data fails to be read; otherwise, go to step B1;
b1: reading a new version of the data;
b2: checking the lock of the data and the update time stamp of the new version again, and if the data is locked or the time stamp of the new version fails to be checked, the data is failed to be read; otherwise, the data reading is successful;
the timestamp check failure means that the update timestamp is greater than the value of the global logic clock recorded when the transaction started executing.
Preferably, after execution of the update transaction is interrupted, the mechanism for detecting inconsistent data is as follows:
the update transaction persists the commit timestamp into a log before performing a write operation on the data; the log is stored in a nonvolatile memory;
if the execution of the update transaction is interrupted, performing a scanning operation on all data in the nonvolatile memory when performing a data recovery operation, and if ts0 or ts1 of the data is equal to the commit timestamp in the log, indicating that the data is inconsistent data;
the inconsistent data is data which is subjected to write operation by the updating transaction;
the commit timestamp is a value obtained by adding 1 to the current global logic clock.
Preferably, if the execution of the update transaction is not interrupted, the commit timestamp in the log is deleted after the update transaction commits.
Preferably, after execution of the update transaction is interrupted, the mechanism for detecting inconsistent data is as follows:
e0: an update transaction persists an address of data in a log prior to performing an update operation on the data; the log is stored in a nonvolatile memory;
e1: if the execution of the updating transaction is interrupted, when the data recovery operation is carried out, the data pointed by the data address in the log is inconsistent data;
the inconsistent data is data that was written by the update transaction.
Preferably, if the execution of the update transaction is not interrupted, the data address in the log is deleted after the update transaction is committed.
Preferably, when the data recovery operation is performed, the new version is overwritten by the old version of the inconsistent data; and overwrite the update timestamp of the new version with the update timestamp of the old version.
Compared with the prior art, the technical scheme of the invention eliminates redundant NVM write operation, reduces the calling times of the cache eviction instruction and the memory barrier instruction, and can obtain the beneficial effect of shortening the execution time of the update transaction; the invention provides a data dual-version-based read-only transaction data reading flow and a transaction data updating reading flow, thereby avoiding read-write conflict in a multi-thread environment and reducing the blockage of the read-only transaction caused by the updating transaction; the invention solves the write conflict in the multithreading environment by using a lock mode; the invention also provides two data consistency recovery mechanisms based on the data double versions, which are respectively data recovery based on global scanning and data recovery based on update address write-back.
Drawings
FIG. 1 is a block diagram of a data unit based on a data double version provided by an embodiment of the present invention;
FIG. 2 is a flow diagram of a first write operation performed on data based on a data double-version update transaction provided by an embodiment of the invention;
FIG. 3 is a flow diagram of a data double version based update transaction commit provided by an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
As shown in fig. 1, the embodiment of the present invention maintains two old and new versions of data a in a persistent transactional memory in a data unit of a nonvolatile memory, where a start address of the data unit is a multiple of a cache line size of the nonvolatile memory, and the data unit includes five fields: lock, v0, v1, ts0, ts 1; lock occupies 1 byte, lock is lock, lock 0 indicates unlocked, lock 1 indicates locked v0, and lock 2 indicates locked v 1; v0 and v1 are two versions of data A, and the sizes of v0 and v1 are adapted to the actual size of the data; ts0 is the update time stamp of v0, ts1 is the update time stamp of v1, and ts0 and ts1 respectively occupy 8 bytes; if ts0> ts1, v0 is the new version and v1 is the old version; if ts0< ts1, v1 is the new version and v0 is the old version. If ts0 ═ ts1, then either v0 or v1 may be selected as the new version.
In this embodiment, lock is 0, v0 is 100, ts0 is 3, v1 is 200, and ts1 is 5; ts0< ts1, so v1 is the new version and v0 is the old version; the value of the global logic clock when the update transaction starts to execute is 10, and is recorded as sc being 10; as shown in FIG. 2, the flow of the update transaction performing the first write operation on data A includes:
(1) locking v 0: updating lock to 1; after the data A is locked, other updating transactions can not lock the data A any more and can not access the data A until the lock of the data A is updated to be 0; checking whether ts1 is less than or equal to sc, ts1 is 5 less than sc, and continuing to execute the updating transaction; otherwise, the update transaction execution fails;
(2) read v1 and copy v1 to DRAM as a copy of the data;
(3) checking whether ts1 is less than or equal to sc, ts1 is 5 less than sc, and continuing to execute the updating transaction; otherwise, the update transaction execution fails;
(4) the value of the data copy is modified to 300.
The flow of the update transaction to perform the write operation again on the data a includes: directly accessing the data copy in the DRAM and modifying the value of the data copy.
As shown in fig. 3, the flow of update transaction commit includes: the value of the current global logic clock is 10, 1 is added to the value of the current global logic clock and the value is updated, and the updated value 11 is assigned to ts 0; updating v0 with the value of data copy 300 and invoking cache eviction and memory barrier instructions ensures that updates to v0 are persisted.
If the update transaction performs an operation that writes multiple data, then a separate call to the cache eviction instruction for the multiple data at commit time is required to ensure that the multiple write operations are persisted.
If a write operation is not performed on the copy of the data while the update transaction is executing, the space occupied by the copy of the data on the DRAM is freed when the transaction commits.
Compared with the prior art, the beneficial effects of the invention comprise the following two aspects:
(1) in the prior art, redundant NVM write operation mainly occurs in duplicate data copy and duplicate data write-back, and the redundant NVM write operation in the prior art is eliminated by a method of maintaining a new version and an old version of data in a persistent transactional memory in one data unit of a nonvolatile memory and circularly updating the two versions by using an updated data duplicate in a DRAM, thereby shortening the execution time of update transactions.
(2) The method only needs to call the cache eviction instruction and the memory barrier instruction when submitting, and if the update transaction executes the operation of writing one data, the cache eviction instruction and the memory barrier instruction need to be called to the single data when submitting, so that the writing operation is ensured to be persistent; if the update transaction performs an operation that writes multiple data, then a separate call to the cache eviction instruction for the multiple data at commit time is required to ensure that the write operation is persisted. Compared with the prior art, the invention reduces the times of instruction calling, thereby shortening the execution time of the update transaction.
Read-write conflicts and write-write conflicts exist in a multi-thread environment in the persistent transaction, and the read thread executing the read operation reads data updated by the write thread executing the write operation, so that the read-write conflicts occur; write-write conflicts occur when two write threads update the same data at the same time.
In order to solve the read-write conflict, the invention designs a flow for reading data only by a read transaction and a flow for updating the read data by the transaction. Whether the read-only transaction reads data or updates the transaction read data, the lock of the data and the update timestamp of a certain version of the data need to be checked, and if the check is passed, the data is consistent, namely the data is not partially updated by a write thread and is not submitted by an update transaction; the criterion for passing the check is that a certain version of the data is not locked and the update timestamp of this version is less than or equal to the value of the global logic clock recorded when the transaction started executing. This is because if a certain version of data is locked, it indicates that the write thread is performing a write operation on the data; if a version of the data is not locked and the update timestamp of this version is greater than the value of the global logical clock recorded at the beginning of execution of the transaction, then the write operation by the write thread to the data is declared committed.
In this embodiment, the lock of data a is 0, v0 is 100, ts0 is 3, v1 is 200, and ts1 is 5. The value of the global logic clock when the update transaction starts to execute is 10, and is recorded as sc being 10; a read-only transaction requires a read operation to be performed on data a, and the data read by the read-only transaction may not be a new version of data, but an old version of data, but the data is consistent. The flow of the read-only transaction execution comprises the following steps:
(1) checking the lock of data A and the update timestamp ts1 of the new version v1, the lock is 0, and the new version is not locked; ts1 is 5 less than sc, the timestamp check is successful; the transaction continues to execute;
(2) read v 1;
(3) check data A's lock again and update timestamp ts1, lock is 0, new version is not locked; when ts1 is 15 or more than sc, the timestamp check fails, and the read operation in step (2) fails;
(4) checking the lock of data A and the update timestamp ts0 of the old version v0, lock is 0, and the old version is not locked; ts0 is 3 less than sc, the timestamp check is successful; the transaction continues to execute;
(5) read v 0;
(6) check again for the lock for data A and the update timestamp ts0 for the old version v0, lock is 0, the old version is not locked; ts0 is 3 less than sc, the timestamp check is successful; the data reading is successful.
A read operation in an update transaction does not need to check the update timestamp of the old version because if the update transaction were to perform an operation that reads data a and then updates data B using the value of data a, then for the update transaction, the update operation could only be performed based on the newest data a, and therefore only the update timestamp of the new version of data a would need to be checked.
In this embodiment, the lock of data a is 0, v0 is 100, ts0 is 3, v1 is 200, and ts1 is 5. The value of the global logic clock when the update transaction starts to execute is 10, and is recorded as sc being 10; the update transaction needs to execute a read operation on the data a, and the execution flow of the update transaction includes:
(1) checking the lock of the data A and the update time stamp ts1 of the new version v1, the lock is 0, and the data is not locked; ts1 is 5 less than sc, the timestamp check is successful; the transaction continues to execute;
(2) read v 1;
(3) the lock of data a and the update timestamp of the new version are checked again, at this time, lock is 2, data is locked, and data reading fails.
The system crash may cause inconsistent data to exist in the transactional memory based on the double versions of the data, for example, if an update transaction completes modification of part of the data, if an unexpected event such as a system crash occurs at this time, the execution of the update transaction is interrupted, the incomplete update transaction remains after the system is restarted, and the data on which the write operation is performed by the update transaction is inconsistent data.
The invention can cover the version modified by the update transaction by using the version in the consistent state in the data double versions, thereby restoring the inconsistent data in the NVM to the state before modification, thereby ensuring the consistency of the data after the update transaction is interrupted. The main problem here is that it is not known which data is inconsistent data after the update transaction is interrupted. The invention designs two recovery mechanisms of data consistency aiming at the problem: data recovery based on global scanning, data recovery based on update address write back.
In this embodiment, the lock of data a is 0, v0 is 100, ts0 is 3, v1 is 200, and ts1 is 5. The current global logic clock has a value of 10, and is marked as t being 10; the data copy of the data A in the DRAM is AA; the flow of data recovery based on global scanning comprises the following steps:
(1) adding 1 to t, updating, recording t as 11, taking the updated value 11 as a submission timestamp, and then persisting the submission timestamp into a log, wherein the log is stored in the NVM;
(2) ts0< ts1, wherein v0 is an old version, and the value of t updated in the step (1) is assigned to ts0, which is recorded as ts0 being 11;
(3) using the updated AA to execute write operation on v0, wherein a system crash occurs at the moment, and the update transaction is interrupted; when data recovery operation is carried out, scanning operation is carried out on all data in the nonvolatile memory, and as a result, ts0 of the data A is found to be equal to the submission time stamp in the log, which indicates that the data A is inconsistent data;
(4) when ts1 is 5, ts1< ts0, v0 is a new version, v1 is an old version, and v0 is overwritten with the value of v 1; and covers ts0 with the value of ts 1.
If the update transaction execution is not interrupted, the commit timestamp in the log is deleted after the update transaction commits.
In this embodiment, the lock of the data a is 0, v0 is 100, ts0 is 3, v1 is 200, and ts1 is 5; the current global logic clock has a value of 10, and is marked as t being 10; the flow of data recovery based on update address write-back includes:
(1) persisting the address of data A into a log; the log is stored in the NVM;
(2) ts0< ts1, v0 is the old version, t is added by 1 and updated, and the updated value of t is assigned to ts0, which is recorded as ts0 being 11; using the updated AA to execute write operation on v0, wherein a system crash occurs at the moment, and the update transaction is interrupted; when data recovery operation is carried out, the data A pointed by the data address in the log is inconsistent data;
(3) when ts1 is 5, ts1< ts0, v0 is a new version, v1 is an old version, and v0 is overwritten with the value of v 1; and covers ts0 with the value of ts 1.
If the execution of the update transaction is not interrupted, the address of data A in the log is deleted after the update transaction commits.
It will be understood by those skilled in the art that the foregoing is only a preferred embodiment of the present invention, and is not intended to limit the invention, and that any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (10)

1. A nonvolatile memory updating method based on data double versions is characterized by comprising the following steps:
maintaining two old and new versions of data in a persistent transactional memory in a data unit of a nonvolatile memory, wherein the initial address of the data unit is a multiple of the cache line size of the nonvolatile memory, and the two versions comprise a new version and an old version; each version has a corresponding update timestamp, the version corresponding to the update timestamp with a larger value is a new version, the version corresponding to the update timestamp with a smaller value is an old version, and when the values of the two update timestamps are equal, one version is selected as the new version;
when the update transaction executes write operation on data, directly executing write operation on the data copy; the data copy is a copy of a new version of data copied to the DRAM when the update transaction reads or writes the data for the first time;
when the update transaction is submitted, adding 1 to the current global logic clock and updating, and assigning the updated global logic clock to the update timestamp of the old version; the old version of data is updated and persisted using the copy of data.
2. The data dual-version-based nonvolatile memory updating method according to claim 1, wherein the data unit comprises five fields: lock, v0, v1, ts0, ts 1; lock is lock, lock 0 indicates unlocked, lock 1 indicates locked v0, lock 2 indicates locked v 1; v0 and v1 are two versions of the data; ts0 is the update timestamp of v0, and ts1 is the update timestamp of v 1.
3. The method according to claim 2, wherein when the update transaction performs a first write operation on the data, the old version of the data is locked; when the update transaction commits, the lock of the data is updated to 0.
4. The method according to claim 2, wherein the process of reading data by the read-only transaction comprises:
a0: checking the lock of the data and the update timestamp of the new version, and if the new version is locked or the timestamp check fails, performing step a 3; otherwise, go to step A1;
a1: reading a new version of the data;
a2: checking the lock of the data and the update time stamp of the new version again, if the new version is locked or the time stamp check fails, the reading operation of the step A1 fails, and executing the step A3; otherwise, the data reading is successful;
a3: checking the lock of the data and the update timestamp of the old version, and if the old version is locked or the timestamp check fails, the data reading fails; otherwise, go to step A4;
a4: reading an old version of the data;
a5: checking the lock of the data and the update time stamp of the old version again, and if the old version is locked or the time stamp check fails, the data reading fails; otherwise, the data reading is successful;
the timestamp check failure means that the update timestamp is greater than the value of the global logic clock recorded when the transaction started executing.
5. The method according to claim 2, wherein the step of updating the transaction read data comprises:
b0: checking the lock of the data and the update time stamp of the new version, and if the data is locked or the time stamp of the new version fails to check, the data fails to be read; otherwise, go to step B1;
b1: reading a new version of the data;
b2: checking the lock of the data and the update time stamp of the new version again, and if the data is locked or the time stamp of the new version fails to be checked, the data is failed to be read; otherwise, the data reading is successful;
the timestamp check failure means that the update timestamp is greater than the value of the global logic clock recorded when the transaction started executing.
6. The method according to claim 2, wherein after the execution of the update transaction is interrupted, the mechanism for detecting inconsistent data is:
the update transaction persists the commit timestamp into a log before performing a write operation on the data; the log is stored in a nonvolatile memory;
if the execution of the update transaction is interrupted, performing a scanning operation on all data in the nonvolatile memory when performing a data recovery operation, and if ts0 or ts1 of the data is equal to the commit timestamp in the log, indicating that the data is inconsistent data;
the inconsistent data is data which is subjected to write operation by the updating transaction;
the commit timestamp is a value obtained by adding 1 to the current global logic clock.
7. The data dual version-based non-volatile memory update method of claim 6, wherein if the update transaction execution is not interrupted, the commit timestamp in the log is deleted after the update transaction commits.
8. The method according to claim 2, wherein after the execution of the update transaction is interrupted, the mechanism for detecting inconsistent data is:
e0: an update transaction persists an address of data in a log prior to performing an update operation on the data; the log is stored in a nonvolatile memory;
e1: if the execution of the updating transaction is interrupted, when the data recovery operation is carried out, the data pointed by the data address in the log is inconsistent data;
the inconsistent data is data that was written by the update transaction.
9. The data dual version-based nonvolatile memory updating method of claim 8, wherein if the execution of the update transaction is not interrupted, the data address in the log is deleted after the update transaction is committed.
10. The method according to claim 6 or 8, wherein when performing data recovery operation, the new version is overwritten by the old version of the inconsistent data; and overwrite the update timestamp of the new version with the update timestamp of the old version.
CN202110970740.8A 2021-08-23 2021-08-23 Nonvolatile memory updating method based on data double versions Active CN113722052B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110970740.8A CN113722052B (en) 2021-08-23 2021-08-23 Nonvolatile memory updating method based on data double versions

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110970740.8A CN113722052B (en) 2021-08-23 2021-08-23 Nonvolatile memory updating method based on data double versions

Publications (2)

Publication Number Publication Date
CN113722052A true CN113722052A (en) 2021-11-30
CN113722052B CN113722052B (en) 2024-02-20

Family

ID=78677511

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110970740.8A Active CN113722052B (en) 2021-08-23 2021-08-23 Nonvolatile memory updating method based on data double versions

Country Status (1)

Country Link
CN (1) CN113722052B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114416201A (en) * 2022-01-12 2022-04-29 山东浪潮科学研究院有限公司 Snapshot isolation implementation method based on distributed database

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110145512A1 (en) * 2009-12-15 2011-06-16 Ali-Reza Adl-Tabatabai Mechanisms To Accelerate Transactions Using Buffered Stores
CN108717360A (en) * 2018-08-24 2018-10-30 江苏神州信源系统工程有限公司 A kind of software version updating method and device
CN109739684A (en) * 2018-11-20 2019-05-10 清华大学 The copy restorative procedure and device of distributed key value database based on vector clock
CN110515705A (en) * 2019-08-07 2019-11-29 上海交通大学 Expansible persistence transaction internal memory and its working method
CN112463311A (en) * 2021-01-28 2021-03-09 腾讯科技(深圳)有限公司 Transaction processing method and device, computer equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110145512A1 (en) * 2009-12-15 2011-06-16 Ali-Reza Adl-Tabatabai Mechanisms To Accelerate Transactions Using Buffered Stores
CN108717360A (en) * 2018-08-24 2018-10-30 江苏神州信源系统工程有限公司 A kind of software version updating method and device
CN109739684A (en) * 2018-11-20 2019-05-10 清华大学 The copy restorative procedure and device of distributed key value database based on vector clock
CN110515705A (en) * 2019-08-07 2019-11-29 上海交通大学 Expansible persistence transaction internal memory and its working method
CN112463311A (en) * 2021-01-28 2021-03-09 腾讯科技(深圳)有限公司 Transaction processing method and device, computer equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114416201A (en) * 2022-01-12 2022-04-29 山东浪潮科学研究院有限公司 Snapshot isolation implementation method based on distributed database
CN114416201B (en) * 2022-01-12 2024-04-02 上海沄熹科技有限公司 Snapshot isolation implementation method based on distributed database

Also Published As

Publication number Publication date
CN113722052B (en) 2024-02-20

Similar Documents

Publication Publication Date Title
US11379324B2 (en) Persistent memory transactions with undo logging
US5369757A (en) Recovery logging in the presence of snapshot files by ordering of buffer pool flushing
EP2972891B1 (en) Multiversioned nonvolatile memory hierarchy for persistent memory
JP5964382B2 (en) Performing mode switching in an infinite transactional memory (UTM) system
KR100204027B1 (en) Database recovery apparatus and method using nonvolatile memory
US7085955B2 (en) Checkpointing with a write back controller
JP6491348B2 (en) Data processing system, data processing method, and computer program for executing hardware transaction memory (HTM) transaction
CN110515705B (en) Extensible persistent transactional memory and working method thereof
CN113220490A (en) Transaction persistence method and system for asynchronous write-back persistent memory
CN113722052B (en) Nonvolatile memory updating method based on data double versions
Giles et al. Hardware transactional persistent memory
CN115640238A (en) Reliable memory mapping I/O implementation method and system for persistent memory
CN111752685B (en) Persistent memory transaction submitting method under multi-core architecture
CN112214171B (en) SQLite database-oriented non-volatile memory buffer area design method
CN113986587A (en) Checkpoint realization method, system, storage medium and equipment based on value log
JPH07271624A (en) Cache flashing method for duplex memory of fault tolerant computer system
JPH10149307A (en) Check point processing method and recording medium

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
GR01 Patent grant
GR01 Patent grant