Data reorganization method, device and electronic equipment

By creating a target data object during the data refactoring process and backing up the valid data of the data object to be refactored onto it, and replacing the target data object when the difference is zero, the problem of limited data write operations in in-place rewriting is solved, ensuring data integrity and availability.

CN114968655BActive Publication Date: 2025-02-11BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110189333.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-02-19
Publication Date
2025-02-11
Estimated Expiration
2041-02-19

AI Technical Summary

Technical Problem

In existing technologies, when implementing data reorganization through in-situ rewriting, data writing operations cannot be performed on the original data objects, resulting in low data availability.

Method used

The first thread creates the target data object and uses it to back up the valid data of the data object to be reorganized to the target data object. When the difference is zero, a replacement operation instruction is sent to the second thread, which then performs the replacement operation and deletes the data object to be reorganized, thus avoiding direct data erasure and rewriting within the data object to be reorganized.

Benefits of technology

This solves the problem of not being able to perform data write operations on the data objects to be reorganized during the data reorganization process, ensuring data integrity and availability, and improving data usability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114968655B_ABST
    Figure CN114968655B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a data reorganization method, device and electronic device, the method comprising: obtaining a data reorganization request, starting a preset first thread, and creating a target data object, using the first thread to back up valid data contained in the data object to be reorganized corresponding to the identifier of the data object to be reorganized to the target data object, using the first thread to determine the difference between the valid data contained in the data object to be reorganized and the valid data contained in the target data object, and when the difference is zero, using the first thread to send a replacement operation instruction to a preset second thread, further using the second thread to execute the task corresponding to the replacement operation instruction, and deleting the data object to be reorganized. The embodiment of the present invention can improve the availability of data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a data reorganization method, device and electronic equipment. Background Art

[0002] Data reshuffling usually refers to rewriting files on disk without changing the data key value, so that the data can be restored in a more compact and performant form.

[0003] In order to realize data reorganization, one solution in the prior art is: in-situ rewriting, that is, erasing the original data and rewriting it, in which the rewritten data overwrites the original data.

[0004] In the process of data reorganization by in-place rewriting, since the original data object is directly operated, in order to ensure the security of the data, the original data object needs to be set to read-only mode, that is, data writing operations cannot be performed on the original data object during the data reorganization process. Moreover, when the data in the original data object fails to be erased and rewritten to obtain a new data object, the original data object is also destroyed, making the data unavailable, thereby reducing the availability of the data. Summary of the invention

[0005] The purpose of the embodiments of the present invention is to provide a data reorganization method, device and electronic device to solve the problem that in the process of implementing data reorganization by in-situ rewriting, the original data object cannot be written and the data availability is low. The specific technical solution is as follows:

[0006] In a first aspect, an embodiment of the present invention provides a data reorganization method, the method comprising:

[0007] Obtaining a data reorganization request, wherein the data reorganization request includes an identifier of a data object to be reorganized;

[0008] Start a preset first thread and create a target data object; wherein the first thread is used to perform a data reorganization task, and the target data object is a data object created for data reorganization;

[0009] Using the first thread, backing up valid data contained in the data object to be reorganized corresponding to the identifier of the data object to be reorganized into the target data object;

[0010] Determine, by using the first thread, a difference between valid data included in the to-be-reorganized data object and valid data included in the target data object;

[0011] In the case where the difference is zero, using the first thread to send a replacement operation instruction to a preset second thread, the preset second thread is used to perform a data writing task, and the replacement operation instruction is used to instruct the target data object to replace the data object to be reorganized;

[0012] The second thread is used to execute the task corresponding to the replacement operation instruction, and the data object to be reorganized is deleted.

[0013] Optionally, the data reorganization request further includes index information corresponding to each data in the data object to be reorganized, and the index information is used to identify the storage status of the data. The step of using the first thread to back up valid data contained in the data object to be reorganized corresponding to the identifier of the data object to be reorganized to the target data object includes:

[0014] Using the first thread, sorting the index information corresponding to each data in the data object to be reorganized;

[0015] Based on the sorting of the index information, the valid data contained in the data object to be reorganized is backed up to the target data object.

[0016] Optionally, the index information includes an offset, a length and a version number of the data, and the step of sorting the index information corresponding to each data in the data object to be reorganized includes:

[0017] Determining the offset and length of the data as a first priority;

[0018] Determining the version number as a second priority;

[0019] Based on the first priority and the second priority in the index information corresponding to the data, the index information corresponding to each data in the data object to be reorganized is sorted.

[0020] Optionally, the step of backing up valid data contained in the to-be-reorganized data object to the target data object based on the sorting of the index information includes:

[0021] The data corresponding to the index information having the same first priority and a higher second priority is backed up to the target data object, and the data corresponding to the index information having the same first priority and a lower second priority is discarded.

[0022] Optionally, the step of sorting the index information corresponding to each data in the data object to be reorganized based on the first priority and the second priority in the index information corresponding to each data includes:

[0023] In the case where the first priorities are different, sorting the index information corresponding to each data in the data object to be reorganized according to the first priorities;

[0024] In the case where the first priorities are the same, the index information corresponding to each data in the data object to be reorganized is sorted according to the second priority.

[0025] Optionally, after determining, by using the first thread, the difference between the valid data included in the to-be-reorganized data object and the valid data included in the target data object, the method further includes:

[0026] In the case where the difference is greater than zero and less than a preset threshold, using the first thread to send an auxiliary backup instruction to the second thread, the auxiliary backup instruction is used to use the second thread to assist the first thread in backing up the data to be backed up in the data object to be reorganized to the target data object when a data write request is received;

[0027] Receiving a data write request for the data object to be reorganized;

[0028] Using the second thread, writing the data corresponding to the data write request into the data object to be reorganized;

[0029] Using the second thread, backing up data of a preset data amount in the difference data in the data object to be reorganized to the target data object, where the preset data amount is determined according to the preset threshold;

[0030] The first thread is used to back up data other than data of the preset data size in the difference data in the data object to be reorganized to the target data object.

[0031] Optionally, after determining, by using the first thread, the difference between the valid data included in the to-be-reorganized data object and the valid data included in the target data object, the method further includes:

[0032] When the difference is not less than a preset threshold, a step of using the first thread to back up valid data contained in the data object to be reorganized corresponding to the identifier of the data object to be reorganized to the target data object is performed.

[0033] Optionally, the step of using the second thread to execute the task corresponding to the replacement operation instruction and deleting the data object to be reorganized includes:

[0034] Using the second thread, determining whether there is a difference between the valid data included in the to-be-reorganized data object and the valid data included in the target data object;

[0035] If so, backing up the data corresponding to the difference in the data object to be reorganized to the target data object, and deleting the data object to be reorganized;

[0036] If it does not exist, delete the data object to be reorganized.

[0037] In a second aspect, an embodiment of the present invention provides a data reorganization device, the device comprising:

[0038] An acquisition module, used to acquire a data reorganization request, wherein the data reorganization request includes an identifier of a data object to be reorganized;

[0039] A creation module, used to start a preset first thread and create a target data object; wherein the first thread is used to perform a data reorganization task, and the target data object is a data object created for data reorganization;

[0040] A first backup module, configured to use the first thread to back up valid data contained in the data object to be reorganized corresponding to the identifier of the data object to be reorganized to the target data object;

[0041] A determination module, configured to determine, by using the first thread, a difference between valid data included in the to-be-reorganized data object and valid data included in the target data object;

[0042] a sending module, configured to, when the difference is zero, use the first thread to send a replacement operation instruction to a preset second thread, the preset second thread being used to execute a data writing task, and the replacement operation instruction being used to instruct the target data object to replace the data object to be reorganized;

[0043] A deletion module is used to use the second thread to execute the task corresponding to the replacement operation instruction and delete the data object to be reorganized.

[0044] Optionally, the data reorganization request further includes index information corresponding to each data in the data object to be reorganized, and the index information is used to identify the storage status of the data. The first backup module includes:

[0045] A sorting submodule, used to sort the index information corresponding to each data in the data object to be reorganized by using the first thread;

[0046] The first backup submodule is used to back up the valid data included in the data object to be reorganized into the target data object based on the sorting of the index information.

[0047] Optionally, the index information includes an offset, a length and a version number of the data, and the sorting submodule includes:

[0048] A first determining unit, configured to determine the offset and length of the data as a first priority;

[0049] A second determining unit, configured to determine the version number as a second priority;

[0050] A sorting unit is used to sort the index information corresponding to each data in the data object to be reorganized based on the first priority and the second priority in the index information corresponding to each data.

[0051] Optionally, the first backup submodule is specifically used to:

[0052] The data corresponding to the index information having the same first priority and a higher second priority is backed up to the target data object, and the data corresponding to the index information having the same first priority and a lower second priority is discarded.

[0053] Optionally, the sorting unit is specifically used to:

[0054] In the case where the first priorities are different, sorting the index information corresponding to each data in the data object to be reorganized according to the first priorities;

[0055] In the case where the first priorities are the same, the index information corresponding to each data in the data object to be reorganized is sorted according to the second priority.

[0056] Optionally, the device further comprises:

[0057] an instruction sending module, configured to use the first thread to send an auxiliary backup instruction to the second thread when the difference is greater than zero and less than a preset threshold, wherein the auxiliary backup instruction is configured to use the second thread to assist the first thread in backing up the data to be backed up in the data object to be reorganized to the target data object when a data write request is received;

[0058] A receiving module, configured to receive a data write request for the data object to be reorganized;

[0059] a data writing module, configured to use the second thread to write the data corresponding to the data writing request into the data object to be reorganized;

[0060] A second backup module, configured to use the second thread to back up data of a preset data volume in the difference data in the data object to be reorganized to the target data object, where the preset data volume is determined according to the preset threshold;

[0061] The third backup module is used to use the first thread to back up the data other than the data of the preset data size in the difference data in the data object to be reorganized to the target data object.

[0062] Optionally, the device further comprises:

[0063] The trigger module is used to trigger the first backup module to execute the first thread to back up the valid data contained in the data object to be reorganized corresponding to the identifier of the data object to be reorganized to the target data object when the difference is not less than a preset threshold.

[0064] Optionally, the deletion module includes:

[0065] a determination submodule, configured to determine, using the second thread, whether there is a difference between the valid data included in the to-be-reorganized data object and the valid data included in the target data object;

[0066] A second backup submodule is configured to, when the determination submodule determines that there is a difference between the valid data contained in the data object to be reorganized and the valid data contained in the target data object, back up the data corresponding to the difference in the data object to be reorganized to the target data object, and delete the data object to be reorganized;

[0067] The deleting submodule is used to delete the data object to be reorganized when the determining submodule determines that there is no difference between the valid data contained in the data object to be reorganized and the valid data contained in the target data object.

[0068] In a third aspect, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;

[0069] Memory, used to store computer programs;

[0070] The processor is used to implement the steps of a data reorganization method described in the first aspect when executing a program stored in the memory.

[0071] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of a data reorganization method described in the first aspect are implemented.

[0072] Beneficial effects of the embodiments of the present invention:

[0073] A data reorganization method, device and electronic device provided by an embodiment of the present invention, after obtaining a data reorganization request, starts a first thread and creates a target data object, uses the first thread to back up the valid data contained in the data object to be reorganized to the target data object, and when the difference between the valid data contained in the data object to be reorganized and the valid data contained in the target data object is zero, uses the first thread to send a replacement operation instruction for instructing the target data object to replace the data object to be reorganized to the second thread, further uses the second thread to perform the task corresponding to the replacement operation instruction, and deletes the data object to be reorganized to complete the data reorganization. In the data reorganization process, data is not directly erased and rewritten in the data object to be reorganized, and thus it is not necessary to set the data object to be reorganized to read-only mode, which solves the problem that data write operations cannot be performed on the data object to be reorganized during the data reorganization process. When all the valid data contained in the data object to be reorganized has been backed up in the target data object, the second thread uses the target data object to replace the data object to be reorganized, and deletes the data object to be reorganized at the same time, ensuring that data will not be lost. Moreover, the valid data contained in the data object to be reorganized is backed up to the target data object. Even if the backup process fails, it will not destroy the integrity of the data object to be reorganized, that is, it will not affect the availability of the data in the data object to be reorganized, thereby improving the availability of the data.

[0074] Of course, it is not necessary to achieve all of the advantages described above at the same time to implement any product or method of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0075] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other embodiments can be obtained based on these drawings without paying creative work.

[0076] Figure 1 A schematic diagram of a flow chart of a first data reorganization method provided by an embodiment of the present invention;

[0077] Figure 2 A schematic diagram of a data backup implementation process provided by an embodiment of the present invention;

[0078] Figure 3 A schematic diagram of a flow chart of an implementation method of replacing and deleting a data object provided by an embodiment of the present invention;

[0079] Figure 4 A flowchart of another data reorganization method provided by an embodiment of the present invention;

[0080] Figure 5A schematic diagram of the structure of a data reorganization device provided by an embodiment of the present invention;

[0081] Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0082] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0083] In order to solve the problems of being unable to perform data write operations on original data objects and low data availability during the existing in-situ rewriting to achieve data reorganization, embodiments of the present invention provide a data reorganization method, device and electronic device.

[0084] A data reorganization method provided by an embodiment of the present invention may include:

[0085] Obtaining a data reorganization request, wherein the data reorganization request includes an identifier of a data object to be reorganized;

[0086] Start a preset first thread and create a target data object; wherein the first thread is used to perform a data reorganization task, and the target data object is a data object created for data reorganization;

[0087] Using the first thread, backing up valid data contained in the data object to be reorganized corresponding to the identifier of the data object to be reorganized into the target data object;

[0088] Determine, by using the first thread, a difference between valid data included in the to-be-reorganized data object and valid data included in the target data object;

[0089] In the case where the difference is zero, using the first thread to send a replacement operation instruction to a preset second thread, the preset second thread is used to perform a data writing task, and the replacement operation instruction is used to instruct the target data object to replace the data object to be reorganized;

[0090] The second thread is used to execute the task corresponding to the replacement operation instruction, and the data object to be reorganized is deleted.

[0091] A data reorganization method provided by an embodiment of the present invention starts a first thread and creates a target data object after obtaining a data reorganization request. The first thread is used to back up the valid data contained in the data object to be reorganized to the target data object. When the difference between the valid data contained in the data object to be reorganized and the valid data contained in the target data object is zero, the first thread is used to send a replacement operation instruction for instructing the target data object to replace the data object to be reorganized to the second thread. The second thread is further used to execute the task corresponding to the replacement operation instruction, and the data object to be reorganized is deleted to complete the data reorganization. In the data reorganization process, data is not directly erased and rewritten in the data object to be reorganized, and thus it is not necessary to set the data object to be reorganized to read-only mode, which solves the problem that data write operations cannot be performed on the data object to be reorganized during the data reorganization process. When all the valid data contained in the data object to be reorganized has been backed up in the target data object, the second thread is used to use the target data object to replace the data object to be reorganized, and the data object to be reorganized is deleted at the same time, ensuring that data will not be lost. Moreover, the valid data contained in the data object to be reorganized is backed up to the target data object. Even if the backup process fails, it will not destroy the integrity of the data object to be reorganized, that is, it will not affect the availability of the data in the data object to be reorganized, thereby improving the availability of the data.

[0092] The following is a detailed description of a data reorganization method provided by an embodiment of the present invention:

[0093] A data reorganization method provided in an embodiment of the present invention can be applied to an electronic device or a server device. Figure 1 As shown, the embodiment of the present invention provides a first data reorganization method, which may include the following steps:

[0094] S101, obtaining a data reorganization request.

[0095] In actual applications, when data needs to be reorganized, an electronic device or server device obtains a data reorganization request, which may include information such as the identification of the data object to be reorganized, so that the data object to be reorganized can be reorganized according to the identification of the data object to be reorganized.

[0096] It can be understood that the data object to be reorganized can be a data file or data block to be reorganized in the file system, and accordingly, the identifier of the data object to be reorganized can be information such as the name of the data file or data block. The data object to be reorganized can also be an object to be reorganized in the object system, and illustratively, the object can be an application program, and accordingly, the identifier of the data object to be reorganized can be information such as the URL (Uniform Resource Locator) of the application program.

[0097] S102: Start a preset first thread and create a target data object.

[0098] After obtaining the data reorganization request, a preset first thread may be started, and the first thread may be used to perform the data reorganization task, so the first thread may also be called a reorganization thread, and the first thread is further used to create a target data object, and the target data object may be a data object created for data reorganization. It can be understood that the newly created target data object does not contain any data, and is used to reorganize the data in the data object to be reorganized.

[0099] S103: using the first thread, backing up valid data contained in the data object to be reorganized corresponding to the identifier of the data object to be reorganized into the target data object.

[0100] After the first thread is started in the embodiment of the present invention, the first thread is directly used to back up the valid data contained in the data object to be reorganized corresponding to the identifier of the data object to be reorganized to the target data object, so as to complete the reorganization of the valid data contained in the data object to be reorganized. In practical applications, the valid data contained in the data object to be reorganized can be backed up one by one, or multiple valid data can be backed up at the same time.

[0101] S104: using the first thread, determining the difference between the valid data included in the data object to be reorganized and the valid data included in the target data object.

[0102] In the process of backing up valid data contained in the data object to be reorganized to the target data object by using the first thread, after completing one data backup, it can be determined whether there is a difference between the valid data contained in the data object to be reorganized and the valid data contained in the target data object, and the data of the difference can be determined so that the first thread can continue to back up the valid data in the data object to be reorganized that has not been backed up to the target data object. It can be understood that one data backup can be a backup of one piece of data or a backup of multiple pieces of data.

[0103] When it is determined that there is a difference between the valid data contained in the data object to be reorganized and the valid data contained in the target data object, it indicates that the valid data contained in the data object to be reorganized has not been fully backed up to the target data object, and further backup is required. When it is determined that there is no difference between the valid data contained in the data object to be reorganized and the valid data contained in the target data object, that is, the difference is zero, it indicates that the valid data contained in the data object to be reorganized has been fully backed up to the target data object, and the data object to be reorganized can be deleted at this time, and subsequent operations only need to be performed on the target data object.

[0104] S105: When the difference is zero, use the first thread to send a replacement operation instruction to a preset second thread.

[0105] When the difference between the valid data contained in the data object to be reorganized and the valid data contained in the target data object is zero, that is, the valid data contained in the data object to be reorganized has been completely backed up in the target data object, the first thread can be used to send a replacement operation instruction to the preset second thread. The preset second thread can be used to perform data writing tasks and can also be called a writing thread. The replacement operation instruction can be used to instruct the target data object to replace the data object to be reorganized.

[0106] As an optional implementation of the embodiment of the present invention, when the difference between the valid data contained in the data object to be reorganized and the valid data contained in the target data object is not less than the preset threshold, that is, there is still a certain difference between the valid data backed up in the target data object and the valid data to be backed up in the data object to be reorganized, then the process returns to step S103 to use the first thread to back up the valid data contained in the data object to be reorganized corresponding to the identifier of the data object to be reorganized to the operation in the target data object. The preset threshold can be set by those skilled in the art according to actual needs. For example, the preset threshold can be 2% or 5%, etc.

[0107] S106: Utilize the second thread to execute the task corresponding to the replacement operation instruction, and delete the data object to be reorganized.

[0108] The second thread receives the replacement operation instruction and executes the task corresponding to the replacement operation instruction, replaces the data object to be reorganized with the target data object, and deletes the data object to be reorganized, thereby completing the reorganization of the data contained in the data object to be reorganized into the target data object.

[0109] A data reorganization method provided by an embodiment of the present invention does not directly erase and rewrite data in a data object to be reorganized during the data reorganization process, and thus does not need to set the data object to be reorganized to read-only mode, thereby solving the problem that data write operations cannot be performed on the data object to be reorganized during the data reorganization process. After all valid data contained in the data object to be reorganized has been backed up to the target data object, the target data object is used to replace the data object to be reorganized by a second thread, and the data object to be reorganized is deleted at the same time, thereby ensuring that data will not be lost. Moreover, the valid data contained in the data object to be reorganized is backed up to the target data object, and even if the backup process fails, the integrity of the data object to be reorganized will not be destroyed, that is, the availability of the data in the data object to be reorganized will not be affected, thereby improving the availability of the data.

[0110] In an embodiment of the present invention, the acquired data reorganization request may also include index information corresponding to each data in the data object to be reorganized, and the index information may be used to identify the storage status of the data, that is, each index information identifies the storage status corresponding to a piece of data. Exemplarily, the storage status corresponding to the data may be information such as the location, storage path, and storage time of the data, and a piece of data may be a word or a sentence.

[0111] As an optional implementation of the embodiment of the present invention, in Figure 1 Based on the embodiment shown, Figure 2 As shown, the above step S103 uses the first thread to back up the valid data contained in the data object to be reorganized corresponding to the identifier of the data object to be reorganized to the target data object, which can be implemented by the following implementation:

[0112] S1031, using the first thread, sorting the index information corresponding to each data in the data object to be reorganized.

[0113] The data reorganization request may include index information identifying the storage status of each data in the data object to be reorganized, and then the index information corresponding to each data in the data object to be reorganized may be directly sorted.

[0114] In the embodiment of the present invention, the index information may include the offset, length, version number, storage path, etc. of the data. The offset of the data may be the number of bytes offset from the starting position of the data in the data object to be reorganized, the length of the data may be the number of bytes of the data, etc., the version number of the data may be the timestamp information corresponding to when the data is written, and the storage path of the data may be the storage path of the data object to be reorganized where the data is located.

[0115] As an optional implementation of the embodiment of the present invention, sorting the index information corresponding to each data in the data object to be reorganized can be implemented by the following implementation:

[0116] Determine the offset and length of the data as the first priority.

[0117] Make the version number the second priority.

[0118] Based on the first priority and the second priority in the index information corresponding to each data, the index information corresponding to each data in the data object to be reorganized is sorted.

[0119] In an embodiment of the present invention, the data offset and length contained in the index information corresponding to each data in the data object to be reorganized can be determined as the first priority for sorting, and the version number can be determined as the second priority for sorting. Then, according to the first priority and the second priority in the index information corresponding to each data, the index information corresponding to each data in the data object to be reorganized can be sorted.

[0120] As an optional implementation of the embodiment of the present invention, based on the first priority and the second priority in the index information corresponding to each data, the index information corresponding to each data in the data object to be reorganized is sorted, which can be implemented by the following implementation:

[0121] When the first priorities are different, the index information corresponding to each data in the data object to be reorganized is sorted according to the first priorities.

[0122] In the case where the first priorities are the same, the index information corresponding to each data in the data object to be reorganized is sorted according to the second priority.

[0123] Based on the first priority and the second priority in the index information corresponding to each data, it can be determined whether the first priority in each index information is the same. If the first priorities are different, the index information corresponding to each data in the data object to be reorganized can be directly sorted according to the first priority. Specifically, the index information corresponding to each data can be sorted according to the offset of each data. If the first priorities are the same, the second priority can be further determined, and the index information corresponding to each data in the data object to be reorganized can be sorted according to the second priority. Specifically, the index information corresponding to the data with the same first priority and a higher second priority can be sorted first.

[0124] Exemplarily, the data writing method can be divided into overwriting and appending. In the appending method, the first data is "Xiao Ming picked up a dollar on the road and gave it to the police uncle", and the first priority offset of the corresponding index information is 21, the length is 17, and the second priority version number is V101. The second data is "The police uncle praised Xiao Ming", and the first priority offset of the corresponding index information is 39, the length is 9, and the second priority version number is V101. The version number V101 can indicate that the first data and the second data are both written for the first time. At this time, the first priority of the index information corresponding to the first data and the second data is different. When sorting, the index information corresponding to the first data is sorted first, and the index information corresponding to the second data is sorted later.

[0125] In the overwrite mode, the first data is "Xiao Ming picked up one yuan on the road and gave it to the police uncle", and the first priority offset of the corresponding index information is 21, the length is 17, and the second priority version number is V101. The second data is "Xiao Ming picked up ten yuan on the road and gave it to the police uncle", and the first priority offset of the corresponding index information is 21, the length is 17, and the second priority version number is V102. It can be understood that the second data is written after the first data, and its version number is higher than the version number corresponding to the first data. At this time, the first priority of the index information corresponding to the first data and the second data is the same. When sorting, the index information corresponding to the second data with a higher version number is sorted first, and the index information corresponding to the first data with a lower version number is sorted last.

[0126] See also Figure 2 , S1032, based on the sorting of the index information, back up the valid data contained in the data object to be reorganized to the target data object.

[0127] After sorting the index information corresponding to each data in the data object to be reorganized, the valid data contained in the data object to be reorganized can be directly backed up to the target data object according to the sorting.

[0128] As an optional implementation of the embodiment of the present invention, based on the sorting of index information, backing up valid data contained in the data object to be reorganized to the target data object can be implemented by the following implementation:

[0129] The data corresponding to the index information with the same first priority and a higher second priority are backed up to the target data object, and the data corresponding to the index information with the same first priority and a lower second priority are discarded.

[0130] In the embodiment of the present invention, after sorting the index information corresponding to each data in the data object to be reorganized, the data with the same first priority but different second priority in the sorted index information indicates that the data has been rewritten, that is, the data with a low second priority is the data written first, and the data with a high second priority is the revised data written later, and then the data corresponding to the index information with the same first priority and a high second priority can be backed up to the target data object, and the data corresponding to the index information with the same first priority and a low second priority can be discarded. Correspondingly, the data corresponding to the index information with different first priorities is backed up to the target data object.

[0131] For example, the first piece of data is "Xiao Ming picked up a dollar on the road and gave it to the police uncle", and the first priority offset of the corresponding index information is 21, the length is 17, and the second priority version number is V101. The second piece of data is "Xiao Ming picked up ten dollars on the road and gave it to the police uncle", and the first priority offset of the corresponding index information is 21, the length is 17, and the second priority version number is V102. At this time, the first priority of the index information corresponding to the first piece of data and the second piece of data is the same, the second priority is different, and the second priority of the second piece of data is higher than the second priority of the first piece of data, indicating that the second piece of data is revised data, that is, valid data, and then the second piece of data is backed up to the target data object, and the first piece of data is discarded.

[0132] In the embodiment of the present invention, the index information corresponding to each data in the data object to be reorganized is first sorted, and then based on the sorting of the index information, the valid data contained in the data object to be reorganized can be quickly backed up to the target data object.

[0133] As an optional implementation of the embodiment of the present invention, in Figure 1 Based on the embodiment shown, Figure 3 As shown, the above step S106 uses the second thread to execute the task corresponding to the replacement operation instruction and deletes the data object to be reorganized, which can be implemented by the following implementation:

[0134] S1061: Determine, using the second thread, whether there is a difference between the valid data included in the data object to be reorganized and the valid data included in the target data object.

[0135] When the first thread determines that the difference between the valid data contained in the data object to be reorganized and the valid data contained in the target data object is zero, and sends a replacement operation instruction to the second thread, and the second thread receives the replacement operation instruction, the second thread can further determine whether there is a difference between the valid data contained in the data object to be reorganized and the valid data contained in the target data object, so as to further determine whether the backed up data during the data reorganization process is complete.

[0136] S1062: If it exists, back up the data corresponding to the difference in the data object to be reorganized to the target data object, and delete the data object to be reorganized.

[0137] When the second thread determines that there is a difference between the valid data contained in the data object to be reorganized and the valid data contained in the target data object, it indicates that when the first thread backs up all the valid data contained in the data object to be reorganized to the target data object, new data may be written to the data object to be reorganized. At this time, the second thread is directly used to back up the data corresponding to the difference (new write) in the data object to be reorganized to the target data object, so as to ensure that the valid data contained in the data object to be reorganized is consistent with the valid data contained in the target data object, and further delete the data object to be reorganized to complete the data reorganization operation of the data object to be reorganized.

[0138] S1063: If it does not exist, delete the data object to be reorganized.

[0139] When the second thread determines that there is no difference between the valid data contained in the data object to be reorganized and the valid data contained in the target data object, it indicates that the valid data contained in the data object to be reorganized is consistent with the valid data contained in the target data object. At this time, the data object to be reorganized is directly deleted to complete the data reorganization operation of the data object to be reorganized.

[0140] In an embodiment of the present invention, the second thread further determines whether there is a difference between the valid data contained in the data object to be reorganized and the valid data contained in the target data object, and if there is a difference, backs up the data corresponding to the difference to the target data object, further ensuring that during the data reorganization process, the valid data contained in the data object to be reorganized is consistent with the valid data contained in the target data object.

[0141] In the embodiment of the present invention, during the data reorganization process, a data write request for the data object to be reorganized can also be received, that is, during the data reorganization process, the data write operation for the data object to be reorganized will not be suspended. In practical applications, a data write request for the data object to be reorganized can be received at any stage of the data reorganization process, and the data write operation can be performed on the data object to be reorganized.

[0142] Specifically, when the first thread backs up the valid data contained in the data object to be reorganized to the target data object, and the difference between the valid data contained in the data object to be reorganized and the valid data contained in the target data object is greater than a preset threshold, a data write request for the data object to be reorganized is received, the second thread writes the data corresponding to the data write request into the data object to be reorganized, and the first thread continues to back up the valid data contained in the data object to be reorganized to the target data object.

[0143] When the difference between the valid data contained in the data object to be reorganized and the valid data contained in the target data object is greater than zero and less than a preset threshold, that is, the valid data contained in the data object to be reorganized is about to be consistent with the data in the target data object. At this time, in order to complete the backup of the data in the data object to be reorganized to the target data object as soon as possible, when a data write request for the data object to be reorganized is received, the second thread can be used to assist the first thread to back up the data to be backed up in the data object to be reorganized to the target data object as soon as possible. The implementation of data reorganization is as follows Figure 4 As shown, in Figure 1 Based on the embodiment shown, another data reorganization method is provided in an embodiment of the present invention. Based on the above data reorganization method, after step S104 uses the first thread to determine the difference between the valid data included in the data object to be reorganized and the valid data included in the target data object, the following steps may also be included:

[0144] S107: When the difference is greater than zero and less than a preset threshold, use the first thread to send an auxiliary backup instruction to the second thread.

[0145] When the difference between the valid data contained in the data object to be reorganized and the valid data contained in the target data object is greater than zero and less than a preset threshold, in order to complete the backup of the data in the data object to be reorganized to the target data object as soon as possible, the first thread can send an auxiliary backup instruction to the second thread. The auxiliary backup instruction can be used to use the second thread to assist the first thread in backing up the data to be backed up in the data object to be reorganized to the target data object when a data write request is received.

[0146] Optionally, when the first thread determines that the difference between the valid data contained in the data object to be reorganized and the valid data contained in the target data object is greater than zero and less than a preset threshold, the first thread may directly send an auxiliary backup instruction to the second thread, or send an auxiliary backup instruction to the second thread after completing each backup of the data in the data object to be reorganized to the target data object, so that after receiving the auxiliary backup instruction, the second thread can assist the first thread in backing up the data to be backed up in the data object to be reorganized to the target data object each time when responding to the data write request if there is a data write request.

[0147] S108, receiving a data write request for the data object to be reorganized.

[0148] The data write request for the data object to be reorganized may include: the data to be written corresponding to the data write request.

[0149] S109: Using the second thread, write the data corresponding to the data write request into the data object to be reorganized.

[0150] In the embodiment of the present invention, when the difference between the valid data included in the data object to be reorganized and the valid data included in the target data object is greater than zero and less than a preset threshold, a data write request for the data object to be reorganized is received, and the second thread can be further used to write the data corresponding to the data write request into the data object to be reorganized. It can be understood that the second thread writing the data corresponding to the data write request into the data object to be reorganized will not affect the reorganization of the data in the data object to be reorganized.

[0151] S110, using the second thread, backing up data of a preset data size in the differential data in the data object to be reorganized into the target data object.

[0152] In an embodiment of the present invention, the second thread receives the auxiliary backup instruction sent by the first thread, and the auxiliary backup instruction may also include: an identifier or mark of the data object to be reorganized and the difference data in the data object to be reorganized (i.e., the data to be backed up). Optionally, when the first thread determines that the difference between the valid data contained in the data object to be reorganized and the valid data contained in the target data object is greater than zero and less than a preset threshold, the auxiliary backup instruction may be sent to the second thread only once, and then the second thread may record the identifier or mark of the data object to be reorganized and the difference data in the data object to be reorganized contained in the auxiliary backup instruction, and during the entire stage when the difference between the valid data contained in the data object to be reorganized and the valid data contained in the target data object is greater than zero and less than the preset threshold, after receiving a data write request for the data object to be reorganized, each time in response to the data write request, the auxiliary first thread backs up the data to be backed up in the data object to be reorganized to the target data object.

[0153] Specifically, after the second thread writes the data corresponding to the data write request into the data object to be reorganized, the data of a preset data amount in the difference data in the data object to be reorganized can be backed up to the target data object according to the identifier of the data object to be reorganized and the difference data in the data object to be reorganized, so as to occupy part of the operation of the second thread to complete the backup of the data in the data object to be reorganized to the target data object, so as to ensure that the valid data in the target data object can be consistent with the valid data contained in the data object to be reorganized as soon as possible, that is, the first thread can complete the backup of the valid data contained in the data object to be reorganized to the target data object more quickly. Among them, the preset data amount is determined according to a preset threshold.

[0154] Exemplarily, the preset threshold may be expressed as Delta. When the difference is greater than zero and less than the preset threshold, the number of times the data corresponding to the difference needs to be backed up is set as Steps, and the preset data size may be set as Delta / Steps.

[0155] S111, using the first thread, backing up data other than data of a preset data size in the difference data in the data object to be reorganized into the target data object.

[0156] In the data reorganization process of the embodiment of the present invention, the first thread is used to back up the valid data contained in the data object to be reorganized to the target data object. When the difference between the valid data contained in the data object to be reorganized and the valid data contained in the target data object is greater than zero and less than a preset threshold, after receiving a data write request for the data object to be reorganized, the second thread writes the data corresponding to the data write request into the data object to be reorganized, and backs up the data of a preset data size in the difference data in the data object to be reorganized to the target data object, and the first thread continues to back up the data other than the data of the preset data size in the difference data in the data object to be reorganized to the target data object. It can be understood that in the process of backing up the valid data in the data object to be reorganized to the target data object, and writing the data corresponding to the data write request to the data object to be reorganized, the difference between the valid data contained in the data object to be reorganized and the valid data contained in the target data object is changing.

[0157] Optionally, when the difference between the valid data contained in the data object to be reorganized and the valid data contained in the target data object is greater than zero and less than a preset threshold, the first thread can be utilized to no longer sort the index information corresponding to the difference data in the data object to be reorganized, and directly back up the data except for the data of a preset data size in the difference data in the data object to be reorganized to the target data object, so as to quickly complete the backup of the data to be backed up in the data object to be reorganized to the target data object.

[0158] When the difference between the valid data contained in the data object to be reorganized and the valid data contained in the target data object is zero, the above step S105 is executed to use the first thread to send a replacement operation instruction to the preset second thread. The specific implementation process is described above, and the embodiment of the present invention will not be repeated here.

[0159] Exemplarily, after the second thread receives a data write request for the data object to be reorganized, the second thread writes the data corresponding to the data write request into the data object to be reorganized, and backs up the data with a data size of Delta / Steps in the difference data within the data object to be reorganized to the target data object, and the first thread continues to back up the data in the difference data within the data object to be reorganized except for the data with a data size of Delta / Steps to the target data object.

[0160] When the second thread receives X data write requests for the data object to be reorganized, the second thread first writes the data corresponding to the data write request into the data object to be reorganized each time, and then backs up the data with a data size of Delta / Steps in the difference data in the data object to be reorganized to the target data object, and then the first thread continues to back up the data in the difference data in the data object to be reorganized except for the data with a data size of X*Delta / Steps to the target data object.

[0161] In the embodiment of the present invention, during the data reorganization process, data is not directly erased and rewritten in the data object to be reorganized, and thus the data object to be reorganized does not need to be set to read-only mode, thereby solving the problem that data write operations cannot be performed on the data object to be reorganized during the data reorganization process. After all valid data contained in the data object to be reorganized has been backed up to the target data object, the second thread uses the target data object to replace the data object to be reorganized, and the data object to be reorganized is deleted at the same time, thereby ensuring that data will not be lost. Moreover, the valid data contained in the data object to be reorganized is backed up to the target data object, and even if the backup process fails, the integrity of the data object to be reorganized will not be destroyed, that is, the availability of the data in the data object to be reorganized will not be affected, thereby improving the availability of the data. In addition, when the difference between the valid data contained in the data object to be reorganized and the valid data contained in the target data object is greater than zero and less than a preset threshold, and a data write request for the data object to be reorganized is received, the second thread can also be used to back up a preset amount of data in the difference data in the data object to be reorganized to the target data object, so as to occupy part of the operation of the second thread to complete the backup of the data in the data object to be reorganized to the target data object, thereby ensuring that the valid data in the target data object can be consistent with the valid data contained in the data object to be reorganized as soon as possible, thereby enabling the first thread to complete the backup of the valid data contained in the data object to be reorganized to the target data object more quickly.

[0162] Corresponding to the above method embodiments, the embodiments of the present invention also provide corresponding device embodiments.

[0163] like Figure 5 As shown, an embodiment of the present invention provides a data reorganization device, which may include:

[0164] The acquisition module 201 is used to acquire a data reorganization request, where the data reorganization request includes an identifier of a data object to be reorganized.

[0165] The creation module 202 is used to start a preset first thread and create a target data object; wherein the first thread is used to perform a data reorganization task, and the target data object is a data object created for data reorganization.

[0166] The first backup module 203 is used to use the first thread to back up the valid data contained in the data object to be reorganized corresponding to the identifier of the data object to be reorganized to the target data object.

[0167] The determination module 204 is configured to determine, by using the first thread, the difference between the valid data included in the data object to be reorganized and the valid data included in the target data object.

[0168] The sending module 205 is used to use the first thread to send a replacement operation instruction to a preset second thread when the difference is zero. The preset second thread is used to perform the data writing task. The replacement operation instruction is used to instruct the target data object to replace the data object to be reorganized.

[0169] The deletion module 206 is used to use the second thread to execute the task corresponding to the replacement operation instruction and delete the data object to be reorganized.

[0170] A data reorganization device provided by an embodiment of the present invention does not directly erase and rewrite data in the data object to be reorganized during the data reorganization process, and thus does not need to set the data object to be reorganized to read-only mode, thereby solving the problem that data write operations cannot be performed on the data object to be reorganized during the data reorganization process. After all valid data contained in the data object to be reorganized has been backed up to the target data object, the target data object is used to replace the data object to be reorganized by a second thread, and the data object to be reorganized is deleted at the same time, thereby ensuring that data will not be lost. Moreover, the valid data contained in the data object to be reorganized is backed up to the target data object, and even if the backup process fails, the integrity of the data object to be reorganized will not be destroyed, that is, the availability of the data in the data object to be reorganized will not be affected, thereby improving the availability of the data.

[0171] Optionally, the data reorganization request further includes index information corresponding to each data in the data object to be reorganized, and the index information is used to identify the storage status of the data. The first backup module 203 includes:

[0172] The sorting submodule is used to sort the index information corresponding to each data in the data object to be reorganized by using the first thread.

[0173] The first backup submodule is used to back up valid data contained in the data object to be reorganized into the target data object based on the sorting of the index information.

[0174] Optionally, the index information includes the offset, length and version number of the data, and the sorting submodule includes:

[0175] The first determining unit is used to determine the offset and length of the data as a first priority.

[0176] The second determining unit is configured to determine the version number as a second priority.

[0177] The sorting unit is used to sort the index information corresponding to each data in the data object to be reorganized based on the first priority and the second priority in the index information corresponding to each data.

[0178] Optionally, the first backup submodule is specifically used to:

[0179] The data corresponding to the index information with the same first priority and a higher second priority are backed up to the target data object, and the data corresponding to the index information with the same first priority and a lower second priority are discarded.

[0180] Optionally, the sorting unit is specifically configured to:

[0181] When the first priorities are different, the index information corresponding to each data in the data object to be reorganized is sorted according to the first priorities.

[0182] In the case where the first priorities are the same, the index information corresponding to each data in the data object to be reorganized is sorted according to the second priority.

[0183] Optionally, the above device further includes:

[0184] The instruction sending module is used to use the first thread to send an auxiliary backup instruction to the second thread when the difference is greater than zero and less than a preset threshold. The auxiliary backup instruction is used to use the second thread to assist the first thread in backing up the data to be backed up in the data object to be reorganized to the target data object when a data write request is received.

[0185] The receiving module is used to receive a data write request for the data object to be reorganized.

[0186] The data writing module is used to use the second thread to write the data corresponding to the data writing request into the data object to be reorganized.

[0187] The second backup module is used to use the second thread to back up data of a preset data size in the differential data in the data object to be reorganized to the target data object, where the preset data size is determined according to a preset threshold.

[0188] The third backup module is used to use the first thread to back up the data other than the data of a preset data size in the difference data in the data object to be reorganized to the target data object.

[0189] Optionally, the above device further includes:

[0190] The trigger module is used to trigger the first backup module to execute the first thread to back up the valid data contained in the data object to be reorganized corresponding to the identifier of the data object to be reorganized to the target data object when the difference is not less than a preset threshold.

[0191] Optionally, the deletion module 206 includes:

[0192] The determination submodule is used to determine, using the second thread, whether there is a difference between the valid data included in the data object to be reorganized and the valid data included in the target data object.

[0193] The second backup submodule is used to back up the data corresponding to the difference in the data object to be reorganized to the target data object and delete the data object to be reorganized when the determination submodule determines that there is a difference between the valid data contained in the data object to be reorganized and the valid data contained in the target data object.

[0194] The deleting submodule is used to delete the data object to be reorganized when the determining submodule determines that there is no difference between the valid data contained in the data object to be reorganized and the valid data contained in the target data object.

[0195] The embodiment of the present invention further provides an electronic device, such as Figure 6 As shown, it includes a processor 301, a communication interface 302, a memory 303 and a communication bus 304, wherein the processor 301, the communication interface 302, and the memory 303 communicate with each other through the communication bus 304.

[0196] Memory 303, used for storing computer programs;

[0197] The processor 301 is used to implement the steps of the above-mentioned data reorganization method when executing the program stored in the memory 303 to achieve the same technical effect.

[0198] The communication bus mentioned in the above electronic device may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0199] The communication interface is used for communication between the above electronic device and other devices.

[0200] The memory may include RAM (Random Access Memory) or NVM (Non-Volatile Memory), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0201] The above-mentioned processor can be a general-purpose processor, including a CPU (Central Processing Unit), NP (Network Processor), etc.; it can also be a DSP (Digital Signal Processing), ASIC (Application Specific Integrated Circuit), FPGA (Field-Programmable Gate Array) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0202] In another embodiment provided by the present invention, a computer-readable storage medium is also provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of any one of the above-mentioned data reorganization methods are implemented to achieve the same technical effect.

[0203] In another embodiment provided by the present invention, a computer program product containing instructions is also provided. When the computer program product is run on a computer, the computer executes the steps of any one of the data reorganization methods in the above embodiments to achieve the same technical effect.

[0204] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, DSL (Digital Subscriber Line, digital subscriber line)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrations. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a DVD (Digital Versatile Disc)), or a semiconductor medium (eg, an SSD (Solid State Disk)), etc.

[0205] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0206] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device / electronic device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0207] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims

1. A data reorganization method, characterized in that: The method comprises: Obtaining a data reorganization request, wherein the data reorganization request includes an identifier of a data object to be reorganized; Start a preset first thread and create a target data object; wherein the first thread is used to perform a data reorganization task, and the target data object is a data object created for data reorganization; Using the first thread, backing up valid data contained in the data object to be reorganized corresponding to the identifier of the data object to be reorganized into the target data object; Determine, by using the first thread, a difference between valid data included in the to-be-reorganized data object and valid data included in the target data object; In the case where the difference is zero, using the first thread to send a replacement operation instruction to a preset second thread, the preset second thread is used to perform a data writing task, and the replacement operation instruction is used to instruct the target data object to replace the data object to be reorganized; The second thread is used to execute the task corresponding to the replacement operation instruction, and the data object to be reorganized is deleted.

2. The method according to claim 1, characterized in that The data reorganization request further includes index information corresponding to each data in the data object to be reorganized, and the index information is used to identify the storage status of the data. The step of using the first thread to back up the valid data contained in the data object to be reorganized corresponding to the identifier of the data object to be reorganized to the target data object includes: Using the first thread, sorting the index information corresponding to each data in the data object to be reorganized; Based on the sorting of the index information, the valid data contained in the data object to be reorganized is backed up to the target data object.

3. The method according to claim 2, characterized in that The index information includes the offset, length and version number of the data, and the step of sorting the index information corresponding to each data in the data object to be reorganized includes: Determining the offset and length of the data as a first priority; Determining the version number as a second priority; Based on the first priority and the second priority in the index information corresponding to the data, the index information corresponding to each data in the data object to be reorganized is sorted.

4. The method according to claim 3, characterized in that: The step of backing up the valid data contained in the data object to be reorganized to the target data object based on the sorting of the index information includes: The data corresponding to the index information having the same first priority and a higher second priority is backed up to the target data object, and the data corresponding to the index information having the same first priority and a lower second priority is discarded.

5. The method according to claim 3, characterized in that: The step of sorting the index information corresponding to each data in the data object to be reorganized based on the first priority and the second priority in the index information corresponding to each data includes: In the case where the first priorities are different, sorting the index information corresponding to each data in the data object to be reorganized according to the first priorities; In the case where the first priorities are the same, the index information corresponding to each data in the data object to be reorganized is sorted according to the second priority.

6. The method according to any one of claims 1 to 5, characterized in that: After determining, by using the first thread, the difference between the valid data included in the to-be-reorganized data object and the valid data included in the target data object, the method further includes: In the case where the difference is greater than zero and less than a preset threshold, using the first thread to send an auxiliary backup instruction to the second thread, the auxiliary backup instruction is used to use the second thread to assist the first thread in backing up the data to be backed up in the data object to be reorganized to the target data object when a data write request is received; Receiving a data write request for the data object to be reorganized; Using the second thread, writing the data corresponding to the data write request into the data object to be reorganized; Using the second thread, backing up data of a preset data amount in the difference data in the data object to be reorganized to the target data object, where the preset data amount is determined according to the preset threshold; The first thread is used to back up data other than data of the preset data size in the difference data in the data object to be reorganized to the target data object.

7. The method according to any one of claims 1 to 5, characterized in that: After determining, by using the first thread, the difference between the valid data included in the to-be-reorganized data object and the valid data included in the target data object, the method further includes: When the difference is not less than a preset threshold, a step of using the first thread to back up valid data contained in the data object to be reorganized corresponding to the identifier of the data object to be reorganized to the target data object is performed.

8. The method according to any one of claims 1 to 5, characterized in that: The step of using the second thread to execute the task corresponding to the replacement operation instruction and deleting the data object to be reorganized includes: Using the second thread, determining whether there is a difference between the valid data included in the to-be-reorganized data object and the valid data included in the target data object; If so, backing up the data corresponding to the difference in the data object to be reorganized to the target data object, and deleting the data object to be reorganized; If it does not exist, delete the data object to be reorganized.

9. A data reorganization device, characterized in that: The device comprises: An acquisition module, used to acquire a data reorganization request, wherein the data reorganization request includes an identifier of a data object to be reorganized; A creation module, used to start a preset first thread and create a target data object; wherein the first thread is used to perform a data reorganization task, and the target data object is a data object created for data reorganization; A first backup module, configured to use the first thread to back up valid data contained in the data object to be reorganized corresponding to the identifier of the data object to be reorganized to the target data object; A determination module, configured to determine, by using the first thread, a difference between valid data included in the to-be-reorganized data object and valid data included in the target data object; a sending module, configured to, when the difference is zero, use the first thread to send a replacement operation instruction to a preset second thread, the preset second thread being used to execute a data writing task, and the replacement operation instruction being used to instruct the target data object to replace the data object to be reorganized; A deletion module is used to use the second thread to execute the task corresponding to the replacement operation instruction and delete the data object to be reorganized.

10. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the method steps described in any one of claims 1 to 8 when executing a program stored in a memory.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 8 are implemented.

Citation Information

Patent Citations

  • Database corruption recovery systems and methods

    CN101506766A

  • Built-in database based high-efficient data deleting and restoring method

    CN102567472A