Data segment reorganization method and device, storage medium and electronic device

By cyclically splicing data segments in the reorganization context, the problem of inconsistent data segment reorganization in the prior art is solved, realizing the reorganization of logically adjacent data segments that are physically adjacent, thus improving the quality and efficiency of data segment reorganization.

CN118363963BActive Publication Date: 2026-06-30JINAN INSPUR DATA TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
JINAN INSPUR DATA TECH CO LTD
Filing Date
2024-05-11
Publication Date
2026-06-30

AI Technical Summary

Technical Problem

In existing technologies, data is reassembled after each data segment is read, which results in the inability to output data that are logically adjacent but physically adjacent, and the data segments are not in the same order in the logical and physical spaces.

Method used

By acquiring data information from the data segment queue, it is determined whether there are adjacent data segments in the reorganization context. Data segments are then cyclically spliced ​​together until the remaining space length is less than or equal to the threshold, and then the data is reorganized to optimize the adjacency relationship and space utilization of the data segments.

Benefits of technology

This achieves data reorganization results where logically adjacent data segments are also physically adjacent, and the order of the data segments is consistent in both logical and physical spaces, thus improving the efficiency and quality of data segment reorganization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118363963B_ABST
    Figure CN118363963B_ABST
Patent Text Reader

Abstract

This application provides a data segment reassembly method, apparatus, storage medium, and electronic device. The data segment reassembly method includes: a splicing step: obtaining a first data segment from a data segment queue and determining the data information of the first data segment; determining, based on the data information, whether a second data segment with an adjacency relationship to the first data segment exists in the reassembly context; if a second data segment exists, splicing the first data segment and the second data segment to obtain an updated reassembly context; determining a first size relationship between the first remaining space length of the updated reassembly context and a space length threshold; if the first size relationship indicates that the first remaining space length is greater than the space length threshold, repeatedly executing the splicing step until it is determined that the first remaining space length is less than or equal to the space length threshold to obtain a target reassembly context; and reassembling the data segments in the target reassembly context to obtain reassembled data segments.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computers, and more specifically, to a method and apparatus for reassembling data segments, a storage medium, and an electronic device. Background Technology

[0002] In related technologies, under limited resource conditions, valid data segments within a certain physical space range can be read sequentially. Each time a data segment is read, it is directly appended to a new data segment, and the corresponding mapping information is also added to the relational data segment. Once the total length of the relational data segments meets the expected value, the new data segment is merged with the relational data segment, thus completing data reorganization. The resources occupied by the read data segments can be released after each segment is processed. This method is simple and consumes few resources during processing. However, it cannot output satisfactory data segment reorganization results; that is, it cannot ensure that logically adjacent data are also physically adjacent, and that the order of data in the logical space is consistent with its order in the physical space.

[0003] Therefore, the problem of failing to output satisfactory data segment reconstruction results, which arises from the practice in related technologies of reassembling each data segment after it has been read, has not yet been effectively resolved. Summary of the Invention

[0004] This application provides a method, apparatus, storage medium, and electronic device for reassembling data segments, to at least solve the problem in related technologies where data segments are reassembled after each data segment is read, resulting in the inability to output satisfactory data segment reassembly results.

[0005] According to an embodiment of this application, a method for reassembling data segments is provided. The method includes: a splicing step: obtaining a first data segment from a data segment queue and determining the data information of the first data segment; determining, based on the data information, whether a second data segment with an adjacency relationship to the first data segment exists in the reassembly context; if the second data segment exists, splicing the first data segment and the second data segment to obtain an updated reassembly context; determining a first size relationship between the first remaining space length of the updated reassembly context and a space length threshold; wherein the data information includes: a first data segment length, a first business object, and a first logical offset position; if the first size relationship indicates that the first remaining space length is greater than the space length threshold, repeatedly executing the splicing step until it is determined that the first remaining space length is less than or equal to the space length threshold to obtain a target reassembly context; and reassembling the data segments in the target reassembly context to obtain reassembled data segments.

[0006] In an exemplary embodiment, determining whether a second data segment with an adjacency to the first data segment exists in the reorganization context based on the data information includes: determining whether a business object consistent with the first business object exists in the reorganization context; if a business object consistent with the first business object exists, determining a first start position and a first end position of the first data segment based on the length of the first data segment and the first logical offset position; and determining whether the second data segment exists in the reorganization context based on the first start position and the first end position.

[0007] In an exemplary embodiment, determining whether the second data segment exists in the reassembly context based on the first start position and the first end position includes: determining position information corresponding to all data segments in the reassembly context, wherein the position information is used to indicate a second start position and a second end position of each data segment in all data segments; determining whether there is a third start position and / or a third end position in the position information that is consistent with the first start position and / or the first end position; if the third start position and / or the third end position is determined to exist, determining the data segment corresponding to the third start position and / or the third end position as the second data segment; if the third start position and / or the third end position is determined not to exist, determining that the second data segment does not exist.

[0008] In an exemplary embodiment, concatenating the first data segment and the second data segment to obtain an updated reassembly context includes: determining the number of the second data segments if they exist; updating the target mapping relationship information recorded in the reassembly context according to the number of the second data segments, and determining the second remaining space length of the reassembly context after updating the target mapping relationship information; determining the concatenation method of the first data segment and the second data segment according to a second size relationship between the second remaining space length and the length of the first data segment, and concatenating the first data segment and the second data segment according to the concatenation method to obtain the updated reassembly context.

[0009] In an exemplary embodiment, updating the target mapping relationship information recorded in the reorganization context according to the number of the second data segments, and determining the second remaining space length of the reorganization context after updating the target mapping relationship information, includes: when the number of the second data segments is determined to be a target number, determining a plurality of mapping relationship information corresponding to the second data segments and a third remaining space length of the reorganization context, wherein each data segment in the second data segments corresponds to a mapping relationship information, and the third remaining space length is the remaining space length of the reorganization context before updating the target mapping relationship; deleting any mapping relationship information among the plurality of mapping relationship information; determining the space length of the any mapping relationship information, and determining the second remaining space length according to the third remaining space length and the space length.

[0010] In one exemplary embodiment, determining the splicing method of the first data segment and the second data segment based on a second size relationship between the second remaining space length and the length of the first data segment, and splicing the first data segment and the second data segment according to the splicing method, includes: splicing the first data segment and the second data segment when the second size relationship indicates that the second remaining space length is greater than or equal to the length of the first data segment; and determining the splicing method based on the number of second data segments when the second size relationship indicates that the second remaining space length is less than the length of the first data segment, and splicing the first data segment and the second data segment according to the splicing method.

[0011] In an exemplary embodiment, determining the splicing method based on the number of the second data segments, and splicing the first data segment and the second data segment according to the splicing method, includes: when the number of the second data segments is determined to be a first number, performing a deletion step, wherein the deletion step includes: determining a plurality of third data segments in the reorganization context, wherein the second business object corresponding to the third data segment is inconsistent with the first business object, and the third data segment does not have the adjacency relationship with the first data segment; sorting the plurality of third data segments according to the second data segment length of each third data segment to determine the minimum data segment length among the plurality of second data segment lengths, and determining the fourth data segment corresponding to the minimum data segment length; In the reorganization context, the fourth data segment is deleted, and the sum of the second remaining space length and the minimum data segment length is determined; the sum is compared with the third size relationship of the first data segment length; if the third size relationship indicates that the sum is less than the first data segment length, the deletion step is repeated until the sum is determined to be greater than or equal to the first data segment length, and the first data segment is concatenated with the second data segment; if the number of the second data segments is determined to be a second number, a first difference between the first data segment length and the second remaining space length is determined; the first data segment is truncated according to the first difference, and the truncated first data segment and the second data segment are concatenated.

[0012] In an exemplary embodiment, data reassembly of data segments in a target reassembly context to obtain reassembled data segments includes: determining a third service object corresponding to each data segment in the target reassembly context and a second logical offset position of each data segment; determining the reassembly order of all data segments in the target reassembly context based on the third service object and the second logical offset position, so as to perform the data reassembly on all data segments sequentially according to the reassembly order.

[0013] In an exemplary embodiment, reorganizing a data segment in a target reorganization context to obtain a reorganized data segment includes: when reorganizing a fifth data segment in the target reorganization context, determining whether it is permissible to add the fifth data segment to a target data segment; if it is determined that it is permissible to add the fifth data segment to the target data segment, adding the fifth data segment to the target data segment to update the target data segment; determining whether the length of the third data segment of the updated target data segment is consistent with a preset data segment length; and if it is determined that the length of the third data segment is consistent with the preset data segment length, determining the updated target data segment as the reorganized data segment.

[0014] In an exemplary embodiment, after determining whether the length of the third data segment of the updated target data segment is consistent with the preset data segment length, the method further includes: if it is determined that the length of the third data segment is inconsistent with the preset data segment length, and the fifth data segment is the last data segment in the reorganization context, determining a second difference between the preset data segment length and the length of the third data segment; performing a zero-padding operation on the updated target data segment according to the second difference to generate a sixth data segment, wherein the length of the fourth data segment of the sixth data segment is consistent with the preset data segment length; and determining the sixth data segment as the reorganized data segment.

[0015] According to another embodiment of this application, a data segment reassembly apparatus is provided, comprising: a splicing module for performing a splicing step, wherein the splicing step includes: acquiring a first data segment from a data segment queue and determining data information of the first data segment; determining, based on the data information, whether a second data segment with an adjacency relationship to the first data segment exists in a reassembly context; if the second data segment exists, splicing the first data segment and the second data segment to obtain an updated reassembly context; determining a first size relationship between a first remaining space length of the updated reassembly context and a space length threshold; wherein the data information includes: a first data segment length, a first business object, and a first logical offset position; a looping module for repeatedly executing the splicing step when the first size relationship indicates that the first remaining space length is greater than the space length threshold, until it is determined that the first remaining space length is less than or equal to the space length threshold, to obtain a target reassembly context; and a reassembly module for performing data reassembly on the data segments in the target reassembly context to obtain reassembled data segments.

[0016] According to yet another embodiment of this application, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer program, and the computer program is configured to execute the steps in the above method embodiments when it is run.

[0017] According to yet another embodiment of this application, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in the above method embodiments.

[0018] According to yet another embodiment of this application, a computer program product is also provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0019] The data segment reassembly method of this application includes a splicing step, comprising: obtaining a first data segment from a data segment queue and determining its first data segment length, first business object, and first logical offset position; determining, based on the first data segment length, first business object, and first logical offset position, whether a second data segment with an adjacency relationship to the first data segment exists in the reassembly context; if a second data segment exists, splicing the first and second data segments to obtain an updated reassembly context; determining a first size relationship between the first remaining space length of the updated reassembly context and a space length threshold; if the first size relationship indicates that the first remaining space length is greater than the space length threshold, repeatedly executing the splicing step until the first remaining space length is less than or equal to the space length threshold, reaching the target reassembly context; and reassembling the final data segments of the target reassembly context to obtain the reassembled context. In other words, this application records data segments in the reassembly context, determines the adjacency relationship between the first data segment and existing data segments in the reassembly context, and then determines the first remaining space length in the reassembly context. If the first remaining space length is greater than a space length threshold, the first data segment is not encoded; instead, new data segments are continuously recorded in the reassembly context until the remaining space length in the reassembly context is less than or equal to the space length threshold. Only then are the data segments in the reassembly context encoded, thus achieving data reassembly of all data segments in the reassembly context. That is, this application does not immediately encode a new data segment upon its addition; instead, it dynamically calculates the first remaining space length of the reassembly context. Encoding is only performed when the first remaining space length is less than or equal to the space length threshold. While the first remaining space length is greater than the space length threshold, new data segments can be continuously added to the reassembly context. During this process, the adjacency relationship between the new data segment and existing data segments in the reassembly context can be determined, achieving optimal data segment reassembly results within a local range. Through the above technical solution, the problem of reassembling a data segment immediately after reading it is solved in related technologies. This leads to the problem of not being able to output good data segment reassembly results, and in turn, it can output good data segment reassembly results. Attached Figure Description

[0020] Figure 1 This is a hardware structure block diagram of a computer terminal for a data segment reassembly method according to an embodiment of this application;

[0021] Figure 2 This is a flowchart of a data segment reassembly method according to an embodiment of this application;

[0022] Figure 3This is a schematic diagram illustrating the adjacency relationship between data segments according to an optional embodiment of this application;

[0023] Figure 4 This is a structural block diagram of a data segment reconstruction apparatus according to an embodiment of this application. Detailed Implementation

[0024] The embodiments of this application will be described in detail below with reference to the accompanying drawings and examples.

[0025] It should be noted that the terms "first," "second," etc., in the specification, claims, and drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.

[0026] The methods and embodiments provided in this application can be executed on a mobile terminal, a computer terminal, or a similar computing device. Taking running on a computer terminal as an example, Figure 1 This is a hardware structure block diagram of a computer terminal for a data segment reassembly method according to an embodiment of this application. For example... Figure 1 As shown, a computer terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The computer terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the computer terminal described above. For example, the computer terminal may also include components that are more complex than those described above. Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0027] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the method for determining the interaction state in this embodiment. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thus implementing the above-described method. The memory 104 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to a computer terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0028] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider for the computer terminal. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module used for wireless communication with the Internet.

[0029] This application provides a method for reassembling data segments. Figure 2 This is a flowchart of a data segment reassembly method according to an embodiment of this application, such as... Figure 2 As shown, the process includes the following steps:

[0030] Step S202, splicing step: Obtain the first data segment in the data segment queue and determine the data information of the first data segment; determine whether there is a second data segment in the reassembly context that is adjacent to the first data segment based on the data information; if the second data segment exists, splice the first data segment and the second data segment to obtain the updated reassembly context; determine the first size relationship between the first remaining space length of the updated reassembly context and the space length threshold; wherein, the data information includes: the first data segment length, the first business object, and the first logical offset position;

[0031] Step S204: When the first size relationship indicates that the first remaining space length is greater than the space length threshold, the splicing step is executed repeatedly until it is determined that the first remaining space length is less than or equal to the space length threshold, so as to obtain the target reorganization context;

[0032] Step S206: Perform data reorganization on the data segment in the target reorganization context to obtain the reorganized data segment.

[0033] The data segment reassembly method of this application includes a splicing step, comprising: obtaining a first data segment from a data segment queue and determining its first data segment length, first business object, and first logical offset position; determining, based on the first data segment length, first business object, and first logical offset position, whether a second data segment with an adjacency relationship to the first data segment exists in the reassembly context; if a second data segment exists, splicing the first and second data segments to obtain an updated reassembly context; determining a first size relationship between the first remaining space length of the updated reassembly context and a space length threshold; if the first size relationship indicates that the first remaining space length is greater than the space length threshold, repeatedly executing the splicing step until the first remaining space length is less than or equal to the space length threshold, reaching the target reassembly context; and reassembling the final data segments of the target reassembly context to obtain the reassembled context. In other words, this application records data segments in the reassembly context, determines the adjacency relationship between the first data segment and existing data segments in the reassembly context, and then determines the first remaining space length in the reassembly context. If the first remaining space length is greater than a space length threshold, the first data segment is not encoded; instead, new data segments are continuously recorded in the reassembly context until the remaining space length in the reassembly context is less than or equal to the space length threshold. Only then are the data segments in the reassembly context encoded, thus achieving data reassembly of all data segments in the reassembly context. That is, this application does not immediately encode a new data segment upon its addition; instead, it dynamically calculates the first remaining space length of the reassembly context. Encoding is only performed when the first remaining space length is less than or equal to the space length threshold. While the first remaining space length is greater than the space length threshold, new data segments can be continuously added to the reassembly context. During this process, the adjacency relationship between the new data segment and existing data segments in the reassembly context can be determined, achieving optimal data segment reassembly results within a local range. Through the above technical solution, the problem of reassembling a data segment immediately after reading it in related technologies is solved. This leads to the problem of not being able to output good data segment reassembly results, and in turn, it can output good data segment reassembly results.

[0034] Optionally, step S202 above, which determines whether there is a second data segment in the reorganization context that is adjacent to the first data segment based on the data information, includes: determining whether there is a business object in the reorganization context that is consistent with the first business object; if there is a business object consistent with the first business object, determining the first start position and the first end position of the first data segment based on the length of the first data segment and the first logical offset position; and determining whether there is a second data segment in the reorganization context based on the first start position and the first end position.

[0035] Understandably, the reorganization context manages each data segment according to the business object corresponding to the data segment. It needs to determine whether there is a business object in the reorganization context that is consistent with the first business object. Only if there is a business object can it be determined whether there is a second data segment in the reorganization context that is adjacent to the first data segment, based on the length of the first data segment and the first logical offset position.

[0036] Determining whether a business object consistent with the first business object exists in the reorganization context also relates to whether it is necessary to calculate the mapping relationship information corresponding to the first data segment. Specifically:

[0037] Since the space length occupied by a mapping relationship information of the same business object's data segment is the same, it is only necessary to calculate the space length occupied by a mapping relationship information of that business object once when adding a new business object and save it in the reorganization context. The saved length information can then be used directly. In other words, if it is determined that a business object with the same business relationship as the first business object exists in the reorganization context, it is not necessary to calculate the space length occupied by the mapping relationship information corresponding to the first data segment. It is only necessary to determine the data segment corresponding to the business object with the same business object as the first business object and the space length occupied by the mapping relationship information corresponding to that data segment. This space length is the space length occupied by the mapping relationship information corresponding to the first data segment. However, if it is determined that no business object with the same business relationship as the first business object exists in the reorganization context, a certain calculation is required when determining the space length occupied by the mapping relationship information corresponding to the first business object. The specific calculation process is as follows:

[0038] Construct the mapping relationship information corresponding to the first data segment based on the data information;

[0039] The mapping information is encoded to determine the first encoded string;

[0040] The length of the first string is determined so that the length of the first string is determined as the first spatial length of the mapping relationship information.

[0041] Determining whether the second data segment exists in the reassembly context based on the first start position and the first end position includes: determining position information corresponding to all data segments in the reassembly context, wherein the position information is used to indicate the second start position and the second end position of each data segment in all data segments; determining whether there is a third start position and / or a third end position in the position information that is consistent with the first start position and / or the first end position; if the third start position and / or the third end position is determined to exist, determining the data segment corresponding to the third start position and / or the third end position as the second data segment; if the third start position and / or the third end position is determined not to exist, determining that the second data segment does not exist.

[0042] It is understandable that determining whether data segments are adjacent is done in a specific way. For example, if the starting position of a data segment B is the ending position of another data segment A, then data segment A and data segment B are considered to be adjacent. Data segment A and data segment B can then be combined into a new data segment C, with the starting position of data segment C being the starting position of data segment A, and the ending position of data segment C being the ending position of data segment B.

[0043] Specifically, assuming that the start position of data segment D is the end position of data segment E, and the end position of data segment F is the start position of data segment E, then data segment E is considered to be adjacent to data segments D and F. Data segments D, E, and F can be combined into a new data segment J, where the start position of data segment J is the same as the start position of data segment F, and the end position of data segment J is the same as the end position of data segment D.

[0044] By using the above technical solutions to determine the adjacency relationship between data segments, multiple data segments can be merged into one data segment, which can reduce the dispersion between data segments and thus optimize the management of data segments.

[0045] Optionally, step S202 above, which involves concatenating the first data segment and the second data segment to obtain an updated reassembly context, includes: determining the number of the second data segments if they exist; updating the target mapping relationship information recorded in the reassembly context according to the number of the second data segments, and determining the second remaining space length of the reassembly context after updating the target mapping relationship information; determining the concatenation method of the first data segment and the second data segment according to the second size relationship between the second remaining space length and the length of the first data segment, and concatenating the first data segment and the second data segment according to the concatenation method to obtain the updated reassembly context.

[0046] The process of updating the target mapping relationship information recorded in the reorganization context based on the number of the second data segments, and determining the second remaining space length of the reorganization context after updating the target mapping relationship information, includes: when the number of the second data segments is determined to be the target number, determining multiple mapping relationship information corresponding to the second data segments and the third remaining space length of the reorganization context, wherein each data segment in the second data segment corresponds to one mapping relationship information, and the third remaining space length is the remaining space length of the reorganization context before updating the target mapping relationship; deleting any mapping relationship information among the multiple mapping relationship information; determining the space length of the any mapping relationship information, and determining the second remaining space length based on the third remaining space length and the space length.

[0047] It is understandable that the target number can be 2. When the number of the second data segment is 2, the mapping relationship information corresponding to either of the two data segments needs to be deleted in order to determine the length of the second remaining space.

[0048] If the number of the second data segment is 1, then there is no need to record an additional mapping relationship information; the length of the second remaining space can be determined directly.

[0049] Using the above technical solution, when the number of the second data segment is the target number, a mapping relationship information can be deleted from the reorganization context, thereby increasing the remaining space length in the reorganization context so that the reorganization context can record more data segments.

[0050] Specifically, determining the splicing method of the first data segment and the second data segment based on a second size relationship between the second remaining space length and the length of the first data segment, and splicing the first data segment and the second data segment according to the splicing method, includes: splicing the first data segment and the second data segment when the second size relationship indicates that the second remaining space length is greater than or equal to the length of the first data segment; and determining the splicing method based on the number of second data segments when the second size relationship indicates that the second remaining space length is less than the length of the first data segment, and splicing the first data segment and the second data segment according to the splicing method.

[0051] It is understandable that the method of splicing the first data segment and the second data segment can be determined based on the second size relationship between the second remaining space length and the first data segment length. In the case that the second remaining space length is greater than or equal to the first data segment length, it can be determined that the remaining space length in the reorganization context is sufficient to record the first data segment. In this case, it is only necessary to directly record the first data segment.

[0052] If the length of the second remaining space is less than the length of the first data segment, it indicates that the current remaining space length of the reorganization context is insufficient to record the first data segment. A new method for concatenating the first and second data segments needs to be determined based on the number of second data segments. Specifically: if the number of second data segments is determined to be the first number, a deletion step is performed. This deletion step includes: identifying multiple third data segments in the reorganization context, wherein the second business object corresponding to the third data segment is inconsistent with the first business object, and the third data segment does not have the aforementioned adjacency relationship with the first data segment; sorting the multiple third data segments according to the length of the second data segment of each third data segment to determine the minimum data segment length among the multiple second data segment lengths, and determining the minimum... The fourth data segment corresponding to the data segment length; the fourth data segment is deleted in the reorganization context, and the sum of the second remaining space length and the minimum data segment length is determined; the sum is compared with the third size relationship of the first data segment length; if the third size relationship indicates that the sum is less than the first data segment length, the deletion step is executed repeatedly until the sum is determined to be greater than or equal to the first data segment length, and the first data segment is concatenated with the second data segment; if the number of the second data segments is determined to be a second number, a first difference between the first data segment length and the second remaining space length is determined; the first data segment is truncated according to the first difference, and the truncated first data segment and the second data segment are concatenated.

[0053] It is understandable that the first quantity can be 2 and the second quantity can be 1.

[0054] When there are two second data segments, since there are two data segments adjacent to the first data segment, the start and end positions of the first data segment need to be concatenated with one data segment. Therefore, the integrity of the first data segment needs to be ensured during the concatenation process. Specifically: identify multiple third data segments that are inconsistent with the first business object and have no adjacent relationship with the first data segment; delete the data segment with the smallest data segment length among the multiple third data segments; check whether the remaining space of the reconstructed context after deletion is greater than or equal to the length of the first data segment; if the remaining space of the reconstructed context after deletion is still less than the length of the first data segment, continue deleting the data segment with the smallest data segment length among the multiple third data segments until it is determined that the remaining space of the reconstructed context after deletion is greater than or equal to the length of the first data segment, and then concatenate the first data segment with the second data segment.

[0055] When the number of the second data segment is 1, that is, there is only one data segment that is adjacent to the first data segment, the first difference between the length of the first data segment and the length of the second remaining space can be determined, and the first data segment can be truncated according to the first difference.

[0056] The truncated first data segment can be concatenated with the second data segment, while the remaining data segment can be added to the data segment queue to await the record of reconstructing the context.

[0057] By using the above technical solution, different splicing methods can be determined according to the number of second data segments, and data segments can be spliced ​​flexibly. The remaining space length in the reorganization context is small enough before data reorganization, thereby improving the utilization rate of space length in the reorganization context.

[0058] Optionally, step S206 above, which involves reassembling the data segment in the target reassembly context to obtain the reassembled data segment, includes:

[0059] (1) Determine the third service object corresponding to each data segment in the target reorganization context and the second logical offset position of each data segment; determine the reorganization order of all data segments in the target reorganization context according to the third service object and the second logical offset position, so as to perform the data reorganization on all data segments in sequence according to the reorganization order.

[0060] Understandably, data segments within the target reorganization context can be distinguished based on whether the business objects are the same. Data segments with the same business objects are grouped together, and the data segments are processed sequentially according to the order of the business objects. This determines the second logical offset position, and the order of data reorganization within the reorganization context is determined based on the second logical offset position.

[0061] Data segments are processed sequentially according to the business object and the second logical offset position, so that after data reorganization, data that are logically adjacent can also be as adjacent as possible in physical space, and the order of data segments in logical space can be as consistent as possible with the order of data segments in physical space.

[0062] (2) When reorganizing the fifth data segment in the target reorganization context, determine whether it is allowed to add the fifth data segment to the target data segment; if it is determined that it is allowed to add the fifth data segment to the target data segment, add the fifth data segment to the target data segment to update the target data segment; determine whether the length of the third data segment of the updated target data segment is consistent with the preset data segment length; if it is determined that the length of the third data segment is consistent with the preset data segment length, determine the updated target data segment as the reorganized data segment.

[0063] The method further includes, after determining whether the length of the third data segment of the updated target data segment is consistent with the preset data segment length, the method further includes: if the length of the third data segment is inconsistent with the preset data segment length, and the fifth data segment is the last data segment in the reorganization context, determining a second difference between the preset data segment length and the length of the third data segment; padding the updated target data segment with zeros according to the second difference to generate a sixth data segment, wherein the length of the fourth data segment of the sixth data segment is consistent with the preset data segment length; and determining the sixth data segment as the reorganized data segment.

[0064] It is understandable that if the length of the first remaining space in the reorganization context is less than or equal to the space length threshold, data reorganization can be performed on the data segment in the target reorganization context. The data reorganization process is as follows:

[0065] (1) Determine whether it is permissible to add the fifth data segment (where the fifth data segment is the last data segment in the reorganization context) to the target data segment. The method for determination is as follows:

[0066] Determine the fourth data segment length of the target data segment and the maximum data segment length that the target data segment is allowed to occupy;

[0067] The remaining data segment length of the target data segment is determined based on the third difference between the maximum data segment length and the fourth data segment length;

[0068] Determine a third size relationship between the length of the fourth data segment and the length of the remaining data segments;

[0069] If the third size relationship indicates that the length of the fourth data segment is less than or equal to the length of the remaining data segment, it is determined that the fifth data segment can be added to the target data segment to update the target data segment;

[0070] If the third size relationship indicates that the length of the fourth data segment is greater than the length of the remaining data segment, it is determined that the fifth data segment cannot be added to the target data segment.

[0071] Determine whether adding the fifth data segment to the target data segment is allowed. Only if it is determined that adding the fifth data segment to the target data segment is allowed can the fifth data segment be reassembled.

[0072] (2) Determine whether the length of the third data segment of the updated target data segment is consistent with the preset data segment length. If they are inconsistent, pad the length of the updated data segment with zeros.

[0073] Padding data segments with zeros during the reorganization process ensures that the segment length meets specific requirements, enabling the data to be processed correctly. Furthermore, zero padding prevents errors or anomalies caused by insufficient length of the third data segment.

[0074] To better understand the process of the above data segment reassembly method, the implementation flow of the above data segment reassembly method will be described below in conjunction with optional embodiments, but this is not intended to limit the technical solution of the embodiments of this application.

[0075] In related technologies, when a storage system performs garbage collection, it typically needs to read valid data within a certain physical space, recombine it into new data segments, and then write the recombined data into a new physical space. All data stored in the original physical space becomes invalid, and the original physical space can then be reused as new free space. The storage system manages the physical space and provides services externally in the form of logical spaces.

[0076] When storing data, it is generally required that logically adjacent data should also be as adjacent in physical space as possible, and the order of data in logical space should be as consistent as possible with its order in physical space. Therefore, the garbage collection process should also try to ensure this principle when reorganizing data.

[0077] During garbage collection, all valid data segments within a certain physical space range can be loaded into memory first. Then, data segments with the same business object identity are aggregated in memory according to logical offset order. Afterward, the aggregated data in memory is reassembled into data segments of the expected size and encoded, completing the reassembly process. Using this technique, the more data loaded, the more data segment information can be analyzed, leading to better data segment reassembly. However, because all valid data needs to be loaded, the reassembly process requires a large amount of memory, which may not be sufficient for reassembly under resource-constrained conditions.

[0078] To address the aforementioned technical solutions, this application proposes an optional embodiment of a method for dynamic data segment reassembly during garbage collection in a storage system. In this optional embodiment, when reading valid data segments sequentially from a certain physical space, each data segment is added to the currently being processed reassembly context after it is read. The reassembly context records all data segments already added to the reassembly context, along with their corresponding reassembly information. Once the data segments added to the reassembly context meet the reassembly requirements, data encoding is performed based on the information recorded in the reassembly context to obtain the reassembled data. This optional embodiment does not encode data immediately upon adding it; instead, it calculates the expected space usage by dynamically calculating the space occupied, and only encodes the recorded data after the conditions are met. This achieves the goal of outputting the locally optimal data segment reassembly result while using limited resources. Specifically:

[0079] The process of the optional embodiments of this application mainly includes:

[0080] (1) Use the reorganization context to record and update various spatial length information during the reorganization process, and manage the data segments that have been added to the context and their mapping relationships;

[0081] The reorganization context can record the information required to complete a data reorganization, including but not limited to: the expected total space occupied by the reorganization, the remaining available space of the reorganization context, the space occupied by the metadata segment, the space occupied by the data segment, the space occupied by the data segment mapping relationship, and the data and mapping relationship information corresponding to the data segment;

[0082] (2) Dynamically calculate the space length occupied by the data and mapping relationship information of the data segment to be added to the reorganization context, and check the adjacency relationship between the data segment to be added to the reorganization context and the data segment already added to the context, so as to determine the addition method of the data segment and the change of the remaining space in the reorganization context;

[0083] Specifically:

[0084] 1) The dynamic reorganization process is based on the information recorded in the reorganization context. During the process of adding data segments one by one, the amount of space occupied by the data and mapping relationship of the corresponding data segment (i.e., the first data segment of this application) is calculated (the amount of space occupied by the data of the data segment is the length of the first data segment of this application). The addition method of the corresponding data segment is determined according to the remaining available space length of the reorganization context. After the data segment is added, the space occupancy information in the reorganization context is updated.

[0085] 2) When processing data segments, if the starting position of a data segment B is the ending position of another data segment A, then the two data segments are considered to be adjacent. These two data segments can be combined into a new data segment C, with the starting position of data segment A and the ending position of data segment B.

[0086] 3) Among them, determining the amount of space occupied by the mapping relationship: Based on the information corresponding to the data segment (i.e. the data information of this application), a mapping relationship information is constructed and actually encoded. The length of the encoded data is taken as the length of space occupied by a mapping relationship information of the data segment.

[0087] 4) In the reorganization context, each data segment is managed according to the business object to which it belongs. Since the space length occupied by a mapping relationship of the data segments of the same business object is the same, it is only necessary to calculate the space length occupied by a mapping relationship of the data segment corresponding to the business object once when adding a new business object and save it in the reorganization context. The saved length information can then be used directly.

[0088] (3) Add the data segments to the reorganization context according to the adjacency relationship between the data segments and the strategy;

[0089] Specifically:

[0090] 1) Figure 3 This is a schematic diagram illustrating the adjacency relationship between data segments according to an optional embodiment of this application, such as... Figure 3 As shown, when adding a data segment to the reorganization context, the system searches the data segment information already saved in the reorganization context for whether there is a data segment that can be adjacent to it (i.e., the second data segment of this application) based on the business object identity identifier corresponding to the data segment, the logical offset position of the data segment, the length of the data segment (i.e., the length of the first data segment of this application), and other information (i.e., the data information of this application).

[0091] If it exists, then there is no need to record an additional mapping relationship information, that is... Figure 3 In (b) and (c), where, Figure 3 In the example, (b) indicates that the end position of data segment 0 is the same as the start position of data segment 1, and (c) indicates that the start position of data segment 0 is the same as the end position of data segment 1.

[0092] If it does not exist, then an additional mapping relationship information needs to be recorded, that is... Figure 3 (d) in the middle;

[0093] Specifically, if this data segment can be adjacent to two adjacent data segments, one less mapping relationship information needs to be recorded, i.e. Figure 3 (a) in the middle.

[0094] 2) When it is necessary to record a mapping relationship information, the space size of the corresponding mapping information is subtracted from the remaining space recorded in the current reorganization context. The remaining space after subtraction is compared with the length of the data segment, and the minimum value is taken as the length of the data segment that can be added. The data segment is truncated and the truncated data segment is added to the reorganization context.

[0095] 3) When it is not necessary to record a mapping relationship information (i.e., "when it is determined that the number of the second data segment is not the target number" in this application), the remaining space amount recorded in the current reorganization context (i.e., the second remaining space length of this application) is compared with the data segment length (i.e., the first data segment length of this application), and the minimum value is taken as the length that the data segment can be added. The data segment is truncated (i.e., the truncation processing of this application), and the truncated data segment is added to the reorganization context.

[0096] 4) When it is necessary to reduce a mapping relationship information (i.e., "when the number of the second data segment is determined to be the target number" in this application), the remaining space recorded in the current reorganization context is added to the space size of the corresponding mapping information (i.e., the minimum data segment length in this application), and the remaining space after the addition (i.e., the sum value in this application) is compared with the data segment length. When the remaining space is less than the data segment length, the lengths of data segments that are not the same object as the data segment and are not adjacent to the data segment (i.e., multiple third data segments in this application) and their corresponding relationships need to be removed sequentially from the recorded data segment information. Starting from the data segment with the smallest length (i.e., the fourth data segment in this application), the removal is checked sequentially until the remaining space can meet the length requirement of the data segment to be added. Then, the data segment is added to the reorganization context.

[0097] The deleted data segment is added back to the data segment queue, ready to be added to the reassembly context again.

[0098] (4) When the data segment recorded in the reconstructed context has met the expected requirements, the reconstructed data segment data and mapping relationship are encoded, and the encoded data segment and mapping relationship offset are output for use by external modules.

[0099] Specifically:

[0100] 1) Determine the order of data encoding for data segments in the reorganization context: When encoding the reorganization context, process the business objects in the order of the records. Multiple data segments within the same business object are processed in the order of logical offset (i.e., the second logical offset position of this application). All recorded data segments are appended to a new data segment N (i.e., the target data segment of this application) in sequence.

[0101] 2) In the process of sequentially appending the recorded data segments to data segment N, first update the physical space offset position in the mapping relationship of the corresponding data segment with the current length of data segment N, and then append the data segment to data segment N. After all data segments have been appended, zeros are added to the end of data segment N as needed (i.e., whether there is still remaining space, etc.) so that the length of data segment N meets the requirements.

[0102] The current length of the data segment N is used as the offset position of the mapping relationship encoding record. The mapping relationship corresponding to the updated data segment is encoded and appended to the data segment N in sequence. After the mapping relationship is encoded, the length of the data segment N should be consistent with the expected length defined by the reorganization context.

[0103] 3) The offset positions of data segment N and the mapping relationship encoding record are output as the result of dynamic reorganization for use by subsequent modules.

[0104] In an optional embodiment of this application, the space length information and data segment information during the reassembly process are managed through a reassembly context. When a data segment is added to the reassembly context, dynamic space occupancy calculation is performed. The addition strategy for the newly added data segment is determined based on the existing data segments in the reassembly context, and the space length information is maintained and updated during addition. When the space occupancy in the reassembly context meets the reassembly requirements, data encoding is performed. During the encoding process, the mapping relationship information between the logical and physical positions of the data segments is updated, and the final mapping relationship is also encoded. After encoding, the encoding result and mapping relationship position information are output as the reassembly result for use by subsequent modules. Through the technical solution of the optional embodiment of this application, the optimal data segment reassembly result can be achieved in a local range under limited resource conditions through dynamic reassembly of data segments.

[0105] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0106] This embodiment also provides a data segment reassembly apparatus for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0107] Figure 4 This is a structural block diagram of a data segment reconstruction apparatus according to an embodiment of this application, such as... Figure 4 As shown, the device includes:

[0108] The splicing module 42 is used to perform a splicing step, wherein the splicing step includes: obtaining a first data segment from the data segment queue and determining the data information of the first data segment; determining, based on the data information, whether there is a second data segment in the reassembly context that is adjacent to the first data segment; if the second data segment exists, splicing the first data segment and the second data segment to obtain an updated reassembly context; determining a first size relationship between the first remaining space length of the updated reassembly context and a space length threshold; wherein the data information includes: a first data segment length, a first business object, and a first logical offset position;

[0109] Loop module 44 is used to repeatedly execute the splicing step when the first size relationship indicates that the first remaining space length is greater than the space length threshold, until it is determined that the first remaining space length is less than or equal to the space length threshold, so as to obtain the target reassembly context;

[0110] The reorganization module 46 is used to reorganize the data segments in the target reorganization context to obtain the reorganized data segments.

[0111] The data segment reassembly apparatus of this application performs a splicing step, including: acquiring a first data segment from a data segment queue and determining the first data segment length, a first service object, and a first logical offset position of the first data segment; determining, based on the first data segment length, the first service object, and the first logical offset position, whether a second data segment with an adjacency relationship to the first data segment exists in the reassembly context; if a second data segment exists, splicing the first data segment and the second data segment to obtain an updated reassembly context; determining a first size relationship between the first remaining space length of the updated reassembly context and a space length threshold; if the first size relationship indicates that the first remaining space length is greater than the space length threshold, repeatedly executing the splicing step until the first remaining space length is less than or equal to the space length threshold, reaching the target reassembly context; and reassembling the final data segments of the target reassembly context to obtain the reassembled context. In other words, this application records data segments in the reassembly context, determines the adjacency relationship between the first data segment and existing data segments in the reassembly context, and then determines the first remaining space length in the reassembly context. If the first remaining space length is greater than a space length threshold, the first data segment is not encoded; instead, new data segments are continuously recorded in the reassembly context until the remaining space length in the reassembly context is less than or equal to the space length threshold. Only then are the data segments in the reassembly context encoded, thus achieving data reassembly of all data segments in the reassembly context. That is, this application does not immediately encode a new data segment upon its addition; instead, it dynamically calculates the first remaining space length of the reassembly context. Encoding is only performed when the first remaining space length is less than or equal to the space length threshold. While the first remaining space length is greater than the space length threshold, new data segments can be continuously added to the reassembly context. During this process, the adjacency relationship between the new data segment and existing data segments in the reassembly context can be determined, achieving optimal data segment reassembly results within a local range. Through the above technical solution, the problem of reassembling a data segment immediately after reading it in related technologies is solved. This leads to the problem of not being able to output good data segment reassembly results, and in turn, it can output good data segment reassembly results.

[0112] In an exemplary embodiment, the splicing module 42 is further configured to determine whether there is a business object consistent with the first business object in the reassembly context; if there is a business object consistent with the first business object, determine the first start position and the first end position of the first data segment based on the first data segment length and the first logical offset position; and determine whether there is a second data segment in the reassembly context based on the first start position and the first end position.

[0113] In an exemplary embodiment, the splicing module 42 is further configured to determine position information corresponding to all data segments in the reassembly context, wherein the position information is used to indicate a second start position and a second end position of each data segment in all data segments; determine whether there is a third start position and / or a third end position in the position information that is consistent with the first start position and / or the first end position; if the existence of the third start position and / or the third end position is determined, the data segment corresponding to the third start position and / or the third end position is determined as the second data segment; if the absence of the third start position and / or the third end position is determined, the second data segment is determined to not exist.

[0114] In an exemplary embodiment, the splicing module 42 is further configured to: determine the number of the second data segments if the second data segments exist; update the target mapping relationship information recorded in the reassembly context according to the number of the second data segments, and determine the second remaining space length of the reassembly context after updating the target mapping relationship information; determine the splicing method of the first data segments and the second data segments according to the second size relationship between the second remaining space length and the length of the first data segments, and splice the first data segments and the second data segments according to the splicing method to obtain the updated reassembly context.

[0115] In an exemplary embodiment, the splicing module 42 is further configured to, when the number of the second data segments is determined to be a target number, determine multiple mapping relationship information corresponding to the second data segments and a third remaining space length of the recombination context, wherein each data segment in the second data segment corresponds to a mapping relationship information, and the third remaining space length is the remaining space length of the recombination context before updating the target mapping relationship; delete any mapping relationship information among the multiple mapping relationship information; determine the space length of the any mapping relationship information, and determine the second remaining space length based on the third remaining space length and the space length.

[0116] In an exemplary embodiment, the splicing module 42 is further configured to splice the first data segment and the second data segment when the second size relationship indicates that the length of the second remaining space is greater than or equal to the length of the first data segment; and to determine the splicing method according to the number of the second data segments when the second size relationship indicates that the length of the second remaining space is less than the length of the first data segment, and to splice the first data segment and the second data segment according to the splicing method.

[0117] In an exemplary embodiment, the splicing module 42 is further configured to perform a deletion step when the number of the second data segments is determined to be a first number. The deletion step includes: determining a plurality of third data segments in the reassembly context, wherein the second business object corresponding to the third data segment is inconsistent with the first business object, and the third data segment does not have the adjacency relationship with the first data segment; sorting the plurality of third data segments according to the second data segment length of each third data segment to determine the minimum data segment length among the plurality of second data segment lengths, and determining a fourth data segment corresponding to the minimum data segment length; deleting the fourth data segment in the reassembly context, and confirming... The process involves: determining the sum of the second remaining space length and the minimum data segment length; comparing the sum with the first data segment length using a third size relationship; if the third size relationship indicates that the sum is less than the first data segment length, repeatedly executing the deletion step until the sum is determined to be greater than or equal to the first data segment length, and then concatenating the first data segment with the second data segment; if the number of the second data segments is determined to be a second number, determining a first difference between the first data segment length and the second remaining space length; truncating the first data segment according to the first difference, and then concatenating the truncated first data segment with the second data segment.

[0118] In an exemplary embodiment, the reassembly module 46 is further configured to determine a third service object corresponding to each data segment in the target reassembly context and a second logical offset position of each data segment; determine the reassembly order of all data segments in the target reassembly context according to the third service object and the second logical offset position, so as to perform the data reassembly on all data segments sequentially according to the reassembly order.

[0119] In an exemplary embodiment, the reorganization module 46 is further configured to, when reorganizing the fifth data segment in the target reorganization context, determine whether it is permissible to add the fifth data segment to the target data segment; if it is determined that it is permissible to add the fifth data segment to the target data segment, add the fifth data segment to the target data segment to update the target data segment; determine whether the length of the third data segment of the updated target data segment is consistent with a preset data segment length; if it is determined that the length of the third data segment is consistent with the preset data segment length, determine the updated target data segment as the reorganized data segment.

[0120] In an exemplary embodiment, the reassembly module 46 is further configured to, when determining that the length of the third data segment is inconsistent with the preset data segment length and the fifth data segment is the last data segment in the reassembly context, determine a second difference between the preset data segment length and the length of the third data segment; perform zero-padding on the updated target data segment according to the second difference to generate a sixth data segment, wherein the length of the fourth data segment of the sixth data segment is consistent with the preset data segment length; and determine the sixth data segment as the reassembled data segment.

[0121] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in the above method embodiments when it is run.

[0122] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.

[0123] Embodiments of this application also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in the above method embodiments.

[0124] In one exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.

[0125] Embodiments of this application also provide a computer program product, including a computer program that, when executed by a processor, is implemented to perform the steps in the above-described method embodiments.

[0126] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.

[0127] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.

[0128] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the principles of this application should be included within the protection scope of this application.

Claims

1. A method for reassembling data segments, characterized in that, include: The splicing steps are as follows: First data segment is obtained from the data segment queue, and its data information is determined; based on the data information, it is determined whether a second data segment with an adjacency to the first data segment exists in the reassembly context; if a second data segment exists, the first data segment and the second data segment are spliced ​​together to obtain the updated reassembly context; a first size relationship is determined between the first remaining space length of the updated reassembly context and a space length threshold; wherein the data information includes: first data segment length, first business object, and first logical offset position; If the first size relationship indicates that the first remaining space length is greater than the space length threshold, the splicing step is executed repeatedly until it is determined that the first remaining space length is less than or equal to the space length threshold, so as to obtain the target reassembly context; Reassemble the data segments in the target reassembly context to obtain the reassembled data segments; Determining whether a second data segment with an adjacency to the first data segment exists in the reorganization context based on the data information includes: Determine whether there is a business object in the reorganization context that is consistent with the first business object; If a business object that is identical to the first business object exists, the first start position and the first end position of the first data segment are determined according to the length of the first data segment and the first logical offset position. Determine whether the second data segment exists in the reorganization context based on the first start position and the first end position; Determining whether the second data segment exists in the reorganization context based on the first start position and the first end position includes: Determine the location information corresponding to all data segments in the reorganization context, wherein the location information is used to indicate the second start position of each data segment in all data segments and the second end position of each data segment in all data segments; Determine whether there exists a third starting position and / or a third ending position in the location information that is consistent with the first starting position and / or the first ending position; If it is determined that the third start position and / or the third end position exist, the data segment corresponding to the third start position and / or the third end position shall be determined as the second data segment; If it is determined that the third start position and / or the third end position do not exist, it is determined that the second data segment does not exist.

2. The method according to claim 1, characterized in that, The first data segment and the second data segment are concatenated to obtain the updated reassembly context, including: If the second data segment exists, determine the number of the second data segments; The target mapping relationship information recorded in the reorganization context is updated according to the number of the second data segments, and the second remaining space length of the reorganization context after updating the target mapping relationship information is determined. The concatenation method of the first data segment and the second data segment is determined based on the second size relationship between the second remaining space length and the first data segment length, and the first data segment and the second data segment are concatenated according to the concatenation method to obtain the updated reorganization context.

3. The method according to claim 2, characterized in that, The target mapping relationship information recorded in the reorganization context is updated according to the number of the second data segments, and the second remaining space length of the reorganization context after updating the target mapping relationship information is determined, including: When the number of the second data segments is determined to be the target number, multiple mapping relationship information corresponding to the second data segments and the third remaining space length of the reorganization context are determined, wherein each data segment in the second data segment corresponds to a mapping relationship information, and the third remaining space length is the remaining space length of the reorganization context before updating the target mapping relationship information; Delete any one of the multiple mapping relationship information; Determine the spatial length of any of the mapping relationship information, and determine the second remaining spatial length based on the third remaining spatial length and the spatial length.

4. The method according to claim 2, characterized in that, The concatenation method of the first data segment and the second data segment is determined based on the second size relationship between the second remaining space length and the first data segment length, and the first data segment and the second data segment are concatenated according to the concatenation method, including: If the second size relationship indicates that the length of the second remaining space is greater than or equal to the length of the first data segment, the first data segment and the second data segment are concatenated. When the second size relationship indicates that the length of the second remaining space is less than the length of the first data segment, the splicing method is determined according to the number of the second data segments, and the first data segment and the second data segment are spliced ​​according to the splicing method.

5. The method according to claim 4, characterized in that, The splicing method is determined based on the number of the second data segments, and the first data segment and the second data segment are spliced ​​together according to the splicing method, including: If the number of the second data segments is determined to be a first number, a deletion step is performed, wherein the deletion step includes: determining a plurality of third data segments in the reorganization context, wherein the second business object corresponding to the third data segment is inconsistent with the first business object, and the third data segment does not have the adjacency relationship with the first data segment; sorting the plurality of third data segments according to the second data segment length of each third data segment to determine the minimum data segment length among the plurality of second data segment lengths, and determining the fourth data segment corresponding to the minimum data segment length; deleting the fourth data segment in the reorganization context, and determining the sum of the second remaining space length and the minimum data segment length; comparing the sum with the third size relationship of the first data segment length; If the third size relationship indicates that the sum is less than the length of the first data segment, the deletion step is executed repeatedly until it is determined that the sum is greater than or equal to the length of the first data segment, and then the first data segment is concatenated with the second data segment; When the number of the second data segments is determined to be the second number, a first difference between the length of the first data segment and the length of the second remaining space is determined; the first data segment is truncated according to the first difference, and the truncated first data segment and the second data segment are spliced ​​together.

6. The method according to claim 1, characterized in that, Reassemble the data segments in the target reassembly context to obtain reassembled data segments, including: Determine the third business object corresponding to each data segment in the target reorganization context and the second logical offset position of each data segment; The reassembly order of all data segments in the target reassembly context is determined based on the third business object and the second logical offset position, so that the data reassembly is performed on all data segments sequentially according to the reassembly order.

7. The method according to claim 1, characterized in that, Reassemble the data segments in the target reassembly context to obtain reassembled data segments, including: In the case of reorganizing the fifth data segment in the target reorganization context, determine whether it is permissible to add the fifth data segment to the target data segment; If it is determined that adding the fifth data segment to the target data segment is permitted, the fifth data segment is added to the target data segment to update the target data segment; Determine whether the length of the third data segment of the updated target data segment is consistent with the preset data segment length; If the length of the third data segment is determined to be consistent with the length of the preset data segment, the updated target data segment is determined as the recombined data segment.

8. The method according to claim 7, characterized in that, After determining whether the length of the third data segment of the updated target data segment is consistent with the preset data segment length, the method further includes: If it is determined that the length of the third data segment is inconsistent with the preset data segment length, and the fifth data segment is the last data segment in the recombination context, a second difference between the preset data segment length and the length of the third data segment is determined; The updated target data segment is padded with zeros based on the second difference to generate a sixth data segment, wherein the length of the fourth data segment of the sixth data segment is the same as the preset data segment length. The sixth data segment is identified as the recombined data segment.

9. A data segment reassembly apparatus, characterized in that, include: A splicing module is used to perform a splicing step, wherein the splicing step includes: obtaining a first data segment from a data segment queue and determining the data information of the first data segment; determining, based on the data information, whether there is a second data segment in the reassembly context that is adjacent to the first data segment; if the second data segment exists, splicing the first data segment and the second data segment to obtain an updated reassembly context; determining a first size relationship between the first remaining space length of the updated reassembly context and a space length threshold; wherein the data information includes: a first data segment length, a first business object, and a first logical offset position; The loop module is used to repeatedly execute the splicing step when the first size relationship indicates that the first remaining space length is greater than the space length threshold, until it is determined that the first remaining space length is less than or equal to the space length threshold, so as to obtain the target reassembly context; The reassembly module is used to reassemble data segments in the target reassembly context to obtain reassembled data segments; The splicing module is further configured to determine whether there is a business object consistent with the first business object in the reassembly context; if there is a business object consistent with the first business object, determine the first start position and the first end position of the first data segment based on the first data segment length and the first logical offset position; and determine whether there is a second data segment in the reassembly context based on the first start position and the first end position. The splicing module is further configured to determine the position information corresponding to all data segments in the reassembly context, wherein the position information is used to indicate the second start position and the second end position of each data segment in all data segments; determine whether there is a third start position and / or a third end position in the position information that is consistent with the first start position and / or the first end position; if the third start position and / or the third end position is determined to exist, the data segment corresponding to the third start position and / or the third end position is determined to be the second data segment; if the third start position and / or the third end position is determined not to exist, the second data segment is determined not to exist.

10. A computer-readable storage medium, characterized in that, include: The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the method according to any one of claims 1 to 8.

11. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, include: When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 8.