Cache mode setting method, device, computer equipment and storage medium

By flexibly switching cache modes in the storage cluster according to the number of controllers and scenario changes, the problem of a single cache mode setting strategy is solved, performance and user experience are improved, and the needs of multi-controller scenarios are met.

CN119148941BActive Publication Date: 2025-09-23INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411280554.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-12
Publication Date
2025-09-23
Estimated Expiration
2044-09-12

AI Technical Summary

Technical Problem

In the existing technology, the cache mode setting strategy of the storage cluster is single and cannot effectively adapt to the multi-controller scenario, resulting in performance degradation, inability to provide flexible mode switching, and poor user experience.

Method used

By determining the number of controllers in the storage cluster, setting the duration of write-back mode, and flexibly switching cache modes in different scenarios, including write-back and write-through modes, using callback functions and variable structures to identify user needs, the cache mode can be adjusted to adapt to different scenarios and fault recovery.

Benefits of technology

It improves the performance of the storage cluster in a single-control state, enhances the redundancy mechanism for failure and failure recovery scenarios, provides flexible cache mode switching, and improves user experience and overall processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119148941B_ABST
    Figure CN119148941B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of computer technology and discloses a cache mode setting method, apparatus, computer equipment, and storage medium. The method comprises: determining the number of controllers in a storage cluster; when the number of controllers is less than or equal to a first preset value, determining a setting duration for a write-back mode; if the setting duration is greater than a second preset value, setting the cache mode of the storage cluster to a write-back mode and maintaining the cache mode of the storage cluster in the write-back mode for the set duration; after the set duration, setting the cache mode of the storage cluster to a write-through mode; and when the setting duration is less than or equal to the second preset value, setting the cache mode of the storage cluster to a write-through mode. The present invention solves the problem of a single cache mode setting strategy and low adaptability to multi-controller scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a cache mode setting method, device, computer equipment and storage medium. Background Art

[0002] The storage cluster handles cached data in different caching modes, including cache write-back and cache write-through. In cache write-back mode, data is returned after being written to the cache, without requiring a down-flush, helping to reduce latency and improve data read and write performance. In cache write-through mode, data is flushed after being written to the cache, maintaining the maximum flush rate. This mode reduces data read and write performance, but ensures a certain level of data security.

[0003] The current cache mode setting policy for different storage cluster controllers is to adjust the storage cluster's cache mode based on the redundancy status of the controllers in the storage cluster. If there are multiple redundant controllers, the cache mode is set to cache data write-back, and data is mirrored in the cache module. If there is only one controller, the cache mode is set to cache data write-through, saving data to the underlying disk. This single cache mode setting policy, which always enables write-through mode in a single-controller state, results in performance degradation and poor adaptability to multi-controller scenarios.

[0004] Therefore, the related technology has the problem of a single cache mode setting strategy and low adaptability to multi-controller scenarios. Summary of the Invention

[0005] In view of this, the present invention provides a cache mode setting method, apparatus, computer device and storage medium to solve the problem that the cache mode setting strategy is single and has low adaptability to multi-controller scenarios.

[0006] In a first aspect, the present invention provides a cache mode setting method, comprising:

[0007] Determine the number of controllers in the storage cluster;

[0008] When the number of controllers is less than or equal to a first preset value, determining a setting duration of the write-back mode; if the setting duration is greater than a second preset value, setting the cache mode of the storage cluster to the write-back mode, and maintaining the cache mode of the storage cluster in the write-back mode for the set duration;

[0009] After setting the duration, set the cache mode of the storage cluster to write-through mode;

[0010] When the set duration is less than or equal to the second preset value, the cache mode of the storage cluster is set to the write-through mode.

[0011] The cache mode setting method provided in this embodiment adjusts the cache mode of the storage cluster by setting different setting durations for the write-back mode when the number of controllers is less than or equal to a first preset value, so that the cache mode can be flexibly switched between the write-back and write-through modes, and the user sets the duration of the write-back mode. After the set duration, the cache mode of the storage cluster is set to the write-through mode. This improves the redundancy mechanism for responding to failure and failure recovery scenarios. Setting the cache mode to the write-back mode helps improve the performance of the storage cluster in a single-controller state, facilitates user selection of the cache mode, and improves the user experience. This solves the problem of a single cache mode setting strategy and low adaptability to multi-controller scenarios.

[0012] In some optional implementations, determining a setting duration of the write-back mode, and setting the cache mode of the storage cluster to the write-back mode if the setting duration is greater than a second preset value, includes:

[0013] In response to a command line modification instruction for configuring a set duration, obtaining a value of a first variable structure using a first callback function, and using the value of the first variable structure as the set duration;

[0014] If the set duration is greater than the second preset value, determining whether the cache mode of the storage cluster is a write-back mode;

[0015] If yes, reset the duration of the write-back mode according to the set duration;

[0016] If not, set the cache mode of the storage cluster to write-back mode and set the duration to the duration of write-back mode.

[0017] In this embodiment, a first callback function is used to obtain the value of a first variable structure, which is used as a set duration to set the storage cluster's cache mode to write-back mode. The set duration is then set to the duration of write-back mode. The callback function identifies the value of the variable structure and adjusts the storage cluster's cache mode based on changes in the variable structure's value, better meeting user needs and adjusting data performance.

[0018] In some optional implementations, setting the cache mode of the storage cluster to the write-back mode and maintaining the cache mode of the storage cluster in the write-back mode for a set period of time includes:

[0019] By setting the second variable structure to a third preset value, the storage cluster is configured to set the cache mode to the write-back mode when the second variable structure is the third preset value;

[0020] Set the third variable structure to the fourth preset value;

[0021] When the third variable structure is a fourth preset value, the second callback function is called;

[0022] According to the second callback function and the set duration, a timer is set, and the cache mode is marked as a write-back mode, wherein the timer is used to determine the duration of the write-back mode;

[0023] When the timer time is less than the set duration, the cache mode is kept in write-back mode.

[0024] In this embodiment, the cache mode is set to write-back mode by setting the second variable structure to a third preset value. A callback function identifies the value of the variable structure and adjusts the storage cluster's cache mode based on changes in the variable structure's value, better meeting user needs and adjusting data performance. A timer is set based on the second callback function and the set duration to determine the duration of write-back mode, facilitating control of the cache mode.

[0025] In some optional implementations, after the time period is set, setting the cache mode of the storage cluster to a write-through mode includes:

[0026] When the timer time is equal to the set duration, the third callback function is called;

[0027] Using the third callback function, the fourth variable structure is set to the fifth preset value;

[0028] When the fourth variable structure is the fifth preset value, by setting the second variable structure to the sixth preset value, the storage cluster is configured to set the cache mode to the write-through mode when the second variable structure is the sixth preset value.

[0029] In this embodiment, the third callback function is used to set the fourth variable structure to the fifth preset value and the second variable structure to the sixth preset value, thereby setting the cache mode to write-through mode. The callback function identifies the value of the variable structure and adjusts the storage cluster's cache mode based on the change in the variable structure's value, better meeting user needs and adjusting data performance.

[0030] In some optional implementations, when the set duration is less than or equal to the second preset value, setting the cache mode of the storage cluster to the write-through mode includes:

[0031] If the set duration is less than or equal to the second preset value, determining whether the cache mode is the write-back mode;

[0032] If yes, then by setting the second variable structure to a sixth preset value, the storage cluster is configured to set the cache mode to the write-through mode when the second variable structure is the sixth preset value;

[0033] If not, set the cache mode to write-through.

[0034] In some optional implementations, after determining the number of controllers in the storage cluster, the method further includes:

[0035] When the number of controllers is greater than a first preset value, determining whether a storage cluster failure occurs;

[0036] If the storage cluster is not faulty, set the cache mode of the storage cluster to write-back mode;

[0037] If a storage cluster fails, a target controller is determined from the controllers, and the storage cluster is set to a control mode based on the target controller;

[0038] Determine the duration of write-back mode.

[0039] If the set duration is greater than the second preset value, the cache mode of the storage cluster is set to write-back mode;

[0040] If the set duration is less than or equal to the second preset value, the cache mode of the storage cluster is set to write-through mode;

[0041] Determine whether a command line modification instruction is received, and if so, determine the modification duration of the write-back mode according to the command line modification instruction;

[0042] If the modification duration is greater than a second preset value, the cache mode of the storage cluster is set to write-back mode;

[0043] If the modification duration is less than or equal to a second preset value, setting the cache mode of the storage cluster to a write-through mode;

[0044] If the storage cluster fails over, set the storage cluster to a control mode based on the number of controllers and set the cache mode of the storage cluster to write-back mode.

[0045] In this embodiment, if the storage cluster has not failed, the cache mode of the storage cluster is set to write-back mode; if the storage cluster has failed, the storage cluster is set to a control mode based on the target controller; and the duration of the write-back mode is set according to the setting duration and modification duration of the write-back mode. If the storage cluster fails and recovers, the storage cluster is set to a control mode based on the number of controllers, and the cache mode of the storage cluster is set to write-back mode. The redundancy mechanism for coping with failure and failure recovery scenarios is improved, and the default write-back mode also helps to improve the overall performance of the storage cluster in a single-controller state. Combined with the node failure / failure recovery scenario, different cache modes can be provided according to scenario changes and user settings, thereby improving overall processing efficiency and smooth experience.

[0046] In some optional embodiments, the method further comprises:

[0047] When the number of controllers is less than or equal to a first preset value, a set duration query command is generated, and an identification field and a timestamp corresponding to the write-back mode are acquired through the set duration query command;

[0048] Determine whether the cache mode of the storage cluster is write-back mode according to the identification field;

[0049] If the cache mode of the storage cluster is write-back mode, whether to end the write-back mode is determined based on the timestamp.

[0050] In a second aspect, the present invention provides a cache mode setting device, comprising:

[0051] A determination module, used to determine the number of controllers in the storage cluster;

[0052] A first setting module is configured to determine a setting duration of the write-back mode when the number of controllers is less than or equal to a first preset value, and if the setting duration is greater than a second preset value, set the cache mode of the storage cluster to the write-back mode, and maintain the cache mode of the storage cluster in the write-back mode for the set duration;

[0053] The second setting module is used to set the cache mode of the storage cluster to a write-through mode after a set time period;

[0054] The third setting module is configured to set the cache mode of the storage cluster to the write-through mode when the set duration is less than or equal to a second preset value.

[0055] In a third aspect, the present invention provides a computer device comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the cache mode setting method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0056] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the cache mode setting method of the first aspect or any corresponding embodiment thereof.

[0057] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions, which are used to enable a computer to execute the cache mode setting method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in related technologies, the following briefly introduces the drawings required for use in the specific embodiments or related technical descriptions. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0059] Figure 1 is a flow chart of a method for setting a cache mode according to an embodiment of the present invention;

[0060] Figure 2 is a schematic diagram of setting a cache mode according to the number of storage cluster controllers according to an embodiment of the present invention;

[0061] Figure 3 is a schematic diagram of setting a cache mode according to a set duration according to an embodiment of the present invention;

[0062] Figure 4 is a schematic diagram of setting a cache mode according to a write-back mode duration according to an embodiment of the present invention;

[0063] Figure 5 is a schematic diagram of a variable structure according to an embodiment of the present invention;

[0064] Figure 6 is a schematic diagram of a callback function according to an embodiment of the present invention;

[0065] Figure 7 This is a flowchart of setting cache modes for a single controller and multiple controllers in a storage cluster according to an embodiment of the present invention;

[0066] Figure 8 is a schematic diagram of setting a cache mode for multiple controllers in a storage cluster according to an embodiment of the present invention;

[0067] Figure 9 is a structural block diagram of a cache mode setting device according to an embodiment of the present invention;

[0068] Figure 10 Schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0069] To make the purpose, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative efforts shall fall within the scope of protection of the present invention.

[0070] Currently, for data redundancy protection, if there is only one controller in a mirrored pair, the cache mode is locked to write-through on low- and mid-range storage products. This is because there is only one node in the mirrored pair in this scenario, and there is only one copy of the cached data. Once a node fails, the data in the cache is at risk of being lost. In write-through mode, after the data is written to the cache, it is first flushed to disk, and the back-end storage array provides data redundancy protection, resulting in higher data security. In high-end storage products, customers have higher requirements for front-end business throughput in various scenarios. In single-control scenarios, write-back mode must be maintained for a certain period of time to maintain business traffic. During this period, customers can repair the on-site environment by restoring the failed controller and other means to get it out of the single-control state.

[0071] Therefore, the current data mode processing strategies for different storage cluster controllers are relatively simple. Since most current storage systems are based on dual controllers, the processing strategy adopted is to flush data when using a single controller and write data back when using multiple controllers. The existing technology has a relatively simple cache data mode, does not provide users with optional data mode switching, and always uses write-through mode in single-controller mode, resulting in performance degradation. It also has low adaptability to multi-controller scenarios.

[0072] Based on the above, an embodiment of the present invention provides a cache mode setting method that can switch the cache mode of a storage cluster containing a single controller and configure the duration of the cache mode. In single-controller mode, the user can set the cache mode and the corresponding setting duration through the command line. The setting duration can be used to set the cache mode in the single-controller state to remain in write-back mode or change it to write-through mode, and the expiration time of the write-back mode can be set and queried. This multi-functional mode of cache state switching better combines the scenarios of node failure / fault recovery. This achieves the effect of providing different cache modes according to scenario changes and user settings, improving overall processing efficiency and smooth experience, and better adapting to user needs and adjusting data performance.

[0073] According to an embodiment of the present invention, a cache mode setting embodiment is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer device with data processing capabilities, such as a computer, a server, etc., and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0074] In this embodiment, a cache mode setting method is provided, which can be used in the above-mentioned computer device. Figure 1 is a flow chart of a method for setting a cache mode according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:

[0075] Step S101: Determine the number of controllers in the storage cluster.

[0076] Specifically, this embodiment sets the cache mode of the storage cluster based on the number of controllers in the storage cluster. For example, if the storage cluster has only one controller, the storage cluster is in single-controller mode; if the storage cluster has multiple controllers, the storage cluster can be in multi-controller mode.

[0077] When the number of controllers in a storage cluster is greater than one, meaning more than one controller is processing cached data, the storage cluster's cache mode is set to write-back mode to ensure data processing efficiency. When the number of controllers in the cluster is one, meaning only one controller in the storage system is currently processing cached data, the cache mode in the storage cluster is set to write-back mode via the ONEWAYCACHE switch. ONEWAYCACHE is a cache consistency model primarily used to manage cache data consistency in multi-processor or multi-node systems. This model allows data to propagate unidirectionally between different processors or nodes, ensuring data consistency.

[0078] The above process is as follows Figure 2 As shown, determine the number of controllers in the cluster and determine whether the number is greater than 1. If it is greater than 1, set the cache mode of the storage cluster to data write-back mode. Otherwise, set the cache mode of the storage cluster to single-controller data write-back mode. It should be noted that there is no difference between single-controller data write-back mode and data write-back mode.

[0079] Step S102, when the number of controllers is less than or equal to a first preset value, determine the setting duration of the write-back mode. If the setting duration is greater than a second preset value, set the cache mode of the storage cluster to the write-back mode, and keep the cache mode of the storage cluster in the write-back mode within the set duration.

[0080] Specifically, the first preset value is, for example, 1 or other smaller integers. When the number of controllers is less than or equal to the first preset value, the storage cluster can be considered to be in single-control mode. At this time, it is necessary to determine the set duration of the write mode, which is set by the user through the command line. The second preset value is, for example, 0 or other smaller values. If the set duration is greater than the second preset value, it can be determined that the user needs to set the cache mode of the storage cluster to write-back mode and maintain the set duration. Therefore, the cache mode of the storage cluster is set to write-back mode, and the cache mode of the storage cluster is maintained in write-back mode within the set duration.

[0081] The above process is as follows Figure 3As shown, the default duration of a single controller is 2 days (Day). The user-set duration T is determined, and whether T is greater than 0 is judged. If T is greater than 0, the cache mode of the storage cluster is set to the single-controller write-back mode, i.e., the write-back mode.

[0082] Step S103: After the time period is set, the cache mode of the storage cluster is set to a write-through mode.

[0083] Specifically, in addition to adjusting the cache mode of the storage cluster according to the set duration, this embodiment also adds a user-selectable and settable mode time, that is, the cache mode is set to the write-back mode duration by setting the time. Within the set duration, the cache mode is maintained in the write-back mode; after the set duration, the cache mode of the storage cluster is set to the write-through mode.

[0084] The above process is as follows Figure 4 As shown, determine the single-control data write-back time and judge whether it times out. If it times out, set the cache mode of the storage cluster to single-control write-through mode, i.e., write-through mode. If it does not time out, continue to keep the cache mode of the storage cluster set to single-control write-back mode, i.e., write-back mode.

[0085] Step S104: When the set duration is less than or equal to the second preset value, the cache mode of the storage cluster is set to a write-through mode.

[0086] Specifically, users can choose to enable write-back mode in single-controller mode, or disable write-back mode and enable write-through mode by setting different setting durations. When the number of controllers is less than or equal to the first preset value, the cache mode of data write-back is adopted by default, and the default duration is 2 natural days. If the setting duration set by the user is less than or equal to the second preset value, there is no need to set the cache mode of the storage cluster to write-back mode, and it can be directly set to write-through mode.

[0087] The above process is as follows Figure 3 As shown, the default duration of a single controller is 2 days (Day). The user-set duration T is determined, and whether T is greater than 0 is judged. If T is not greater than 0, the cache mode of the storage cluster is set to the single-controller write-through mode, i.e., the write-through mode.

[0088] The cache mode setting method provided in this embodiment adjusts the cache mode of the storage cluster by setting different setting durations for the write-back mode when the number of controllers is less than or equal to a first preset value, so that the cache mode can be flexibly switched between the write-back and write-through modes, and the user sets the duration of the write-back mode. After the set duration, the cache mode of the storage cluster is set to the write-through mode. This improves the redundancy mechanism for responding to failure and failure recovery scenarios. Setting the cache mode to the write-back mode helps improve the performance of the storage cluster in a single-controller state, facilitates user selection of the cache mode, and improves the user experience. This solves the problem of a single cache mode setting strategy and low adaptability to multi-controller scenarios.

[0089] In some optional implementations, determining a setting duration of the write-back mode, and setting the cache mode of the storage cluster to the write-back mode if the setting duration is greater than a second preset value, includes:

[0090] In response to a command line modification instruction for configuring a set duration, obtaining a value of a first variable structure using a first callback function, and using the value of the first variable structure as the set duration;

[0091] If the set duration is greater than the second preset value, determining whether the cache mode of the storage cluster is a write-back mode;

[0092] If yes, reset the duration of the write-back mode according to the set duration;

[0093] If not, set the cache mode of the storage cluster to write-back mode and set the duration to the duration of write-back mode.

[0094] Specifically, this embodiment adds a command line control process, allowing users to query and set the status of single-control write-back through cli (Command Line Interface) commands. The command line modification instructions are included in the cli commands. The command line modification instructions are, for example: choneway cache time. The command line modification instructions can be used to set different setting durations for the write-back mode.

[0095] In order to facilitate the control of each module's recognition and response to the switching of cache modes, this embodiment adds multiple variable structures to control state changes, such as Figure 5As shown, this embodiment sets a plurality of variable structures, for example: the first variable structure timerDuration, timerDuration is used to set and identify the duration of single-control write-back, and also includes variable structures timerChanged, timerSwitch, timerExpired and ONEWAYCACHE, timerChanged is used to identify and control whether to switch the state or time, timerSwitch is used to control and identify the opening of single-control write-back, ONEWAYCACHE is used to set the write-back switch when running the cache mode, and timerExpired is used to identify and control whether the single-control write-back times out. The value of timerDuration is the duration set by the user. The state value callback function can monitor the value of the above variable structure, determine the change of the state machine state, and switch the cache mode by setting ONEWAYCACHE, so as to realize the control of the cache mode of the storage cluster to write-back / write-through by monitoring whether the variable switches the state value.

[0096] The status value callback function is as follows Figure 6 As shown, this embodiment sets three callback functions, namely: callback function A, callback function B, and callback function C. The first callback function is, for example, callback function C. Callback function C is used to mark timerChanged as true when the set timerDuration value is 0; when the set timerDuration value is greater than 0, determine whether the cache mode of the current storage cluster is in write-back mode, and adjust the cache mode of the storage cluster according to the set duration.

[0097] When a user issues a command line modification instruction to modify the write-back mode setting time, the first callback function is called in response to the command line modification instruction for configuring the setting duration. The first callback function obtains the value of the first variable structure (timerDuration) and uses the value of the first variable structure as the setting duration.

[0098] The second preset value is, for example, 0 or another smaller value. If the set duration is less than or equal to the second preset value, the flag timerChanged is set to true. If the set duration is greater than the second preset value, a determination is made as to whether the cache mode of the storage cluster is write-back mode. If it is write-back mode, the duration of the write-back mode is reset based on the set duration, for example, by canceling the original timer or resetting the timer based on the set duration. If it is not write-back mode, set the cache mode of the storage cluster to write-back mode, and set the set duration to the duration of the write-back mode. For example, set the variable structure timerSwitch to true, and set ONEWAYCACHE to true. Turn on the ONEWAYCACHE switch to set the cache mode of the storage cluster to write-back mode. ONEWAYCACHE is a flag in the cache module state machine, indicating that the internal control turns on the single-controller write-back mode. TimerSwitch is the timer switch. Turning on timerSwitch means turning on the timer switch and the timer starts working. Setting ONEWAYCACHE means setting the flag to true. At this time, even in the single-controller state, the write-back mode continues to be maintained. Otherwise, the cache mode is switched to write-through in the single-controller state.

[0099] The above process is as follows Figure 6 As shown, callback function C: When a change in timerDuration is detected, callback function C is called to determine whether the value of timerDuration is greater than 0. If it is equal to 0, timerChanged is set to true; if it is greater than 0, it is determined whether the timer is turned on. If it is turned on, the original timer is canceled and the timer is reset; if it is not turned on, timerChanged is set to true.

[0100] In this embodiment, a first callback function is used to obtain the value of a first variable structure, which is used as a set duration to set the storage cluster's cache mode to write-back mode. The set duration is then set to the duration of write-back mode. The callback function identifies the value of the variable structure and adjusts the storage cluster's cache mode based on changes in the variable structure's value, better meeting user needs and adjusting data performance.

[0101] In some optional implementations, setting the cache mode of the storage cluster to the write-back mode and maintaining the cache mode of the storage cluster in the write-back mode for a set period of time includes:

[0102] By setting the second variable structure to a third preset value, the storage cluster is configured to set the cache mode to the write-back mode when the second variable structure is the third preset value;

[0103] Set the third variable structure to the fourth preset value;

[0104] When the third variable structure is a fourth preset value, the second callback function is called;

[0105] According to the second callback function and the set duration, a timer is set, and the cache mode is marked as a write-back mode, wherein the timer is used to determine the duration of the write-back mode;

[0106] When the timer time is less than the set duration, the cache mode is kept in write-back mode.

[0107] Specifically, the second variable structure is, for example, ONEWAYCACHE, the third variable structure is, for example, timerSwitch, and the second callback function is, for example, callback function A.

[0108] The third preset value is, for example, true. The storage cluster is configured to set the cache mode to write-back mode when the second variable structure is the third preset value. For example, by setting ONEWAYCACHE to true, turning on the ONEWAYCACHE switch sets the cache mode of the storage cluster to write-back mode.

[0109] The fourth preset value is, for example, true. The third variable structure (timerSwitch) is set to true, and callback function A is called when a change in the value of timerSwitch is detected.

[0110] When the value of timerSwitch changes to true, callback function A sets a timer with the set duration using the uttm structure and marks the cache mode as write-back. If the timer duration is less than the set duration, the cache mode remains in write-back mode. When the value of timerSwitch changes to false, callback function A stops the running uttm timer.

[0111] The above process is as follows Figure 6 As shown, callback function A: determines whether timerSwitch has changed and calls callback function A. Determines whether the value of timerSwitch is true. If so, sets the timer; if false, turns off the timer.

[0112] In this embodiment, the cache mode is set to write-back mode by setting the second variable structure to a third preset value. A callback function identifies the value of the variable structure and adjusts the storage cluster's cache mode based on changes in the variable structure's value, better meeting user needs and adjusting data performance. A timer is set based on the second callback function and the set duration to determine the duration of write-back mode, facilitating control of the cache mode.

[0113] In some optional implementations, after the time period is set, setting the cache mode of the storage cluster to a write-through mode includes:

[0114] When the timer time is equal to the set duration, the third callback function is called;

[0115] Using the third callback function, the fourth variable structure is set to the fifth preset value;

[0116] When the fourth variable structure is the fifth preset value, by setting the second variable structure to the sixth preset value, the storage cluster is configured to set the cache mode to the write-through mode when the second variable structure is the sixth preset value.

[0117] Specifically, the third callback function is, for example, callback function B. The fourth variable structure is, for example, timerExpired, and the second variable structure is, for example, ONEWAYCACHE.

[0118] When the timer time is equal to the set duration, it is determined that the duration of the write-back mode reaches the user's set duration. After that, the duration of the write-back mode will exceed the set duration. It is necessary to turn off the write-back mode and change the cache mode of the storage cluster to write-through mode. The third callback function is called and the cache mode of the storage cluster is changed to write-through mode using the third callback function.

[0119] The fifth preset value is, for example, true, and the third callback function is used to set timerExpired to true.

[0120] The sixth preset value is, for example, false. When timerExpired is true, the second variable structure (ONEWAYCACHE) is set to false. The storage cluster is configured to set the cache mode to write-through mode when the second variable structure is the sixth preset value. For example, by setting ONEWAYCACHE to false, the ONEWAYCACHE switch is turned off, and the cache mode of the storage cluster is set to write-through mode.

[0121] The above process is as follows Figure 6 As shown, callback function B: when the timer times out, callback function B is called, timerExpired=true is set, and the cache mode is set to write-through mode.

[0122] In this embodiment, the third callback function is used to set the fourth variable structure to the fifth preset value and the second variable structure to the sixth preset value, thereby setting the cache mode to write-through mode. The callback function identifies the value of the variable structure and adjusts the storage cluster's cache mode based on the change in the variable structure's value, better meeting user needs and adjusting data performance.

[0123] In some optional implementations, when the set duration is less than or equal to the second preset value, setting the cache mode of the storage cluster to the write-through mode includes:

[0124] If the set duration is less than or equal to the second preset value, determining whether the cache mode is the write-back mode;

[0125] If yes, then by setting the second variable structure to a sixth preset value, the storage cluster is configured to set the cache mode to the write-through mode when the second variable structure is the sixth preset value;

[0126] If not, set the cache mode to write-through.

[0127] Specifically, the second preset value is, for example, 0 or other smaller values.

[0128] The user can modify the command line to set the write-back mode duration, for example: chonewaycache time.

[0129] If the set duration is less than or equal to the second preset value, it indicates that the cache mode of the storage cluster needs to be set to write-through mode, including:

[0130] The sixth preset value is, for example, false, and the second variable structure is, for example, ONEWAYCACHE. A determination is made as to whether the cache mode is write-back mode. If so, by setting ONEWAYCACHE to false, the storage cluster is configured to set the cache mode to write-through mode when the second variable structure is the sixth preset value. For example, by setting ONEWAYCACHE to false, the ONEWAYCACHE switch is turned off, and the cache mode of the storage cluster is set to write-through mode. If not in write-back mode, the cache mode is directly set to write-through mode.

[0131] In addition, if the user does not modify the command to set the write-back mode duration through the command line, the write-back state is enabled by default when only one controller remains in the cluster and remains for two days.

[0132] In some optional implementations, after determining the number of controllers in the storage cluster, the method further includes:

[0133] When the number of controllers is greater than a first preset value, determining whether a storage cluster failure occurs;

[0134] If the storage cluster is not faulty, set the cache mode of the storage cluster to write-back mode;

[0135] If a storage cluster fails, a target controller is determined from the controllers, and the storage cluster is set to a control mode based on the target controller;

[0136] Determine the duration of write-back mode.

[0137] If the set duration is greater than the second preset value, the cache mode of the storage cluster is set to write-back mode;

[0138] If the set duration is less than or equal to the second preset value, the cache mode of the storage cluster is set to write-through mode;

[0139] Determine whether a command line modification instruction is received, and if so, determine the modification duration of the write-back mode according to the command line modification instruction;

[0140] If the modification duration is greater than a second preset value, the cache mode of the storage cluster is set to write-back mode;

[0141] If the modification duration is less than or equal to a second preset value, setting the cache mode of the storage cluster to a write-through mode;

[0142] If the storage cluster fails over, set the storage cluster to a control mode based on the number of controllers and set the cache mode of the storage cluster to write-back mode.

[0143] Specifically, through the above variable structure, callback function and command line setting instructions, the timer state value and the corresponding cache mode state change can be effectively controlled, and different corresponding changes can be made when performing operations in different states. Figure 7 As shown, the state machine state changes are determined. If there is only one controller in the cluster, the system checks whether timerDuration is greater than 0. If so, it turns on timerSwitch and sets ONEWAYCACHE. It also checks whether timerExpired is false. If so, it cancels ONEWAYCACHE. It also checks whether timerChanged is true. If true, it sets ONEWAYCACHE based on the duration. If there are multiple controllers in the cluster, it turns off timerSwitch and cancels ONEWAYCACHE.

[0144] If the number of controllers is greater than a first preset value, determine whether the storage cluster has failed. If the storage cluster has not failed, set the cache mode of the storage cluster to write-back mode. If the storage cluster has failed, it is necessary to set the storage cluster to a single controller, determine a target controller from the controllers, and set the storage cluster to a control mode based on the target controller. The number of target controllers can be 1 or another smaller integer.

[0145] The second preset value is, for example, 0 or another smaller value. The user-set duration for the write-back mode is determined. If a node failure occurs in the storage cluster in a multi-controller state and the set duration is greater than the second preset value, the storage cluster becomes single-controller and the cache mode of the storage cluster is set to write-back mode. If a node failure occurs in the storage cluster in a multi-controller state and the set duration is less than or equal to the second preset value, the cache mode of the storage cluster is set to write-through mode.

[0146] In addition, the user can set the modification duration of the write-back mode through a command line modification instruction. A determination is made as to whether a command line modification instruction has been received. If so, the modification duration of the write-back mode is determined based on the command line modification instruction. If the modification duration is greater than a second preset value, the cache mode of the storage cluster is set to write-back mode. If the modification duration is less than or equal to the second preset value, or if the write-back mode timer expires, the cache mode of the storage cluster is set to write-through mode.

[0147] If the storage cluster fails and recovers, the storage cluster is set to a control mode based on the number of controllers, that is, the storage cluster is switched to a multi-controller state, and the cache mode of the storage cluster is set to write-back mode.

[0148] The above process is as follows Figure 8 As shown in the figure, if the storage cluster has multiple controllers, you can use timerDuration to set the duration to >= 0, meaning the single-controller write-back duration is >= 0. If a node fails and the single-controller write-back duration is 0, the cluster is set to single-controller write-through. If the node recovers, the cluster is set to multi-controller. If the storage system's cache mode is single-controller write-through, you can enable single-controller write-back mode using allowOneWay, timerSwitch, and timerChanged. If the storage cluster has multiple controllers and a node fails and the user-set single-controller write-back duration is greater than 0, you can enable single-controller write-back mode using allowOneWay and timerSwitch. While the storage cluster is in single-controller write-back mode, you can use timerDuration and timerUttm to set the single-controller write-back duration to greater than 0. If the single-controller write-back mode timer expires, you can switch the storage cluster's cache mode to single-controller write-through using timerExpired, timerSwitch, and allowOneWay. If the storage cluster is in single-controller write-back mode and the user-set timer is 0, you can use timerChanged, timerSwitch, and allowOneWay to switch the storage cluster's cache mode to single-controller write-through. If the node recovers from a single-controller write-back mode, you can use timerSwitch and allowOneWay to switch the storage cluster to multi-controller mode.

[0149] In this embodiment, if the storage cluster has not failed, the cache mode of the storage cluster is set to write-back mode; if the storage cluster has failed, the storage cluster is set to a control mode based on the target controller; and the duration of the write-back mode is set according to the setting duration and modification duration of the write-back mode. If the storage cluster fails and recovers, the storage cluster is set to a control mode based on the number of controllers, and the cache mode of the storage cluster is set to write-back mode. The redundancy mechanism for coping with failure and failure recovery scenarios is improved, and the default write-back mode also helps to improve the overall performance of the storage cluster in a single-controller state. Combined with the node failure / failure recovery scenario, different cache modes can be provided according to scenario changes and user settings, thereby improving overall processing efficiency and smooth experience.

[0150] In some optional implementations, the process of determining whether a storage cluster failure is recovered may include steps A1 to A4.

[0151] Step A1: Divide all configuration items of the storage cluster into several minimum unit configuration items;

[0152] Step A2: query the configuration information corresponding to the minimum unit configuration item and write the queried configuration information into the corresponding file; the file is named after the query command;

[0153] Step A3: Calculate the hash value of each file, compare the difference between the minimum unit configuration items before and after the storage cluster system failure recovery, and store the differences in folders or recursive folders according to the level of difference;

[0154] Specifically, the system calculates the hash value of each file and compares the differences between the minimum unit configuration items before and after the storage cluster system failure recovery. Minimum unit configuration items that do not differ before and after the storage cluster system failure recovery are placed in a first-level folder. For example, system feature configurations—SSL protocol and security level, volume protection status—are placed in a first-level folder. Minimum unit configuration items that differ before and after the storage cluster system failure recovery are processed for differences and then placed in a recursive folder based on the difference level. By converting the check of minimum unit configuration item configuration parameters into a check and comparison of the minimum unit configuration item hash value, the amount of comparison data is significantly reduced and the detection and analysis process is simplified.

[0155] Step A4, calculating the first hash value of all minimum unit configuration item files in the folder and recursive folder before the storage cluster failure recovery and the second hash value of all minimum unit configuration item files in the folder and recursive folder after the storage cluster failure recovery;

[0156] Step A5: Compare the first hash value with the second hash value and output the result.

[0157] Specifically, if the first hash value is the same as the second hash value, it means that the storage cluster failure has recovered normally, and the successful recovery information is output as the result; otherwise, the storage cluster failure recovery fails, and the minimum unit configuration items corresponding to the different first hash values ​​and second hash values ​​are recorded and output as the result.

[0158] In this implementation, all configuration items of the storage cluster are first segmented into a number of minimal unit configuration items. The first and second hash values ​​of all the minimal unit configuration item files are calculated, and the first and second hash values ​​are compared to determine whether the storage cluster has failed or recovered. This process improves detection efficiency while simplifying workflows and standardizing operations, facilitating the sharing, replication, and transfer of knowledge about automated detection methods. This embodiment boasts a reliable design principle, simple structure, and broad application prospects.

[0159] In some optional embodiments, the method further comprises:

[0160] When the number of controllers is less than or equal to a first preset value, a set duration query command is generated, and an identification field and a timestamp corresponding to the write-back mode are acquired through the set duration query command;

[0161] Determine whether the cache mode of the storage cluster is write-back mode according to the identification field;

[0162] If the cache mode of the storage cluster is write-back mode, whether to end the write-back mode is determined based on the timestamp.

[0163] Specifically, this embodiment adds a command line control process, which can query and set the status of single-controller writeback through CLI commands. The first preset value is, for example, 0 or other smaller integers. When the number of controllers is less than or equal to the first preset value, a set duration query command is generated. The set duration query command is included in the CLI command, for example, lsiogrpiogrpid. Through lsiogrpiogrpid, the single-controller writeback status and duration in the corresponding iogrp can be queried.

[0164] After entering the set duration query command, the corresponding identification field for write-back mode and the corresponding write-back mode expiration timestamp are displayed. The identification field determines whether the storage cluster's cache mode is write-back. If the storage cluster's cache mode is write-back, the timestamp determines whether to end write-back mode. This timestamp indicates when write-back will end after single-controller write-back is enabled. After this time, the cache mode switches to write-through. If single-controller write-back is not enabled or has expired, a past timestamp is displayed.

[0165] This embodiment also provides a cache mode setting device, which is used to implement the above-mentioned embodiments and preferred implementations. Details that have already been described will not be repeated. As used below, the term "module" may refer to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.

[0166] This embodiment provides a cache mode setting device, such as Figure 9 Shown, including:

[0167] Determination module 901, used to determine the number of controllers in the storage cluster;

[0168] A first setting module 902 is configured to determine a setting duration of the write-back mode when the number of controllers is less than or equal to a first preset value, and if the setting duration is greater than a second preset value, set the cache mode of the storage cluster to the write-back mode and maintain the cache mode of the storage cluster in the write-back mode for the set duration;

[0169] The second setting module 903 is used to set the cache mode of the storage cluster to the write-through mode after the set time period;

[0170] The third setting module 904 is configured to set the cache mode of the storage cluster to a write-through mode when the set duration is less than or equal to a second preset value.

[0171] In some optional implementations, the first setting module 902 determines a setting duration of the write-back mode, and if the setting duration is greater than a second preset value, sets the cache mode of the storage cluster to the write-back mode, including:

[0172] In response to a command line modification instruction for configuring a set duration, obtaining a value of a first variable structure using a first callback function, and using the value of the first variable structure as the set duration;

[0173] If the set duration is greater than the second preset value, determining whether the cache mode of the storage cluster is a write-back mode;

[0174] If yes, reset the duration of the write-back mode according to the set duration;

[0175] If not, set the cache mode of the storage cluster to write-back mode and set the duration to the duration of write-back mode.

[0176] In some optional implementations, the first setting module 902 sets the cache mode of the storage cluster to the write-back mode and maintains the cache mode of the storage cluster in the write-back mode for a set period of time, including:

[0177] By setting the second variable structure to a third preset value, the storage cluster is configured to set the cache mode to the write-back mode when the second variable structure is the third preset value;

[0178] Set the third variable structure to the fourth preset value;

[0179] When the third variable structure is a fourth preset value, the second callback function is called;

[0180] According to the second callback function and the set duration, a timer is set, and the cache mode is marked as a write-back mode, wherein the timer is used to determine the duration of the write-back mode;

[0181] When the timer time is less than the set duration, the cache mode is kept in write-back mode.

[0182] In some optional implementations, after setting the duration, the second setting module 903 sets the cache mode of the storage cluster to the write-through mode, including:

[0183] When the timer time is equal to the set duration, the third callback function is called;

[0184] Using the third callback function, the fourth variable structure is set to the fifth preset value;

[0185] When the fourth variable structure is the fifth preset value, by setting the second variable structure to the sixth preset value, the storage cluster is configured to set the cache mode to the write-through mode when the second variable structure is the sixth preset value.

[0186] In some optional implementations, when the set duration is less than or equal to the second preset value, the third setting module 904 sets the cache mode of the storage cluster to the write-through mode, including:

[0187] If the set duration is less than or equal to the second preset value, determining whether the cache mode is the write-back mode;

[0188] If yes, then by setting the second variable structure to a sixth preset value, the storage cluster is configured to set the cache mode to the write-through mode when the second variable structure is the sixth preset value;

[0189] If not, set the cache mode to write-through.

[0190] In some optional implementations, after determining the number of controllers in the storage cluster, the apparatus is configured to:

[0191] When the number of controllers is greater than a first preset value, determining whether a storage cluster failure occurs;

[0192] If the storage cluster is not faulty, set the cache mode of the storage cluster to write-back mode;

[0193] If a storage cluster fails, a target controller is determined from the controllers, and the storage cluster is set to a control mode based on the target controller;

[0194] Determine the duration of write-back mode.

[0195] If the set duration is greater than the second preset value, the cache mode of the storage cluster is set to write-back mode;

[0196] If the set duration is less than or equal to the second preset value, the cache mode of the storage cluster is set to write-through mode;

[0197] Determine whether a command line modification instruction is received, and if so, determine the modification duration of the write-back mode according to the command line modification instruction;

[0198] If the modification duration is greater than a second preset value, the cache mode of the storage cluster is set to write-back mode;

[0199] If the modification duration is less than or equal to a second preset value, setting the cache mode of the storage cluster to a write-through mode;

[0200] If the storage cluster fails over, set the storage cluster to a control mode based on the number of controllers and set the cache mode of the storage cluster to write-back mode.

[0201] In some optional embodiments, the device is further used to:

[0202] When the number of controllers is less than or equal to a first preset value, a set duration query command is generated, and an identification field and a timestamp corresponding to the write-back mode are acquired through the set duration query command;

[0203] Determine whether the cache mode of the storage cluster is write-back mode according to the identification field;

[0204] If the cache mode of the storage cluster is write-back mode, whether to end the write-back mode is determined based on the timestamp.

[0205] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0206] The cache mode setting device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0207] The embodiment of the present invention also provides a computer device having the above Figure 9 The cache mode setting device is shown.

[0208] See also Figure 10 , Figure 10 is a structural diagram of a computer device provided by an optional embodiment of the present invention, such as Figure 10 As shown, the computer device includes: one or more processors 10, memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components utilize different buses to communicate with each other and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in the memory or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Equally, multiple computer devices can be connected, and each device provides part of the necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 10 A processor 10 is taken as an example.

[0209] The processor 10 may be a central processing unit, a network processor, or a combination thereof. The processor 10 may further include an application-specific integrated circuit, a programmable logic device, or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic, or any combination thereof.

[0210] The memory 20 stores instructions that can be executed by at least one processor 10, so as to enable at least one processor 10 to execute the method shown in the above embodiment.

[0211] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and application programs required for at least one function; the data storage area may store data created based on the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely located relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0212] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid-state drive; the memory 20 may also include a combination of the above types of memory.

[0213] The computer device further includes a communication interface 30 for the computer device to communicate with other devices or a communication network.

[0214] The embodiment of the present invention also provides a computer-readable storage medium. The above-mentioned method according to the embodiment of the present invention can be implemented in hardware, firmware, or implemented as a computer code that can be recorded in a storage medium, or implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and downloaded through a network and will be stored in a local storage medium, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state drive, etc.; further, the storage medium can also include a combination of the above-mentioned types of memory. It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor or hardware, the method shown in the above embodiment is implemented.

[0215] A portion of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the form in which the computer program instruction exists in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc. Accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium that can be accessed by the computer.

[0216] Although the embodiments of the present invention have been described with reference to the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations shall fall within the scope defined in this application.

Claims

1. A cache mode setting method, characterized in that: The method comprises: Determine the number of controllers in the storage cluster; When the number of the controllers is less than or equal to a first preset value, determining a setting duration of the write-back mode; if the setting duration is greater than a second preset value, setting the cache mode of the storage cluster to the write-back mode, and maintaining the cache mode of the storage cluster in the write-back mode for the setting duration; After the set time period, setting the cache mode of the storage cluster to a write-through mode; When the set duration is less than or equal to the second preset value, the cache mode of the storage cluster is set to the write-through mode.

2. The method according to claim 1, characterized in that The determining of a setting duration of the write-back mode, and setting the cache mode of the storage cluster to the write-back mode if the setting duration is greater than a second preset value, includes: In response to a command line modification instruction for configuring the set duration, obtaining a value of a first variable structure using a first callback function, and using the value of the first variable structure as the set duration; If the set duration is greater than the second preset value, determining whether the cache mode of the storage cluster is the write-back mode; If yes, resetting the duration of the write-back mode according to the set duration; If not, the cache mode of the storage cluster is set to the write-back mode, and the set duration is set to the duration of the write-back mode.

3. The method according to claim 1, characterized in that Setting the cache mode of the storage cluster to the write-back mode and maintaining the cache mode of the storage cluster in the write-back mode for the set time period includes: By setting the second variable structure to a third preset value, the storage cluster is configured to set the cache mode to the write-back mode when the second variable structure is the third preset value; Set the third variable structure to the fourth preset value; When the third variable structure is the fourth preset value, calling the second callback function; Setting a timer according to the second callback function and the set duration, and marking the cache mode as the write-back mode, wherein the timer is used to determine the duration of the write-back mode; When the timer time is less than the set duration, the cache mode is maintained in the write-back mode.

4. The method according to claim 3, characterized in that After the set time period, setting the cache mode of the storage cluster to a write-through mode includes: When the timer time is equal to the set duration, calling the third callback function; Using the third callback function, the fourth variable structure is set to a fifth preset value; When the fourth variable structure is the fifth preset value, by setting the second variable structure to a sixth preset value, the storage cluster is configured to set the cache mode to the write-through mode when the second variable structure is the sixth preset value.

5. The method according to claim 3, characterized in that When the set duration is less than or equal to the second preset value, setting the cache mode of the storage cluster to the write-through mode includes: If the set duration is less than or equal to the second preset value, determining whether the cache mode is the write-back mode; If yes, by setting the second variable structure to a sixth preset value, the storage cluster is configured to set the cache mode to the write-through mode when the second variable structure is the sixth preset value; If not, the cache mode is set to the write-through mode.

6. The method according to claim 1, wherein After determining the number of controllers in the storage cluster, the method further includes: When the number of the controllers is greater than the first preset value, determining whether a failure occurs in the storage cluster; If the storage cluster does not fail, setting the cache mode of the storage cluster to the write-back mode; If the storage cluster fails, determining a target controller from the controllers, and setting the storage cluster to a control mode based on the target controller; Determining a setting duration of the write-back mode; If the set duration is greater than the second preset value, setting the cache mode of the storage cluster to the write-back mode; If the set duration is less than or equal to the second preset value, setting the cache mode of the storage cluster to the write-through mode; Determining whether a command line modification instruction is received, and if received, determining a modification duration of the write-back mode according to the command line modification instruction; If the modification duration is greater than the second preset value, setting the cache mode of the storage cluster to the write-back mode; If the modification duration is less than or equal to the second preset value, setting the cache mode of the storage cluster to the write-through mode; If the storage cluster fails and recovers, the storage cluster is set to a control mode of controllers based on the number of controllers, and the cache mode of the storage cluster is set to the write-back mode.

7. The method according to claim 1, characterized in that The method further comprises: When the number of the controllers is less than or equal to a first preset value, generating a set duration query command, and obtaining an identification field and a timestamp corresponding to the write-back mode through the set duration query command; Determining whether the cache mode of the storage cluster is the write-back mode according to the identification field; If the cache mode of the storage cluster is the write-back mode, determining whether to end the write-back mode is determined according to the timestamp.

8. A cache mode setting device, characterized in that: The device comprises: A determination module, used to determine the number of controllers in the storage cluster; a first setting module, configured to determine, when the number of the controllers is less than or equal to a first preset value, a setting duration of the write-back mode; if the setting duration is greater than a second preset value, set the cache mode of the storage cluster to the write-back mode, and maintain the cache mode of the storage cluster in the write-back mode for the setting duration; A second setting module is used to set the cache mode of the storage cluster to a write-through mode after the set time period; A third setting module is configured to set the cache mode of the storage cluster to the write-through mode when the set duration is less than or equal to the second preset value.

9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the cache mode setting method according to any one of claims 1 to 7 by executing the computer instructions.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the cache mode setting method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Data write-back method and device, electronic equipment and computer readable storage medium

    CN116909485A

  • Methods and systems for implementing shared disk array management functions

    US20020188655A1