A log management method, device and equipment and readable storage medium

By configuring an independent log processing unit near non-volatile memory, the storage preprocessing and persistent storage of log management are completed, solving the problems of high CPU overhead and high transmission latency in database systems, and achieving ultra-low latency and high throughput log persistence.

CN123178199APending Publication Date: 2026-11-27XINHUASAN INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611339571.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-31
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

In modern database management systems, operations such as log serialization, verification, and calculation are performed by the CPU, resulting in high CPU overhead and high transmission latency. Existing architectures fail to fully utilize the computing power of non-volatile memory.

Method used

A log management method is provided, which configures an independent log processing unit near non-volatile memory to receive and parse log generation instructions, generate log data blocks, and perform storage preprocessing and persistent storage, including operations such as verification, compression, and encryption, and completes log management independently of the CPU.

Benefits of technology

It reduces CPU log processing load, lowers data transmission latency, increases computing capacity, and reduces system power consumption, all without requiring large-scale modifications to the existing database architecture.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123178199A_ABST
    Figure CN123178199A_ABST
Patent Text Reader

Abstract

The present specification provides a log management method, device and equipment and readable storage medium, the method comprises: applied to the log processing unit, the method comprises: receiving and analyzing the log generation instruction issued by the database management system kernel; according to the operation data contained in the log generation instruction and the preset log generation rule, generate log data block; The log generation rule contains the log format template required by the database management system kernel; the log data block is stored and pretreated to obtain the database log; the database log is stored persistently. Through the technical scheme of the present specification, the CPU-based database log storage and management can be realized, the CPU computing power is saved and the data transmission delay is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification relates to the field of communication technology, and in particular to a log management method, apparatus, device, and readable storage medium. Background Technology

[0002] In modern database management systems (such as MySQL and PostgreSQL), write-ahead logs are commonly used to ensure the atomicity and durability of transactions. Taking the Redo Log of the InnoDB storage engine as an example, log records must be synchronously written to persistent storage before a transaction is committed. During this process, operations such as sequence numbering, verification, calculation, and encryption of log records are all performed by the database server's CPU. Log data needs to traverse multiple software layers, including database user space, operating system kernel page cache, and block device drivers, resulting in high CPU overhead and data transmission latency. Therefore, there is an urgent need for a technical solution that can fundamentally reduce the CPU load on log processing and achieve ultra-low latency, high throughput log persistence. Summary of the Invention

[0003] In view of this, this specification provides a log management method, apparatus, electronic device, and readable storage medium to improve the aforementioned problems of high CPU overhead and high transmission latency.

[0004] Specifically, the technical solution is as follows: This specification provides a log management method applied to a log processing unit, which is independent of the CPU and configured closer to non-volatile memory than the CPU is to non-volatile memory. The non-volatile memory is used to store database logs. The method includes: Receive and parse log generation instructions issued by the database management system kernel; Log data blocks are generated based on the operation data contained in the log generation instruction and the preset log generation rules; the log generation rules include log format templates that conform to the requirements of the database management system kernel. Preprocess the log data blocks to obtain the database log; Persistently store database logs.

[0005] Furthermore, the storage preprocessing includes: Fill in the data checksum corresponding to the log data block; And / or, compress log data blocks; And / or, encrypt sensitive fields in log data blocks.

[0006] Furthermore, the persistent storage of database logs includes: Perform atomic write operations independently on a single database log.

[0007] Furthermore, the persistent storage of database logs also includes: The system stores log sequence numbers used to identify log data blocks; each log sequence number corresponds one-to-one with a log data block.

[0008] This specification also provides a log management device for a log processing unit, the log processing unit being independent of the CPU and configured closer to non-volatile memory than the CPU is to non-volatile memory, the non-volatile memory being used to store database logs, the device comprising: The receiving and parsing module is used to receive and parse log generation instructions issued by the database management system kernel; The log generation module is used to generate log data blocks based on the operation data contained in the log generation instruction and the preset log generation rules; the log generation rules include log format templates that conform to the requirements of the database management system kernel. The data preprocessing module is used to perform storage preprocessing on log data blocks to obtain database logs; The storage module is used for persistent storage of database logs.

[0009] Furthermore, the data preprocessing module includes: The checksum filling module is used to fill in the data checksum corresponding to the log data block; And / or, a compression module for compressing log data blocks; And / or, an encryption module for encrypting sensitive fields in log data blocks.

[0010] Furthermore, the storage module is specifically used for: Perform atomic write operations independently on a single database log.

[0011] Furthermore, the storage module is also used for: The system stores log sequence numbers used to identify log data blocks; each log sequence number corresponds one-to-one with a log data block.

[0012] This specification also provides an electronic device, including a processor and a readable storage medium storing machine-executable instructions that can be executed by the processor, the processor executing the machine-executable instructions to implement the aforementioned log management method.

[0013] This specification also provides a readable storage medium storing machine-executable instructions that, when invoked and executed by a processor, cause the processor to implement the aforementioned log management method.

[0014] The technical solutions provided in this specification offer at least the following beneficial effects: Without CPU processing, the database engine, in conjunction with the log management unit and non-volatile memory, autonomously manages the database logs, saving CPU computing power and reducing data transmission latency. Attached Figure Description

[0015] To more clearly illustrate the technical solutions in the embodiments of this specification or the prior art, the drawings used in the description of the embodiments of this specification or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For those skilled in the art, other drawings can be obtained based on these drawings of the embodiments of this specification.

[0016] Figure 1 This is a flowchart of a log management method according to one embodiment of this specification; Figure 2 This is a schematic diagram of the hardware assembly for a log management method according to one embodiment of this specification; Figure 3 This is a structural diagram of a log management device according to one embodiment of this specification; Figure 4 This is a hardware structure diagram of an electronic device according to one embodiment of this specification. Detailed Implementation

[0017] The terminology used in the embodiments described herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of this specification. The singular forms “a,” “described,” and “the” as used in this specification and claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to any and all possible combinations comprising one or more of the associated listed items.

[0018] It should be understood that although the terms first, second, third, etc., may be used to describe various information in embodiments of this specification, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this specification, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" may also be interpreted as "when," "when," or "in response to a determination."

[0019] In modern database management systems (such as MySQL and PostgreSQL), write-ahead logs are commonly used to ensure the atomicity and durability of transactions. Taking the InnoDB storage engine's Redo Log as an example, log records must be synchronously written to persistent storage before a transaction is committed. During this process, operations such as log serialization, checksum calculation, and compression / encryption are all performed by the database server's CPU. These tasks compete for computing resources with the core transaction processing logic, resulting in high CPU overhead. Simultaneously, log data needs to traverse multiple software layers, including database user space, operating system kernel page cache, and block device drivers, leading to increased write latency. While newer non-volatile memory (NVDIMM) can provide access speeds close to memory, it is currently used only as a passive storage device in existing architectures, and its computational capabilities adjacent to data remain unutilized, with the server CPU still bearing the entire log processing load. The potential of NVDIMM is not being fully realized.

[0020] Therefore, there is an urgent need for a technical solution that can fundamentally reduce the CPU log processing load and achieve ultra-low latency and high throughput log persistence.

[0021] In view of this, this specification provides a log management method, apparatus, electronic device, and readable storage medium to improve the aforementioned problems of high CPU overhead and high transmission latency.

[0022] Specifically, the technical solution is described below.

[0023] This specification provides a log management method applied to a log processing unit, which is independent of the CPU and configured closer to non-volatile memory than the CPU is to non-volatile memory. The non-volatile memory is used to store database logs. The method includes: Receive and parse log generation instructions issued by the database management system kernel; Log data blocks are generated based on the operation data contained in the log generation instruction and the preset log generation rules; the log generation rules include log format templates that conform to the requirements of the database management system kernel. Preprocess the log data blocks to obtain the database log; Persistently store database logs.

[0024] Optionally, the storage preprocessing includes: Fill in the data checksum corresponding to the log data block; And / or, compress log data blocks; And / or, encrypt sensitive fields in log data blocks.

[0025] Optionally, the persistent storage of database logs includes: Perform atomic write operations independently on a single database log.

[0026] Optionally, the persistent storage of database logs also includes: The system stores log sequence numbers used to identify log data blocks; each log sequence number corresponds one-to-one with a log data block.

[0027] Specifically, such as Figure 1 This includes the following steps: Step S11: Receive and parse the log generation instruction issued by the database management system kernel.

[0028] In the method provided by this solution, the database management system kernel sends a log generation command at a preset transaction commit point (a preset time point at which task submission is allowed).

[0029] Step S12: Generate log data blocks based on the operation data contained in the log generation instruction and the preset log generation rules.

[0030] The log generation rules include log format templates that conform to the requirements of the database management system kernel. The log processing unit acquires and parses the log generation instruction, obtains the operation data and opcode contained in the log generation instruction, and assembles the operation data into log data blocks that meet the requirements of the database operating system kernel according to the pre-configured log format template.

[0031] Step S13: Perform storage preprocessing on the log data blocks to obtain the database log.

[0032] The log data blocks undergo further processing to ensure they meet the management requirements for storage. This storage preprocessing may include verification, compression, and encryption.

[0033] Step S14: Persistently store the database logs.

[0034] The processed log blocks are written to persistent storage media without server intervention.

[0035] In one embodiment, the storage preprocessing includes: Fill in the data checksum corresponding to the log data block; And / or, compress log data blocks; And / or, encrypt sensitive fields in log data blocks.

[0036] These steps are entirely handled by the log processing unit and do not consume server CPU resources.

[0037] In one embodiment, the persistent storage of database logs includes: Perform atomic write operations independently on a single database log.

[0038] During storage, the writing of database logs is performed atomically, working in conjunction with the power management unit to ensure that in the event of an unexpected power failure, a single database log in the process of processing is either completely written or not written at all, avoiding partial writes and ensuring the integrity of a single database log.

[0039] In one embodiment, the persistent storage of database logs further includes: The system stores log sequence numbers used to identify log data blocks; each log sequence number corresponds one-to-one with a log data block.

[0040] The log processing unit generates a log sequence number that corresponds one-to-one with the log data block (and the database log), and the log sequence number is globally unique.

[0041] The log processing unit is independent of the CPU and is configured closer to the non-volatile memory than the CPU is to the non-volatile memory. Specifically, the physical transmission path of log generation instructions is shorter than the physical transmission path of log-related instructions issued by the CPU when managing database logs. In some embodiments, the log processing unit and the non-volatile memory are integrated into an intelligent log management system, significantly shortening the data transmission link.

[0042] A schematic diagram of the hardware module in one possible implementation is shown below. Figure 2As shown in the diagram. In this embodiment, the log processing unit includes a host control interface, an instruction receiving buffer, a log processing module, a hardware acceleration engine, and an atomicity guarantee circuit. The log processing unit is configured on a persistent storage medium (communicating with the persistent storage medium). The host control interface communicates with the host (database) and supports low-latency, high-bandwidth data and instruction transmission. The instruction receiving buffer is used to temporarily store instruction streams received from the database engine (database management system kernel) for log generation instructions or other related instructions. The log processing module is the core computing component of the log processing unit. For example, the log processing module can be a programmable processor core (such as ARM / RISC-V) or a fixed-function hardware optimized for the log processing flow, whose core function is to parse and execute log operation instructions. Taking storage preprocessing including verification, compression, and encryption operations as an example, the hardware acceleration engine includes a checksum calculation engine, a data compression engine, and a data encryption engine. The checksum calculation engine is a hardware circuit used to quickly generate checksums such as CRC32 / CRC64. The data compression engine is a hardware accelerator that can support LZ4, Zstd, or other compression algorithms. The data encryption engine is a hardware encryption coprocessor that supports AES or other preset encryption algorithms. An atomicity guarantee circuit, in conjunction with the power management unit, ensures that in the event of any unexpected power failure, the instructions being processed are either fully effective (logs are persisted) or completely invalid, preventing partial writes and guaranteeing the absolute integrity of the logs. The persistent storage medium provides addressable, non-volatile storage space for the database logs, used to ultimately store the processed physical log records. This embodiment does not limit the specific hardware configuration of the log processing unit, as long as the solution provided in this specification can be implemented.

[0043] In this embodiment, the specific method flow is as follows: At the transaction commit point, the database management system kernel encapsulates the current database operation (database modification action) into a set of concise instructions conforming to predefined requirements, namely log generation instructions. It then drives a pre-defined program to package the log generation instructions and write them to the instruction receive buffer of the intelligent persistent memory device via a memory write operation. The log processing unit retrieves the log generation instructions from the instruction receive buffer, decodes their operation data, and converts the operation data into log data blocks conforming to pre-set log generation rules based on the opcode and other relevant information contained in the log generation instructions. Storage preprocessing, including verification, compression, and encryption, is performed on the log data blocks. The verification step involves calculating the checksum and calculating and filling the checksum for the entire log record block. The compression step compresses the log data blocks according to the requirements of database log management. The encryption step encrypts sensitive fields in the log data blocks. These storage preprocessing steps are all completed in the log processing unit and do not consume server CPU resources. The processed log data blocks are atomically written to the persistent storage medium. The intelligent log management system, composed of persistent storage media and a log processing unit, can autonomously manage global log sequence numbers, ensuring that the log sequence numbers monotonically increase, correspond one-to-one with log data blocks (and also one-to-one with database logs), and are correctly associated with the database logs and their storage locations, without server intervention. After the storage process is complete, the intelligent log management system can also notify the database management system kernel and / or server that the database logs indicated by the current set of log generation instructions have been stored by sending a storage completion signal or triggering an interrupt. This embodiment does not limit whether or not to send storage completion information or the method of sending it.

[0044] By applying the method provided in this manual, database log management can be autonomously completed by the database engine, log management unit, and non-volatile memory, without CPU processing. The CPU is completely freed from heavy log processing tasks, allowing it to focus on core business logic such as transaction processing and query optimization, effectively increasing the host's computing capacity. This saves CPU computing power and reduces data transmission latency. Furthermore, dedicated hardware for specific tasks is far more energy efficient than general-purpose CPUs, improving performance while reducing overall system power consumption. Simultaneously, the device implementing this method can be integrated into existing servers without large-scale modifications to database software or system architecture, facilitating commercialization.

[0045] This specification also provides a log management device 31, such as Figure 3 An apparatus is applied to a log processing unit, which is independent of the CPU and configured closer to the non-volatile memory than the CPU is to the non-volatile memory, the non-volatile memory being used to store database logs. The apparatus includes: The receiving and parsing module 32 is used to receive and parse log generation instructions issued by the database management system kernel; The log generation module 33 is used to generate log data blocks based on the operation data contained in the log generation instruction and the preset log generation rules; the log generation rules include log format templates that conform to the requirements of the database management system kernel. Data preprocessing module 34 is used to perform storage preprocessing on log data blocks to obtain database logs; Storage module 35 is used for persistent storage of database logs.

[0046] Furthermore, the data preprocessing module includes: The checksum filling module is used to fill in the data checksum corresponding to the log data block; And / or, a compression module for compressing log data blocks; And / or, an encryption module for encrypting sensitive fields in log data blocks.

[0047] Furthermore, the storage module is specifically used for: Perform atomic write operations independently on a single database log.

[0048] Furthermore, the storage module is also used for: The system stores log sequence numbers used to identify log data blocks; each log sequence number corresponds one-to-one with a log data block.

[0049] The implementation methods of the apparatus are the same as or similar to the corresponding implementation methods, and will not be described again here.

[0050] In one embodiment, this specification provides an electronic device 41, including a processor 42 and a readable storage medium 43. The readable storage medium stores machine-executable instructions 44 that can be executed by the processor. The processor executes the machine-executable instructions to implement the aforementioned log management method. From a hardware perspective, a hardware architecture diagram can be found... Figure 4 As shown.

[0051] In one embodiment, this specification provides a readable storage medium storing machine-executable instructions that, when invoked and executed by a processor, cause the processor to implement the aforementioned log management method.

[0052] Here, a readable storage medium can be any electronic, magnetic, optical, or other physical storage device that can contain or store information, such as executable instructions, data, etc. For example, a readable storage medium can be: RAM (Random Access Memory), volatile memory, non-volatile memory, flash memory, storage drives (such as hard disk drives), solid-state drives, any type of storage disk (such as optical discs, DVDs, etc.), or similar storage media, or combinations thereof.

[0053] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, which can take the form of a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email sending and receiving device, game console, tablet computer, wearable device, or any combination of these devices.

[0054] For ease of description, the above devices are described in terms of function, divided into various units. Of course, in implementing this specification, the functions of each unit can be implemented in one or more software and / or hardware components.

[0055] Those skilled in the art will understand that embodiments of this specification can be provided as methods, systems, or computer program products. Therefore, this specification can take the form of a completely hardware implementation, a completely software implementation, or an implementation combining software and hardware aspects. Furthermore, embodiments of this specification can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0056] This specification is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments thereof. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0057] Furthermore, these computer program instructions can also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in the process. Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0058] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0059] Those skilled in the art will understand that embodiments of this specification can be provided as methods, systems, or computer program products. Therefore, this specification can take the form of a completely hardware implementation, a completely software implementation, or an implementation combining software and hardware aspects. Furthermore, this specification can take the form of a computer program product implemented on one or more computer-usable storage media (which may include, but are not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0060] The above description is merely an embodiment of this specification and is not intended to limit this specification. Various modifications and variations can be made to this specification by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of the claims of this specification.

Claims

1. A log management method, characterized in that, The method, applied to a log processing unit independent of the CPU and configured closer to non-volatile memory than the CPU is to non-volatile memory for storing database logs, includes: Receive and parse log generation instructions issued by the database management system kernel; Log data blocks are generated based on the operation data contained in the log generation instruction and the preset log generation rules; the log generation rules include log format templates that conform to the requirements of the database management system kernel. The log data blocks are preprocessed for storage to obtain the database log; Persistently store database logs.

2. The method according to claim 1, characterized in that, The storage preprocessing includes: Fill in the data checksum corresponding to the log data block; And / or, compress log data blocks; And / or, encrypt sensitive fields in log data blocks.

3. The method according to claim 1, characterized in that, The persistent storage database logs include: Perform atomic write operations independently on a single database log.

4. The method according to claim 1, characterized in that, The persistent storage database log also includes: The system stores log sequence numbers used to identify log data blocks; each log sequence number corresponds one-to-one with a log data block.

5. A log management device, characterized in that, An apparatus for use in a log processing unit, independent of the CPU and configured closer to non-volatile memory than the CPU is to non-volatile memory, the non-volatile memory being used to store database logs, the apparatus comprising: The receiving and parsing module is used to receive and parse log generation instructions issued by the database management system kernel; The log generation module is used to generate log data blocks based on the operation data contained in the log generation instruction and the preset log generation rules; the log generation rules include log format templates that conform to the requirements of the database management system kernel. The data preprocessing module is used to perform storage preprocessing on log data blocks to obtain database logs; The storage module is used for persistent storage of database logs.

6. The apparatus according to claim 5, characterized in that, The data preprocessing module includes: The checksum filling module is used to fill in the data checksum corresponding to the log data block; And / or, a compression module for compressing log data blocks; And / or, an encryption module for encrypting sensitive fields in log data blocks.

7. The apparatus according to claim 5, characterized in that, The storage module is specifically used for: Perform atomic write operations independently on a single database log.

8. The apparatus according to claim 5, characterized in that, The storage module is also used for: The system stores log sequence numbers used to identify log data blocks; each log sequence number corresponds one-to-one with a log data block.

9. An electronic device, characterized in that, include: A processor and a readable storage medium storing machine-executable instructions that can be executed by the processor to implement the method of any one of claims 1-4.

10. A readable storage medium, characterized in that, The readable storage medium stores machine-executable instructions that, when invoked and executed by a processor, cause the processor to implement the method described in any one of claims 1-4.