CN116301654A - Data migration method, device, electronic equipment and storage medium - Google Patents

Data migration method, device, electronic equipment and storage medium Download PDF

Info

Publication number
CN116301654A
CN116301654A CN202310375132.1A CN202310375132A CN116301654A CN 116301654 A CN116301654 A CN 116301654A CN 202310375132 A CN202310375132 A CN 202310375132A CN 116301654 A CN116301654 A CN 116301654A
Authority
CN
China
Prior art keywords
data
partition
original
stored
electronic device
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.)
Pending
Application number
CN202310375132.1A
Other languages
Chinese (zh)
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.)
Ecoflow Technology Ltd
Original Assignee
Ecoflow Technology Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ecoflow Technology Ltd filed Critical Ecoflow Technology Ltd
Priority to CN202310375132.1A priority Critical patent/CN116301654A/en
Publication of CN116301654A publication Critical patent/CN116301654A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/0647Migration mechanisms
    • 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/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1448Management of the data involved in backup or backup restore
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0644Management of space entities, e.g. partitions, extents, pools
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Quality & Reliability (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to the field of data storage, and provides a data migration method, a data migration device, electronic equipment and a storage medium. The method comprises the following steps: acquiring original data in a first partition, and calculating a check value of the original data; adding a check value and a carrying identifier to the original data to obtain first data; determining a second partition and a third partition; writing the first data into a second partition and a third partition; responding to the received data initialization instruction, reading second data stored in the second partition, and checking the second data according to a check value in the second data; if the second data check fails and the second data carries the handling identification, copying the third data stored in the third partition to the second partition. By the method, the times of accessing the first partition can be reduced, so that the probability of abnormality of the first partition is reduced.

Description

Data migration method, device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of data storage technologies, and in particular, to a data migration method, a data migration device, an electronic device, and a storage medium.
Background
In practical applications, it is often necessary to write raw data from an original memory partition to another memory partition. When the data written in the written storage partition is abnormal, the original storage partition is to be revisited, and the original data is acquired from the original storage partition. But accessing the original storage partition multiple times is cumbersome and may cause anomalies in the data of the original storage partition.
Disclosure of Invention
In view of the foregoing, it is necessary to provide a data migration method, apparatus, device and storage medium, so as to solve the technical problem that when an abnormality occurs in stored data after data migration, multiple accesses to an original flash memory partition corresponding to the data are required.
A first aspect of the present application provides a data migration method, applied to an electronic device, where the method includes: acquiring original data in a first partition, and calculating a check value of the original data; adding the check value and the carrying identification to the original data to obtain first data; determining a second partition and a third partition; writing the first data to the second partition and the third partition; reading second data stored in the second partition in response to the received data initialization instruction, and checking the second data according to a check value in the second data; and if the second data check fails and the second data carries the carrying identification, copying third data stored in the third partition to the second partition.
According to the technical scheme, the first data obtained by adding the check value and the handling identifier to the original data in the first partition is written into the second partition and the third partition, wherein the first data is written into the second partition and then is called second data, the first data is written into the third partition and then is called third data, so that the first data can be backed up in the third partition, when the second data in the subsequent second partition is abnormal, the third data can be directly obtained from the third partition by determining that the data is written into the second partition and the third partition when the handling identifier exists in the second data, and the first partition is not required to be accessed again to obtain the original data, so that the times of accessing the first partition are reduced, the steps of data migration are simplified, and repeated erasing and writing operations on the second partition and the third partition are not required; moreover, by adding the check value to the original data, after the data is migrated to a new partition, the data can be checked according to the check value each time the initialization operation is performed on the data, so that whether the data is abnormal or not can be timely determined, and the occurrence of the situation of using abnormal data can be reduced.
A second aspect of the present application provides a data migration apparatus, including:
the data calculation module is used for obtaining the original data in the first partition and calculating the check value of the original data;
the data processing module is used for adding the check value and the carrying identifier to the original data to obtain first data;
the storage partition module is used for determining a second partition and a third partition;
a data writing module for writing the first data into the second partition and the third partition;
the data verification module is used for responding to the received data initialization instruction, reading second data stored in the second partition and verifying the second data according to a verification value in the second data;
and the data copying module is used for copying the third data stored in the third partition to the second partition if the second data fails to check and the second data carries the carrying identification.
A third aspect of the present application provides an electronic device, comprising:
a memory storing computer readable instructions; a kind of electronic device with high-pressure air-conditioning system
And a processor executing computer readable instructions stored in the memory to implement the data migration method.
A fourth aspect of the present application provides a computer-readable storage medium having computer-readable instructions stored therein, the computer-readable instructions being executable by a processor in an electronic device to implement the data migration method.
Drawings
Fig. 1 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Fig. 2 is a flowchart of a data migration method according to an embodiment of the present application.
Fig. 3 is a flowchart of a data migration method according to an embodiment of the present application.
FIG. 4 is a detailed flow chart of a method for copying third data stored in a third partition to a second partition according to an embodiment of the present application.
FIG. 5 is a detailed flow chart of a method for determining a second partition and a third partition provided in an embodiment of the present application.
Fig. 6 is a flowchart of a data migration method according to an embodiment of the present application.
Fig. 7 is a schematic structural diagram of a data migration apparatus according to an embodiment of the present application.
Fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The terms "first" and "second" are used below for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more such feature. In describing embodiments of the present application, words such as "exemplary," "or," "such as," and the like are used to mean serving as an example, instance, or illustration. Any embodiment or design described herein as "exemplary" or "for example" should not be construed as preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary," "or," "such as," and the like are intended to present related concepts in a concrete fashion.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used in the description of the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. It should be understood that, "/" means or, unless otherwise indicated herein. For example, A/B may represent A or B. The term "and/or" in this application is merely an association relationship describing an association object, and means that three relationships may exist. For example, a and/or B may represent: a exists alone, A and B exist simultaneously, and B exists alone. "at least one" means one or more. "plurality" means two or more than two. For example, at least one of a, b or c may represent: seven cases of a, b, c, a and b, a and c, b and c, a, b and c. It will be appreciated that the order of the steps shown in the flowcharts herein may be changed and some may be omitted.
The application provides a data migration method, which is used for reducing the number of times of accessing an original storage partition corresponding to stored data when the stored data is abnormal, so that the data migration step is simplified, and repeated erasing and writing operations on a new partition after migration are not needed.
The data migration method provided by the embodiment of the application can be applied to electronic equipment. The electronic device includes a Memory for storing electronic information using a Memory technology such as a Flash Memory technology. The above memory may provide a storage function for an electronic device, and the memory may include one or more of a usb flash drive, a CF card, an SM card, an SD/MMC card, a memory stick, an XD card, an MS card, a TF card, a PCIe flash memory card, and the like, and the electronic device may access the memory to obtain data stored in the memory. Typically, the electronic device will employ a database to manage the data in the memory. The electronic device can be an energy storage device, a solar tracker, a mower, a mobile phone, a tablet computer, a desktop computer, a notebook computer and other electronic devices. The embodiment of the application does not particularly limit the specific form of the electronic device.
For a better understanding of the data migration method provided in the embodiment of the present application, the following describes in detail the implementation manner of the embodiment of the present application with reference to the accompanying drawings.
Fig. 1 is a schematic structural diagram of a memory in an electronic device according to an embodiment of the present application. As shown in fig. 1, one or more memories 10 may be included in an electronic device, the memories 10 including at least three memory partitions, a first partition 110, a second partition 120, and a third partition 130. In other embodiments, the first partition 110 may belong to a different memory than the second partition 120, the third partition 130. In this embodiment, the data stored in the first partition 110 is the original data, which may be important data required for normal use or operation of the electronic device corresponding to the memory 10, or data generated during the operation of the electronic device, which is not limited herein. In practical applications, it may be necessary to migrate the original data in the first partition to other partitions in the memory 10, such as a failure in a database that manages the original data, or a need to migrate the original data to a new memory.
Other memory partitions in memory 10 may access first partition 110 to obtain the original data stored in first partition 110. For example, the second partition 120 may obtain the original data stored in the first partition 110 by accessing the first partition 110. The data stored by the second partition 120 is referred to as second data. The second partition 120 may be an accessible area provided by the memory 10 to the outside, and other electronic devices outside may obtain the second data stored in the second partition 120 by accessing the second partition 120. The third partition 130 may act as a backup partition for backing up data. For example, the third partition 130 may backup the second data stored in the second partition 120. The data stored by the third partition 130 may be referred to as third data.
Fig. 1 is merely an example of an electronic device and is not meant to be limiting in this regard, and in other embodiments, memory 10 in an electronic device may include more partitions than illustrated, and embodiments of the present application are not limited in this regard.
Fig. 2 is a flowchart of a data migration method according to an embodiment of the present application. The method shown in fig. 2 is applied to an electronic device, such as the electronic device shown in fig. 1. The order of the steps in the flowchart may be changed and some steps may be omitted according to various needs.
Step 210, obtaining the original data in the first partition, and calculating a check value of the original data.
The first partition is used for storing data in the electronic device. For example, the first partition may be used to store data acquired by the electronic device or data generated by the electronic device during operation. The data stored in the first partition is referred to as raw data.
The check value may be used to verify the data to prove the accuracy and integrity of the data. In an embodiment, the verification value may verify the original data, or may verify the data after the original data is transferred. For example, the data in which the original data is transferred is second data, and the check value may verify the second data.
In an embodiment of the present application, the original data may be calculated by cyclic redundancy check (Cyclic Redundancy Check, CRC) to obtain a check value of the original data. In other embodiments of the present application, other ways of calculating the parity value of the original data may be used, such as parity, hamming, and other verification methods. The method for calculating the check value in the embodiment of the present application is not limited in any way.
And 220, adding a check value and a carrying identifier to the original data to obtain first data.
In one embodiment of the present application, a check value handling identifier is added to the original data before the original data needs to be migrated to another partition. The check value is the check value calculated from the original data in step 210. The handling identifier is used to indicate that the original data is stored to two different partitions. When the data is detected with the handling identifier, the data is migrated to or acquired from other partitions. For example, before the original data needs to be migrated to other partitions, a handling identifier is added to the original data, so that whether the original data is handled to the partition can be judged by detecting the handling identifier in the migrated partition, and repeated migration of the same data can be avoided.
In an embodiment of the present application, an original partition corresponding to data (i.e., a first partition storing original data) may be determined according to the handling identifier. The carrying identification carries an identification indicating the original partition corresponding to the data. For example, data a in partition a is obtained from partition B, and the handling identifier on data a may indicate that the source of data a is partition B.
In this embodiment, the first data is the original data to which the check value and the handling identifier are added. The check value and the carrying identifier carried by the first data have no influence on the data content contained in the first data. The data content contained in the first data is the same as the data content contained in the original data.
In step 230, the second partition and the third partition are determined.
The second partition and the first partition may be different storage partitions of the same memory in the electronic device, or new partitions in different memories, for storing data. For example, the second partition may store the first data obtained after the processing of the original data.
The third partition is a backup partition corresponding to the second partition, and the third partition and the backup partition can be located in the same memory and used for backing up the data stored in the second partition. When data is stored in the second partition, a backup may be performed in the third partition, i.e., when the second partition stores a data X, the data X may also be stored in the third partition. It will be appreciated that when using data, the data in the backup partition is not typically used, reducing the likelihood of errors occurring in the data in the backup partition. Because the third partition is a backup partition corresponding to the second partition, the data in the second partition has corresponding data in the third partition, and the data content of the data in the second partition is the same as the data content of the corresponding data in the third partition under the condition that the data in the second partition is unchanged. It will be appreciated that if the data in the second partition changes or is erroneous, the data content of the data will differ from the data content of the corresponding data in the third partition.
The space sizes of the second partition and the third partition may be set to be the same or different. The second partition and the third partition may be determined according to a preset space size. For some embodiments of determining the second partition and the third partition, see the relevant description of FIG. 5 below.
Step 240, writing the first data into the second partition and the third partition.
The first data is written to the second partition and is referred to as second data. The first data is written to the third partition and is referred to as third data. When the second data is unchanged, the data content of the first data, the data content of the second data and the data content of the third data are all the same.
In an embodiment of the present application, the electronic device may write the first data to the second partition and the third partition simultaneously. The embodiment can synchronously realize the storage of the data and the backup of the data.
In another embodiment of the present application, the electronic device may also write the first data into the second partition and the third partition sequentially. The present application is not limited in this regard.
Step 250, in response to the received data initialization instruction, reads the second data stored in the second partition.
The data initialization instruction is used for controlling the electronic equipment to execute data initialization operation. In an embodiment of the present application, the data initialization command is automatically triggered when the electronic device is powered on. In another embodiment of the present application, the electronic device may trigger the data initialization instruction based on the operation of the user. The application does not limit the trigger data initialization instruction.
In an embodiment of the present application, the data initialization operation is used for verifying the second data, and if the verification value obtained by the verification is consistent with the verification value carried on the second data, it indicates that the second data can be used normally, then the data initialization is completed.
Step 260, checking the second data according to the check value in the second data.
And the electronic equipment checks the second data according to the check value in the second data, and determines whether the second data is the required data, namely, whether the data content of the second data is consistent with the data content of the original data.
In an embodiment of the present application, the electronic device may determine a current check value of the second data according to a check method for determining the check value in the second data; judging whether the check value obtained by the current calculation of the second data is consistent with the check value in the second data; if the current check value of the second data is consistent with the check value in the second data, determining that the second data is successfully checked; and if the current check value of the second data is inconsistent with the check value in the second data, determining that the second data check is unsuccessful.
In an embodiment of the present application, if the second data check is successful, the data initialization operation is completed according to the second data. If the second data verification is successful, the electronic device determines that the data content of the second data is consistent with the data content of the original data in the first partition, and completes the data initialization operation corresponding to the initialization instruction.
In step 270, if the second data check fails and the second data carries the handling identifier, the third data stored in the third partition is copied to the second partition.
In an embodiment of the present application, if the second data check fails, it indicates that the second data is abnormal. The current second data is inconsistent with the corresponding original data, namely, the data content of the current second data is inconsistent with the data content of the first data.
If the second data check fails, the electronic device may detect whether the second data carries a handling identifier. When the second data carries the handling identifier, the electronic device can determine that corresponding backup data exists in the second data when the second data is stored, namely third data stored in a third partition. Since the third data in the third partition is also derived from the first data, the third data is copied to the second partition to replace the current second data, avoiding the original data being directly obtained from the first partition.
In an embodiment of the present application, if the second data check fails, deleting the second data stored in the second partition. And deleting the second data stored in the second partition by erasing the second partition.
In an embodiment of the present application, after the third data is copied to the second partition, updated second data is obtained, and based on the updated second data of the second partition, a data initialization operation corresponding to the initialization instruction is completed.
Some embodiments for copying third data stored in the third partition to the second partition may be found in the related description of FIG. 4 below.
According to the method provided by the embodiment, the first data obtained after the verification value and the handling identifier are added to the original data in the first partition are written into the second partition and the third partition, wherein the first data is written into the second partition and then is called second data, and the first data is written into the third partition and then is called third data, so that the first data can be backed up in the third partition, when the second data in the second partition is abnormal, the third data can be directly obtained from the third partition after the fact that the data are written into the second partition and the third partition when the handling identifier exist in the second data is detected, the first partition is not required to be accessed again to obtain the original data, the number of times of accessing the first partition is reduced, the possibility of abnormal occurrence of the first partition is reduced, the steps of data migration are simplified, and repeated erasing and writing operations on the second partition and the third partition are not required; moreover, by adding the check value to the original data, after the data is migrated to the new partition, the second data stored in the second partition is checked according to the check value each time the initialization operation is performed on the data, so as to timely determine whether the second data is abnormal, and therefore the occurrence of the situation of using the abnormal second data can be reduced.
Fig. 3 is a flowchart of a data migration method according to an embodiment of the present application, which is applied to an electronic device. The order of the steps in the flowchart may be changed and some steps may be omitted according to various needs.
Step 310, obtaining the original data in the first partition, and calculating the check value of the original data.
And step 320, adding a check value and a carrying identifier to the original data to obtain first data.
Step 330, determining a second partition and a third partition of the backup partition.
Step 340, writing the first data to the second partition and the third partition.
In step 350, the second data stored in the second partition is read in response to the received data initialization command.
Step 360, the second data is verified according to the verification value in the second data.
For some embodiments of steps 310 through 360, reference may be made to the descriptions above with respect to steps 210 through 260 of FIG. 2.
And step 370, if the second data check fails and the second data does not carry the handling identifier, deleting the second data stored in the second partition and the third data stored in the third partition.
When the second data does not carry the carrying identification, the electronic equipment determines that the second data stored in the second partition is abnormal and does not correspond to the required original data. For example, after the first data is written into the second partition, the remaining users again erase the data in the second partition. For another example, the electronic device has not previously copied the first data to the second partition and the third partition. At this time, it cannot be determined whether the third data in the third partition is authentic, and therefore, the electronic device can directly delete the second data stored in the second partition and the third data stored in the third partition. If the second data fails to be checked and the second data carries the handling identifier, the process will be described below with respect to the process shown in fig. 4.
After step 370, the flow goes to step 310, where the electronic device returns to perform the acquisition of the original data in the first partition, and calculates a check value of the original data. In some embodiments of the present application, the electronic device may continue to perform the subsequent steps to re-determine the second data, and complete the data initialization operation based on the re-determined second data, i.e. continue to perform steps 310 to 360 in fig. 3.
According to the method provided by the embodiment, when the second data fails to check and the second data does not carry the carrying identification, the second data and the third data which are stored currently are determined to be abnormal, the original data is obtained again and stored to obtain new second data and third data, so that the data initialization operation is completed, and when the abnormal occurrence of the data after migration is determined, the data migration operation can be re-executed, and repeated carrying of the data from the first partition is avoided.
Fig. 4 is a detailed flowchart of a method for copying third data stored in a third partition to a second partition according to an embodiment of the present application, which is applied to an electronic device. The order of the steps in the flowchart may be changed and some steps may be omitted according to various needs.
In step 410, if the second data fails to verify and the second data carries the handling identifier, the third data stored in the third partition is obtained.
In some embodiments of the present application, the third data stored in the third partition may be obtained according to the handling identifier carried by the second data. For example, the access path of the third partition may be determined by the handling identifier carried by the second data; and acquiring third data stored in the third partition based on the determined access path.
And step 420, checking the third data according to the check value in the third data.
And the electronic equipment checks the third data according to the check value in the third data, and determines whether the third data is changed compared with the data stored in the storage, namely, whether the data content of the third data is consistent with the data content of the first data. Since the data content of the first data is consistent with the data content of the original data, this step may also be to determine whether the data content of the third data is consistent with the data content of the original data.
In an embodiment of the present application, the electronic device may determine a current check value of the third data according to a check algorithm for determining the check value in the third data; if the current check value of the third data is consistent with the check value in the third data, determining that the third data is successfully checked; if the current check value of the third data is inconsistent with the check value in the third data, determining that the third data check is unsuccessful.
Step 430, determining whether the third data is verified successfully.
If the third data check is successful, step 440 is performed, the third data stored in the third partition is copied to the second partition.
If the third data is successfully checked, the electronic device may determine that the third data is unchanged, and copy the third data stored in the third partition to the second partition as data corresponding to the first data.
If the third data verification fails, the electronic device may execute step 450 to delete the second data stored in the second partition and the third data stored in the storage partition. In an embodiment of the present application, after deleting the second data stored in the second partition and the third data stored in the storage partition, the electronic device may return to performing the step of acquiring the original data in the first partition, that is, performing step 310 shown in fig. 3, or step 210 shown in fig. 2.
According to the embodiment, before the third data is copied to the second partition, the third data is further verified, and after the third data is verified successfully, the third data is copied to the second partition, so that the situation that the third data is copied to the second partition under the condition of third data errors can be avoided, and the accuracy and the integrity of the data in the second partition are further guaranteed.
According to the method provided by the embodiment, after the third data verification fails, the second data stored in the second partition and the third data stored in the storage partition are deleted, the original data are obtained again and stored to obtain new second data and third data, so that the data initialization operation is completed, and when the data after migration is determined to be abnormal, the data migration operation can be re-executed, and repeated data carrying is avoided.
Fig. 5 is a detailed flowchart of a method for determining a second partition and a third partition, which is provided in an embodiment of the present application, and is applied to an electronic device. The order of the steps in the flowchart may be changed and some steps may be omitted according to various needs.
Step 510, determining the space that the first data needs to occupy.
In an embodiment of the present application, a space that needs to be occupied by the first data may be determined according to a data amount of the first data; the space occupied by the first data can be determined according to the space occupied by the original data. For example, the space occupied by the original data may be added with the space required by the check value and the handling identifier, to obtain the space required by the first data.
And step 520, determining the second partition and the third partition according to the space required to be occupied by the first data.
The space size of the second partition and the space size of the third partition are larger than or equal to the space occupied by the first data. The space size of the second partition may be the same as or different from the space size of the third partition, and is not limited in any way.
The method provided by the embodiment can accurately determine the memory size required by the second partition and the third partition, and avoid the situation that the second partition or the third partition cannot store the first data due to insufficient space size, thereby further ensuring the success rate of data migration.
Fig. 6 is a flowchart of a data migration method according to an embodiment of the present application, which is applied to an electronic device. The order of the steps in the flowchart may be changed and some steps may be omitted according to various needs.
In step 610, raw data in a first partition is obtained.
For some embodiments of step 610, see the description above regarding step 210 of FIG. 2.
In step 620, if the acquisition of the original data from the first partition fails, the original data is acquired from the server, and a check value of the original data is calculated.
If the primary data fails to be obtained from the first partition, the electronic device or the electronic device in which the electronic device is located may communicate with a server, which may be a database or other device providing storage functionality, in some embodiments, in which the primary data in the first partition is stored. In other embodiments, the server may store general data, so as to avoid that when the original data cannot be acquired, the original data may be replaced by the general data acquired from the server, thereby ensuring that the electronic device may operate normally.
For some embodiments of calculating the verification value of the original data, reference may be made to the description above regarding step 220 in fig. 2.
And step 630, adding the check value and the carrying identification to the original data to obtain first data.
At step 640, the second partition and the third partition are determined.
Step 650, writing the first data to the second partition and the third partition.
Step 660, in response to the received data initialization instruction, reading the second data stored in the second partition.
Step 670, verifying the second data according to the verification value in the second data.
In step 680, if the second data check fails and the second data carries the handling identifier, the third data stored in the third partition is copied to the second partition.
For details of steps 630 through 680, see the description above regarding steps 220 through 270 of FIG. 2.
According to the method provided by the embodiment, under the condition that the electronic equipment fails to acquire the original data in the first partition, the original data is acquired from the server, and the first data acquired after the verification value and the carrying identification are added to the original data is written into the second partition and the third partition, wherein the first data is written into the second partition and then is called second data, and the first data is written into the third partition and then is called third data, so that the first data can be backed up in the third partition, and when the second data in the subsequent second partition is abnormal, the third data can be acquired from the third partition directly without continuously accessing the first partition to acquire the original data, the number of times of accessing the first partition is reduced, and the possibility of the first partition abnormal is reduced; moreover, by adding the check value to the original data, the second data stored in the second partition can be checked according to the check value during each data initialization operation, so that whether the second data is abnormal or not can be timely determined, and the occurrence of the situation of using the abnormal second data can be reduced; meanwhile, when the second data is abnormal, whether the third data corresponding to the second data exists in the third partition can be accurately determined based on the added carrying identification, so that the accuracy of determining the third data is improved, and the efficiency of copying the third data to the second partition is improved.
Fig. 7 is a schematic structural diagram of a data migration apparatus according to an embodiment of the present application. In some embodiments, the data migration apparatus 70 may comprise a plurality of functional modules consisting of computer program segments. The computer program of the individual program segments in the data migration apparatus 70 may be stored in a memory of an electronic device and executed by at least one processor to perform the data migration method in the various embodiments described above.
In this embodiment, the data migration apparatus 70 may be divided into a plurality of functional modules according to the functions it performs. The divided plurality of functional modules may include: a data calculation module 701, a data processing module 702, a memory partition module 703, a data writing module 704, a data verification module 705, and a data copying module 706. A module as referred to in this application refers to a series of computer program segments, stored in a memory, capable of being executed by at least one processor and of performing a fixed function. In the embodiments of the present application, the definition of the data migration device 70 may refer to the definition of the data migration method above, and will not be described in detail herein.
The data calculation module 701 is configured to obtain the original data in the first partition, and calculate a check value of the original data;
The data processing module 702 is configured to add a check value and a handling identifier to the original data, so as to obtain first data;
a memory partition module 703 for determining a second partition and a third partition;
a data writing module 704 for writing the first data into the second partition and the third partition;
the data verification module 705 is configured to read second data stored in the second partition in response to the received data initialization instruction, and verify the second data according to a verification value in the second data;
and the data copying module 706 is configured to copy the third data stored in the third partition to the second partition if the second data fails to verify and the second data carries the handling identifier.
It will be appreciated that the above-described division of modules into a logical function division may be implemented in other ways. In addition, each functional module in each embodiment of the present application may be integrated in the same processing unit, or each module may exist alone physically, or two or more modules may be integrated in the same unit. The integrated modules may be implemented in hardware or in hardware plus software functional modules.
In this embodiment, regarding some specific implementations of the functions of each module/unit, the description about the data migration method in the foregoing embodiments may be omitted here.
According to the technical scheme, the data migration device can write the first data obtained after the verification value and the carrying identifier are added to the original data in the first partition into the second partition and the third partition, wherein the first data is written into the second partition and then is called second data, and the first data is written into the third partition and then is called third data, so that the first data can be backed up in the third partition, and when the second data in the subsequent second partition is abnormal, the third data can be directly obtained from the third partition, and the first partition is not required to be continuously accessed to obtain the original data, so that the times of accessing the first partition are reduced, and the probability of the first partition abnormal is reduced; moreover, by adding the check value to the original data, the second data stored in the second partition can be checked according to the check value during each data initialization operation, so that whether the second data is abnormal or not can be timely determined, and the occurrence of the situation of using the abnormal second data can be reduced; meanwhile, when the second data is abnormal, whether the third data corresponding to the second data exists in the third partition can be accurately determined based on the added carrying identification, so that the accuracy of determining the third data is improved, and the efficiency of copying the third data to the second partition is improved.
Referring to fig. 8, fig. 8 is a schematic block diagram of an electronic device according to an embodiment of the present application.
The network in which the electronic device 100 is located includes, but is not limited to, the internet, a wide area network, a metropolitan area network, a local area network, a virtual private network (Virtual Private Network, VPN), and the like.
As shown in fig. 8, the electronic device 100 includes a communication interface 801, a memory 802, a processor 803, an Input/Output (I/O) interface 804, and a bus 805. The processor 803 is coupled to the communication interface 801, the memory 802, and the I/O interface 804, respectively, via a bus 805.
The communication interface 801 is used for communication. The communication interface 801 may be an existing interface on the electronic device 100 or may be an interface newly built on the electronic device 100. The communication interface 801 may be a network interface such as a wireless area network (Wireless Local Area Network, WLAN) interface, a cellular network communication interface, or a combination thereof, or the like.
Memory 802 may be used to store an operating system and computer programs. For example, the memory 802 stores a program corresponding to the data migration method described above.
It should be appreciated that the memory 802 may include a program area and a data area. Wherein the storage program area may be used to store an operating system, an application program (such as a data migration method, etc.) required by at least one method, etc.; the storage data area may store data created according to the use of the electronic device 30, or the like. In addition, memory 802 may include volatile memory, and may also include non-volatile memory, such as a hard disk, memory, plug-in hard disk, smart Media Card (SMC), secure Digital (SD) Card, flash Card (Flash Card), at least one disk storage device, flash memory device, or other storage device.
The processor 803 provides computing and control capabilities to support the operation of the overall computer device. For example, the processor 803 is configured to execute a computer program stored in the memory 802 to implement the steps in the data migration method described above, such as the steps in fig. 2 to 6.
It is to be appreciated that the processor 803 is a central processing unit (Central Processing Unit, CPU) that may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), field-programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. Wherein the general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The I/O interface 804 is used to provide a channel for user input or output, for example, the I/O interface 804 may be used to connect various input and output devices (mouse, keyboard, or 3D touch device, etc.), displays so that a user may enter information, or visualize information.
The bus 805 is at least used to provide a channel for communication among the communication interface 801, the memory 802, the processor 803, and the I/O interface 804 in the electronic device 100.
It will be appreciated by those skilled in the art that the structure shown in fig. 8 is merely a block diagram of a portion of the structure associated with the present application and is not intended to limit the computer device to which the present application is applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, the data migration method is applied to the electronic device 100, and when the processor 803 executes the computer program stored in the memory 802 to implement the data migration method, the following steps are implemented:
acquiring original data in a first partition, and calculating a check value of the original data;
adding a check value and a carrying identifier to the original data to obtain first data;
determining a second partition and a third partition;
writing the first data into a second partition and a third partition;
responding to the received data initialization instruction, reading second data stored in the second partition, and checking the second data according to a check value in the second data;
if the second data check fails and the second data carries the handling identification, copying the third data stored in the third partition to the second partition.
In particular, the specific implementation method of the above instruction by the processor 803 may refer to the description of the relevant steps in the foregoing data migration method embodiment, which is not repeated herein.
Embodiments of the present application also provide a computer readable storage medium having a computer program stored thereon, where the computer program includes program instructions, and when the program instructions are executed, a method implemented by the program instructions may refer to various embodiments of the data migration method of the present application.
The computer readable storage medium may be an internal storage unit of the electronic device according to the foregoing embodiment, for example, a hard disk or a memory of the electronic device. The computer readable storage medium may also be an external electronic device of the electronic device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the electronic device.
Further, the computer-readable storage medium may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function, and the like; the storage data area may store data created according to the use of the electronic device, etc.
According to the electronic device and the computer readable storage medium provided by the embodiment, the verification value and the carrying identifier are added to the original data in the first partition, the obtained first data is written into the second partition and the third partition, wherein the first data is written into the second partition and then is called second data, and the first data is written into the third partition and then is called third data, so that the first data can be backed up in the third partition, and when the second data in the second partition is abnormal, the third data can be directly obtained from the third partition without continuously accessing the first partition to obtain the original data, and the number of times of accessing the first partition is reduced, so that the possibility of the first partition abnormal is reduced; moreover, by adding the check value to the original data, the second data stored in the second partition can be checked according to the check value during each data initialization operation, so that whether the second data is abnormal or not can be timely determined, and the occurrence of the situation of using the abnormal second data can be reduced; meanwhile, when the second data is abnormal, whether the third data corresponding to the second data exists in the third partition can be accurately determined based on the added carrying identification, so that the accuracy of determining the third data is improved, and the efficiency of copying the third data to the second partition is improved.
It is also to be understood that the terminology used in the description of the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations. It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The foregoing embodiment numbers of the present application are merely for describing, and do not represent advantages or disadvantages of the embodiments. While the invention has been described with reference to certain preferred embodiments, it will be understood by those skilled in the art that various changes and substitutions of equivalents may be made and equivalents will be apparent to those skilled in the art without departing from the scope of the invention. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A data migration method applied to an electronic device, the method comprising:
acquiring original data in a first partition, and calculating a check value of the original data;
adding the check value and the carrying identification to the original data to obtain first data;
determining a second partition and a third partition;
writing the first data to the second partition and the third partition;
reading second data stored in the second partition in response to the received data initialization instruction, and checking the second data according to a check value in the second data;
and if the second data check fails and the second data carries the carrying identification, copying third data stored in the third partition to the second partition.
2. The data migration method of claim 1, wherein after the verifying the second data according to the verification value in the second data, the method further comprises:
and if the second data is successfully checked, finishing the data initialization operation according to the second data.
3. The data migration method of claim 1, wherein copying the third data stored in the third partition to the second partition if the second data fails to verify and the second data carries the handling identifier comprises:
if the second data check fails and the second data carries the carrying identification, acquiring third data stored in the third partition;
checking the third data according to the check value in the third data;
and if the third data check is successful, copying the third data stored in the third partition to the second partition.
4. The data migration method of claim 3, wherein after said verifying said third data based on a verification value in said third data, said method further comprises:
And if the third data check fails, deleting the second data stored in the second partition and the third data stored in the storage partition, and returning to the step of acquiring the original data in the first partition.
5. The data migration method of claim 1, wherein the method further comprises:
if the second data check fails and the second data does not carry the handling identifier, deleting the second data stored in the second partition and the third data stored in the third partition, and returning to the step of acquiring the original data in the first partition.
6. The data migration method of any one of claims 1 to 5, further comprising:
and when the original data cannot be acquired from the first partition, acquiring the original data from a server, and calculating a check value of the original data.
7. The data migration method of claim 1, wherein the determining the second partition and the third partition comprises:
determining the space which the first data need to occupy;
and determining a second partition and a third partition according to the space required to be occupied by the first data, wherein the space size of the second partition and the space size of the third partition are larger than or equal to the space required to be occupied by the first data.
8. A data migration apparatus, the data migration apparatus comprising:
the data calculation module is used for obtaining the original data in the first partition and calculating the check value of the original data;
the data processing module is used for adding the check value and the carrying identifier to the original data to obtain first data;
the storage partition module is used for determining a second partition and a third partition;
a data writing module for writing the first data into the second partition and the third partition;
the data verification module is used for responding to the received data initialization instruction, reading second data stored in the second partition and verifying the second data according to a verification value in the second data;
and the data copying module is used for copying the third data stored in the third partition to the second partition if the second data fails to check and the second data carries the carrying identification.
9. An electronic device, the electronic device comprising:
a memory storing computer readable instructions; a kind of electronic device with high-pressure air-conditioning system
A processor executing computer readable instructions stored in the memory to implement the data migration method of any one of claims 1 to 7.
10. A computer-readable storage medium, characterized by: the computer readable storage medium having stored therein computer readable instructions for execution by a processor in an electronic device to implement the data migration method of any one of claims 1 to 7.
CN202310375132.1A 2023-03-29 2023-03-29 Data migration method, device, electronic equipment and storage medium Pending CN116301654A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310375132.1A CN116301654A (en) 2023-03-29 2023-03-29 Data migration method, device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310375132.1A CN116301654A (en) 2023-03-29 2023-03-29 Data migration method, device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116301654A true CN116301654A (en) 2023-06-23

Family

ID=86797882

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310375132.1A Pending CN116301654A (en) 2023-03-29 2023-03-29 Data migration method, device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116301654A (en)

Similar Documents

Publication Publication Date Title
CA2847841C (en) Nonvolatile media dirty region tracking
US7945815B2 (en) System and method for managing memory errors in an information handling system
WO2019174205A1 (en) Trash recovery method and device and storage equipment
US10261705B2 (en) Efficient data consistency verification for flash storage
US10489289B1 (en) Physical media aware spacially coupled journaling and trim
US10769018B2 (en) System and method for handling uncorrectable data errors in high-capacity storage
KR20120014939A (en) Object oriented memory in solid state devices
CN113419685B (en) RAID creation based on SMR, data writing aiming at RAID and RAID recovery method
CN110413454B (en) Data reconstruction method and device based on storage array and storage medium
US10983862B2 (en) Prioritized rebuilding of extents in multiple tiers
KR20200113992A (en) Apparatus and method for reducing cell disturb in open block of the memory system during receovery procedure
US11314594B2 (en) Method, device and computer program product for recovering data
KR20170125698A (en) Generalized write operations verification method
WO2018188618A1 (en) Solid-state disk access
US10942678B2 (en) Method of accessing data in storage device, method of managing data in storage device and storage device performing the same
US20110099461A1 (en) Data integrity units in nonvolatile memory
TWI616807B (en) Data writing method and storage controller
US11210024B2 (en) Optimizing read-modify-write operations to a storage device by writing a copy of the write data to a shadow block
US11144380B2 (en) Memory controller and storage device including the same
CN111913835A (en) Data multi-backup storage method and device based on cross mapping, computer equipment and storage medium
CN116301654A (en) Data migration method, device, electronic equipment and storage medium
CN113505026B (en) Method, device and equipment for verifying backup data and storage medium
CN111949434B (en) RAID management method, RAID controller and system
CN113704028B (en) Memory, data storage method and door lock system
US11803443B2 (en) Storage system, data copy control 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