CN112000629B - Log recording method, device and equipment of storage system and readable storage medium - Google Patents

Log recording method, device and equipment of storage system and readable storage medium Download PDF

Info

Publication number
CN112000629B
CN112000629B CN202010850277.9A CN202010850277A CN112000629B CN 112000629 B CN112000629 B CN 112000629B CN 202010850277 A CN202010850277 A CN 202010850277A CN 112000629 B CN112000629 B CN 112000629B
Authority
CN
China
Prior art keywords
log data
area
log
storage system
write
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010850277.9A
Other languages
Chinese (zh)
Other versions
CN112000629A (en
Inventor
范会杨
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN202010850277.9A priority Critical patent/CN112000629B/en
Publication of CN112000629A publication Critical patent/CN112000629A/en
Application granted granted Critical
Publication of CN112000629B publication Critical patent/CN112000629B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/1805Append-only file systems, e.g. using logs or journals to store data
    • G06F16/1815Journaling file systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application discloses a log recording method of a storage system, which divides a memory area for recording logs into two parts, wherein one part only records log data generated in the first time when problems occur, and the other part circularly records subsequently generated log data. Therefore, the method not only avoids the problem that the performance of the storage system is influenced by overlarge recorded log data volume, but also avoids the problem that the log data in the first time is lost when the problem occurs, and brings convenience to the problem positioning process. In addition, the application also provides a log recording device, equipment and a readable storage medium of the storage system, and the technical effect of the log recording device and equipment corresponds to the technical effect of the method.

Description

Log recording method, device and equipment of storage system and readable storage medium
Technical Field
The present application relates to the field of storage technologies, and in particular, to a method, an apparatus, a device, and a readable storage medium for recording a log of a storage system.
Background
Currently, storage systems locate problems primarily through print logs. When the logs are printed too much, in order to avoid the influence on the system caused by the overlarge log files, a strategy of discarding the earliest log and keeping the latest log is usually adopted. However, for some problems, only the log printed at the first time when a problem occurs has an analysis value, and the strategy of continuously printing the log file and discarding the earliest log file is likely to cause key information loss, which brings great difficulty to the problem analysis.
Therefore, in the log recording scheme of the current storage system, all logs are recorded, so that the system performance is influenced by overlarge log data volume; or only the latest log is recorded, so that the log at the first time when the problem with analysis value occurs is lost, and difficulty is brought to problem positioning. How to overcome the above defects is a problem to be solved by those skilled in the art.
Disclosure of Invention
The application aims to provide a log recording method, a log recording device, log recording equipment and a readable storage medium of a storage system, which are used for solving the problem that the performance of the storage system is influenced by recording all logs or the problem positioning is difficult because only the latest log is recorded in the current log recording scheme. The specific scheme is as follows:
in a first aspect, the present application provides a method for logging in a storage system, including:
dividing a log recording area in a memory of a storage system into a write-once area and a circular write-in area, wherein the write-once area comprises a first number of entries, and each entry is used for recording a piece of log data;
acquiring target log data to be written;
when the number of pieces of log data written into the log recording area is smaller than the first number, writing the target log data into the write-once area in a manner of not covering original log data;
when the number of the log data written into the log recording area is larger than or equal to the first number, if the circular writing area is not full of the log data, writing the target log data into an empty entry of the circular writing area; and if the circular writing area is full of log data, covering the earliest written log data in the circular writing area by using the target log data.
Preferably, when the number of pieces of log data written into the log recording area is smaller than the first number, writing the target log data into the write-once area in a manner of not overwriting original log data includes:
when the index number of the target log data is smaller than the first number, writing the target log data into an entry corresponding to the index number in the write-once area, wherein the numerical value of the index number is equal to the number of the log data written into the log recording area.
Preferably, the circular writing area includes a second number of entries, and when the number of pieces of log data written into the log recording area is greater than or equal to the first number, if the circular writing area is not full of log data, the target log data is written into an empty entry of the circular writing area; if the circular writing area is full of log data, covering the earliest written log data in the circular writing area by using the target log data, including:
when the index number of the target log data is larger than or equal to the first number, carrying out remainder operation on the index number by using the second number, and determining a target entry in the circular writing area according to a remainder result; and writing the log data into the target entry.
Preferably, the dividing the log recording area in the memory of the storage system into a write-once area and a circular write area includes:
the method comprises the steps of dividing a log recording area in a memory of a storage system into two areas with the same size to obtain a write-once area and a circular write-in area.
Preferably, the method further comprises the following steps:
exporting the log data on the log recording area to a target file;
and analyzing the target file to visually display the log data.
Preferably, before the dividing the logging area in the memory of the storage system into the write-once area and the circular write area, the method further includes:
and dividing a log recording area in the storage system according to preset entry parameters, wherein the preset entry parameters comprise entry size and/or entry number.
Preferably, after the partitioning the storage system into the logging areas according to the preset entry parameters, the method further includes:
and generating a global variable array for describing the log record area, wherein each member of the global variable array is used for describing one piece of log data.
In a second aspect, the present application provides a logging apparatus of a storage system, including:
a region division module: the device comprises a storage system memory, a first storage unit and a second storage unit, wherein the storage system memory is used for storing log data, the first storage unit is used for storing the log data, and the second storage unit is used for storing the log data;
a log obtaining module: the method comprises the steps of obtaining target log data to be written;
write-once module: when the number of pieces of log data written into the log recording area is smaller than the first number, writing the target log data into the write-once area in a manner of not covering original log data;
a cyclic writing module: when the number of the log data written into the log recording area is larger than or equal to the first number, if the circular writing area is not full of the log data, writing the target log data into an empty entry of the circular writing area; and if the circular writing area is full of log data, covering the earliest written log data in the circular writing area by using the target log data.
In a third aspect, the present application provides a logging apparatus of a storage system, including:
a memory: for storing a computer program;
a processor: for executing the computer program for implementing the steps of the logging method of the storage system as described above.
In a fourth aspect, the present application provides a readable storage medium having stored thereon a computer program for implementing the steps of the logging method of the storage system as described above when executed by a processor.
The application provides a log recording method of a storage system, which comprises the following steps: dividing a log recording area in a memory of a storage system into a write-once area and a circular write-in area, wherein the write-once area comprises a first number of entries, and each entry is used for recording one piece of log data; acquiring target log data to be written; when the number of the log data written into the log recording area is smaller than a first number, writing the target log data into the write-once area in a mode of not covering the original log data; when the number of the log data written into the log recording area is larger than or equal to a first number, if the circular writing area is not full of the log data, writing the target log data into an empty entry of the circular writing area; and if the circular writing area is full of log data, covering the earliest written log data in the circular writing area by using the target log data.
Therefore, the method divides the memory area for recording the log into two parts, one part only records the log data generated in the first time when the problem occurs, and the other part circularly records the subsequently generated log data. Therefore, the method not only avoids the problem that the performance of the storage system is influenced by overlarge recorded log data volume, but also avoids the problem that the log data in the first time is lost when the problem occurs, and brings convenience to the problem positioning process.
In addition, the application also provides a log recording device, equipment and a readable storage medium of the storage system, and the technical effect of the log recording device corresponds to that of the method, and the description is omitted here.
Drawings
For a clearer explanation of the embodiments or technical solutions of the prior art of the present application, the drawings needed for the description of the embodiments or prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
Fig. 1 is a flowchart illustrating a first implementation of a method for logging in a storage system according to an embodiment of the present disclosure;
fig. 2 is a flowchart illustrating implementation of a second embodiment of a logging method of a storage system according to the present application;
FIG. 3 is a functional block diagram of an embodiment of a logging apparatus of a storage system provided in the present application;
fig. 4 is a schematic structural diagram of an embodiment of a logging apparatus of a storage system provided in the present application.
Detailed Description
The core of the application is to provide a log recording method, a log recording device, log recording equipment and a readable storage medium of a storage system. The problem that the performance of a storage system is influenced due to the fact that the recorded log data volume is too large is avoided, the problem that the log data in the first time are lost when the problem occurs is also avoided, and convenience is brought to the problem positioning process.
In order that those skilled in the art will better understand the disclosure, the following detailed description will be given with reference to the accompanying drawings. It is to be understood that the embodiments described are only a few embodiments of the present application and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Referring to fig. 1, a first embodiment of a method for logging in a storage system provided in the present application is described below, where the first embodiment includes:
s101, dividing a log recording area in a memory of a storage system into a write-once area and a circular write-in area, wherein the write-once area comprises a first number of entries, and each entry is used for recording one piece of log data;
s102, obtaining target log data to be written;
s103, when the number of the log data written into the log recording area is smaller than a first number, writing the target log data into the write-once area in a mode of not covering original log data;
s104, when the number of the log data written into the log recording area is larger than or equal to the first number, if the circular writing area is not full of the log data, writing the target log data into an empty entry of the circular writing area; and if the circular writing area is full of log data, covering the earliest written log data in the circular writing area by using the target log data.
In this embodiment, the area is called a logging area, and the logging area is divided into two sub-areas, which are respectively called a write-once area and a circular write area. Each sub-area includes consecutive entries (entries), each entry for recording one piece of log data.
When dividing the area, the log recording area may be divided into two areas with equal size, or may be divided into two areas with different sizes, which is not limited in this embodiment.
It should be noted that, when writing the log data into the log recording area, the writing mode may be sequential writing or random writing, which is not limited in this embodiment.
In the log recording method of the storage system provided by this embodiment, a memory area for recording a log is divided into two parts, one part records only log data generated in a first time when a problem occurs, and the other part records log data generated subsequently in a circulating manner. Therefore, the method not only avoids the problem that the performance of the storage system is influenced by overlarge recorded log data volume, but also avoids the problem that the log data in the first time is lost when the problem occurs, and brings convenience to the problem positioning process.
The second embodiment of the logging method for a storage system provided by the present application is described in detail below, and the second embodiment is implemented based on the first embodiment and is expanded to a certain extent based on the first embodiment.
Referring to fig. 2, the second embodiment specifically includes:
s201, dividing a log recording area in a storage system according to preset entry parameters, wherein the preset entry parameters comprise entry size and/or entry quantity;
in the embodiment, the size of the log recording area is not limited, and in practical application, a trade-off is made between recording enough logs and avoiding occupying too much resources.
S202, generating a global variable array for describing a log recording area, wherein each member of the global variable array is used for describing one piece of log data;
the global variable array is specifically denoted as log _ entries [2048], and in practical applications, the array size may be other values.
S203, dividing a log recording area in a memory of the storage system into two areas with the same size to obtain a write-once area and a circular write-in area;
in this embodiment, the write-once area includes 1024 entries, and the circular write area includes 1024 entries, each entry being used to record one piece of log data.
S204, acquiring target log data to be written;
s205, when the index number of the target log data is less than 1024, writing the target log data into an entry corresponding to the index number in a write-once area;
the numerical value of the index number is equal to the number of pieces of log data written in the log recording area.
S206, when the index number of the target log data is more than or equal to 1024, carrying out remainder operation on the index number by using 1024, and determining a target entry in the circular writing area according to a remainder result; writing the log data into the target entry;
specifically, the first half of the log recording area is used as a write-once area, the second half is used as a circular write area, and log _ index is used as the count of the currently written log, and the pseudo code is as follows:
Figure BDA0002644497230000071
wherein add _ log _ to (log _ entries [ M ]) indicates that log information is written into Mth member of log record array, and log _ entries [0] - -log _ entries [1023] is used for recording 0-1023 logs generated by the system, as shown in the above pseudo code; subsequent log loops starting from 1024 entries cover writes log _ entrys [1024] - -log _ entrys [2047 ]. Thus, log _ entrys [0] - -log _ entrys [1023] records the first problem site, and log _ entrys [1024] - -log _ entrys [2047] records the latest log.
S207, exporting the log data on the log recording area to a target file;
and S208, analyzing the target file to visually display the log data.
And a memory export module is used for sending the memory content dump of the log _ entries array to a file, so that the problem analysis can be assisted. The file derived from the memory is a binary file and needs to be viewed by parsing.
Therefore, the log recording method of the storage system provided by the embodiment divides the recording area into a write-once part and a write-in-circulation part, and the write-once part and the write-circulation part are respectively used for recording the first site with the problem and recording the latest log, so that the key information of the first site in the problem can be reserved, the problem locatability and the product maintainability can be improved, too large influence on the system performance caused by printing the log file can be avoided, and the product competitiveness can be improved.
In the following, a journal recording device of a storage system provided by an embodiment of the present application is introduced, and a journal recording device of a storage system described below and a journal recording method of a storage system described above may be referred to correspondingly.
As shown in fig. 3, the logging apparatus of the storage system of the present embodiment includes:
the region division module 301: the device comprises a storage system memory, a first data storage unit, a second data storage unit and a control unit, wherein the storage system memory is used for storing log data;
the log obtaining module 302: the method comprises the steps of obtaining target log data to be written;
write-once module 303: when the number of pieces of log data written into the log recording area is smaller than a first number, writing target log data into the write-once area in a mode of not covering original log data;
the loop write module 304: when the number of the log data written into the log recording area is larger than or equal to a first number, if the circular writing area is not full of the log data, writing the target log data into an empty entry of the circular writing area; and if the circular writing area is full of log data, covering the earliest written log data in the circular writing area by using the target log data.
The logging apparatus of the storage system of the present embodiment is configured to implement the aforementioned logging method of the storage system, and therefore, a specific implementation manner of the apparatus may be seen in the foregoing embodiment portions of the logging method of the storage system, for example, the area dividing module 301, the log obtaining module 302, the write-once module 303, and the circular writing module 304, which are respectively configured to implement steps S101, S102, S103, and S104 in the logging method of the storage system. Therefore, specific embodiments thereof may be referred to in the description of the corresponding respective partial embodiments, and will not be described herein.
In addition, since the logging apparatus of the storage system of this embodiment is used to implement the logging method of the storage system, the role of the logging apparatus corresponds to that of the method described above, and details are not described here again.
In addition, the present application also provides a logging device of a storage system, as shown in fig. 4, including:
the memory 100: for storing a computer program;
the processor 200: for executing a computer program for implementing the steps of the logging method of the storage system as described above.
Finally, the present application provides a readable storage medium having stored thereon a computer program for implementing the steps of the logging method of the storage system as described above when executed by a processor.
The embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same or similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The above detailed descriptions of the solutions provided in the present application, and the specific examples applied herein are set forth to explain the principles and implementations of the present application, and the above descriptions of the examples are only used to help understand the method and its core ideas of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (10)

1. A method of logging in a storage system, comprising:
dividing a log recording area in a memory of a storage system into a write-once area and a circular write-in area, wherein the write-once area comprises a first number of entries, and each entry is used for recording a piece of log data;
acquiring target log data to be written;
when the number of pieces of log data written into the log recording area is smaller than the first number, writing the target log data into the write-once area in a manner of not covering original log data;
when the number of the log data written into the log recording area is larger than or equal to the first number, if the log data are not fully written into the circular writing area, writing the target log data into an empty entry of the circular writing area; and if the circular writing area is full of log data, covering the earliest written log data in the circular writing area by using the target log data.
2. The method of claim 1, wherein writing the target log data to the write-once area in a manner that does not overwrite original log data when a number of pieces of log data written to the logging area is less than the first number comprises:
when the index number of the target log data is smaller than the first number, writing the target log data into an entry corresponding to the index number in the write-once area, wherein the numerical value of the index number is equal to the number of the log data written into the log recording area.
3. The method of claim 2, wherein the circular writing area includes a second number of entries, and when the number of pieces of log data written into the logging area is greater than or equal to the first number, if the circular writing area is not full of log data, the target log data is written into an empty entry of the circular writing area; if the circular writing area is full of log data, covering the earliest written log data in the circular writing area by using the target log data, including:
when the index number of the target log data is larger than or equal to the first number, carrying out remainder operation on the index number by using the second number, and determining a target entry in the circular writing area according to a remainder result; and writing the log data into the target entry.
4. The method of claim 3, wherein the dividing the logging area in the storage system memory into a write-once area and a circular write area comprises:
the method comprises the steps of dividing a log recording area in a memory of a storage system into two areas with the same size to obtain a write-once area and a circular write-in area.
5. The method of claim 1, further comprising:
exporting the log data on the log recording area to a target file;
and analyzing the target file to visually display the log data.
6. The method of any one of claims 1-5, wherein prior to the dividing the logging area in the storage system memory into a write-once area and a circular write area, further comprising:
and dividing a log recording area in the storage system according to preset entry parameters, wherein the preset entry parameters comprise entry size and/or entry quantity.
7. The method of claim 6, wherein after the partitioning the logging area in the storage system according to the preset entry parameter, further comprising:
and generating a global variable array for describing the log record area, wherein each member of the global variable array is used for describing one piece of log data.
8. A logging apparatus of a storage system, comprising:
a region division module: the device comprises a storage system memory, a first storage unit and a second storage unit, wherein the storage system memory is used for storing log data, the first storage unit is used for storing the log data, and the second storage unit is used for storing the log data;
a log obtaining module: the method comprises the steps of obtaining target log data to be written;
write-once module: when the number of pieces of log data written into the log recording area is smaller than the first number, writing the target log data into the write-once area in a manner of not covering original log data;
a cyclic writing module: when the number of the log data written into the log recording area is larger than or equal to the first number, if the circular writing area is not full of the log data, writing the target log data into an empty entry of the circular writing area; and if the circular writing area is full of log data, covering the earliest written log data in the circular writing area by using the target log data.
9. A logging device of a storage system, comprising:
a memory: for storing a computer program;
a processor: for executing the computer program for implementing the steps of the logging method of the storage system according to any of claims 1-7.
10. A readable storage medium, having stored thereon a computer program for implementing the steps of the logging method of the storage system according to any of claims 1-7 when being executed by a processor.
CN202010850277.9A 2020-08-21 2020-08-21 Log recording method, device and equipment of storage system and readable storage medium Active CN112000629B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010850277.9A CN112000629B (en) 2020-08-21 2020-08-21 Log recording method, device and equipment of storage system and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010850277.9A CN112000629B (en) 2020-08-21 2020-08-21 Log recording method, device and equipment of storage system and readable storage medium

Publications (2)

Publication Number Publication Date
CN112000629A CN112000629A (en) 2020-11-27
CN112000629B true CN112000629B (en) 2022-07-08

Family

ID=73472999

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010850277.9A Active CN112000629B (en) 2020-08-21 2020-08-21 Log recording method, device and equipment of storage system and readable storage medium

Country Status (1)

Country Link
CN (1) CN112000629B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112765116B (en) * 2021-01-22 2022-07-29 苏州浪潮智能科技有限公司 Log storage method, platform, equipment and medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109446174A (en) * 2018-10-30 2019-03-08 东软集团股份有限公司 Logdata record method, apparatus and computer readable storage medium
CN111078515B (en) * 2019-11-25 2024-02-13 深圳忆联信息系统有限公司 SSD layered log recording method, SSD layered log recording device, SSD layered log recording computer device and storage medium
CN111104254A (en) * 2019-11-29 2020-05-05 北京浪潮数据技术有限公司 Storage system data flashing method, device, equipment and readable storage medium

Also Published As

Publication number Publication date
CN112000629A (en) 2020-11-27

Similar Documents

Publication Publication Date Title
CN113282249B (en) Data processing method, system, device and medium
CN108874688B (en) Message data caching method and device
CN112307263A (en) File storage method, device, equipment and medium
CN107562578B (en) Snapshot creating method, device, equipment and storage medium for stored data
CN101783740B (en) Method and device for managing message file
CN113568582B (en) Data management method, device and storage equipment
KR20170010810A (en) Method, device and user equipment for reading/writing data in nand flash
CN113608695A (en) Data processing method, system, device and medium
CN113077563A (en) Fault information processing method and device
CN112000629B (en) Log recording method, device and equipment of storage system and readable storage medium
CN112463880B (en) Block chain data storage method and related device
CN109992527B (en) Bitmap management method of full flash memory system
CN110134615B (en) Method and device for acquiring log data by application program
CN111966531A (en) Data snapshot method and device, computer equipment and storage medium
CN110018986B (en) Abnormal snapshot identification method and device
CN110795031A (en) Data deduplication method, device and system based on full flash storage
CN115328851A (en) Data protection method, device, equipment and medium
CN107391708B (en) Method and device for storing performance statistics file in storage system
CN113010113B (en) Data processing method, device and equipment
CN115857811A (en) Data processing method and device, solid state disk and readable storage medium
CN113360095A (en) Hard disk data management method, device, equipment and medium
CN111090396A (en) File processing method and device and electronic equipment
KR20090049838A (en) Method and apparatus for allocation of buffer
CN111625192B (en) Metadata object access method, device, equipment and medium
CN111324280B (en) Data writing method and device based on Raid5

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant