Catalog information management method, electronic device, storage medium, and program product
By using a target stack and a directory information table in directory information management, the update process of leaf directories is filtered, which solves the problem of low efficiency in directory information management in storage systems and achieves more efficient directory management and updates.
Patent Information
- Application Number
- CN202511232951.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-29
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2045-08-29
AI Technical Summary
In existing technologies, the management efficiency of directory information in storage systems is low, especially when traversing the entire storage system, which requires scanning each directory one by one, resulting in low efficiency.
By using a target stack to record the directories that need to be traversed in the storage system, updating the directory information table based on the popped directory, and pushing the target subdirectory of the popped directory onto the stack when it is a non-leaf directory, the update process of leaf directories is filtered out, thus improving the efficiency of directory management.
It effectively reduces the number of directories traversed, improves the efficiency of directory information management, reduces the access pressure on the storage system, and improves the accuracy and speed of directory management.
Smart Images

Figure CN120743912B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data storage, and particularly relates to a directory information management method, an electronic device, a storage medium and a program product. BACKGROUND
[0002] With the rapid development of computer technology, a large amount of data is generated, and data storage and management become an important function affecting the performance of a server. In general, data is stored in a file, and the file can be stored in a directory.
[0003] In the related art, a storage system can be scanned one by one to determine information of each storage file and / or information of a storage directory. The information can include, but is not limited to, last modification time, data volume, user information, and the like. However, the above scheme has the problem of relatively low efficiency. SUMMARY
[0004] The present application provides a directory information management method, an electronic device, a storage medium and a program product, to improve the efficiency of directory information management.
[0005] The present application provides a directory information management method, comprising:
[0006] an outstack directory is obtained from a top of a target stack, the target stack being used for recording a directory to be traversed in a directory management process of a storage system; a target subdirectory of the outstack directory is determined from a directory information table and the storage system according to a last modification time of the outstack directory in the directory information table and a last modification time of the outstack directory in the storage system, the directory information table being used for recording information of a directory in the storage system; the target subdirectory is stored in the target stack when information of the target subdirectory in the directory information table meets a stacking condition, the stacking condition including that a level of the target subdirectory in the directory information table corresponds to a non-leaf directory; and the directory information table is updated according to the outstack directory.
[0007] The present application further provides a directory information management apparatus, comprising:
[0008] a directory extraction module, configured to obtain an outstack directory from a top of a target stack, the target stack being used for recording a directory to be traversed in a directory management process of a storage system.
[0009] a subdirectory determination module, configured to determine a target subdirectory of the outstack directory from a directory information table and the storage system according to a last modification time of the outstack directory in the directory information table and a last modification time of the outstack directory in the storage system, the directory information table being used for recording information of a directory in the storage system.
[0010] The in-stacking module is configured to store the target subdirectory into the target stack when information of the target subdirectory in the directory information table meets in-stacking conditions, and the in-stacking conditions include that a level of the target subdirectory in the directory information table corresponds to a non-leaf directory.
[0011] The updating module is configured to update the directory information table according to the out-stacked directory.
[0012] The present application further provides an electronic device, including a memory configured to store a computer program, and a processor configured to execute the computer program to implement steps of any of the directory information management methods.
[0013] The present application further provides a computer readable storage medium, and the computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement steps of any of the directory information management methods.
[0014] The present application further provides a computer program product, and the computer program product includes a computer program, and the computer program is executed by a processor to implement steps of any of the directory information management methods.
[0015] The present application embodiment filters leaf nodes by identifying leaf directories in the level of the directory information table, so that subsequent judgment and processing of the leaf nodes are avoided, and the directory information updating efficiency can be improved. BRIEF DESCRIPTION OF DRAWINGS
[0016] In order to more clearly illustrate the present application, the following will briefly introduce the drawings needed to be used in the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort.
[0017] Figure 1 A scenario schematic diagram provided by the present application;
[0018] Figure 2 A structure schematic diagram of a directory information table provided by the present application embodiment;
[0019] Figure 3 A step flowchart of a directory information management method provided by the present application;
[0020] Figure 4 A flowchart of a directory information management method provided by the present application;
[0021] Figure 5 A schematic diagram of a directory quantity in a level provided by the present application;
[0022] Figure 6 A structure schematic diagram of a metadata table provided by the present application embodiment;
[0023] Figure 7 A schematic diagram of the structure of a catalog information management device provided in this application;
[0024] Figure 8 This is a schematic diagram of the structure of an electronic device provided in this application. Detailed Implementation
[0025] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of this application.
[0026] It should be noted that, in the description of this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. The terms "first," "second," etc., in this application are used to distinguish similar objects and are not used to describe a specific order or sequence.
[0027] This application embodiment is used to perform information statistics on directories stored on the storage system and record them in the directory information table.
[0028] Figure 1 A scenario illustration provided for this application, such as Figure 1 As shown, the specific application scenario of this application involves storage systems and databases. Here, the storage system is used to store directories, the directories are used to store files, and the files contain data. (See reference...) Figure 1 As shown, an exemplary representation of the directories included in the storage system is provided, forming a tree structure. These different directories form a parent-child relationship. Specifically, the root directory C0 is the parent directory of directories C1 and C2, and directories C1 and C2 are child directories of the root directory C0. Similarly, directory C1 is the parent directory of directories C3, C4, C5, and C6, and directories C3, C4, C5, and C6 are child directories of directory C1; directory C2 is the parent directory of directories C7 and C8, and directories C7 and C8 are child directories of directory C2; directory C5 is the parent directory of directories C9, C10, and C11, and directories C9, C10, and C11 are child directories of directory C5.
[0029] The above directories C3, C4, C6, C7, C8, C9, C10 and C11 are all leaf directories, which are directories without subdirectories, that is, only files are stored under the leaf directories, and no directories are stored under the leaf directories.
[0030] In order to manage the above directories in the above storage system, some related technologies usually scan the directories in the storage system one by one to count the data amount. However, this solution needs to traverse the entire storage system, resulting in relatively low efficiency. The embodiments of the present application record the directories that need to be traversed in the storage system through a target stack, so as to update the directory information table according to the directories when they are popped out of the stack, and when the target subdirectory of the popped-out directory is a leaf directory, the target subdirectory of the popped-out directory is not pushed into the stack, but when the target subdirectory of the popped-out directory is a non-leaf directory, the target subdirectory of the popped-out directory is pushed into the stack. In this way, the directory information table is not updated according to the leaf directory, the updating process of filtering out the leaf directory is realized, and the directory management efficiency is improved.
[0031] Referring to Figure 1 The embodiments of the present application set a directory information table in the database to record the information of the directories stored in the storage system. In order to distinguish the directories in the directory information table and the directories in the storage system, the directories in the directory information table can be called recorded directories, and the directories in the storage system are called real directories. In an ideal case, the recorded directories and the real directories are consistent, but after the real directories are updated in the storage system and before the directory information table is updated, the two may not be consistent. For example, when a real directory is deleted in the storage system, the recorded directory corresponding to the real directory is not deleted, so that the recorded directory does not exist in the storage system corresponding to the real directory; when a real directory is added in the storage system, the information of the recorded directory corresponding to the real directory is not added to the directory information table, so that the real directory does not exist in the directory information table corresponding to the recorded directory; when the content of a real directory is updated in the storage system, but the information of the recorded directory corresponding to the real directory is not updated in the directory information table, so that the information of the real directory and the information of the recorded directory are inconsistent.
[0032] The above database can be any database, which can usually be a SQLite database, which is a lightweight SQL (Structured Query Language) database.
[0033] Referring to Figure 2As shown, the directory information table is described from the field name, meaning and purpose, and example description in the directory information table. The above recorded directory information can include but is not limited to: directory number id, directory path path, last modification time last_modify_time, directory data size size, last directory data size last_size, home user identification owner, level level, parent directory path parent_path, record update time update_time.
[0034] The directory number is used to uniquely represent a recorded directory, and the directory number can be a positive integer greater than or equal to 1. Each time a recorded directory is added, the corresponding directory number is incremented by 1. For example, the directory number of the first recorded directory can be 1. Figure 2 As shown.
[0035] The directory path is the path of the recorded directory, which is composed of the name of the current recorded directory and the names of its multiple upper directories, and is updated with the path of the directory in the storage system. For example, as shown in Figure 2 / dir1 / dir2 / dir3, where dir1 and dir2 are the names of the upper directories, and dir3 is the name of the recorded directory.
[0036] The last modification time is the time of the last update of the content in the recorded directory, which can be updated according to the update of the corresponding directory in the storage system. For example, if the last time a subdirectory is added to the recorded directory is T1, the last modification time of the recorded directory can be updated to T1 when updating the directory information table. For example, as shown in Figure 2 1667288616000 is the last modification time.
[0037] The directory data size is the data size included in the recorded directory, which can also be referred to as the recorded directory size. For example, as shown in Figure 2 124720 is the directory data size.
[0038] The last directory data size is the data size included in the recorded directory after the last update. The directory data size and the last directory data size of the embodiments of the present application can be represented by Kb (Kilobyte), Mb (Megabyte), etc. For example, as shown in Figure 2 124720 is the last directory data size.
[0039] The home user identification of the recorded directory is used to indicate the home user of the recorded directory. For example, the home user identification can be Figure 2 root (root user) as shown.
[0040] The level is used to indicate whether the record directory is a leaf directory or a non-leaf directory, or the path depth when it is a non-leaf directory. For example, when the level is 999999, it indicates that the record directory is a leaf directory, Figure 1 The levels of the directories C3, C4, C6, C7, C8, C9, C10 and C11 shown in FIG. 1 are 999999, and when the level is 2, it indicates that the record directory is a non-leaf directory with a path depth of 1, such as Figure 1 The level of the directory C0 shown in FIG. 1 is 0, the levels of the directories C1 and C2 are 1, and the level of the directory C5 is 2, such as Figure 2 4 is the level shown in FIG. 1.
[0041] The parent directory path is the path of the parent directory of the current record directory, for example, for Figure 1 The parent directory path of the directory C3 shown in FIG. 1 is the path of the directory C1. For another example, Figure 2 The parent directory path shown in FIG. 1 is / dir1 / dir2.
[0042] The record update time is the information update time of the record directory in the directory information table, for example, at time T1, a subdirectory is last added to the record directory, and at time T2 thereafter, the last modification time of the record directory is updated to T1, then the record update time of the record directory is T2. The last modification time and the record update time of the present application can be UTC (Universal Time Coordinated) time, of course, other times can also be used, and the present application does not limit the representation of time. For example, Figure 2 The record update time shown in FIG. 1 is 1667288616000.
[0043] It can be understood that the information of the record directory in the directory information table can be obtained according to the information of the corresponding directory in the storage system.
[0044] The technical solutions of the present application and how the technical solutions of the present application solve the above technical problems will be described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes can not be described again in some embodiments. The embodiments of the present application will be described below with reference to the accompanying drawings.
[0045] Figure 3 A step flow chart of a directory information management method provided by the present application is shown in FIG. 1, Figure 3 The method comprises:
[0046] S201, obtaining a stack directory from the top of a target stack, the target stack being used to record directories to be traversed in the directory management process of the storage system.
[0047] The target stack is a stack for storing directory paths to record real directories, in which directory paths to be traversed are constantly updated with pop-in actions, and the directory paths to be traversed can include directory paths of directories in the storage system and / or directory paths of recorded directories in the directory information table.
[0048] At the beginning, referring to Fig. 2, the root directory C0 path of the storage system is popped in, that is, added to the top of the target stack, and subsequently, whether to pop in is determined according to the judgment condition when popping out, such as the pop-in condition in step S203. Figure 4
[0049] Here, the pop-out directory is the directory to be traversed corresponding to the directory path at the top of the target stack extracted from the target stack, that is, the top directory shown in Fig. 3, Figure 4 Figure 4 the bottom directory shown in Fig. 4 is finally taken out. At the beginning, the pop-out directory is the root directory in the storage system, and in the traversal process, the pop-out directory can be a directory still existing under the root directory in the storage system or a directory that has been deleted.
[0050] S202, determining the target subdirectory of the pop-out directory from the directory information table and the storage system according to the latest modification time of the pop-out directory in the directory information table and the latest modification time of the pop-out directory in the storage system, the directory information table being used to record information of directories in the storage system.
[0051] It can be understood that before the directory information table is updated, the information of recorded directories in the directory information table and the information of directories in the storage system can be inconsistent; after the directory information table is accurately updated, the information of recorded directories in the directory information table and the information of directories in the storage system are consistent.
[0052] The target subdirectory is determined by whether the pop-out directory has been changed, which is determined by whether the latest modification time of the pop-out directory in the directory information table and the latest modification time of the pop-out directory in the storage system are consistent, and the target subdirectory is a subdirectory of the pop-out directory, which is divided into two types: a subdirectory of the pop-out directory in the storage system and a subdirectory of the pop-out directory in the directory information table.
[0053] Referring to Fig. 5, when the two latest modification times of the pop-out directory are consistent, it means that the pop-out directory has not been changed, and at this time, the subdirectory of the pop-out directory in the directory information table is taken as the target subdirectory. Figure 4 Referring to Fig. 6, when the two latest modification times of the pop-out directory are inconsistent, it means that the pop-out directory has been changed, and at this time, the subdirectory of the pop-out directory in the storage system is taken as the target subdirectory.
[0054] Figure 4
[0055] In some possible implementation manners, the target subdirectory of the outstacked directory is determined from the directory information table and the storage system according to the latest modification time of the outstacked directory in the directory information table and the latest modification time of the outstacked directory in the storage system, including: when the latest modification time of the outstacked directory in the directory information table and the latest modification time of the outstacked directory in the storage system are consistent, the subdirectory of the outstacked directory in the directory information table is taken as the target subdirectory; and when the latest modification time of the outstacked directory in the directory information table and the latest modification time of the outstacked directory in the storage system are inconsistent, the subdirectory of the outstacked directory in the storage system is taken as the target subdirectory. In this way, the target subdirectory can be directly extracted from the directory information table when the outstacked directory does not change, so that the frequency of accessing the storage system is reduced, the access pressure on the storage system is reduced, and the management efficiency of the storage system is further improved.
[0056] The latest modification time of the outstacked directory in the directory information table can be extracted by matching the outstacked directory path and the directory path in the directory information table, and taking the latest modification time corresponding to the directory path in the directory information table that matches the outstacked directory path as the latest modification time of the outstacked directory in the directory information table.
[0057] The latest modification time of the outstacked directory in the storage system can be extracted by matching the outstacked directory path and the directory path in the storage system, and taking the latest modification time corresponding to the directory path in the storage system that matches the outstacked directory path as the latest modification time of the outstacked directory in the storage system.
[0058] After the two latest modification times of the outstacked directory are determined according to the above method, the target subdirectory of the outstacked directory can be determined from the directory information table or the storage system.
[0059] When the target subdirectory of the outstacked directory is determined from the directory information table, the outstacked directory and the parent directory path in the directory information table are matched, and when the matching is successful, the directory path in the directory information table is taken as the path of the target subdirectory of the outstacked directory.
[0060] When the target subdirectory of the outstacked directory is determined from the storage system, the outstacked directory and each directory path in the storage system are matched, and when the matching is successful, the subdirectory path in the storage system is taken as the path of the target subdirectory of the outstacked directory.
[0061] S203, when the information of the target subdirectory in the directory information table satisfies the instack condition, the target subdirectory is stored in the target stack, and the instack condition includes that the level of the target subdirectory in the directory information table corresponds to a non-leaf directory.
[0062] In this embodiment, leaf directories are not added to the target stack as directories to be traversed. This ensures that the directories popped from the stack later are non-leaf directories, rather than leaf directories. This avoids traversing leaf directories during the next pop, and only traversing non-leaf directories. This can effectively reduce the number of directories traversed and improve directory management efficiency.
[0063] Understandably, leaf directories do not have subdirectories, and their updates are usually caused by operations on the files within them (including adding, deleting, and modifying files), not by changes to subdirectories. If a leaf directory remains unchanged, then no operations have occurred on the files within it, because leaf directories have no subdirectories and therefore do not need to be considered. Thus, there is no need to add leaf directories to the target stack for traversal.
[0064] If the conditions for pushing onto the stack are not met, the target subdirectory will not be added to the target stack.
[0065] In some embodiments of this application, the push conditions further include: the amount of directory data in the target subdirectory in the directory information table is different from the amount of directory data in the storage system, and / or the amount of directory data in the target subdirectory in the directory information table is different from the previous amount of directory data in the directory information table. This allows for accurate identification of whether the target subdirectory has changed, and when a change occurs, it is treated as a directory to be traversed, thus improving the accuracy of the push.
[0066] Among some possible implementations, the above method also includes:
[0067] Reference Figure 4 As shown, when the most recent modification time of the popped directory in the directory information table is inconsistent with the most recent modification time in the storage system, the target subdirectory is the subdirectory of the popped directory in the storage system. If the target subdirectory does not exist in the directory information table, it is stored in the target stack. In other words, when the popped directory changes, for target subdirectories that exist in the storage system but not in the directory information table, their information needs to be added to the directory information table. Therefore, it is added to the target stack for traversal. This achieves synchronous updating of the directory information table when a new directory is added to the storage system.
[0068] In summary, when the most recent modification time of the popped directory in the directory information table is the same as the most recent modification time in the storage system, the target subdirectory is stored in the target stack based on the above-mentioned push conditions.
[0069] When the most recent modification time of the popped directory in the directory information table is inconsistent with the most recent modification time in the storage system, there are two scenarios. In the first scenario, the target subdirectory information exists in the directory information table. In this case, the target subdirectory needs to be stored in the target stack according to the aforementioned push conditions to update the target subdirectory information in the directory information table. In the second scenario, the target subdirectory information does not exist in the target information table. In this case, the target subdirectory is stored in the target stack to add the target subdirectory information to the directory information table.
[0070] As can be seen, this application embodiment improves directory information update efficiency by filtering leaf directories. The following analysis examines the effect of filtering leaf directories on improving update efficiency. For example, the average directory depth is h, and each non-leaf directory has an average of k subdirectories. The number of leaf directories (last level) in the storage system is... The total number of directories in the storage system is calculated using the proportional summation formula. So, the percentage of the leaf directory to the total directory is... When the directory is deep, i.e., h is large, Approaching 0, meaning the proportion of leaf directories approaches 0. .
[0071] For example, if the average directory depth h is 20 (i.e., levels from 0 to h-1), and each non-leaf directory contains 10 subdirectories, then leaf directories account for approximately 90%. Assuming each non-leaf directory has at least one subdirectory, the number of leaf directories at level n is calculated as follows: leaf_num(n) = num(n) - num(n+1), where num(n) is the number of directories at level n, and num(n+1) is the number of directories at level n+1. If num(n) - num(n+1) < 0, then the number of leaf directories at level n, leaf_num(n), is 0; if num(n+1) does not exist, then the number of leaf directories at level n, leaf_num(n), is num(n).
[0072] Reference Figure 5 As shown, the number of directories at levels 3 to 37 are 1, 701, 2812, 29931, 158350, 408891, 1783526, 1127504, 2493246, 831690, 1030260, 1644735, 1511559, 414321, 157653, 74603, 47672, 29198, 25312, 15242, 14055, 3849, 1362, 391, 349, 474, 305, 294, 272, 269, 280, 86, 57, 18, and 6 respectively. The total number of leaf directories is... .according to Figure 5The total number of directories is 11,809,274, and the total number of leaf directories is greater than 3,962,831. Assuming that each directory has one subdirectory, there should be at least 3,962,831 leaf directories. In reality, a directory cannot have only one subdirectory, so there may be 8 million leaf directories. That is, the number of leaf directories is greater than the number of non-leaf directories. Therefore, filtering out leaf directories can effectively improve the efficiency of directory information updates.
[0073] Experiments showed that updating 500,000 directories without filtering leaf directories takes 300 seconds, or 5 minutes. However, updating 500,000 directories with filtering leaf directories takes only 20 seconds, improving efficiency by about 15 times.
[0074] S204. Update the directory information table based on the popped directory.
[0075] Updating the directory information table here can include, but is not limited to: adding directory information, deleting directory information, and modifying directory information. Modifying directory information refers to modifying any information in the directory, including but not limited to: directory number, directory path, last modification time, directory data volume, last directory data volume, owner user ID, hierarchy, parent directory path, and record update time.
[0076] Among some possible implementations, refer to Figure 4 As shown, if the popped directory exists in the directory information table but not in the storage system, then the information of the popped directory and its subdirectories in the directory information table is deleted. It can be understood that when the popped directory exists in the directory information table but not in the storage system, it means that the popped directory has been deleted from the storage system, but still exists in the directory information table. In this case, the popped directory is redundant information in the directory information table. Therefore, it is necessary to delete the information of the popped directory and all its subdirectories in the directory information table. The deletion process for the information of all its subdirectories in the directory information table includes: first, using the popped directory as the current parent directory path, matching this current parent directory path with the parent directory paths in the directory information table; finally, deleting the information of all directories that successfully match the current parent directory path from the directory information table, and extracting the directory path from the information of all directories that successfully match the current parent directory path as the new current parent directory path, returning to the step of matching the current parent directory path with the parent directory paths in the directory information table, and performing the next round of deletion until the leaf directories or no successfully matched directories exist.
[0077] In some other possible implementations, refer to Figure 4As shown, if the pop-up directory does not exist in the directory information table but exists in the storage system, it is represented that the pop-up directory is a newly added directory in the storage system, and therefore, the information of the pop-up directory needs to be newly added in the directory information table.
[0078] In this way, the target information table can be updated in the above two cases of pop-up, so as to update the directory information table as early as possible and improve the directory information management efficiency.
[0079] In some possible implementation manners, reference is made to Figure 4 As shown, when the latest modification time of the pop-up directory in the directory information table is consistent with the latest modification time in the storage system, it is represented that the pop-up directory has not been changed, and at this time, if the pop-up directory has no subdirectory in the directory information table and the level of the pop-up directory in the directory information table indicates that the pop-up directory is not a leaf directory, the level of the pop-up directory in the directory information table is modified to the level of a leaf directory. In this way, the level of the pop-up directory that has become a leaf directory in the directory information table can be modified to the level of a leaf directory, so as to ensure the accuracy of the level and filter out the leaf directory when the directory information table is updated again in the future, and further improve the directory information management efficiency.
[0080] It can be understood that in the process of updating the directory information table, part of the record directory can be deleted, causing the parent directory to change from a non-leaf directory to a leaf directory. Therefore, when the pop-up directory is obtained, it is first determined whether the latest modification time of the pop-up directory in the directory information table is consistent with the latest modification time in the storage system. If they are consistent, it is determined that the information of the pop-up directory in the directory information table, except the level and the record update time, has been updated, and at this time, the level of the pop-up directory can be updated. If they are not consistent, it is determined that the information of the pop-up directory in the directory information table, except the level and the record update time, has not been updated, and at this time, there can be a case that the subdirectory of the pop-up directory is not deleted according to the storage system, and therefore, the level of the pop-up directory cannot be accurately updated according to the information in the directory information table.
[0081] For example, reference is made to Figure 1 As shown, after the directories C7 and C8 are deleted in the storage system, the information in the directory information table is updated, and then the level of the directory C2 needs to be modified to the level of a leaf directory.
[0082] Whether the popped directory has subdirectories can be determined based on the directory information table. Specifically, the directory path of the popped directory can be obtained from the directory information table, and then the directory path of the popped directory is matched with each parent directory in the directory information table. If at least one parent directory matches the directory path of the popped directory, it means that the popped directory has subdirectories in the directory information table. If no parent directory matches the directory path of the popped directory, it means that the popped directory does not have subdirectories in the directory information table.
[0083] To further reduce unnecessary modifications, in this embodiment of the application, when it is determined that the most recent modification time of the popped directory in the directory information table is consistent with the most recent modification time in the storage system, and the popped directory does not have any subdirectories in the directory information table, it is also necessary to determine whether the level of the popped directory in the directory information table is the leaf directory level. If not, it means that the level of the popped directory in the directory information table is inaccurate. In this case, the level of the popped directory in the directory information table is modified to the leaf directory level.
[0084] Furthermore, in this embodiment, it is not necessary to update the hierarchy after all the information of all records in the directory information table has been completely updated. Instead, the hierarchy is updated when popping from the stack, which can achieve the hierarchy update as early as possible.
[0085] In some possible implementations, updating the directory information table based on the popped directory includes: First, obtaining the enqueue reference information of the popped directory, which includes at least one of the following: whether the last modification time of the popped directory in the storage system is consistent with the last modification time in the directory information table, the level of the popped directory in the directory information table, and the sub-directories of the popped directory in the storage system; then, determining whether the popped directory should be stored in the target queue based on the enqueue reference information; finally, updating the directory information table based on the directories in the target queue, which is used to record the directories required to update the directory information table.
[0086] Among them, the pop directory is a subdirectory of the storage system along the following path: Figure 1 The directory tree shown represents the directories reachable by traversing downwards from the popped directory, that is, the directories in the subtree rooted at the popped directory. For example, refer to... Figure 1 As shown, the subdirectories of directory C1 include: C3, C4, C5, and C6, which are subdirectories of C1, and C9, C10, and C11, which are subdirectories of C5.
[0087] The embodiments of the present application can further filter the directories of the directory information table through the target queue, and improve the directory information management efficiency. In some possible implementation manners, when the enqueue reference information comprises: whether the latest modification time of the dequeued directory in the storage system and the latest modification time of the dequeued directory in the directory information table are consistent, and the level of the dequeued directory in the directory information table, the determination of whether the dequeued directory is stored in the target queue according to the enqueue reference information of the dequeued directory comprises: referring to FIG. 2, when the latest modification time of the dequeued directory in the storage system and the latest modification time of the dequeued directory in the directory information table are inconsistent, and the level of the dequeued directory in the directory information table corresponds to the level of the leaf directory, the dequeued directory is stored in the target queue. In this way, the directories needing to update the directory information table can be accurately identified, and the directory information management accuracy is improved. Figure 4
[0088] It can be understood that when the latest modification time of the dequeued directory in the storage system and the latest modification time of the dequeued directory in the directory information table are inconsistent, and the level of the dequeued directory in the directory information table corresponds to the level of the leaf directory, it represents that the dequeued directory is the leaf directory that has changed, at this time, the directory information table needs to be updated according to the dequeued directory, and the dequeued directory needs to be added to the target queue.
[0089] Of course, referring to FIG. 2, when the latest modification time of the dequeued directory in the storage system and the latest modification time of the dequeued directory in the directory information table are consistent (that is, the dequeued directory has not changed), and the level of the dequeued directory in the directory information table corresponds to the level of the leaf directory, it represents that the dequeued directory is the leaf directory that has not changed, at this time, the directory information table does not need to be updated according to the dequeued directory, and the dequeued directory does not need to be added to the target queue. Figure 4
[0090] In some possible implementation manners, when the enqueue reference information comprises: the subdirectories of the dequeued directory in the storage system, referring to FIG. 2, the determination of whether the dequeued directory is stored in the target queue according to the enqueue reference information of the dequeued directory comprises: if all the subdirectories of the dequeued directory in the storage system have been stored in the target queue, and there is a subdirectory that has changed, the dequeued directory is stored in the target queue, so as to update the directory information table through the dequeued directory, and the latest modification time of the subdirectory that has changed in the storage system and the latest modification time of the subdirectory that has changed in the directory information table are inconsistent. In this way, when the subdirectories have changed and are enqueued, the parent directory can be enqueued to update the directory information table, and the accuracy of the update is ensured. Figure 4
[0091] The above-mentioned subdirectory that has changed is the subdirectory whose latest modification time in the directory information table and the latest modification time in the storage system are different.
[0092] Referring to FIG. 2, Figure 4 As shown, if all the sub-directories of the dequeued directory in the storage system have been stored in the target queue, and there is no sub-directory that has changed, the dequeued directory does not need to be stored in the target queue, that is, the directory information table does not need to be updated according to the dequeued directory.
[0093] In some possible implementation manners, updating the directory information table according to the directories in the target queue includes: obtaining a dequeued directory from the target queue, to determine whether the dequeued directory has changed according to the latest modification time of the dequeued directory in the directory information table and the latest modification time of the dequeued directory in the storage system; and updating the information of the dequeued directory in the directory information table when the dequeued directory has changed. In this way, the change is determined again when the dequeued directory is dequeued, so that the directory information that needs to be updated can be accurately identified, and the updating accuracy is improved.
[0094] In some possible implementation manners, the method further includes: Figure 4 As shown, when the dequeued directory has changed, updating the information of the dequeued directory in the directory information table includes three cases: in a first case, when the information of the dequeued directory exists in the directory information table, the information of the dequeued directory in the directory information table is updated, and the level of the dequeued directory in the directory information table is used to indicate the real level of the dequeued directory in the storage system or the level of the corresponding leaf directory; in a second case, when the information of the dequeued directory does not exist in the directory information table, the information of the dequeued directory in the storage system is inserted as the information in the directory information table; and in a third case, when the dequeued directory does not exist in the storage system, the information of the dequeued directory in the directory information table is deleted. It can be seen that the embodiments of the present application can cover all possible updating cases, which helps to ensure the comprehensiveness of the updating, and further ensures the accuracy of the directory information.
[0095] It needs to be understood that, for the first case, when the dequeued directory exists in the directory information table, it means that the dequeued directory is not a newly added directory in the storage system, so that only the information of the dequeued directory in the directory information table needs to be updated. Specifically, the directory data amount of the dequeued directory in the directory information table is taken as the last directory data amount of the dequeued directory in the directory information table, and the latest modification time, the directory data amount, the user identifier, the level, and the parent directory path of the dequeued directory in the storage system are updated, and the current time is updated as the record update time.
[0096] In the second scenario described above, if the dequeue directory does not exist in the directory information table, it means that the dequeue directory is a newly added directory in the storage system. In this case, the information of the dequeue directory in the storage system is inserted into the directory information table as information therein. Specifically, firstly, the directory number of the dequeue directory in the directory information table is obtained by adding 1 to the maximum directory number in the directory information table, and the previous directory data volume of the dequeue directory in the directory information table is set to 0. The directory path, last modification time, directory data volume, owner user ID, level, and parent directory path of the dequeue directory in the storage system are then used as the directory path, last modification time, directory data volume, owner user ID, level, and parent directory path of the dequeue directory in the directory information table. Next, the current time is used as the record update time of the dequeue directory in the directory information table. Finally, the directory number, directory path, last modification time, directory data volume, owner user ID, level, parent directory path, and record update time of the dequeue directory in the directory information table are inserted into the directory information table.
[0097] In the third scenario described above, if the dequeue directory does not exist in the storage system, it means that the dequeue directory has been deleted from the storage system. In this case, it is necessary to simultaneously delete the information of the dequeue directory in the directory information table.
[0098] In other embodiments, reference is made to... Figure 4 As shown, when the dequeue directory has not changed, the information of the parent directory of the dequeue directory can be updated. Specifically, the target data volume of the parent directory of the dequeue directory can be summarized upwards from the dequeue directory, and the target data volume before the update can be used as the previous directory data volume.
[0099] In some possible implementations, updating the information of the dequeued directory in the directory information table includes: first, obtaining the most recent modification time of the dequeued directory in the directory information table and the most recent modification time of its parent directory in the directory information table; then, if the most recent modification time of the dequeued directory and its parent directory are the same, and the difference between the current time and the most recent modification time of the dequeued directory is less than or equal to a first preset duration threshold, modifying the most recent modification time of the parent directory to the current time; or, if the most recent modification time of the dequeued directory is greater than the most recent modification time of the parent directory, and the difference between the current time and the most recent modification time of the dequeued directory is less than or equal to a second preset duration threshold, modifying the most recent modification time of the parent directory to the current time, where the second preset duration threshold is greater than the first preset duration threshold. Thus, in the next round of updates, when the dequeued directory is extracted from the target stack as the popped directory, based on its most recent modification time in the directory information table and its most recent modification time in the storage system, it is determined that the popped directory has changed, and its directory data volume will be re-counted, ensuring the accuracy of the directory information.
[0100] When determining whether the dequeue directory has changed, if the dequeue directory is continuously manipulated by special commands, it may cause errors in updating the directory information based on changes in the most recent modification time. Therefore, this embodiment of the application determines whether the dequeue directory is continuously changing based on the aforementioned most recent modification time. If it is continuously changing, the most recent modification time of the parent directory in the directory information table is updated to the current time. The aforementioned first preset duration threshold can be 2 seconds, and the aforementioned second preset duration threshold can be 2 minutes.
[0101] The preceding section described how this application updates the directory information table using a target stack. Building upon this, updates for hot directories can be overlaid. Specifically, this includes obtaining hot directories from the directory information table. Hot directories include directories whose most recent modification time was within a preset timeframe prior to the current time, and updating the directory information table based on these hot directories. It is understood that hot directories are the most recently modified directories in the directory information table. This application updates the information in the directory information table separately based on these hot directories to achieve the information update for these hot directories as early as possible.
[0102] Updating the directory information table based on hotspot directories can include, but is not limited to, at least one of the following: updating the information of hotspot directories in the directory information table, and updating the information of directories associated with hotspot directories in the directory information table. Directories associated with hotspot directories can be some or all of the hotspot directory's parent directories, or some or all of the hotspot directory's child directories. For example, refer to... Figure 1 As shown, when directory C5 is a hot directory, not only can the information of hot directory C5 in the directory information table be updated, but also the information of subdirectories C9, C10 and C11 of hot directory C5 in the directory information table can be updated, as well as the information of parent directories C1 and C0 of hot directory C5 in the directory information table can be updated.
[0103] It is understood that the embodiments of this application can periodically update the information of the hotspot directory, and the preset duration can be the duration of the period. For example, the update can be performed on a daily basis, so the preset duration can be daily. This enables the acquisition of directories modified in the previous day as hotspot directories each day, and the updating of the directory information table based on these hotspot directories.
[0104] The preset duration directly affects the accuracy of hotspot directory identification. The longer the preset duration, the more hotspot directories are identified, and the more accurate the identification results. In subsequent traversals, only these hotspot directories need to be traversed to update the directory information more quickly and accurately.
[0105] In some possible implementation manners, updating the directory information table according to the hotspot directory includes: first, determining a target directory according to the hotspot directory, the target directory including at least one of the following: the hotspot directory, a parent directory of the hotspot directory, and a target child directory of the hotspot directory, the target child directory being different from the hotspot directory by a preset number of levels threshold; and then, updating information of the target directory in the directory information table. The embodiments of the present application update the information of the hotspot directory and all parent directories and part of child directories of the hotspot directory in the directory information table, reduce the update waiting time of the hotspot directory, and only update the information of part of child directories below the hotspot directory, which helps to further improve the update efficiency and reduce the update time.
[0106] The parent directory herein can be all parent directories, for example, as shown in Figure 1 The target child directory herein is part of child directories, which is determined by the preset number of levels threshold, for example, when the preset number of levels threshold is 1, the target child directory includes a child directory of the hotspot directory, and when the preset number of levels threshold is 2, the target child directory includes a child directory and a grandchild directory of the hotspot directory.
[0107] In the actual application scenario of the cloud-native artificial intelligence cluster storage, the hotspot directory accounts for only 0.05% to 0.1% of the total directory in one day, that is, about 500 to 1000 hotspot directories in 1 million directories. Therefore, the hotspot directory is quickly identified according to the latest modification time stored in the directory information table to update the directory information table, and the proportion of the hotspot directory is small, so the update of the hotspot directory will not take too long time.
[0108] In an implementation manner of the embodiments of the present application, updating the information of the target directory in the directory information table includes: obtaining a sorting parameter of the hotspot directory from the storage system, and sorting the hotspot directory according to the sorting parameter to obtain a hotspot directory sequence, the sorting parameter including at least one of the following: the latest modification time, the modification frequency, and the directory data volume; and then, updating the information of the target directory in the directory information table in the order of the hotspot directory sequence. The embodiments of the present application can perform sequential update in combination with the sorting parameter, which helps to preferentially update the information of the target directory with the latest modification time first, the higher modification frequency, and the larger directory data volume.
[0109] The above several sorting parameters can have priorities, and the priorities can be flexibly configured, for example, the priorities of the latest modification time, the modification frequency, and the directory data volume can be from high to low, so the latest modification time is sorted in ascending order first, when the latest modification time is the same, the modification frequency is sorted in descending order, and when the latest modification time and the modification frequency are the same, the directory data volume is sorted in descending order. The above sorting can be descending order.
[0110] In an implementation form of the embodiment of the application, updating the information of the target directory in the directory information table comprises: updating the information of the target directory in the directory information table in the order of the hot directory, the target subdirectory and the upper directory. In this way, the information of the hot directory can be updated first, then the information of the target subdirectory, and finally the information of the upper directory.
[0111] In some possible implementation forms, the order of the hot directory, the target subdirectory and the upper directory can be combined with the sorting parameter to implement the sequential updating. For example, the hot directory, the target subdirectory and the upper directory are sorted first, then the hot directory is sorted according to the sorting parameter, the target subdirectory is sorted according to the sorting parameter, and the upper directory is sorted according to the sorting parameter. In this way, a total target directory sequence is obtained, and the information updating is performed according to the target directory sequence.
[0112] In an implementation form of the embodiment of the application, updating the information of the target directory in the directory information table comprises:
[0113] When the target directory does not exist in the storage system, the information corresponding to the target directory and the information of the subdirectory of the target directory in the directory information table are deleted; and when the information corresponding to the target directory exists in the target directory information table, the information of the target directory in the directory information table is updated. In this way, the embodiment of the application can update the information of the target directory from two aspects, and the accuracy of the directory information table is improved.
[0114] The updating of the information of the target directory in the directory information table comprises: taking the directory data amount of the target directory in the directory information table as the last directory data amount, and taking the sum of the file data amount of the target directory in the storage system and the data amount of the subdirectory of the target directory in the directory information table as the directory data amount of the target directory in the directory information table. The subdirectory here is a directory whose directory path is the parent directory path of the target directory in the directory information table.
[0115] Before updating the directory information table in this embodiment, the log mode of the database containing the directory information table can be set to WAL (Write-Ahead Log) mode. This significantly improves the performance of database read and write operations, allowing multiple read connections to coexist with one write connection simultaneously. This effectively solves the problem of write operations blocking read operations in traditional log mode, improving concurrency performance. Setting the synchronization mode to NORMAL balances data persistence and performance to a certain extent. Compared to FULL mode, it reduces disk synchronization operations and speeds up writes, making it suitable for scenarios where data integrity requirements are not absolutely paramount but performance is prioritized. In the SQLite3 database, configuring journal_mode=WAL&synchronous=NORMAL&busy_timeout=1000 and setting the busy timeout to 1000 milliseconds means that when the database is locked, the connection will wait 1000 milliseconds while attempting to acquire the lock. This avoids frequent program failures due to immediate error returns, providing a certain degree of fault tolerance and buffer time for database operations, which helps to execute related operations more stably in high-concurrency scenarios.
[0116] The directory information management method provided in this application identifies leaf directories through the hierarchy in the directory information table, thereby filtering leaf nodes and avoiding subsequent judgment and processing of leaf nodes, which can improve the efficiency of directory information updates.
[0117] In some implementations, embodiments of this application support directory management for different storage systems. Therefore, to achieve directory management for different storage systems, different directory information tables are set up for different storage systems. In this case, before updating the directory information table, it is also necessary to pre-determine the directory information table of the storage system. Specifically, embodiments of this application set up another metadata table, referring to... Figure 6 As shown, the metadata table is explained from three aspects: field names, meanings and uses, and examples. (Refer to...) Figure 6 As shown, this metadata table stores the table name (table_name) and storage path (storage_path) of the directory information tables for each storage system. Therefore, before updating the directory information table for a given storage system, its table name must first be determined based on that storage system. The table name of the directory information table for a storage system can include the storage system name. For example, the table name of the directory information table for storage system SY1 could be... Figure 6 As shown in SY1_CIT, the directory information table of storage system SY2 can be named SY2_CIT, and the directory information table of storage system SY3 can be named SY3_CIT. Therefore, when updating the directory information table of storage system SY1, the storage path SR1 corresponding to the directory information table SY1_CIT can be obtained from the metadata table (e.g., SR1). Figure 6As shown in / dir11 / dir2), when updating the directory information table of the storage system SY2, the corresponding storage path SR2 of the corresponding directory information table SY2_CIT of the metadata table can be obtained, when updating the directory information table of the storage system SY3, the corresponding storage path SR3 of the corresponding directory information table SY3_CIT of the metadata table can be obtained, and thus the directory information tables SY1_CIT, SY2_CIT and SY3_CIT of the storage systems SY1, SY2 and SY3 can be obtained from SR1, SR2 and SR3 respectively.
[0118] Figure 7 A structure schematic diagram of a directory information management device provided in the present application is shown in the figure, the directory information management device 400 provided in the embodiment includes: Figure 7
[0119] The out-stacking module 401 is configured to obtain an out-stacking directory from the top of a target stack, and the target stack is configured to record a directory to be traversed in a directory management process of a storage system.
[0120] The sub-directory determining module 402 is configured to determine a target sub-directory of the out-stacking directory from a directory information table and the storage system according to a latest modification time of the out-stacking directory in the directory information table and a latest modification time of the out-stacking directory in the storage system, and the directory information table is configured to record information of a directory in the storage system.
[0121] The first in-stacking module 403 is configured to store the target sub-directory into the target stack when information of the target sub-directory in the directory information table satisfies an in-stacking condition, and the in-stacking condition includes that a level of the target sub-directory in the directory information table corresponds to a non-leaf directory.
[0122] The information updating module 404 is configured to update the directory information table according to the out-stacking directory.
[0123] In a possible implementation, the in-stacking condition further includes that a directory data amount of the target sub-directory in the directory information table and a directory data amount in the storage system are different, and / or the directory data amount of the target sub-directory in the directory information table and a last directory data amount in the directory information table are different.
[0124] In a possible implementation, the sub-directory determining module 402 is further configured to:
[0125] when the latest modification time of the out-stacking directory in the directory information table and the latest modification time of the out-stacking directory in the storage system are consistent, a sub-directory of the out-stacking directory in the directory information table is taken as the target sub-directory; and when the latest modification time of the out-stacking directory in the directory information table and the latest modification time of the out-stacking directory in the storage system are inconsistent, a sub-directory of the out-stacking directory in the storage system is taken as the target sub-directory.
[0126] In a possible implementation, the apparatus further includes:
[0127] The second stacking module is configured to, when the latest modification time of the out-stacking directory in the directory information table and the latest modification time in the storage system are inconsistent, and the information of the target sub-directory does not exist in the directory information table, store the target sub-directory into the target stack.
[0128] In a possible implementation, the apparatus further includes:
[0129] The level modification module is configured to, when the latest modification time of the out-stacking directory in the directory information table and the latest modification time in the storage system are consistent, and the out-stacking directory has no sub-directory in the directory information table and the level of the out-stacking directory in the directory information table indicates a non-leaf directory, modify the level of the out-stacking directory in the directory information table to a leaf directory level.
[0130] In a possible implementation, the information updating module 404 is further configured to:
[0131] obtain the enqueue reference information of the out-stacking directory, the enqueue reference information including at least one of the following: whether the latest modification time of the out-stacking directory in the storage system and the latest modification time in the directory information table are consistent, the level of the out-stacking directory in the directory information table, and the sub-directories of the out-stacking directory in the storage system; determine whether the out-stacking directory is stored into the target queue according to the enqueue reference information of the out-stacking directory; and update the directory information table according to the directories in the target queue, the target queue being used to record the directories required for updating the directory information table.
[0132] When the latest modification time of the out-stacking directory in the storage system and the latest modification time in the directory information table are inconsistent, and the level of the out-stacking directory in the directory information table corresponds to a leaf directory level, store the out-stacking directory into the target queue.
[0133] In a possible implementation, the information updating module 404 is further configured to:
[0134] When all the sub-directories of the out-stacking directory in the storage system have been stored into the target queue, and there exists a sub-directory that has changed, store the out-stacking directory into the target queue, the sub-directory that has changed having inconsistent latest modification time in the storage system and in the directory information table.
[0135] In a possible implementation, the information updating module 404 is further configured to:
[0136] Obtaining a de-queue directory from the target queue; determining whether the de-queue directory is changed according to a latest modification time of the de-queue directory in the directory information table and a latest modification time of the de-queue directory in the storage system; updating information of the de-queue directory in the directory information table when the de-queue directory is changed.
[0137] In a possible implementation, the information updating module 404 is further configured to:
[0138] When the information of the de-queue directory exists in the directory information table, updating the information of the de-queue directory in the directory information table, and a level of the de-queue directory in the directory information table is used to indicate a real level of the de-queue directory in the storage system or a corresponding leaf directory level.
[0139] When the information of the de-queue directory does not exist in the directory information table, inserting the information of the de-queue directory in the storage system as the information in the directory information table; and deleting the information of the de-queue directory in the directory information table when the de-queue directory does not exist in the storage system.
[0140] In a possible implementation, the information updating module 404 is further configured to:
[0141] Obtaining a latest modification time of the de-queue directory in the directory information table and a latest modification time of a parent directory of the de-queue directory in the directory information table; when the latest modification time of the de-queue directory and the latest modification time of the parent directory are the same, and a difference between a current time and the latest modification time of the de-queue directory is less than or equal to a first preset time threshold, modifying the latest modification time of the parent directory as the current time; when the latest modification time of the de-queue directory is greater than the latest modification time of the parent directory, and the difference between the current time and the latest modification time of the de-queue directory is less than or equal to a second preset time threshold, modifying the latest modification time of the parent directory as the current time, the second preset time threshold being greater than the first preset time threshold.
[0142] In a possible implementation, the information updating module 404 is further configured to:
[0143] Obtaining a hot directory in the directory information table, the hot directory including a directory with a latest modification time within a preset time before a current time; and updating the directory information table according to the hot directory.
[0144] In a possible implementation, the information updating module 404 is further configured to:
[0145] Determining a target directory according to the hot directory, the target directory including at least one of the following: the hot directory, a superior directory of the hot directory, and a target subordinate directory of the hot directory, the target subordinate directory being different from the hot directory by a preset number of levels; and updating information of the target directory in the directory information table.
[0146] In a possible implementation, the information updating module 404 is further configured to:
[0147] obtain a sorting parameter of the hotspot directory from the storage system, and sort the hotspot directory according to the sorting parameter to obtain a hotspot directory sequence, the sorting parameter including at least one of the following: a latest modification time, a modification frequency, and a directory data volume; and update information of the target directory in the directory information table according to an order of the hotspot directory sequence.
[0148] In a possible implementation, the information updating module 404 is further configured to:
[0149] update the information of the target directory in the directory information table according to an order of the hotspot directory, the target subdirectory, and the parent directory.
[0150] In a possible implementation, the information updating module 404 is further configured to:
[0151] when the target directory does not exist in the storage system, delete information corresponding to the target directory and information of a subdirectory of the target directory from the directory information table; and when the information corresponding to the target directory exists in the directory information table, update the information of the target directory in the directory information table.
[0152] The directory information management apparatus provided in this embodiment can execute the method provided in the method embodiment, and has similar implementation principles and technical effects, which will not be described here again in this embodiment.
[0153] Figure 8 A structural schematic diagram of an electronic device is provided in this application. As shown in Figure 8 The electronic device 500 provided in this embodiment includes at least one processor 501 and a memory 502. Optionally, the electronic device 500 further includes a communication component 503. The processor 501, the memory 502, and the communication component 503 are connected through a bus 504.
[0154] In the specific implementation process, the at least one processor 501 executes the computer execution instructions stored in the memory 502, so that the at least one processor 501 executes the method described above.
[0155] The specific implementation process of the processor 501 can refer to the method embodiment described above, and has similar implementation principles and technical effects, which will not be described here again in this embodiment.
[0156] In the above embodiments, it should be understood that the processor can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in combination with the application can be directly embodied as hardware processor execution, or executed by a combination of hardware and software modules in the processor.
[0157] The memory can include a random access memory (RAM), and can also include a non-volatile memory (NVM), such as at least one disk memory.
[0158] The bus can be an industry standard architecture (ISA) bus, a peripheral component (PCI) bus, or an extended industry standard architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application does not limit to only one bus or one type of bus.
[0159] The present application also provides a computer program product, comprising a computer program, which, when executed by a processor, implements the above method.
[0160] The present application also provides a computer readable storage medium, which stores computer execution instructions, and when a processor executes the computer execution instructions, the above method is implemented.
[0161] The above readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general-purpose or special-purpose computer.
[0162] An example readable storage medium is coupled to the processor such that the processor can read information from the readable storage medium and can write information to the readable storage medium. Of course, the readable storage medium can also be a part of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the readable storage medium can also exist as discrete components in the device.
[0163] The division of units is only a logical functional division, and in actual implementation, there can be another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interfaces, devices or units, and can be electrical, mechanical or other forms.
[0164] The units described as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, that is, can be located in one place, or can be distributed on a plurality of network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.
[0165] In addition, the functional units in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit.
[0166] If the functions are realized in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application or the part of the present application that essentially contributes to the prior art or the part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method of each embodiment of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various program code storage media.
[0167] Those skilled in the art can understand that all or part of the steps of the above-mentioned method embodiments can be completed by program instruction related hardware. The foregoing program can be stored in a computer readable storage medium. The program executes to perform the steps of the above-mentioned method embodiments; and the foregoing storage medium includes various media capable of storing program codes, such as ROM, RAM, magnetic disk, or optical disk.
[0168] Finally, it should be noted that other embodiments of the present application will readily occur to those skilled in the art upon consideration of the specification and practice of the present application disclosed herein. The present application is intended to include all such variations, uses, or adaptations of the application in which the general principles of the application are used to best advantage and encompassed within its scope. The present application is not limited to the precise structures described and shown in the accompanying drawings and figures, and can be practiced with variation of modifications and alterations without departing from the scope of the present application. The scope of the present application is limited only by the claims appended hereto.
Claims
1. A directory information management method characterized by comprising: The method comprises the following steps: obtaining a pop directory from a top of a target stack, the target stack being used to record directories to be traversed in a directory management process of a storage system; determining a target subdirectory of the pop directory from a directory information table and the storage system according to a latest modification time of the pop directory in the directory information table and a latest modification time of the pop directory in the storage system, the directory information table being used to record information of directories in the storage system, and the directory information table recording a level field of each directory, the level field being used to indicate whether the corresponding directory is a leaf directory; storing the target subdirectory into the target stack when information of the target subdirectory in the directory information table satisfies a push condition, the push condition comprising that the level of the target subdirectory in the directory information table corresponds to a non-leaf directory, and the push condition further comprising that a directory data amount of the target subdirectory in the directory information table is different from a directory data amount of the target subdirectory in the storage system, and / or the directory data amount of the target subdirectory in the directory information table is different from a last directory data amount in the directory information table; updating the directory information table according to the pop directory.
2. The method of claim 1, wherein, The step of determining the target subdirectory of the pop directory from the directory information table and the storage system according to the latest modification time of the pop directory in the directory information table and the latest modification time of the pop directory in the storage system comprises the following steps: when the latest modification time of the pop directory in the directory information table is consistent with the latest modification time of the pop directory in the storage system, taking a subdirectory of the pop directory in the directory information table as the target subdirectory; when the latest modification time of the pop directory in the directory information table is inconsistent with the latest modification time of the pop directory in the storage system, taking a subdirectory of the pop directory in the storage system as the target subdirectory.
3. The method of claim 2, wherein, The method further comprises the following steps: when the latest modification time of the pop directory in the directory information table is inconsistent with the latest modification time of the pop directory in the storage system, storing the target subdirectory into the target stack if the information of the target subdirectory does not exist in the directory information table.
4. The method of claim 2, wherein, The method further comprises the following steps: when the latest modification time of the pop directory in the directory information table is consistent with the latest modification time of the pop directory in the storage system, modifying the level of the pop directory in the directory information table to a leaf directory level if the pop directory has no subdirectory in the directory information table and the level of the pop directory in the directory information table indicates a non-leaf directory.
5. The method according to any one of claims 1 to 4, characterized in that, The step of updating the directory information table according to the pop directory comprises the following steps: obtaining enqueue reference information of the pop directory, the enqueue reference information comprising at least one of the following: whether the latest modification time of the pop directory in the storage system is consistent with the latest modification time of the pop directory in the directory information table, the level of the pop directory in the directory information table, and a subdirectory of the pop directory in the storage system. Determining whether the outstacked directory is stored into a target queue according to enqueue reference information of the outstacked directory, the target queue being used to record directories needed to update a directory information table; Updating the directory information table according to directories in the target queue.
6. The method of claim 5, wherein, The determining whether the outstacked directory is stored into a target queue according to enqueue reference information of the outstacked directory comprises: When the latest modification time of the outstacked directory in the storage system and the latest modification time of the outstacked directory in the directory information table are inconsistent, and the level of the outstacked directory in the directory information table corresponds to a leaf directory level, storing the outstacked directory into the target queue.
7. The method of claim 5, wherein, The determining whether the outstacked directory is stored into a target queue according to enqueue reference information of the outstacked directory comprises: If all subdirectories of the outstacked directory in the storage system have been stored into the target queue, and there exists a subdirectory which has inconsistent latest modification time in the storage system and in the directory information table, storing the outstacked directory into the target queue.
8. The method of claim 5, wherein, The updating the directory information table according to directories in the target queue comprises: Obtaining a de-queued directory from the target queue; Determining whether the de-queued directory has changed according to the latest modification time of the de-queued directory in the directory information table and the latest modification time of the de-queued directory in the storage system; When the de-queued directory has changed, updating information of the de-queued directory in the directory information table.
9. The method of claim 8, wherein, The updating information of the de-queued directory in the directory information table comprises: When there is information of the de-queued directory in the directory information table, updating information of the de-queued directory in the directory information table, the level of the de-queued directory in the directory information table being used to indicate a real level of the de-queued directory in the storage system or a corresponding leaf directory level; When there is no information of the de-queued directory in the directory information table, inserting information of the de-queued directory in the storage system into the directory information table as information in the directory information table; When there is no de-queued directory in the storage system, deleting information of the de-queued directory in the directory information table.
10. The method of claim 8, wherein, The updating information of the de-queued directory in the directory information table comprises: Obtaining the latest modification time of the de-queued directory in the directory information table and the latest modification time of a parent directory of the de-queued directory in the directory information table; When the latest modification time of the de-queued directory and the latest modification time of the parent directory are the same, and the difference between the current time and the latest modification time of the de-queued directory is less than or equal to a first preset time threshold, modifying the latest modification time of the parent directory as the current time; When the latest modification time of the de-queued directory is greater than the latest modification time of the parent directory, and the difference between the current time and the latest modification time of the de-queued directory is less than or equal to a second preset time threshold, modifying the latest modification time of the parent directory as the current time, the second preset time threshold being greater than the first preset time threshold.
11. The method according to any one of claims 1 to 4, characterized in that, Further comprising: acquire a hot directory in the directory information table, the hot directory including a directory whose latest modification time is within a preset time period before a current time; update the directory information table according to the hot directory.
12. The method of claim 11, wherein, The updating the directory information table according to the hot directory comprises: determining a target directory according to the hot directory, the target directory including at least one of the hot directory, a superior directory of the hot directory, and a target subordinate directory of the hot directory, the target subordinate directory having a hierarchical difference from the hot directory less than or equal to a preset hierarchical threshold; updating information of the target directory in the directory information table.
13. The method of claim 12, wherein, The updating the information of the target directory in the directory information table comprises: acquiring a sorting parameter of the hot directory from the storage system, and sorting the hot directory according to the sorting parameter to obtain a hot directory sequence, the sorting parameter including at least one of a latest modification time, a modification frequency, and a directory data volume; updating the information of the target directory in the directory information table in an order of the hot directory sequence.
14. The method of claim 12, wherein, The updating the information of the target directory in the directory information table comprises: updating the information of the target directory in the directory information table in an order of the hot directory, the target subordinate directory, and the superior directory.
15. The method of claim 14, wherein, The updating the information of the target directory in the directory information table comprises: when the target directory does not exist in the storage system, deleting information corresponding to the target directory and information of a subordinate directory of the target directory from the directory information table; when the information corresponding to the target directory exists in the directory information table, updating the information of the target directory in the directory information table.
16. A directory information management apparatus characterized by comprising: comprise: a directory extraction module configured to extract a directory from a top of a target stack, the target stack being configured to record a directory to be traversed in a directory management process of a storage system; a subdirectory determination module configured to determine a target subdirectory of the extracted directory from the directory information table and the storage system according to a latest modification time of the extracted directory in the directory information table and a latest modification time of the extracted directory in the storage system, the directory information table being configured to record information of directories in the storage system, and the directory information table recording a hierarchical field of each directory, the hierarchical field being configured to indicate whether a corresponding directory is a leaf directory; a stacking module configured to store the target subdirectory into the target stack when information of the target subdirectory in the directory information table satisfies a stacking condition, the stacking condition including that the target subdirectory is a non-leaf directory in the directory information table, and the stacking condition further including that a directory data volume of the target subdirectory in the directory information table is different from a directory data volume in the storage system, and / or the directory data volume of the target subdirectory in the directory information table is different from a last directory data volume in the directory information table; an updating module configured to update the directory information table according to the extracted directory.
17. An electronic device, comprising: comprise: a memory and a processor; the memory stores computer execution instructions. The processor executes computer-executable instructions stored in the memory such that the processor performs the method of any of claims 1 to 15.
18. A computer-readable storage medium, characterized in that, The computer-readable storage medium has stored therein computer-executable instructions that, when executed by a processor, perform the method of any of claims 1 to 15.
19. A computer program product, characterised in that, A computer program that, when executed by a processor, performs the method of any of claims 1 to 15.
Citation Information
Patent Citations
Storage file management method and device, AI platform and storage medium
CN116089364A
Storage directory statistical method and device, electronic equipment and storage medium
CN117235313A