A file sorting method, system, device and storage medium

By using hash algorithm to sort inside and outside the shard in a distributed file system, the difficulty of reading caused by file disorder is solved, and the orderly arrangement and efficient acquisition of files are achieved.

CN115934643BActive Publication Date: 2025-07-04JINAN INSPUR DATA TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310018042.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-06
Publication Date
2025-07-04
Estimated Expiration
2043-01-06

AI Technical Summary

Technical Problem

In distributed file systems, the distribution of files is usually disordered, resulting in the distributed object system being unable to read files effectively, and it is difficult for the prior art to implement the sorting of files to meet the protocol requirements of the distributed object system.

Method used

The files are processed by the hashing algorithm, and after receiving the file read instruction, they are sorted within and between slices to ensure that the files are arranged in an orderly manner within the primary preset interval range according to the expected sorting method.

Benefits of technology

It realizes orderly sorting of files, which facilitates the efficient acquisition of required files by distributed object systems, and improves file reading efficiency and system interoperability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115934643B_ABST
    Figure CN115934643B_ABST
Patent Text Reader

Abstract

The present invention discloses a file sorting method, system, device and storage medium, relating to the field of server storage. After receiving a primary file reading instruction, first perform in-slice file sorting, that is, sort the file order of each file in each slice respectively according to the expected sorting method, and then perform inter-slice file sorting. Specifically, sequentially obtain from each slice the first target files whose file order is not greater than the primary maximum value within the primary preset interval range corresponding to the primary file reading instruction, and then obtain from each of the first target files the second target files whose file order is not greater than the primary maximum value, so as to determine the primary expected files in the second target files. By sequentially performing in-slice sorting and inter-slice sorting, obtain from each unordered file the primary expected files whose file order is within the primary preset interval range after being sorted according to the expected sorting method, thereby realizing the sorting of files and facilitating the acquisition of files in order.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of server storage, and particularly to a file sorting method, system, device and storage medium. Background Art

[0002] In current distributed systems, distributed systems can be divided into distributed object systems and distributed file systems. In distributed file systems, the distribution of each file in memory is usually disordered. Due to the protocol requirements of distributed object systems, when a distributed object system reads files from a distributed file system, the read file directory needs to be sorted according to the sorting method corresponding to the protocol of the distributed object system. Therefore, how to sort each file in the distributed file system so that the distributed object system can read the files in the distributed file system is an urgent problem to be solved by those skilled in the art. Summary of the Invention

[0003] The purpose of the present invention is to provide a file sorting method, system, device and storage medium. By performing in-slice sorting and inter-slice sorting in sequence, primary expected files whose file order is within the primary preset interval range after sorting according to the expected sorting method are obtained from each disordered file, so as to realize the sorting of files and facilitate the acquisition of files in order.

[0004] To solve the above technical problems, the present invention provides a file sorting method, including:

[0005] After receiving a primary file reading instruction, sort the file order of each file in each slice after the attribution slicing process of each file using a hash algorithm according to the expected sorting method, and the expected sorting method corresponds to the primary file reading instruction;

[0006] Sequentially obtain first target files from each of the slices whose file order is not greater than the primary maximum value of the primary preset interval range corresponding to the primary file reading instruction, and sort each of the first target files according to the expected sorting method to determine second target files among each of the first target files whose file order is not greater than the primary maximum value;

[0007] Obtain primary expected files from each of the second target files whose file order is within the primary preset interval range.

[0008] Preferably, after obtaining primary expected files from each of the second target files whose file order is within the primary preset interval range, it further includes:

[0009] Determine the maximum file order in each of the second target files;

[0010] If a post-stage file reading instruction is received, it is determined whether the post-stage maximum value within the post-stage preset interval range corresponding to the post-stage file reading instruction is not greater than the maximum file sequence;

[0011] If so, obtain post-stage expected files from each of the second target files whose file sequences are within the post-stage preset interval range.

[0012] Preferably, after receiving a post-stage file reading instruction and determining whether the post-stage maximum value within the post-stage preset interval range corresponding to the post-stage file reading instruction is not greater than the maximum file sequence, it further includes:

[0013] If not, sequentially obtain third target files from each of the slices whose file sequences are not greater than the post-stage maximum value, sort each of the third target files according to the expected sorting method, and determine fourth target files from each of the third target files whose file sequences are not greater than the post-stage maximum value;

[0014] Obtain post-stage expected files from each of the fourth target files whose file sequences are within the post-stage preset interval range.

[0015] Preferably, obtaining primary expected files from each of the second target files whose file sequences are within the primary preset interval range includes:

[0016] Determine the primary minimum value within the primary preset interval range;

[0017] Set each of the second target files in each of the second target files whose file sequences are not less than the primary minimum value and not greater than the primary maximum value as the primary expected files.

[0018] Preferably, the expected sorting method is the lexicographical sorting method.

[0019] Preferably, before sorting the file sequences of the files in each of the slices after processing each file for belonging to slices using the hash algorithm according to the expected sorting method, and the expected sorting method corresponds to the primary file reading instruction, it further includes:

[0020] Using the hash algorithm, assign each of the files to each of the slices according to the logical slice number of each of the files.

[0021] Preferably, sequentially obtaining first target files from each of the slices whose file sequences are not greater than the primary maximum value within the primary preset interval range corresponding to the primary file reading instruction, and sorting each of the first target files according to the expected sorting method, and determining second target files from each of the first target files whose file sequences are not greater than the primary maximum value includes:

[0022] S701: Sort each of the slices, and set the first slice as the current slice;

[0023] S702: Obtain each of the first target files in the current slice whose file order is not greater than the primary maximum value;

[0024] S703: Determine whether the current slice is the last slice. If not, proceed to step S704; if so, proceed to step S707;

[0025] S704: Set the first target file with the file order of the primary maximum value among each of the first target files as the cursor file;

[0026] S705: Set the next slice of the current slice as the current slice in the order of each slice;

[0027] S706: Add each file in the current slice whose file order is less than the file order of the cursor file to the first target files, sort the updated first target files according to the expected sorting method, and return to step S703;

[0028] S707: Set each of the first target files as the second target file.

[0029] To solve the above technical problems, the present invention provides a file sorting system, including:

[0030] A sorting unit, configured to, after receiving a primary file reading instruction, sort the file orders of the files in each of the slices obtained by subjecting each file to attribution slicing processing using a hash algorithm respectively according to an expected sorting method, where the expected sorting method corresponds to the primary file reading instruction;

[0031] A first obtaining unit, configured to sequentially obtain first target files from each of the slices whose file orders are less than the primary maximum value of the primary preset interval range corresponding to the primary file reading instruction, and sort each of the first target files according to the expected sorting method to determine second target files among each of the first target files whose file orders are less than the primary maximum value;

[0032] A second obtaining unit, configured to obtain primary expected files from each of the second target files whose file orders are within the primary preset interval range.

[0033] To solve the above technical problems, the present invention provides a file sorting device, including:

[0034] A memory, configured to store a computer program;

[0035] A processor for implementing the steps of the file sorting method as described above when executing the computer program.

[0036] To solve the above technical problems, the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the file sorting method as described above are implemented.

[0037] The present application provides a file sorting method, system, device and storage medium, which relates to the field of server storage. After receiving a primary file reading instruction, first perform in-slice file sorting, that is, sort the file order of each file in each slice respectively according to the expected sorting method, and then perform inter-slice file sorting. Specifically, sequentially obtain from each slice the first target files whose file order is not greater than the primary maximum value within the primary preset interval range corresponding to the primary file reading instruction, and then obtain the second target files from each of the first target files whose file order is not greater than the primary maximum value, so as to determine the primary expected files in the second target files. By sequentially performing in-slice sorting and inter-slice sorting, each primary expected file whose file order is within the primary preset interval range after being sorted according to the expected sorting method is obtained from each unordered file, thereby realizing the sorting of files and facilitating the acquisition of files in order. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for use in the prior art and the embodiments. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0039] Figure 1 A schematic flowchart of a file sorting method provided by the present invention;

[0040] Figure 2 A schematic diagram of using a hash algorithm for attribution slice processing provided by the present application;

[0041] Figure 3 A specific schematic flowchart of a file sorting method provided by the present invention;

[0042] Figure 4 A schematic structural diagram of a file sorting system provided by the present invention;

[0043] Figure 5 A schematic structural diagram of a file sorting device provided by the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0044] The core of the present invention is to provide a file sorting method, system, device and storage medium. By performing in-segment sorting and inter-segment sorting in sequence, primary expected files whose file order is within the primary preset interval range can be obtained from each unordered file after sorting according to the expected sorting method, so as to realize the sorting of files and facilitate the acquisition of files in sequence.

[0045] To make the objectives, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some but not all of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0046] Please refer to Figure 1 , Figure 1 which is a schematic flowchart of a file sorting method provided by the present invention. The method includes:

[0047] S11: After receiving a primary file reading instruction, sort the file orders of the files in each of the segments obtained by subjecting each file to attribution segmentation processing using a hash algorithm respectively according to the expected sorting method, and the expected sorting method corresponds to the primary file reading instruction;

[0048] In the prior art, the distribution of each file in a distributed file system in memory is disordered. However, the protocol in a distributed object system requires that when calling a file in the distributed file system, it needs to be called in the order specified by the protocol. Therefore, the disordered files in the distributed file system in the prior art are not convenient for the distributed object system to call files.

[0049] To solve the above technical problem, the present application sorts each file in the distributed file system. Specifically, after receiving a primary file reading instruction, that is, the first file reading instruction sent by the distributed object system, it will first use a hash algorithm to perform attribution segmentation processing on each file in the distributed file system. It should be noted that the attribution segmentation processing may also have been performed before receiving the file reading instruction. Each file is divided into multiple segments, and the file orders of the files in each segment are sorted first, specifically according to the expected sorting method of the primary file reading instruction. The sorting method here can be but is not limited to the lexicographical sorting method. The lexicographical sorting method can sort according to the file names of the files, such as File 1, File 2, and File 3, etc., or it can be determined according to the specific sorting method requirements of the primary file reading instruction.

[0050] It should be noted that in a distributed file system, the maximum number of files in a directory is one million. To break through this limit, when the number of files in a directory reaches a certain quantity, the directory attribution sharding process will be triggered. A logical directory (the directory form presented externally) can be divided into multiple actual subdirectories to store these files separately. When the number of files in these subdirectories reaches a certain quantity, the directory sharding process will be triggered again and split once more.

[0051] The distributed file system currently uses the hash calculation method to implement the attribution mapping of files to the directory shards they belong to. This results in the files being disordered within a directory shard and between different directory shards. Please refer to Figure 2 , Figure 2 which is a schematic diagram of the attribution sharding process using the hash algorithm provided in this application. It can be seen that the order of the files in each shard is disordered, which is not convenient for sequential reading.

[0052] S12: Sequentially obtain from each shard the first target files whose file order is not greater than the primary maximum value within the primary preset range corresponding to the primary file reading instruction, and sort the first target files according to the expected sorting method to determine the second target files among the first target files whose file order is not greater than the primary maximum value;

[0053] After sorting the files within each shard, sequentially obtain from each shard the first target files whose file order is not greater than the primary maximum value within the primary preset range, and perform inter-shard sorting on the first target files obtained from each shard, so as to determine from the first target files the second target files whose file order is not greater than the primary maximum value. Among the second target files, there are the primary expected files whose file order is within the primary preset range.

[0054] S13: Obtain from each second target file the primary expected files whose file order is within the primary preset range.

[0055] Since each second target file includes the primary expected files whose file order is within the primary preset range, and the file order of each second target file is sorted according to the expected sorting method, the primary expected files whose file order is within the primary preset range can be determined according to the file order of each second target file, thus realizing the sorting of the files and obtaining the sorted primary expected files, which is convenient for the distributed object system to obtain the primary expected files.

[0056] It should be noted that in the algorithm for file sorting, it can be divided into the LIB layer (the intermediate library file between the MDS and osd in the distributed file system and the upper-layer application, providing various interfaces to the upper-layer application) and the MDS layer (Metadata Server, the metadata service in the distributed file system). The MDS layer is responsible for sorting the files within each shard. After receiving the primary file reading instruction, the LIB layer sends a request to the MDS layer to obtain the first target file. After receiving the first target file sent by the MDS, the LIB layer performs inter-shard sorting. The sorted second target files are stored in the LIB layer and uploaded to the host computer so that the host computer can send them to the distributed object system.

[0057] Among them, the protocol of the distributed object system can be the S3 protocol, and the protocol of the distributed file system can be the NAS protocol. Through file sorting, the distributed object system with the S3 protocol can communicate with the distributed file system with the NAS protocol.

[0058] In summary, in this embodiment, after receiving the primary file reading instruction, first perform in-shard file sorting, that is, sort the file order of each file in each shard according to the expected sorting method respectively, and then perform inter-shard file sorting. Specifically, obtain the first target file whose file order is not greater than the primary maximum value within the primary preset interval range corresponding to the primary file reading instruction from each shard in turn, and then obtain the second target file whose file order is not greater than the primary maximum value from each first target file, so as to determine the primary expected file in the second target file. By performing in-shard sorting and inter-shard sorting in turn, obtain each primary expected file whose file order is within the primary preset interval range after being sorted according to the expected sorting method from each unordered file, so as to realize the sorting of the files and facilitate the acquisition of the files in order.

[0059] Based on the above embodiment:

[0060] As a preferred embodiment, after obtaining the primary expected file whose file order is within the primary preset interval range from each second target file, it further includes:

[0061] Determine the maximum file order in each second target file;

[0062] If a subsequent file reading instruction is received, then determine whether the subsequent maximum value within the subsequent preset interval range corresponding to the subsequent file reading instruction is not greater than the maximum file order;

[0063] If so, obtain the subsequent expected file whose file order is within the subsequent preset interval range from each second target file.

[0064] After sorting each second target file and determining each primary expected file whose file order is within the range of the primary preset interval, if a subsequent file reading instruction is received again, it is possible to first determine whether the second target file includes a subsequent expected file whose file order is within the range of the subsequent preset interval. If it includes, the subsequent expected files can be directly obtained from the second target file according to the file order of the second target file, without the need for inter-shard sorting, improving the file acquisition efficiency.

[0065] Specifically, the maximum file order in the second target file can be determined. If the subsequent maximum value within the range of the subsequent preset interval is not greater than the maximum file order, it can be determined whether the second target file includes each subsequent expected file. Also, since the minimum file order in the second target file is the file with the smallest file order among all files in all shards, which can be considered the first file, the second target file includes the files from the first file to the file with the maximum file order, completely including each subsequent expected file within the range of the subsequent preset interval.

[0066] It should be noted that since the LIB layer stores each second target file, the LIB layer can no longer perform inter-shard file sorting and can directly determine the subsequent expected files from each second target file stored in the LIB layer, improving the file processing efficiency.

[0067] As a preferred embodiment, after receiving a subsequent file reading instruction and determining whether the subsequent maximum value within the range of the subsequent preset interval corresponding to the subsequent file reading instruction is not greater than the maximum file order, it further includes:

[0068] If not, obtain each third target file whose file order is not greater than the subsequent maximum value from each shard, and sort each third target file according to the expected sorting method to determine the fourth target file whose file order is not greater than the subsequent maximum value among each third target file;

[0069] Obtain the subsequent expected files whose file order is within the range of the subsequent preset interval from each fourth target file.

[0070] If the range of the subsequent preset interval exceeds the file range included in the second target file, it is also necessary to re-obtain each third target file corresponding to the range of the subsequent preset interval from each shard, perform inter-shard sorting on each third target file, determine the fourth target file, so as to obtain the subsequent expected files whose file order is within the range of the subsequent preset interval from each fourth target file.

[0071] It should be noted that when obtaining the third target file, the files obtained can be directly added to the second target file for sorting according to the files in each slice whose file order is greater than the maximum file order but not greater than the maximum value of the suffix, that is, only the files greater than the maximum file order but not greater than the maximum value of the suffix need to be sorted, so as to improve the efficiency of file sorting.

[0072] As a preferred embodiment, obtaining the primary expected files whose file orders are within the primary preset interval range from each second target file includes:

[0073] Determining the primary minimum value of the primary preset interval range;

[0074] Setting each second target file whose file order is not less than the primary minimum value and not greater than the primary maximum value in each second target file as the primary expected file.

[0075] After determining each second target file whose file order is in the expected sorting manner, when determining the primary expected files from the second target files, since the maximum file order of the second target files is not greater than the primary maximum value, it can be determined that the file with the maximum file order in the second target files is the primary expected file with the largest file order. Then, by determining the files in the second target files whose file order is not less than the primary minimum value, the primary expected files within the primary preset interval range in the second target files are demarcated, which is convenient for the distributed object system to call the primary expected files in an orderly manner.

[0076] It should be noted that if the primary minimum value is one, then each second target file is the primary expected file.

[0077] As a preferred embodiment, before sorting the file orders of the files in each slice after processing each file for belonging to slices by using the hash algorithm in the expected sorting manner after receiving the primary file reading instruction, and the expected sorting manner corresponds to the primary file reading instruction, it further includes:

[0078] Using the hash algorithm, each file is respectively attributed to each slice according to the logical slice number of each file.

[0079] In this embodiment, the belonging slice processing of each file is performed before receiving the primary file reading instruction. Specifically, each file has its own corresponding logical slice number. When performing the belonging slice processing on the file, it can be sliced according to the logical slice number. However, the file orders of the files in the slice after slicing are in the order of the logical slice number, and this order is transparent to the user. Therefore, for the user, each file is still in a disordered state. However, after slicing, it is convenient for the large-scale storage of files. Therefore, the belonging slice processing is also essential.

[0080] Please refer to Figure 3 , Figure 3 which is a specific process schematic diagram of a file sorting method provided by the present invention.

[0081] As a preferred embodiment, sequentially obtain from each slice the first target files whose file sequence is not greater than the primary maximum value corresponding to the primary file reading instruction in the primary preset range, and sort each first target file according to the expected sorting method to determine the second target files in each first target file whose file sequence is not greater than the primary maximum value, including:

[0082] S701: Sort each slice, and set the first slice as the current slice;

[0083] S702: Obtain each first target file in the current slice whose file sequence is not greater than the primary maximum value;

[0084] S703: Determine whether the current slice is the last slice. If not, go to step S704; if so, go to step S707;

[0085] S704: Set the first target file with the file sequence of the primary maximum value in each first target file as the cursor file;

[0086] S705: Set the next slice of the current slice as the current slice in the order of each slice;

[0087] S706: Add each file in the current slice whose file sequence is less than the file sequence of the cursor file to the first target file, sort the updated first target files according to the expected sorting method, and return to step S703;

[0088] S707: Set each first target file as the second target file.

[0089] This embodiment provides a specific method for sorting among shards, that is, first obtain each first target file in the first shard whose file order is not greater than the primary maximum value. After sorting each first target file, determine the first target file with the file order of the primary maximum value in the first target files and set it as the cursor file. Then, obtain each first target file in the second shard whose file order is less than the file order of the cursor file, add it to the original first target files and sort again to re-determine the new cursor file. Then, obtain each first target file in the third shard whose file order is less than the file order of the cursor file, add it to the original first target files and sort again to re-determine the new cursor file, until obtaining each first target file in the last shard whose file order is less than the file order of the cursor file, add it to the original first target files and sort again to determine each second target file with the file order of the primary maximum value, and each second target file is a file sorted in the expected sorting manner, and each primary expected file can be directly located from each second target file, reducing the number of sorting times.

[0090] Of course, it is also possible to obtain each first target file in each shard whose file order is not greater than the primary maximum value at one time and directly perform the overall file sorting process, but this method is more complex.

[0091] Please refer to Figure 4 , Figure 4 which is a schematic structural diagram of a file sorting system provided by the present invention. The structure includes:

[0092] A sorting unit 41, configured to, after receiving a primary file reading instruction, sort the file orders of the files in each shard after the attribution sharding process of each file using a hash algorithm respectively in the expected sorting manner, and the expected sorting manner corresponds to the primary file reading instruction;

[0093] A first obtaining unit 42, configured to sequentially obtain from each shard the first target files whose file order is less than the primary maximum value of the primary preset interval range corresponding to the primary file reading instruction, and sort each first target file in the expected sorting manner to determine the second target files whose file order is less than the primary maximum value in each first target file;

[0094] A second obtaining unit 43, configured to obtain the primary expected files whose file order is within the primary preset interval range from each second target file.

[0095] For the introduction of a file sorting system provided by the present invention, please refer to the above method embodiment, and the present invention will not be elaborated herein.

[0096] Please refer to Figure 5 , Figure 5The structural schematic diagram of a file sorting device provided by the present invention, the device includes:

[0097] A memory 51 for storing computer programs;

[0098] A processor 52 for implementing the steps of the above file sorting method when executing the computer program.

[0099] For the introduction of a file sorting device provided by the present invention, please refer to the above method embodiments, and the present invention will not be elaborated herein.

[0100] A computer program is stored on the computer-readable storage medium in the present invention, and when the computer program is executed by a processor, the steps of the above file sorting method are implemented.

[0101] For the introduction of the computer-readable storage medium provided by the present invention, please refer to the above method embodiments, and the present invention will not be elaborated herein.

[0102] It should also be noted that in this specification, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or also includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of additional identical elements in the process, method, article or device including the said element.

[0103] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to these embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A file sorting method, characterized in that, Including: After receiving the primary file reading instruction, the file orders of the files in each of the slices obtained by subjecting each file to attribution slicing using a hash algorithm are sorted respectively according to the expected sorting method, and the expected sorting method corresponds to the primary file reading instruction; wherein, before receiving the initial file reading instruction, each of the files is attributed to each of the slices according to the logical slice numbers of the files using the hash algorithm. Sequentially obtain from each of the slices first target files whose file orders are not greater than the primary maximum value within the primary preset interval range corresponding to the primary file reading instruction, and sort each of the first target files according to the expected sorting method to determine second target files among each of the first target files whose file orders are not greater than the primary maximum value; specifically including the following steps: S701: Sort each of the slices, and set the first slice as the current slice. S702: Obtain from the current slice each of the first target files whose file orders are not greater than the primary maximum value. S703: Determine whether the current slice is the last slice. If not, proceed to step S704; if so, proceed to step S707. S704: Set the first target file among each of the first target files whose file order is the primary maximum value as the cursor file. S705: Set the next slice of the current slice as the current slice according to the order of each of the slices. S706: Add to the first target files each of the files in the current slice whose file order is less than the file order of the cursor file, sort the updated first target files according to the expected sorting method, and return to step S703. S707: Set each of the first target files as the second target files. Obtain from each of the second target files primary expected files whose file orders are within the primary preset interval range.

2. The file sorting method according to claim 1, wherein After obtaining from each of the second target files primary expected files whose file orders are within the primary preset interval range, further including: Determine the maximum file order in each of the second target files. If a subsequent file reading instruction is received, determine whether the subsequent maximum value within the subsequent preset interval range corresponding to the subsequent file reading instruction is not greater than the maximum file order. If so, obtain from each of the second target files subsequent expected files whose file orders are within the subsequent preset interval range.

3. The file sorting method according to claim 2, characterized in that After determining whether the subsequent maximum value within the subsequent preset interval range corresponding to the subsequent file reading instruction is not greater than the maximum file order if a subsequent file reading instruction is received, further including: If not, sequentially obtain from each of the slices third target files whose file orders are not greater than the subsequent maximum value, and sort each of the third target files according to the expected sorting method to determine fourth target files among each of the third target files whose file orders are not greater than the subsequent maximum value. Obtain the subsequent expected files whose file order is within the range of the subsequent preset interval from each of the fourth target files.

4. The file sorting method according to claim 1, wherein Obtain the primary expected files whose file order is within the range of the primary preset interval from each of the second target files, including: Determine the primary minimum value of the primary preset interval range; Set each of the second target files whose file order is not less than the primary minimum value and not greater than the primary maximum value among each of the second target files as the primary expected files.

5. The document sorting method according to claim 1, wherein The expected sorting method is the lexicographical sorting method.

6. A file sorting system, characterized in that, Including: A sorting unit, configured to, after receiving a primary file reading instruction, sort the files in each of the slices after the files are assigned to slices by using a hash algorithm according to the expected sorting method, and the expected sorting method corresponds to the primary file reading instruction; wherein, before receiving the initial file reading instruction, each of the files is assigned to each of the slices according to the logical slice number of each of the files by using the hash algorithm; A first obtaining unit, configured to sequentially obtain the first target files whose file order is less than the primary maximum value of the primary preset interval range corresponding to the primary file reading instruction from each of the slices, and sort each of the first target files according to the expected sorting method to determine the second target files whose file order is less than the primary maximum value among each of the first target files; the first obtaining unit is specifically configured to perform the following steps: S701: Sort each of the slices, and set the first slice as the current slice; S702: Obtain each of the first target files whose file order in the current slice is not greater than the primary maximum value; S703: Determine whether the current slice is the last slice, if not, proceed to step S704, if so, proceed to step S707; S704: Set the first target file whose file order is the primary maximum value among each of the first target files as the cursor file; S705: Set the next slice of the current slice as the current slice according to the order of each of the slices; S706: Add each of the files whose file order in the current slice is less than the file order of the cursor file to the first target files, sort the updated first target files according to the expected sorting method, and return to step S703; S707: Set each of the first target files as the second target files; A second obtaining unit, configured to obtain the primary expected files whose file order is within the range of the primary preset interval from each of the second target files.

7. A file sorting device, characterized in that, Including: A memory, configured to store a computer program; A processor, configured to implement the steps of the file sorting method according to any one of claims 1 to 5 when executing the computer program.

8. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and when the computer program is executed by the processor, the steps of the file sorting method according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Data sorting method and device for relational database

    CN114461173A