Log storage method and device, equipment and storage medium

By obtaining the target data amount of log data to be stored in the log storage system and the storage amount of the target nonvolatile memory in the target controller, and determining the storage location based on the data attribute information, the log data loss problem caused by insufficient power of the nonvolatile memory is solved, and a high-reliability log data storage is achieved.

CN120104062APending Publication Date: 2025-06-06DAWNING INFORMATION IND (BEIJING) CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510237677.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-27
Publication Date
2025-06-06

AI Technical Summary

Technical Problem

The prior art When nonvolatile memory power is insufficient, storing log data may lead to loss, reducing the reliability of log data storage.

Method used

By obtaining the target data of the log data to be stored and the amount of stored data of the target nonvolatile memory in the target controller, and determining the storage location from the target nonvolatile memory and solid state drive based on the data attribute information, the log data is stored in the nonvolatile memory and synchronously stored in the memory of other controllers to ensure the persistence and reliability of the data.

Benefits of technology

Improve the reliability of log data storage, prevent data loss caused by insufficient nonvolatile memory power, and ensure data durability and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120104062A_ABST
    Figure CN120104062A_ABST
Patent Text Reader

Abstract

The invention relates to a log storage method and device, equipment and a storage medium. The method comprises the following steps: in response to a data storage request for a target controller, obtaining a target data volume of to-be-stored log data and a storable data volume of a target nonvolatile memory in the target controller, and storing the to-be-stored log data according to the target data volume, the storable data volume of the target nonvolatile memory and data attribute information of the to-be-stored log data, and determining a storage position of the to-be-stored log data from the target nonvolatile memory and a solid state disk associated with the target controller, and storing the to-be-stored log data into the target nonvolatile memory under the condition that the storage position is the target nonvolatile memory. And synchronously storing the log data to be stored into the nonvolatile memory in the other controller. By adopting the method, the reliability of log data storage can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] The log system is an important part of modern computer infrastructure, and data persistence storage is the primary consideration of the log system. In the prior art, in order to store log data persistently, the log data to be stored is generally first stored in a non-volatile memory to prevent the system power failure from causing the loss of the log data to be stored. Subsequently, the log data in the non-volatile memory is transferred to a solid-state drive to ensure the persistent storage of the data.

[0003] However, with the prior art, if the log data is still stored in the non-volatile memory when the power of the non-volatile memory is insufficient, problems such as log data loss may occur, thereby reducing the reliability of log data storage. Summary of the invention

[0004] Based on this, it is necessary to provide a log storage method, device, equipment and storage medium that can improve the reliability of log data storage in response to the above technical problems.

[0005] In a first aspect, the present application provides a log storage method, comprising:

[0006] In response to a data storage request for a target controller, obtaining a target data volume of log data to be stored and a storable data volume of a target non-volatile memory in the target controller;

[0007] Determining a storage location of the log data to be stored from the target non-volatile memory and a solid-state hard disk associated with the target controller according to the target data volume, the storable data volume of the target non-volatile memory, and data attribute information of the log data to be stored;

[0008] In the case where the storage location is the target non-volatile memory, the log data to be stored is stored in the target non-volatile memory, and the log data to be stored is synchronously stored in the non-volatile memory in other controllers.

[0009] In an embodiment of the present application, on the one hand, the storage location of the log data to be stored is selected based on the data attribute information, so as to ensure the rationality and accuracy of the data storage location; on the other hand, after the log data to be stored is stored in the target non-volatile memory, the log data to be stored is also synchronized to the non-volatile memory in other controllers to back up the log data to be stored, thereby ensuring the reliability of the log data storage.

[0010] In one embodiment, according to the target data volume, the storable data volume of the target non-volatile memory and the data attribute information of the log data to be stored, determining the storage location of the log data to be stored from the target non-volatile memory and the solid state drive associated with the target controller includes:

[0011] When the target data volume is greater than or equal to the storable data volume of the target non-volatile memory, the target non-volatile memory is used as the storage location of the log data to be stored;

[0012] When the target data volume is smaller than the storable data volume of the target non-volatile memory, the storage location of the log data to be stored is determined from the target non-volatile memory and the solid state drive associated with the target controller according to the data attribute information of the log data to be stored.

[0013] In the embodiment of the present application, by selecting a method for determining the storage location in a corresponding situation according to the size relationship between the target data volume and the storable data volume of the target non-volatile memory, the accuracy of the storage location determination can be ensured.

[0014] In one embodiment, according to data attribute information of the log data to be stored, determining a storage location of the log data to be stored from a target non-volatile memory and a solid state drive associated with a target controller includes:

[0015] Determine the available memory space of the target non-volatile memory according to the data attribute information of the log data to be stored;

[0016] Determine the maximum amount of data that can be stored in the target non-volatile memory according to the available memory space and the amount of data that can be stored in the target non-volatile memory;

[0017] When the maximum storable data volume is greater than or equal to the target data volume, the target non-volatile memory is expanded, and the expanded target non-volatile memory is used as the storage location for the log data to be stored;

[0018] When the maximum storable data volume is less than the target data volume, the solid state drive associated with the target controller is used as the storage location for the log data to be stored.

[0019] In an embodiment of the present application, by judging whether the target non-volatile memory after expansion can fully accommodate the log data to be stored based on the available memory space of the target non-volatile memory, and determining the storage location of the log data to be stored based on the judgment result, the rationality of the storage location determination can be ensured.

[0020] In one embodiment, the method further comprises:

[0021] In the case where the storage location is a solid state drive, determining a target data segment from each candidate data segment according to the target data volume and the storable data volume of each candidate data segment in the solid state drive;

[0022] Store the log data to be stored in the target data segment.

[0023] In the embodiment of the present application, by determining the target data segment according to the target data volume and the storable data volume of each candidate data segment, and storing the log data to be stored in the target data segment, the utilization rate of the memory space can be effectively improved.

[0024] In one embodiment, determining the target data segment from each candidate data segment according to the target data amount and the storable data amount of each candidate data segment in the solid state drive includes:

[0025] The candidate data segments that can store data amounts greater than the target data amount are selected as candidate data segments;

[0026] For each candidate data segment, according to the target data volume and the storable data volume of the candidate data segment, determine the remaining storable data volume of the candidate data segment after storing the log data to be stored;

[0027] The candidate data segment corresponding to the smallest remaining storable data amount among the candidate data segments is used as the target data segment.

[0028] In the embodiment of the present application, by taking the minimum memory loss as the goal and selecting the target data segment from each candidate data segment based on the remaining storable data amount of each candidate data segment, the rationality of the target data segment selection can be ensured.

[0029] In one embodiment, obtaining a target data volume of log data to be stored and a storable data volume of a target non-volatile memory in a target controller includes:

[0030] When it is determined that the remaining power of the target non-volatile memory in the target controller is greater than or equal to the power threshold, a target data volume of the log data to be stored and a storable data volume of the target non-volatile memory in the target controller are obtained.

[0031] In an embodiment of the present application, by comparing the remaining power and the power threshold, and when the remaining power is greater than or equal to the power threshold, obtaining the target data volume and the storable data volume of the target non-volatile memory for subsequent storage location selection, the reliability of log data storage can be ensured.

[0032] In one embodiment, the method further comprises:

[0033] When it is determined that the remaining power of the target non-volatile memory in the target controller is less than the power threshold, the solid state drive associated with the target controller is used as the storage location for the log data to be stored.

[0034] In an embodiment of the present application, by comparing the remaining power and the power threshold, and when the remaining power is less than the power threshold, directly using the solid-state hard disk as the storage location for the log data to be stored, the problem of losing the log data to be stored when the target non-volatile memory is low on power can be avoided, thereby ensuring the reliability of log data storage.

[0035] In a second aspect, the present application also provides a log storage device, including:

[0036] A data acquisition module, configured to acquire, in response to a data storage request for a target controller, a target data volume of log data to be stored and a storable data volume of a target non-volatile memory in the target controller;

[0037] A location determination module, used to determine a storage location of the log data to be stored from the target non-volatile memory and a solid state drive associated with the target controller according to the target data volume, the storable data volume of the target non-volatile memory and the data attribute information of the log data to be stored;

[0038] The first storage module is used to store the log data to be stored in the target non-volatile memory when the storage location is the target non-volatile memory, and to synchronously store the log data to be stored in the non-volatile memory in other controllers.

[0039] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0040] In response to a data storage request for a target controller, obtaining a target data volume of log data to be stored and a storable data volume of a target non-volatile memory in the target controller;

[0041] Determining a storage location of the log data to be stored from the target non-volatile memory and a solid-state hard disk associated with the target controller according to the target data volume, the storable data volume of the target non-volatile memory, and data attribute information of the log data to be stored;

[0042] In the case where the storage location is the target non-volatile memory, the log data to be stored is stored in the target non-volatile memory, and the log data to be stored is synchronously stored in the non-volatile memory in other controllers.

[0043] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:

[0044] In response to a data storage request for a target controller, obtaining a target data volume of log data to be stored and a storable data volume of a target non-volatile memory in the target controller;

[0045] Determining a storage location of the log data to be stored from the target non-volatile memory and a solid-state hard disk associated with the target controller according to the target data volume, the storable data volume of the target non-volatile memory, and data attribute information of the log data to be stored;

[0046] In the case where the storage location is the target non-volatile memory, the log data to be stored is stored in the target non-volatile memory, and the log data to be stored is synchronously stored in the non-volatile memory in other controllers.

[0047] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:

[0048] In response to a data storage request for a target controller, obtaining a target data volume of log data to be stored and a storable data volume of a target non-volatile memory in the target controller;

[0049] Determining a storage location of the log data to be stored from the target non-volatile memory and a solid-state hard disk associated with the target controller according to the target data volume, the storable data volume of the target non-volatile memory, and data attribute information of the log data to be stored;

[0050] In the case where the storage location is the target non-volatile memory, the log data to be stored is stored in the target non-volatile memory, and the log data to be stored is synchronously stored in the non-volatile memory in other controllers.

[0051] The log storage method, device, equipment and storage medium obtain the target data volume of the log data to be stored and the storable data volume of the target non-volatile memory in the target controller by responding to the data storage request for the target controller, and determine the storage location of the log data to be stored from the target non-volatile memory and the solid-state hard disk associated with the target controller according to the target data volume, the storable data volume of the target non-volatile memory and the data attribute information of the log data to be stored; and then, when the storage location is the target non-volatile memory, the log data to be stored is stored in the target non-volatile memory, and the log data to be stored is synchronously stored in the non-volatile memory in other controllers. Compared with the related art, in which the log data to be stored is directly stored in the non-volatile memory, the above method, on the one hand, selects the storage location of the log data to be stored based on the data attribute information, which can ensure the rationality and accuracy of the data storage location; on the other hand, after the log data to be stored is stored in the target non-volatile memory, the log data to be stored is also synchronized to the non-volatile memory in other controllers to back up the log data to be stored, thereby ensuring the reliability of log data storage. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0053] Figure 1 A flow chart of a log storage method in one embodiment;

[0054] Figure 2 is a schematic diagram of controller association in one embodiment;

[0055] Figure 3 A schematic diagram of a process for determining a storage location in one embodiment;

[0056] Figure 4 A schematic diagram of a flow chart for determining a storage location in another embodiment;

[0057] Figure 5 A schematic diagram of a data storage process in an embodiment;

[0058] Figure 6 A schematic diagram of data storage in an embodiment;

[0059] Figure 7 A schematic diagram of a process for determining a target data segment in one embodiment;

[0060] Figure 8 A flow chart of a log storage method in another embodiment;

[0061] Fig. 9 is a structural block diagram of a log storage device in an embodiment;

[0062] Fig.10 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0063] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0064] The log system is an important part of modern computer infrastructure, and data persistence storage is the primary consideration of the log system. In the prior art, in order to store log data persistently, the log data to be stored is generally first stored in a non-volatile memory to prevent the system power failure from causing the loss of the log data to be stored. Subsequently, the log data in the non-volatile memory is transferred to a solid-state drive to ensure the persistent storage of the data.

[0065] However, with the prior art, if the log data is still stored in the non-volatile memory when the power of the non-volatile memory is insufficient, problems such as log data loss may occur, thereby reducing the reliability of log data storage.

[0066] Based on this, in an exemplary embodiment, Figure 1 As shown, a log storage method is provided, and the method is applied to a log storage device as an example for description, which specifically includes the following steps:

[0067] S101 , in response to a data storage request for a target controller, obtaining a target data volume of log data to be stored and a storable data volume of a target non-volatile memory in the target controller.

[0068] The log data refers to the record files automatically generated by the system or application during the operation of the computer system and application. Furthermore, the so-called log data to be stored refers to the log data that has not yet been stored.

[0069] The so-called target controller is the controller that receives the data storage request; the so-called data storage request is used to instruct the controller to store the log data to be stored. In an embodiment of the present application, the data storage request can be initiated by the application layer, or it can be automatically generated based on a preset request generation interval, and this application does not impose any restrictions on this.

[0070] The so-called target data volume is the amount of log data to be stored; the so-called target non-volatile memory is the non-volatile memory in the target controller. For example, the non-volatile memory can be a power-saving memory, that is, a memory that can still store data in a system power-off scenario; the so-called storable data volume is the amount of data that can be accommodated in the remaining space of the target non-volatile memory at the current moment.

[0071] In an optional implementation, when a data storage request for a target controller is detected, log data to be stored can be obtained from a preset log cache space based on identification information of the data to be archived in the data storage request, and a target data volume of the log data to be stored can be determined.

[0072] Furthermore, the amount of data that can be stored in the target non-volatile memory at the current moment can be determined according to the data storage record and the maximum data capacity of the target non-volatile memory.

[0073] S102, determining a storage location of the log data to be stored from the target non-volatile memory and a solid state drive associated with the target controller according to the target data volume, the storable data volume of the target non-volatile memory and the data attribute information of the log data to be stored.

[0074] The so-called data attribute information refers to the attribute-related information of the log data, for example, it may include information such as the log level and log record type.

[0075] In an optional implementation, the data importance level of the log data to be stored can be determined based on data attribute information of the log data to be stored; then, the storage location of the log data to be stored is determined from the solid-state hard disk associated with the target non-volatile memory and the target controller based on the size relationship between the target data volume and the storable data volume of the target non-volatile memory, as well as the data importance level.

[0076] Exemplarily, when the data importance level is greater than or equal to the preset level threshold, the target non-volatile memory can be directly used as the storage location for the log data to be stored. At this time, if the target data volume is greater than the storable data volume, the target non-volatile memory can be expanded, or the log data with a storage time longer than the preset time threshold in the target non-volatile memory can be migrated to the solid-state hard disk associated with the target controller until the storable data volume is greater than the target data volume.

[0077] When the data importance level is less than the preset level threshold, if the target data volume is less than or equal to the size relationship between the storable data volume, the target non-volatile memory is used as the storage location for the log data to be stored; if the target data volume is greater than the size relationship between the storable data volume, the solid-state hard disk associated with the target controller is used as the storage location for the log data to be stored.

[0078] In another optional implementation, the target data volume, the target storable data volume of the non-volatile memory, and the data attribute information of the log data to be stored may be simultaneously input into a trained location selection model, and the location selection model outputs the storage location of the log data to be stored based on the target data volume, the storable data volume, the data attribute information, and the model parameters.

[0079] S103, when the storage location is the target non-volatile memory, the log data to be stored is stored in the target non-volatile memory, and the log data to be stored is synchronously stored in the non-volatile memory in other controllers.

[0080] The so-called other controllers are controllers associated with the target controller.

[0081] It is understandable that in order to ensure the reliability of log data storage, the non-volatile memory can be redundantly configured. Exemplarily, multiple interrelated controllers are configured at the same time, and each controller includes a non-volatile memory. At this time, the non-volatile memories in each controller are copies of each other.

[0082] In the case where the non-volatile memory is power-saving memory, refer to Figure 2 The controller association diagram shown in the figure, where mSeg is the power-saving memory segment. The mSeg user can communicate with the mSegMgr agent in the controller to instruct the mSegMgr agent to manage the power-saving memory. The mSegMgr agent is the management node of the power-saving memory in each controller, and is used to communicate with the mSegMgr agents in other controllers and the master mSegMgr. The master mSegMgr is the main control node of each power-saving memory, and is used to synchronize the log data in each power-saving memory and configure the corresponding data segment for each power-saving memory.

[0083] For example, mSeg users can apply for mSeg, update mSeg status, register mSeg, etc. from the mSegMgr agent. The mSegMgr agent can apply for mSeg in batches and update mSeg in batches from the main mSegMgr. The main mSegMgr can collect mSeg usage from the mSegMgr agent. When adding a new controller, the mSegMgr agent can register the controller memory with the main mSegMgr. At this time, the main mSegMgr will collect the memory information of the controller from the mSegMgr agent, and the mSegMgr agent will collect the memory information of the controller from the power-saving memory.

[0084] In an optional implementation, when the storage location is determined to be a target non-volatile memory, the log data to be stored can be stored in the target non-volatile memory, and then a data synchronization request is generated based on the log data to be stored, and the data synchronization request is sent to other controllers to synchronously store the log data to be stored in the non-volatile memory in the other controllers.

[0085] For example, continue to refer to Figure 2 After controller A stores the log data to be stored in the power-saving memory in controller A, a data synchronization request can be sent to the main mSegMgr through the mSegMgr agent. After the main mSegMgr records the storage process information of the log data, data synchronization requests can be sent to the mSegMgr agents in controller B, controller C, and controller D respectively to store the log data to be stored in the power-saving memory in controller B, controller C, and controller D.

[0086] In the above log storage method, by responding to a data storage request for a target controller, the target data volume of the log data to be stored and the storable data volume of the target non-volatile memory in the target controller are obtained, and according to the target data volume, the storable data volume of the target non-volatile memory and the data attribute information of the log data to be stored, the storage location of the log data to be stored is determined from the target non-volatile memory and the solid-state hard disk associated with the target controller; and then, when the storage location is the target non-volatile memory, the log data to be stored is stored in the target non-volatile memory, and the log data to be stored is synchronously stored in the non-volatile memory in other controllers. Compared with the related art, in which the log data to be stored is directly stored in the non-volatile memory, the above method, on the one hand, selects the storage location of the log data to be stored based on the data attribute information, which can ensure the rationality and accuracy of the data storage location; on the other hand, after the log data to be stored is stored in the target non-volatile memory, the log data to be stored is also synchronized to the non-volatile memory in other controllers to back up the log data to be stored, thereby ensuring the reliability of log data storage.

[0087] In order to ensure the accuracy of the storage location determination, based on the above embodiments, in the embodiments of the present application, an optional method for determining the storage location is provided, such as Figure 3 As shown, the specific steps include:

[0088] S301: When the target data volume is greater than or equal to the storable data volume of the target non-volatile memory, the target non-volatile memory is used as a storage location for log data to be stored.

[0089] In an optional implementation, in order to ensure the rationality of the storage location determination, the target data volume can be compared with the storable data volume of the target non-volatile memory. If the target data volume is greater than or equal to the storable data volume of the target non-volatile memory, it proves that the target non-volatile memory can accommodate the log data to be stored. Therefore, the target non-volatile memory can be used as the storage location for the log data to be stored.

[0090] S302, when the target data volume is smaller than the storable data volume of the target non-volatile memory, determine the storage location of the log data to be stored from the target non-volatile memory and the solid state drive associated with the target controller according to the data attribute information of the log data to be stored.

[0091] In an optional implementation, if the target data volume is smaller than the storable data volume of the target non-volatile memory, it proves that the target non-volatile memory cannot fully accommodate the log data to be stored. Therefore, it is necessary to determine whether it is necessary to continue to expand the target non-volatile memory in combination with the data attribute information of the log data to be stored, so as to determine the storage location of the log data to be stored in the solid-state hard disk associated with the target non-volatile memory and the target controller.

[0092] Exemplarily, the log record type corresponding to the log data to be stored may be determined based on data attribute information of the log data to be stored, and the maximum memory capacity that can be applied for the log type may be determined based on the log record type corresponding to the log data to be stored.

[0093] If the memory that has been applied for this log type in the target non-volatile memory has reached the maximum memory, the storage location of the log data to be stored is determined to be the solid-state hard disk associated with the target controller; if the memory that has been applied for this log type in the target non-volatile memory has not reached the maximum memory, the target non-volatile memory needs to be expanded, and the storage location of the log data to be stored is determined to be the target non-volatile memory.

[0094] In the embodiment of the present application, by selecting a method for determining the storage location in a corresponding situation according to the size relationship between the target data volume and the storable data volume of the target non-volatile memory, the accuracy of the storage location determination can be ensured.

[0095] In order to further ensure the accuracy of the storage location determination, based on the above embodiment, in the embodiment of the present application, another optional method for determining the storage location is provided, such as Figure 4 As shown, the specific steps include:

[0096] S401, determining available memory space of a target non-volatile memory according to data attribute information of log data to be stored.

[0097] The so-called available memory space refers to the memory space that can be applied for at the current moment.

[0098] In an optional implementation, the log level and log record type in the data attribute information of the log data to be stored can be used as index information to query in a pre-constructed maximum memory space query table, thereby determining the maximum memory space corresponding to the log data to be stored. The maximum memory space query table is constructed based on the correspondence between each candidate log level, each candidate log record type, and each candidate maximum memory space.

[0099] According to the memory attribute information of the target non-volatile memory, the current memory capacity of the target non-volatile memory is determined; then, the difference between the maximum memory space corresponding to the log data to be stored and the current memory capacity of the target non-volatile memory can be used as the applicable memory space of the target non-volatile memory.

[0100] S402: Determine the maximum amount of data that can be stored in the target non-volatile memory according to the available memory space and the amount of data that can be stored in the target non-volatile memory.

[0101] The so-called maximum storable data volume is the data volume that the target non-volatile memory can accommodate at the current moment.

[0102] In an optional implementation, after determining the available memory space, the available memory space can be converted into the amount of data that can be accommodated based on the conversion relationship between the space size and the space capacity; then, the sum of the amount of data that can be accommodated and the amount of data that can be stored in the target non-volatile memory is used as the maximum amount of data that can be stored in the target non-volatile memory at the current moment.

[0103] S403, when the maximum storable data amount is greater than or equal to the target data amount, the target non-volatile memory is expanded, and the expanded target non-volatile memory is used as a storage location for the log data to be stored.

[0104] In an optional implementation, the maximum amount of storable data can be compared with the target data amount. If the maximum amount of storable data is greater than or equal to the target data amount, it proves that the expanded target non-volatile memory can completely accommodate the log data to be stored. Therefore, the target non-volatile memory can be expanded.

[0105] Furthermore, after the target non-volatile memory is expanded, the target non-volatile memory after the expansion process can be used as a storage location for the log data to be stored.

[0106] S404: When the maximum storable data volume is less than the target data volume, the solid state drive associated with the target controller is used as a storage location for the log data to be stored.

[0107] In an optional implementation, if the maximum amount of storable data is less than the target data amount, it proves that the expanded target non-volatile memory cannot fully accommodate the log data to be stored. Therefore, in order to ensure the integrity of data storage, the solid-state hard drive associated with the target controller can be directly used as the storage location for the log data to be stored.

[0108] In an embodiment of the present application, by judging whether the target non-volatile memory after expansion can fully accommodate the log data to be stored based on the available memory space of the target non-volatile memory, and determining the storage location of the log data to be stored based on the judgment result, the rationality of the storage location determination can be ensured.

[0109] In the case where the storage location is a solid state drive, in order to ensure memory space utilization, based on the above embodiments, in the embodiments of the present application, an optional method for data storage is provided, such as Figure 5 As shown, the specific steps include:

[0110] S501, when the storage location is a solid state drive, determine a target data segment from each candidate data segment according to the target data volume and the storable data volume of each candidate data segment in the solid state drive.

[0111] Among them, the so-called candidate data segment is the memory segment pre-divided in the solid-state hard disk for storing log data. In order to ensure the efficiency of determining the target data segment, in an embodiment of the present application, only the data segment whose remaining memory space is greater than the space threshold can be used as a candidate data segment; the so-called target data segment is the data segment used to store the log data to be stored.

[0112] In an optional implementation, when the storage location is determined to be a solid state drive, the target data volume can be compared with the storable data volume of each candidate data segment in the solid state drive; then, based on the size comparison result, the target data segment is determined from the candidate data segments. Exemplarily, any candidate data segment whose storable data volume is greater than or equal to the target data volume can be used as the target data segment.

[0113] S502: Store the log data to be stored in the target data segment.

[0114] In an optional implementation, a write-through mode may be entered to store the log data to be stored in the target data segment by linear mapping, wherein the write-through mode is a data writing mode in which the log data is directly written to the solid state drive when the log data is submitted.

[0115] Exemplary, reference Figure 6 The data storage schematic diagram. When the log data to be stored is stored in the non-volatile memory, it can be directly stored without adjusting the log data to be stored; when the log data to be stored is stored in the target data segment (persistent space), it is necessary to linearly map the data objects in the log data to be stored, and then store the linearly mapped log data in the target data segment.

[0116] It is understandable that since the log data to be stored is not stored in sequence in the solid-state drive, in order to ensure the convenience of subsequent log data query, after the log data to be stored is stored in the target data segment, the data identifier of the log data to be stored and the corresponding data storage location can be stored in a fixed location.

[0117] In the embodiment of the present application, by determining the target data segment according to the target data volume and the storable data volume of each candidate data segment, and storing the log data to be stored in the target data segment, the utilization rate of the memory space can be effectively improved.

[0118] In order to further ensure the memory space utilization, based on the above embodiments, in the embodiment of the present application, an optional method for determining the target data segment is provided, such as Figure 7 As shown, the specific steps include:

[0119] S701 , select a candidate data segment whose storable data volume is greater than the target data volume among the candidate data segments as a candidate data segment.

[0120] The so-called candidate data segment is a candidate data segment that can store a larger amount of data than the target amount of data.

[0121] In an optional implementation, the target data volume may be compared with the storable data volume in each candidate data segment, and the candidate data segment with a storable data volume greater than the target data volume may be used as a candidate data segment.

[0122] S702 : for each candidate data segment, according to the target data volume and the storable data volume of the candidate data segment, determine the remaining storable data volume of the candidate data segment after storing the log data to be stored.

[0123] The so-called remaining storable data volume is the data volume that can be stored in the selected data segment after storing the log data to be stored.

[0124] In an optional implementation, for each candidate data segment, the difference between the storable data volume of the candidate data segment and the target data volume may be used as the remaining storable data volume of the candidate data segment after storing the log data to be stored.

[0125] S703: The candidate data segment corresponding to the smallest remaining storable data amount among the candidate data segments is used as the target data segment.

[0126] In an optional implementation, in order to reduce the memory capacity loss of data segments, each candidate data segment can be sorted in order from small to large according to the remaining storable data volume of each candidate data segment; then, the candidate data segment ranked first can be used as the target data segment, that is, the candidate data segment corresponding to the smallest remaining storable data volume among the candidate data segments is directly used as the target data segment.

[0127] In the embodiment of the present application, by taking the minimum memory loss as the goal and selecting the target data segment from each candidate data segment based on the remaining storable data amount of each candidate data segment, the rationality of the target data segment selection can be ensured.

[0128] In practical applications, when the remaining power of the non-volatile memory is low, it will affect the reliability of data storage. Based on this, on the basis of the above embodiments, in an embodiment of the present application, an optional method for determining data storage is provided. Specifically, when it is determined that the remaining power of the target non-volatile memory in the target controller is greater than or equal to the power threshold, the target data volume of the log data to be stored and the storable data volume of the target non-volatile memory in the target controller are obtained.

[0129] The so-called power threshold is a value that can measure the remaining power of the non-volatile memory.

[0130] In an optional embodiment, the remaining power of the target non-volatile memory in the target controller can be compared with a preset power threshold. If the remaining power of the target non-volatile memory is greater than or equal to the power threshold, it proves that the target non-volatile memory can store log data normally at this time. Therefore, the target data volume of the log data to be stored and the storable data volume of the target non-volatile memory in the target controller can be obtained by referring to the above step S101.

[0131] Correspondingly, when it is determined that the remaining power of the target non-volatile memory in the target controller is less than the power threshold, the solid state drive associated with the target controller is used as the storage location for the log data to be stored.

[0132] In an optional implementation, if the remaining power of the target non-volatile memory is less than the power threshold, it proves that the target non-volatile memory cannot store log data at this time. Therefore, in order to ensure the reliability of data storage, the solid-state hard disk associated with the target controller can be directly used as the storage location for the log data to be stored.

[0133] In the embodiment of the present application, by selecting from two different storage methods based on the remaining power of the target non-volatile memory, the reliability of log data storage can be ensured.

[0134] Figure 8 FIG. 2 is a flow chart of a log storage method in another embodiment. Based on the above embodiment, this embodiment provides an optional example of a log storage method. Figure 8 The specific implementation process is as follows:

[0135] S801, in response to a data storage request for a target controller, obtaining a remaining power of a target non-volatile memory in the target controller.

[0136] S802, determine whether the remaining power is less than the power threshold, if so, execute S809; if not, execute S803.

[0137] S803, obtaining a target data volume of the log data to be stored and a storable data volume of the target non-volatile memory in the target controller.

[0138] S804, determine whether the target data volume is less than the storable data volume of the target non-volatile memory, if so, execute S805; if not, execute S806.

[0139] S805, storing the log data to be stored in the target non-volatile memory, and synchronously storing the log data to be stored in the non-volatile memory in other controllers.

[0140] S806: Determine available memory space of the target non-volatile memory according to data attribute information of the log data to be stored.

[0141] S807: Determine the maximum amount of data that can be stored in the target non-volatile memory according to the available memory space and the amount of data that can be stored in the target non-volatile memory.

[0142] S808, determine whether the maximum storable data volume is less than the target data volume, if so, execute S809; if not, execute S803.

[0143] S809: select, among the candidate data segments, a candidate data segment that can store data in an amount greater than the target data amount as a candidate data segment.

[0144] S810 , for each candidate data segment, determining the remaining storable data volume of the candidate data segment after storing the log data to be stored according to the target data volume and the storable data volume of the candidate data segment.

[0145] S811 , taking the candidate data segment corresponding to the smallest remaining storable data amount among the candidate data segments as the target data segment, and storing the log data to be stored in the target data segment.

[0146] S812, expand the target non-volatile memory, store the log data to be stored in the target non-volatile memory after the expansion, and synchronously store the log data to be stored in the non-volatile memory in other controllers.

[0147] The specific process of S801-S812 can refer to the description of the above method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

[0148] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0149] Based on the same inventive concept, the embodiment of the present application also provides a log storage device for implementing the log storage method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in one or more log storage device embodiments provided below can refer to the limitations on the log storage method above, and will not be repeated here.

[0150] In an exemplary embodiment, Fig. 9 As shown, a log storage device 1 is provided, comprising: a data acquisition module 10, a location determination module 20 and a first storage module 30, wherein:

[0151] A data acquisition module 10, for acquiring a target data volume of log data to be stored and a storable data volume of a target non-volatile memory in the target controller in response to a data storage request for the target controller;

[0152] A location determination module 20, configured to determine a storage location of the log data to be stored from the target non-volatile memory and a solid state drive associated with the target controller according to the target data volume, the storable data volume of the target non-volatile memory, and data attribute information of the log data to be stored;

[0153] The first storage module 30 is used to store the log data to be stored in the target non-volatile memory when the storage location is the target non-volatile memory, and to synchronously store the log data to be stored in the non-volatile memory in other controllers.

[0154] In an exemplary embodiment, the location determination module 20 includes:

[0155] A first determining unit 21 is configured to use the target non-volatile memory as a storage location for the log data to be stored when the target data volume is greater than or equal to the storable data volume of the target non-volatile memory;

[0156] The second determination unit 22 is used to determine the storage location of the log data to be stored from the target non-volatile memory and the solid state drive associated with the target controller according to the data attribute information of the log data to be stored when the target data amount is less than the storable data amount of the target non-volatile memory.

[0157] In an exemplary embodiment, the second determining unit 22 is specifically configured to:

[0158] According to the data attribute information of the log data to be stored, the available memory space of the target non-volatile memory is determined; according to the available memory space and the storable data amount of the target non-volatile memory, the maximum storable data amount of the target non-volatile memory is determined; when the maximum storable data amount is greater than or equal to the target data amount, the target non-volatile memory is expanded, and the expanded target non-volatile memory is used as the storage location for the log data to be stored; when the maximum storable data amount is less than the target data amount, the solid-state hard disk associated with the target controller is used as the storage location for the log data to be stored.

[0159] In an exemplary embodiment, the log storage device 1 further includes a second storage module, wherein the second storage module includes:

[0160] a data segment selection unit, for determining a target data segment from each candidate data segment according to the target data amount and the storable data amount of each candidate data segment in the solid state hard disk when the storage location is a solid state hard disk;

[0161] The data storage unit is used to store the log data to be stored in the target data segment.

[0162] In an exemplary embodiment, the data segment selection unit is specifically configured to:

[0163] The candidate data segments whose storable data volume is greater than the target data volume in each candidate data segment are taken as candidate data segments; for each candidate data segment, the remaining storable data volume of the candidate data segment after storing the log data to be stored is determined based on the target data volume and the storable data volume of the candidate data segment; the candidate data segment corresponding to the smallest remaining storable data volume in each candidate data segment is taken as the target data segment.

[0164] In an exemplary embodiment, the data acquisition module is specifically used to:

[0165] When it is determined that the remaining power of the target non-volatile memory in the target controller is greater than or equal to the power threshold, a target data volume of the log data to be stored and a storable data volume of the target non-volatile memory in the target controller are obtained.

[0166] In an exemplary embodiment, the log storage device 1 further includes a power determination module, wherein the power determination module is specifically used to:

[0167] When it is determined that the remaining power of the target non-volatile memory in the target controller is less than the power threshold, the solid state drive associated with the target controller is used as the storage location for the log data to be stored.

[0168] Each module in the above-mentioned log storage device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.

[0169] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Fig.10 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store log data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a log storage method is implemented.

[0170] Those skilled in the art will understand that Fig.10 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0171] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.

[0172] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0173] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0174] It should be noted that the data involved in this application (including but not limited to log data, etc.) are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0175] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0176] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0177] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A log storage method, characterized in that: The method comprises: In response to a data storage request for a target controller, obtaining a target data volume of log data to be stored and a storable data volume of a target non-volatile memory in the target controller; Determining a storage location of the log data to be stored from the target non-volatile memory and a solid-state hard disk associated with the target controller according to the target data volume, the storable data volume of the target non-volatile memory, and data attribute information of the log data to be stored; In a case where the storage location is the target non-volatile memory, the log data to be stored is stored in the target non-volatile memory, and the log data to be stored is synchronously stored in the non-volatile memory in other controllers.

2. The method according to claim 1, characterized in that The step of determining a storage location of the log data to be stored from the target non-volatile memory and a solid state drive associated with the target controller according to the target data volume, the storable data volume of the target non-volatile memory, and the data attribute information of the log data to be stored, comprises: In a case where the target data volume is greater than or equal to the storable data volume of the target non-volatile memory, using the target non-volatile memory as the storage location of the log data to be stored; When the target data volume is smaller than the storable data volume of the target non-volatile memory, the storage location of the log data to be stored is determined from the target non-volatile memory and the solid-state hard disk associated with the target controller according to data attribute information of the log data to be stored.

3. The method according to claim 2, characterized in that The step of determining the storage location of the log data to be stored from the target non-volatile memory and the solid state hard disk associated with the target controller according to the data attribute information of the log data to be stored includes: Determining the available memory space of the target non-volatile memory according to the data attribute information of the log data to be stored; Determine the maximum amount of data that can be stored in the target non-volatile memory according to the available memory space and the amount of data that can be stored in the target non-volatile memory; When the maximum storable data amount is greater than or equal to the target data amount, the target non-volatile memory is expanded, and the expanded target non-volatile memory is used as the storage location of the log data to be stored; When the maximum storable data amount is less than the target data amount, the solid state hard disk associated with the target controller is used as the storage location of the log data to be stored.

4. The method according to claim 1, characterized in that: The method further comprises: In the case where the storage location is the solid state drive, determining a target data segment from each candidate data segment according to the target data volume and the storable data volume of each candidate data segment in the solid state drive; The log data to be stored is stored in the target data segment.

5. The method according to claim 4, characterized in that The step of determining a target data segment from each candidate data segment according to the target data amount and the storable data amount of each candidate data segment in the solid state drive comprises: Selecting, among the candidate data segments, a candidate data segment that can store a data amount greater than the target data amount as a candidate data segment; For each candidate data segment, determining, according to the target data volume and the storable data volume of the candidate data segment, the remaining storable data volume of the candidate data segment after storing the log data to be stored; The candidate data segment corresponding to the smallest remaining storable data amount among the candidate data segments is used as the target data segment.

6. The method according to claim 1, characterized in that The step of obtaining a target data volume of log data to be stored and a storable data volume of a target non-volatile memory in the target controller includes: When it is determined that the remaining power of the target non-volatile memory in the target controller is greater than or equal to the power threshold, the target data volume of the log data to be stored and the storable data volume of the target non-volatile memory in the target controller are obtained.

7. The method according to claim 6, characterized in that The method further comprises: When it is determined that the remaining power of the target non-volatile memory in the target controller is less than a power threshold, the solid state drive associated with the target controller is used as a storage location for the log data to be stored.

8. A log storage device, characterized in that: The device comprises: A data acquisition module, configured to acquire, in response to a data storage request for a target controller, a target data volume of log data to be stored and a storable data volume of a target non-volatile memory in the target controller; a location determination module, configured to determine a storage location of the log data to be stored from the target non-volatile memory and a solid state drive associated with the target controller according to the target data volume, the storable data volume of the target non-volatile memory, and data attribute information of the log data to be stored; The first storage module is used for storing the log data to be stored in the target non-volatile memory when the storage location is the target non-volatile memory, and synchronously storing the log data to be stored in the non-volatile memory in other controllers.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.