Test method, test equipment and computer readable storage medium

By simulating the garbage collection process, creating source and test files, clearing the cache, and comparing hash values, the stability and consistency issues of storage devices under high load and complex environments were resolved, and the reliability of the garbage collection mechanism was verified.

CN120932720APending Publication Date: 2025-11-11SHENZHEN SHICHUANGYI ELECTRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510928987.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-07
Publication Date
2025-11-11

AI Technical Summary

Technical Problem

Traditional garbage collection solutions suffer from instability, performance degradation, and data consistency issues under high load and complex environments, necessitating a testing method that can verify the reliability of storage device garbage collection mechanisms.

Method used

By simulating the garbage collection process, source and test files are created, storage device cache contents are cleared, and file hash values ​​are calculated and compared to verify whether the garbage collection process causes file data corruption or loss.

Benefits of technology

It can promptly identify potential problems in the garbage collection mechanism, ensuring that storage devices maintain stable performance and data consistency under high load and complex environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120932720A_ABST
    Figure CN120932720A_ABST
Patent Text Reader

Abstract

The invention discloses a test method, test equipment and a computer readable storage medium, and relates to the technical field of storage. The test method comprises the following steps: creating a source file; creating a test file; writing the test file into a storage device; clearing cache content in the storage device; calculating a hash value of the written test file; comparing the Hash value of the written test file with the Hash value of the source file, and analyzing a comparison result; wherein the content of the test file is the same as that of the source file; according to the test method, the garbage collection process is simulated to test whether the garbage collection process can cause damage or loss of the file data so as to verify the reliability of the garbage collection mechanism of the storage device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of storage technology, and in particular to a test method, test equipment, and computer-readable storage medium. Background Technology

[0002] With the increasing demand for data storage, especially in big data, cloud computing, and enterprise-level storage environments, garbage collection mechanisms in storage devices have gradually become one of the key technologies for ensuring system stability and performance. The design and implementation of garbage collection (GC) mechanisms directly affect the space utilization, data consistency, and system response speed of storage devices. Traditional garbage collection schemes perform well under low-load environments, but may suffer from instability, performance degradation, and data consistency issues under high loads, complex operations, or extreme environments.

[0003] Therefore, verifying the reliability of the garbage collection mechanism of storage devices has become a crucial task, and there is an urgent need for a testing method that can test the reliability of the garbage collection mechanism of storage devices. Summary of the Invention

[0004] The purpose of this application is to provide a testing method, testing equipment, and computer-readable storage medium that, by simulating the garbage collection process, tests whether the garbage collection process will cause damage or loss of file data, thereby verifying the reliability of the garbage collection mechanism of the storage device.

[0005] This application discloses a testing method applied to a storage device, comprising the following steps:

[0006] Create source file;

[0007] Create a test file;

[0008] Write the test file to the storage device;

[0009] Clear the cache contents of the storage device;

[0010] Calculate the hash value of the test file after it has been written;

[0011] Compare the hash value of the written test file with the hash value of the source file, and analyze the comparison results.

[0012] The test file has the same content as the source file.

[0013] Optionally, the step of calculating the hash value of the test file after it has been written includes:

[0014] Implement intermittent operation;

[0015] The intermittent operation includes:

[0016] Pause the calculation of the hash value of the test file;

[0017] Execute sleep time;

[0018] Resume the computation operation until the computation process ends and the calculated hash value is obtained.

[0019] Optionally, the duration of the sleep time is X seconds, where X is a positive integer;

[0020] Wherein, X is greater than or equal to 0.5 and less than or equal to 10.

[0021] Optionally, the step of calculating the hash value of the test file after it has been written includes:

[0022] To enable intermittent operation;

[0023] The intermittent operation includes:

[0024] Pause the calculation of the hash value of the test file;

[0025] Execute the first sleep time;

[0026] Resume calculation operations;

[0027] Execute the second sleep time;

[0028] Resume the computation operation until the computation process ends and the calculated hash value is obtained.

[0029] Optionally, the duration of the first sleep time is different from the duration of the second sleep time;

[0030] Wherein, the duration of the first sleep time is greater than the duration of the second sleep time / or,

[0031] The duration of the first sleep time is shorter than the duration of the second sleep time.

[0032] Optionally, the size of the source file is between 1GB and 512MB.

[0033] Optionally, the hash value of the calculated test file is written to the log file of the storage device.

[0034] Optionally, the step of comparing the hash value of the written test file with the hash value of the source file and analyzing the comparison result includes:

[0035] Based on preset rules, analyze and compare the results;

[0036] The preset rules include:

[0037] If the hash value of the test file is inconsistent with the hash value of the source file, output a test failure message;

[0038] If the hash value of the test file matches the hash value of the source file, output a message indicating that the test was successful.

[0039] This application also discloses a testing device, including:

[0040] Memory, used to store computer programs;

[0041] A processor for implementing the steps of a test method as described above when executing the computer program.

[0042] This application also discloses a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of a test method as described above.

[0043] The testing method of this application simulates the garbage collection process by clearing the cache, and tests whether the garbage collection process will cause damage or loss of file data, so as to verify the reliability of the garbage collection mechanism of the storage device. The testing method of this application can promptly discover potential problems in the garbage collection mechanism, and ensure that the storage device can maintain stable performance and data consistency under high load and complex environment. Attached Figure Description

[0044] The accompanying drawings, which form part of the specification, are used to provide a further understanding of the embodiments of this application and illustrate the implementation methods of this application, together with the textual description, to explain the principles of this application. Obviously, the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any creative effort. In the drawings:

[0045] Figure 1 This is a flowchart of the steps of a testing method according to the first embodiment of this application;

[0046] Figure 2 This is a schematic diagram of the structure of a test device according to the third embodiment of this application.

[0047] Among them, 100 is the test equipment; 200 is the memory; and 300 is the processor. Detailed Implementation

[0048] It should be understood that the terminology, specific structural and functional details used herein are merely for describing particular embodiments and are representative. However, this application may be implemented in many alternative forms and should not be construed as being limited to the embodiments set forth herein.

[0049] In the description of this application, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating relative importance or implying the number of technical features indicated. Therefore, unless otherwise stated, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature; "multiple" means two or more. The term "comprising" and any variations thereof mean non-exclusive inclusion, where one or more other features, integers, steps, operations, units, components, and / or combinations thereof may be present or added.

[0050] In addition, terms such as “center,” “horizontal,” “up,” “down,” “left,” “right,” “vertical,” “horizontal,” “top,” “bottom,” “inner,” and “outer” that indicate orientation or positional relationship are based on the orientation or relative positional relationship shown in the accompanying drawings. They are only for the purpose of simplifying the description of this application and do not indicate that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this application.

[0051] Furthermore, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to fixed connections, detachable connections, or integral connections; they can refer to mechanical connections or electrical connections; they can refer to direct connections or indirect connections through an intermediate medium, or internal connections between two components. Those skilled in the art can understand the specific meaning of the above terms in this application based on the specific circumstances.

[0052] The present application will now be described in detail with reference to the accompanying drawings and optional embodiments. It should be noted that, without conflict, the various embodiments or technical features described below can be arbitrarily combined to form new embodiments.

[0053] like Figure 1 As shown, as a first embodiment of this application, a testing method is disclosed, applied to a storage device, the testing method including the following steps:

[0054] Create source file;

[0055] Specifically, the host computer can create and generate the source file, calculate the hash value of the source file after it is generated, and use the calculated hash value of the source file as the base value of the hash value in this test.

[0056] Create a test file with the same content as the source file;

[0057] Specifically, the host computer can create test files. Test files can be generated by completely copying the source file or by creating them directly. The content of the test file must be completely consistent with the content of the source file.

[0058] Write the test file to the storage device;

[0059] Specifically, the test files are first stored in the cache and then written to the disk of the storage device for storage;

[0060] Clear the cache contents of the storage device;

[0061] Specifically, clear the test file content in the cache and only retain the test file content on the disk of the storage device;

[0062] Calculate the hash value of the test file after it has been written;

[0063] Specifically, calculate the hash value of the test file on the storage device's disk;

[0064] Compare the hash value of the written test file with the hash value of the source file, and analyze the comparison results.

[0065] Specifically, clearing the cache before performing file operations can simulate data consistency issues that may occur during garbage collection. Therefore, comparing the hash value of the written test file with the hash value of the source file can reveal whether the garbage collection mechanism of the tested storage device has caused file data corruption or loss.

[0066] The testing method in this embodiment generates a source file and a test file, writes the test file to a storage device, clears the cached content in the storage device, and after the cache is cleared, the file data may change. At this time, the hash value of the written test file is calculated and compared with the hash value of the source file. If the hash value of the written test file is inconsistent with the hash value of the source file, it indicates that the garbage collection mechanism of the storage device has caused the file data to be damaged or lost. If the hash value of the written test file is consistent with the hash value of the source file, it indicates the reliability of the garbage collection mechanism of the storage device.

[0067] In summary, the testing method of this application simulates the garbage collection process by clearing the cache, and tests whether the garbage collection process will cause file data corruption or loss, so as to verify the reliability of the garbage collection mechanism of the storage device. The testing method of this application can promptly discover potential problems in the garbage collection mechanism, ensuring that the storage device can maintain stable performance and data consistency under high load and complex environment.

[0068] Furthermore, to better evaluate the reliability of the storage device's garbage collection mechanism, the step of calculating the hash value of the test file after it has been written includes:

[0069] Implement intermittent operation;

[0070] The intermittent operation includes:

[0071] Pause the calculation of the hash value of the test file;

[0072] Execute sleep time;

[0073] Resume the computation operation until the computation process ends and the calculated hash value is obtained.

[0074] It should be noted that the steps for performing intermittent operations described in this embodiment are only illustrated by the calculation of the hash value of the test file. Intermittent operations can also be other operations, such as system-level process operations that may affect file operations. No restrictions are imposed here.

[0075] The testing method in this embodiment first pauses the calculation of the hash value of the test file, performs a sleep period, and then resumes the calculation operation until the calculation process ends. This intermittent operation simulates process pause and resumption to test whether the storage device can stably recover and continue running after a temporary interruption. After simulating process pause and resumption, the hash value of the test file is compared with the hash value of the source file to determine whether the storage device can continue to calculate the hash value normally under interruption and resumption operations during garbage collection. If the calculated hash value of the test file is inconsistent with the hash value of the source file, it indicates that garbage collection affected the content of the test file during the intermittent operation or in one of the aforementioned environments, and the test fails, outputting a test failure message. If the calculated hash value of the test file is consistent with the hash value of the source file, it indicates that the storage device can correctly handle file operations and maintain data consistency during garbage collection, outputting a test success message. In this embodiment, the sleep period is X seconds, where X is a positive integer; X is greater than or equal to 0.5 and less than or equal to 10.

[0076] Furthermore, the size of the source file is between 2GB and 100MB. The size of the source file can be selected according to the designer's testing needs. If the purpose of the test is to quickly test and verify basic functions, a smaller file (e.g., between 100MB and 512MB) can be selected. If the purpose of the test is to test the stability and performance of the storage device under higher complexity, a larger file (e.g., 1GB or 2GB) can be selected. The designer can choose according to actual needs, and there is no limitation here. In this embodiment, the size of the source file can be 512MB.

[0077] In this embodiment, the calculated hash value of the test file is written to the log file of the storage device to facilitate multiple tests. Specifically, after the test file is written to the disk, the storage device's cache is cleared, intermittent operation simulation is performed, the hash value of the test file is calculated, and then written to the storage device's log file. This process is repeated to obtain the hash values ​​of multiple test files, thus verifying the reliability of the storage device's garbage collection scheme. Through repeated testing, accurate verification is achieved, allowing for the timely detection and resolution of potential problems in the garbage collection mechanism. The log file can also store the hash value of the source file for hash value comparison.

[0078] Furthermore, the step of comparing the hash value of the written test file with the hash value of the source file and analyzing the comparison result includes:

[0079] Based on preset rules, analyze and compare the results;

[0080] The preset rules include:

[0081] If the hash value of the test file is inconsistent with the hash value of the source file, output a test failure message;

[0082] If the hash value of the test file matches the hash value of the source file, output a message indicating that the test was successful.

[0083] Specifically, the hash value of the calculated test file can be obtained from the log file and compared with the hash value of the source file. If the hash value of the test file is inconsistent with the hash value of the source file, it means that the test file has changed during the test, the test fails and exits immediately. If the hash value of the test file is consistent with the hash value of the source file, the verification is successful, the test success message is output, and the time taken for this round of testing is recorded. Subsequently, repeated tests can be performed to verify the reliability of the garbage collection scheme of the storage device. The time difference of multiple rounds of testing can be compared so that when hash value inconsistencies occur, the recorded data can be used to assist in analysis to determine the cause, and potential problems in the garbage collection mechanism can be discovered and resolved in a timely manner.

[0084] The testing method in this embodiment tests the garbage collection mechanism of the storage device from multiple dimensions, covering file operations, cache cleanup, system load simulation, and other aspects. This effectively evaluates the reliability of the garbage collection scheme and allows for early detection of potential problems in the storage device's garbage collection mechanism, ensuring that the storage device maintains stable performance and data consistency under high load and complex environments.

[0085] As a second embodiment of this application, and a further improvement upon the first embodiment, a testing method is disclosed, wherein the step of calculating the hash value of the written test file includes:

[0086] To enable intermittent operation;

[0087] The intermittent operation includes:

[0088] Pause the calculation of the hash value of the test file;

[0089] Execute the first sleep time;

[0090] Resume calculation operations;

[0091] Execute the second sleep time;

[0092] Resume the computation operation until the computation process ends and the calculated hash value is obtained.

[0093] The testing method in this embodiment involves pausing the calculation of the hash value of the test file, performing a first sleep period, resuming the calculation, performing a second sleep period, and resuming the calculation again, until the calculation process ends. Unlike the intermittent operation described in the previous embodiment, this method adds multiple sleep steps to make the simulated process pause and resume operation more closely resemble actual usage scenarios and increases the complexity of the test environment. This tests whether the storage device can stably resume operation after a temporary interruption in a complex environment. After simulating the process pause and resume operation, the hash value of the test file is compared with the hash value of the source file to determine whether the storage device can continue to calculate the hash value normally under such complex conditions when interrupted and resumed during garbage collection. If the calculated hash value of the test file is inconsistent with the hash value of the source file, it indicates that garbage collection has affected the content of the test file during the intermittent operation or in one of the aforementioned environments, and the test fails, outputting a test failure message. If the calculated hash value of the test file is consistent with the hash value of the source file, it indicates that the storage device can correctly handle file operations and maintain data consistency during garbage collection, outputting a test success message.

[0094] It should be noted that in this embodiment, the duration of the first sleep time and the duration of the second sleep time can be the same or different. Designers can choose according to the scenario they want to test. If consistency is desired, the duration of the first sleep time and the duration of the second sleep time can be the same, i.e., a fixed duration can be used. If randomness is desired to test the storage device's response under different conditions, the duration of the first sleep time and the duration of the second sleep time can be different. The duration of the first sleep time can be greater than the duration of the second sleep time, or it can be less than the duration of the second sleep time. In this embodiment, the duration of the first sleep time can be 5 seconds, and the duration of the second sleep time can be 0.5 seconds, thereby achieving randomness to test the storage device's response under different conditions.

[0095] like Figure 2 As shown, as a third embodiment of this application, a testing device 100 is disclosed, the testing device 100 comprising:

[0096] Memory 200 is used to store computer programs;

[0097] The processor 300 is used to implement the steps of a test method as disclosed above when executing a computer program.

[0098] The testing device 100 provided in this embodiment of the invention has the beneficial effects of the aforementioned testing method.

[0099] Accordingly, embodiments of the present invention also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of a test method as disclosed above.

[0100] The computer-readable storage medium provided in this embodiment of the invention has the beneficial effects of the aforementioned test method.

[0101] It should be noted that the limitations on each step involved in this solution are not considered as limiting the order of steps, provided that they do not affect the implementation of the specific solution. The steps listed first can be executed first, later, or even simultaneously. As long as this solution can be implemented, it should be considered to fall within the scope of protection of this application.

[0102] It should be noted that the inventive concept of this application can form many embodiments, but due to the limited space of the application documents, they cannot all be listed. Therefore, without conflict, the embodiments described above or the technical features can be arbitrarily combined to form new embodiments. After the embodiments or technical features are combined, the original technical effect will be enhanced.

[0103] The above description, in conjunction with specific optional embodiments, provides a further detailed explanation of this application and should not be construed as limiting the specific implementation of this application to these descriptions. For those skilled in the art, various simple deductions or substitutions can be made without departing from the concept of this application, and all such modifications or substitutions should be considered within the scope of protection of this application.

Claims

1. A testing method applied to a storage device, characterized in that, Including the following steps: Create source file; Create a test file; Write the test file to the storage device; Clear the cache contents of the storage device; Calculate the hash value of the test file after it has been written; Compare the hash value of the written test file with the hash value of the source file, and analyze the comparison results. The test file has the same content as the source file.

2. The test method according to claim 1, characterized in that, The steps for calculating the hash value of the written test file include: Implement intermittent operation; The intermittent operation includes: Pause the calculation of the hash value of the test file; Execute sleep time; Resume the computation operation until the computation process ends and the calculated hash value is obtained.

3. The test method according to claim 2, characterized in that, The duration of the sleep time is X seconds, where X is a positive integer; Wherein, X is greater than or equal to 0.5 and less than or equal to 10.

4. The test method according to claim 1, characterized in that, The steps for calculating the hash value of the written test file include: To enable intermittent operation; The intermittent operation includes: Pause the calculation of the hash value of the test file; Execute the first sleep time; Resume calculation operations; Execute the second sleep time; Resume the computation operation until the computation process ends and the calculated hash value is obtained.

5. The test method according to claim 4, characterized in that, The duration of the first sleep time is different from the duration of the second sleep time; Wherein, the duration of the first sleep time is greater than the duration of the second sleep time / or, The duration of the first sleep time is shorter than the duration of the second sleep time.

6. The test method according to claim 1, characterized in that, The size of the source file is between 1GB and 512MB.

7. The test method according to claim 1, characterized in that, The hash value of the calculated test file is written to the log file of the storage device.

8. The test method according to claim 1, characterized in that, The step of comparing the hash value of the written test file with the hash value of the source file and analyzing the comparison result includes: Based on preset rules, analyze and compare the results; The preset rules include: If the hash value of the test file is inconsistent with the hash value of the source file, output a test failure message; If the hash value of the test file matches the hash value of the source file, output a message indicating that the test was successful.

9. A testing device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the steps of a test method as described in any one of claims 1 to 8.

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